<?php 
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
 $cc=0;
      
  require_once "labClass.php";
  
  $con = new labClass();
 
  ?>
  CUSTOMER DEPOSIT WITHDRAW:
     <table>
  <tr>
    <td>
    <sup id="tr"></sup>
    <label for="cname" class="form-label">Search/Sort by: Name:</label>
   <input class="form-control" list="cnames" name="cname" id="cname" onchange="processData();">
   <datalist id="cnames">
    <?php
     $Q= $con->getCusListBcN();
     if ($Q->rowCount()>0) {
     $lb=
     $Q->fetchAll();
     foreach ($lb as $key => $l) {
      
      ?>
      <option value="<?php echo  $l["cname"];?>">  
             <?php
            
           }
           }
 
      ?>
      </datalist>

      </td>
        <td>
    <sup id="trp"></sup>
    <label for="phone" class="form-label">Phone:</label>
   <input class="form-control" list="phones" name="phone" id="phone" onchange="processDataP();">
   <datalist id="phones">
    <?php
     $Q= $con->getCusListBcP();
     if ($Q->rowCount()>0) {
     $lb=$Q->fetchAll();
     foreach ($lb as $key => $l) {
      
      ?>
      <option value="<?php echo  $l["phone"];?>">  
             <?php
            
           }
           }
 
      ?>
      </datalist>

      </td>
    
       
    </tr>
  </table>
  <div id="dpl">
  </div>
    <script type="text/javascript">

  function processDataP(){ 
var ecc=0; 
var  phone=document.getElementById('phone').value; 
$.trim(phone); 
var cname=''; 
  //FIRST NAME VALIDATION
  
if(phone==""){ 

         ecc++;
         document.getElementById('trp').innerHTML="Phone no is required!..";

             }
else{

document.getElementById('trp').innerHTML="";
    }
  
    if(ecc==0)
    { 
        $.post("pharmcusGetThisWdrw.php",
          {phone:phone,cname:cname},
          function(data){
      $('#dpl').html(data).show();

    });
    }
 
} 
function processData(){ 
var ecc=0; 
var cname =document.getElementById('cname').value; 
$.trim(cname);   
 
var phone='';
  //FIRST NAME VALIDATION
  
if(cname==""){ 

         ecc++;
         document.getElementById('tr').innerHTML="Customer is required!..";

             }
else{

document.getElementById('tr').innerHTML="";
    }
  
    if(ecc==0)
    { 
        $.post("pharmcusGetThisWdrw.php",
          {phone:phone,cname:cname},
          function(data){
      $('#dpl').html(data).show();

    });
    }
 
} 

 
 
function getCusN(){
    
    var iname=$('#descrip').val();
    //alert(iname);
    $('#dsp').empty();
    $.post('getAmount.php',{iname:iname},function(data){
      $('#dsp').html(data);});
     
  }
     </script>     