<?php 
 $cc=0;
 $tpayb=0;     
 $tptd=0;
 $tbal=0;
 $status="NOT PAID";
 require_once "labClass.php";
 $con = new labClass();
  ?>
<div class="container-fluid" id="co"> 
<div  class="mt-4 p-5 bg-white text-dark rounded"> 
<table class="table">
<tr><td colspan="6" align="center"><small>DEBIT RECONCILIATION:</small></td></tr>
<tr><td align="right">
<label for="cname" class="form-label">Select customer to reconciliate debit:</label>   
</td>
<td colspan="3">    
<input class="form-control" list="cnames" name="cname" id="cname" onchange="processData();">
<datalist id="cnames">
<?php
 $Q= $con->getOrderListBcN();
 if ($Q->rowCount()>0) {
 $lb=$Q->fetchAll();
     foreach ($lb as $key => $l){
      ?>
      <option value="<?php echo  $l["cname"];?>">  
             <?php
           }
           }
      ?></datalist>
    </td>
    
  </tr>
   
 </table>
 
 
 
 <div class="container-fluid " id="dpl">
  
</div>
<script type="text/javascript">
function processData(){ 
var ecc=0;  
var cname= document.getElementById('cname').value;   
  //FIRST NAME VALIDATION
 if(cname==""){ 
         ecc++;
         alert('Customer name required!..');
             }
   
    if(ecc==0)
    { 
        $.post("pharmGtThisCusDebReconcil.php",
          {cname:cname},
          function(data){
      $('#dpl').html(data).show();

    });
    }
 
} 

 </script>