<?php
$cc=0; 
  require_once"labClass.php";
  $con=new labClass();
  $rQ= $con->getThisTempProf();
  if ($rQ->rowCount()>0) {
  $chp=$rQ->fetchAll();
 ?>
  <table class="table table-bordered table-striped" border="1">
  <thead class="bg-secondary" >
       <th>  
        <small><h6>S/N</h6></small>
      </th>
      <th>  
        <small><h6>ITEM NAME</h6></small>
      </th>
      <th>  
        <small><h6>QTY</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> 
    <a href="#" onclick="
         var iname =$('#iname<?php echo $cc;?>').val();  if(  iname!='' ) { $.post('profDelTemp.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'];?>"/>
         </td>
         <td>
    <sup id="in<?php echo $cc;?>"><?php echo $p['iname'];?></sup>
    <input type="text" style="display: none; background-color:white;border-radius:12px; border-color: white; width:100%;"  name="iname<?php echo $cc;?>" id="iname<?php echo $cc;?>" disabled="true" value="<?php echo $p['iname'];?>" onclick="document.getElementById('iname<?php echo $cc;?>').disabled=false;" onchange="shareData()"  /> 
  </td>
  <td> 
  <input type="number" style="display: none; 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()"  />
  <sup id="eq<?php echo $cc;?>"><?php echo $p['eQty'];?></sup>

  </td> 
  
  <td> 
   <input type="number" style="display: none; 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'];?>"onmouseleave="$('#rate<?php echo $cc;?>').hide();$('#isp<?php echo $cc;?>').show();" onclick="document.getElementById('rate<?php echo $cc;?>').disabled=false;" onchange="shareData()"  />  <sup id="isp<?php echo $cc;?>"><?php echo $p['isprice'];?></sup>
  </td>
  <td> 
     <?php
     $tsprice=$tsprice+$p['isprice']*$p['eQty'];
      ?>
    <input type="number" style="background-color:white;border-radius:12px;display: none; width:100%;"  name="tprice<?php echo $cc;?>" id="tprice<?php echo $cc;?>" disabled="true" value="<?php echo $p['isprice']*$p['eQty'];?>"  />
    <sup id="tp<?php echo $cc;?>"><?php echo $p['isprice']*$p['eQty'];?></sup>
  </td>
 
   
</tr>
 
<?php
} 

?>

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

?>
  <td>
      
      <input type="number" style="display: none; background-color:white;border-radius:12px; width:100%;"  name="tprice" id="tprice" disabled="true" value="<?php echo $tsprice;?>"  />
      <sup id="tsp"><?php echo $tsprice;?></sup>
  </td>
   
   
 </tr>
 <!--<tr><td><input type="radio" name="pst" id="pst" onclick="cashS()" value="PAID">Paid </td><td><input type="radio" name="npst" id="npst" onclick="ncashS()" value="NOT PAID">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;
 ?> 

 