<?php 
 $cc=0;
      
  require_once "labClass.php";
  
  $con = new labClass();
  
if($_POST["cname"])
{
 $cname=$_POST["cname"]; 
 $chkp= $con->getThisCusRecByN($cname); 
}
 
if($_POST["phone"])
{
 $phone=$_POST["phone"]; 
 $chkp= $con->getThisCusRecByP($phone); 
} 
     
if ($chkp->rowCount()>0) {

  $chp=$chkp->fetchAll();
  ?>
  CUSTOMER DEPOSIT:
  <table class="table"> 
  <th>
        <small><h6>S/N</h6></small>
      </th>

      <th>
        <small><h6>NAME CUSTOMER</h6></small>
      </th>
      
      <th>
        <small><h6>C/DEPOSIT</h6></small>
      </th>
     
     <th>
        <small><h6>ADD DEPOSIT</h6></small>
      </th>
      <th>
        <small><h6>ACTION</h6></small>
      </th>
      
<?php
 foreach ($chp as $key => $p) {
    $recID=$p['recID'];
      $cc++; 
     
        ?>
 <tr>
     <td colspan="8">
       <sup id="rdn<?php echo $cc;?>" class="text-danger" ></sup>
     </td>
   </tr> 
  <tr>
   <td width="5%">
       <input type="hidden" name="recID<?php echo $cc;?>" id="recID<?php echo $cc;?>" value="<?php echo $p['recID'];?>"/>
    <!--<div class="input-group">
    <span class="input-group-text">-->

      <?php
          echo $cc;
       ?>  
      </td>
       <td width="30%">
         <textarea style="background-color:white; height:30px; width:95%;" disabled="true" name="cname<?php echo $cc;?>" id="cname<?php echo $cc;?>"><?php echo $p['cname']."(".$p['phone'].")";?></textarea> 
  </td>
  
  
  <td>
    <input type="number" style="background-color:white;border-radius:12px; width:100%;" disabled="true" name="depo<?php echo $cc;?>" id="depo<?php echo $cc;?>"  value="<?php echo $p['deposit'];?>" />   
  </td>
  <td>
    <input type="number" style="background-color:white;border-radius:12px; width:100%;"   name="depon<?php echo $cc;?>" id="depon<?php echo $cc;?>"  value="" />   
  </td>
  
  <td> 
        <input type="submit" name="adds<?php echo $cc;?>" id="adds<?php echo $cc;?>" value="Save" id="submit" onclick="var sdate=$('#sdate').val(); var user=$('#user').val();recID=$('#recID<?php echo $cc;?>').val(); var depon=$('#depon<?php echo $cc;?>').val(); var depo=$('#depo<?php echo $cc;?>').val(); var cname=$('#cname<?php echo $cc;?>').val();  if(recID!=''&& depo!=''&& depon!=''&& sdate!=''  && cname!=''&& user!='') { $.post('pharmcusDepositPro.php',{depon:depon,depo:depo,user:user,recID:recID, cname:cname,sdate:sdate},function(data){$('#rdn<?php echo $cc;?>').html(data).show();}); } else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide item detail required!..';}" />
   
   
</tr> 
  <?php
}
$cc=0;
 ?> 
 <?php
}
  
  ?>