<?php
$cc=0; 
  require_once"labClass.php";
  $con=new labClass();
  $orderID=$_POST['orderID'];
  $rQ= $con->getThisInvItemList($orderID);
  if ($rQ->rowCount()>0) {
  $chp=$rQ->fetchAll();
 ?>
<table class="table table-bordered table-striped">
  <thead class="bg-secondary">
      <th>  
        <small><h6>S/N</h6></small>
      </th>
      <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>S. PRICE</h6></small>
      </th>
     
      <th>
        <small><h6>DATE.</h6></small>
      </th>
      
      <th>
        <small><h6>TIME</h6></small>
      </th>
      <th>
        <small><h6>DICISSION</h6></small>
      </th>
    </thead>
  <tbody>
   
  <?php
 $tpprice=0;
 $tsprice=0;
 $tprofit=0;
///////////////////////////////

foreach ($chp as $key => $p) {
    $itemID=$p['itemID'];
      $cc++; 
     
        ?>
        
           <input type="hidden" name="orderID" id="orderID" value="<?php echo $orderID;?>"/> 
       <input type="hidden" name="itemD<?php echo $cc;?>" id="itemD<?php echo $cc;?>" value="<?php echo $p['itemID'];?>"/>
      <input type="hidden" name="recID<?php echo $cc;?>" id="recID<?php echo $cc;?>" value="<?php echo $p['recID'];?>"/>
        <input type="hidden" name="inam<?php echo $cc;?>" id="inam<?php echo $cc;?>" value="<?php echo $p['iname'];?>"/>
        <input type="hidden" name="tim<?php echo $cc;?>" id="tim<?php echo $cc;?>" value="<?php echo $p['timeAt'];?>"/> 
         <input type="hidden" name="qtyt<?php echo $cc;?>" id="qty<?php echo $cc;?>" value="<?php echo $p['eQty'];?>"/>
     
  
        
        
 
  <tr>
    <td>
        <?php echo $cc;?>
    </td>
    <td>
        <sup id="rdn<?php echo $cc;?>" ></sup>
      <?php echo $p['iname'];?>
    </td> 
    <td> 
    <?php echo $p['eQty'];?> 
    </td>
    <td align="right"> 
      <?php 
      $tpprice=$tpprice+$p['ipprice']*$p['eQty'];
      echo  number_format($p['isprice'],2);
      ?> 
    </td> 
    <td align="right"> 
    <?php
     $tsprice=$tsprice+$p['isprice']*$p['eQty'];
     echo number_format($p['isprice']*$p['eQty'],2);?> 
    </td>
   
    <td>
        <input type="date" name="ds<?php echo $cc;?>" id="ds<?php echo $cc;?>" value="<?php echo $p['entryD'];?>"/> 
     
    </td>
    
     <td> 
    <?php echo $p['timeAt'];?> 
    </td>
     
     <td> 
        <input type="submit" name="add<?php echo $cc;?>" id="add<?php echo $cc;?>" value="Delete" id="submit" onclick=" var orderID=$('#orderID').val();var user=$('#user').val(); var iname=$('#inam<?php echo $cc;?>').val();var sdate=$('#sdate').val(); var tim=$('#tim<?php echo $cc;?>').val();  var ds=$('#ds<?php echo $cc;?>').val();  var qty =$('#qty<?php echo $cc;?>').val();var recID =$('#recID<?php echo $cc;?>').val(); var itemID =$('#itemD<?php echo $cc;?>').val(); if(orderID!=''&& itemID!=''&& recID!=''&& ds!='' && qty!='' && iname!=''&& user!='' ) { $.post('delHPInvoicePro.php',{orderID:orderID,user:user,sdate:sdate,itemID:itemID,recID:recID, qty:qty,ds:ds,tim:tim,iname:iname},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide item detail required!..';}" />
  </td>
   
  </tr>
 
<?php
}  
}
$cc=0;
 ?> 
</tbody>
</table>
 