<?php 
  include("../config.php");
  $report     = "SELECT * FROM report_setting WHERE company_id = '".$_SESSION['company_id']."' AND branch_id = '".$_SESSION['branch_id']."'";
  $report_res = mysqli_query($conn,$report);
  $report_row = mysqli_fetch_assoc($report_res);
  $id = $_POST['id'];

  $bank_det         = "SELECT * FROM company_mst WHERE id = '".$_SESSION['company_id']."'";
  $bank_det_res     = mysqli_query($conn,$bank_det);
  $bank_det_rows    = mysqli_fetch_assoc($bank_det_res);

  $payment          = "SELECT * FROM payment WHERE voucher_no = '".$id."' AND company_id = '".$_SESSION['company_id']."' AND branch_id = '".$_SESSION['branch_id']."'";
  $payment_res      = mysqli_query($conn,$payment);
  $payment_row      = mysqli_fetch_assoc($payment_res);
 
  $num              = mysqli_num_rows($payment_res);
  $master_accounts  = combine(getAllRecords('act_master'), 'act_code', 'ac_name');

  $act              = "SELECT * FROM act_master WHERE act_code = '".$payment_row['account_name']."'";
  $act_res          = mysqli_query($conn,$act);
  $act_row          = mysqli_fetch_assoc($act_res);
?>

<?php echo $report_row['header_data']; ?>
<style type="text/css">
  tr td label strong {
    width: 86px !important;
  }
</style>
<table class="table no-top-border-table">
  <tr class="receipt">
    <td class="text-center"><h5 class="bold">BANK PAYMENT VOUCHER</h5></td>
  </tr>
  <tr>
    <td width="100%" class="text-left"><label class="control-label"><strong class="hitz-top-header">Voucher No</strong> : <?php echo $payment_row['voucher_no'];?></label></td>
  </tr>
  <tr>
    <td width="100%" colspan="5" class="text-left"><label class="control-label"><strong class="hitz-top-header">Date</strong> : <?php echo risFormatDate($payment_row['b_date']);?></label></td>
  </tr>
 
</table>
<table class="table table-bordered table-striped print-bill-bottom">
  <tbody>
    <tr class="text-center">
      <td class='hitz-td bold' colspan="8">Particulars</td>
      <td class='hitz-td text-right bold' width="15%">Amount</td>
    </tr>
    <tr>
      <td colspan="8"><span class="bold">Account</span> : <?php echo $act_row['ac_name'];?><br/><?php echo $payment_row['narration'];?></td>
      <td class="text-right"><?php echo customFormatMoney($payment_row['amount']);?></td>
    </tr>
  </tbody>
</table>
<table class="print-bill-blank">
  <?php if( $num < 8 ) { ?>
      <?php for ($j=1; $j <= ( 8 - $num ); $j++) { ?> 
          <tr>
            <td>&nbsp;</td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
          </tr>
      <?php } ?>
    <?php } ?>
</table>
<table class="table table-bordered table-striped print-bill-bottom print-bill-bottom45">
  <tbody>
    <tr>
      <td colspan="4" rowspan="2"><label>Total Amount in Words : <br/> <?php echo convertNumber2Words($payment_row['amount']);?></label></td>
    </tr>
    <tr>
      <td colspan="6" align="right"><label class="control-label">For,<?php echo $bank_det_rows['name'];?><br/><br/> Auth. Signature</label></td>
      
    </tr>

  </tbody>
</table>
