<?php 
include("../config.php");
$vendor_id = $_GET['q'];

// bill table

$vendor           = "SELECT * FROM `act_master` WHERE `id` = '".$vendor_id."'";
$vendor_res       = mysqli_query($conn,$vendor);
$vector_row       = mysqli_fetch_array($vendor_res);

$bill             = "SELECT * FROM `lhc` WHERE owner_name = '".$vector_row['ac_name']."' AND balance > '0' AND company_id = '".$_SESSION['company_id']."' AND branch_id = '".$_SESSION['branch_id']."' GROUP BY lhc_no";
$bill_res         = mysqli_query($conn,$bill);
$total_records    = mysqli_num_rows($bill_res);

?>
<div class="row">
   <div class="col-xs-12 col-sm-12">
      <div class="box">
         <div class="box-header with-border">
            <h3 class="box-title">VOUCHER DETAILS</h3>
         </div>
         <div class="" id="product-wapper">
            <table class="table table-striped table-bordered table-list" id="">
               <thead>
                  <tr class="hitz-tab capital">
                     <th class="center">#</th>
                     <th class="center">LHC NO</th>
                     <th class="center">LHC.DATE</th>
                     <th class="center">ACCOUNT NAME</th>
                     <th class="center">AMOUNT</th>
                     <th class="center">DUE</th>
                     <th class="center">ADJUST</th>
                     <th class="center">BALANCE</th>
                  </tr>
               </thead>
               <tbody>
                  <?php
                  $count=$total_records;  if($count>0){
                  $i = 0; 
                  while ($bill_row = mysqli_fetch_array($bill_res)) { ?>
                  <tr>
                     <td><input type="checkbox" required="" id="lhc_no" value="<?php echo $bill_row['lhc_no'];?>" name="product[<?php echo $i; ?>][lhc_no]"></td>
                     <td><?php echo $bill_row['lhc_no'];?></td>
                     <td><?php echo $bill_row['lhc_date'];?></td>
                     <td><?php echo $bill_row['owner_name'];?></td>
                     <!-- <td><?php 
                        $vendor     = "SELECT * FROM `vendor_master` WHERE `id` = '".$bill_row['vendor_id']."'";
                        $vendor_res = mysqli_query($conn,$vendor);
                        $vendor_row = mysqli_fetch_array($vendor_res);
                        echo $vendor_row['name'];
                        ?></td> -->
                     <td><input type="text" class="form-control hit_net_amt" value="<?php echo $bill_row['net_amnt'];?>" name="product[<?php echo $i; ?>][total_amount]" readonly="" onkeyup="calculateFinalAmount(this);"></td>

                     <td><input type="text" class="form-control due_amnt" name="product[<?php echo $i; ?>][due_amnt]" onkeyup="calculateFinalAmount(this);" value="<?php echo $bill_row['balance'];?>" readonly=""></td>

                     <td><input type="text" class="form-control adj_amnt" name="product[<?php echo $i; ?>][adjust_amnt]" onkeyup="calculateFinalAmount(this);" max="<?php echo $bill_row['balance'];?>"></td>

                     <td><input type="text" class="form-control balance" readonly="" name="product[<?php echo $i; ?>][balance]" value="<?php echo $bill_row['balance'];?>"></td>
                  </tr>
                  
                  <?php $i++;} }else{ ?>
                  <tr>
                    <td colspan="8" align="center"><b><?php echo "No Record Found...!!!!"; ?></b></td>
                  </tr>
                  <?php } ?>
               </tbody>
            </table>
         </div>
      </div>
   </div>
</div>