<?php
$cc=0; 
  require_once"labClass.php";
  $con=new labClass();
  $rQ= $con->getThisTemOrder();
  if ($rQ->rowCount()>0) {
  $chp=$rQ->fetchAll();
 ?>
  <table class="table table-bordered table-striped" border="1">
  <thead class="bg-secondary" >
       
      <th>  
        <small><h6>ITEM NAME</h6></small>
      </th>
      <th>  
        <small><h6>QUANTITY</h6></small>
      </th>
       
      <th>  
        <small><h6>RATE</h6></small>
      </th>
     <th>  
        <small><h6>TOTAL</h6></small>
      </th>
    </thead>
  <tbody>
   
  <?php
 $tpprice=0;
 $tsprice=0;
 $tprofit=0;
///////////////////////////////

foreach ($chp as $key => $p) {
    $itemID=$p['itemID'];
      $cc++; 
     
        ?>
 
  <tr >
   <td height="30px" colspan="4" >
    <a href="#" onclick="
         var iname =$('#iname<?php echo $cc;?>').val();  if(  iname!='' ) { $.post('pharmDelTemp.php',{iname:iname},function(data){$('#dR').html(data).show();});} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide item detail required!..';}" ><?php echo $cc;?></a>. 

         <input type="hidden" name="item<?php echo $cc;?>" id="item<?php echo $cc;?>" value="<?php echo $p['itemID'];?>"/>
         <textarea style="background-color:white; height:30px; width:95%;" disabled="true" name="iname<?php echo $cc;?>" id="iname<?php echo $cc;?>"><?php echo $p['iname'];?></textarea> 
  </td>
</tr>
<tr>
  <td height="30px"></td>
  <td>
  
  <input type="number" style="background-color:white;border-radius:12px; width:100%;" disabled="true" name="eQty<?php echo $cc;?>" id="eQty<?php echo $cc;?>"  value="<?php echo $p['eQty'];?>" onclick="document.getElementById('eQty<?php echo $cc;?>').disabled=false;" onchange="shareData()"  />
  </td> 
  
  <td> 
   <input type="number" style="background-color:white;border-radius:12px; border-color: white; width:100%;"  name="rate<?php echo $cc;?>" id="rate<?php echo $cc;?>" disabled="true" value="<?php echo $p['isprice'];?>" onclick="document.getElementById('rate<?php echo $cc;?>').disabled=false;" onchange="shareData()"  />  
  </td>
  <td> 
     <?php
     $tsprice=$tsprice+$p['isprice']*$p['eQty'];
      ?>
    <input type="number" style="background-color:white;border-radius:12px; width:100%;"  name="tprice<?php echo $cc;?>" id="tprice<?php echo $cc;?>" disabled="true" value="<?php echo $p['isprice']*$p['eQty'];?>"  />
  </td>
 
   
</tr>
 
<?php
} 

?>

 <tr>
  <td colspan="3" align="right">Total:
  </td>
    <?php

?>
  <td>
      
      <input type="number" style="background-color:white;border-radius:12px; width:100%;"  name="tprice" id="tprice" disabled="true" value="<?php echo $tsprice;?>"  />
  </td>
   
   
 </tr>
 <tr><td><input type="radio" name="pst" id="pst" style="display:none;" onclick="cashS()" value="PAID"> </td><td><input type="radio" checked="true" style="display:none;" name="npst" id="npst" onclick="ncashS()" value="NOT PAID"></td><td colspan="2"><sup id="cs" style="display: none;">Cash (if any):<input type="number" name="cash" id="cash" value="0" style="background-color:white;border-radius:12px; width:50%;"></sup></td>
 </tr>
</tbody>
</table>
<input type="hidden" name="cc" id="cc" value="<?php echo $cc;?>">
<?php
}
$cc=0;
 ?> 

 