<?php
$cc=0; 
  $user=$_POST['user'];
  require_once"labClass.php";
  $con=new labClass();
  $rQ= $con->getThisPCreateOrder($user);
  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'];
    $iname=$p['iname'];
      $cc++; 
   // $r= $con->getThisStoreItem($iname)->fetch();
        ?>
 
  <tr >
   <td height="30px"   width="5%" >
    <input value="<?php echo $cc;?>"
  style="color:blue; border:none; outline:none; caret-color:white; background:transparent; cursor:pointer;width:100%;" onclick="
         var iname =$('#iname<?php echo $cc;?>').val();  if(  iname!='' ) { $.post('createPorderLLDel.php',{iname:iname},function(data){$('#ss<?php echo $cc;?>').html(data).show();});} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide item detail required!..';}" >  </td><td width="55%"> 

         <input type="hidden" name="item<?php echo $cc;?>" id="item<?php echo $cc;?>" value="<?php echo $p['itemID'];?>"/>
          <input type="hidden" name="iname<?php echo $cc;?>" id="iname<?php echo $cc;?>" value="<?php echo $p['iname'];?>"/>
 
  <small> <?php echo $p['iname'];?></small> <sup id="ss<?php echo $cc;?>"></sup>
  </td>
  <td>
     <input type="number" style="color:blue; border:none; outline:none; caret-color:white; background:transparent;  width:100%;" name="eQty<?php echo $cc;?>" id="eQty<?php echo $cc;?>"  value="<?php echo $p['eQty'];?>" onkeypress="$('#savq<?php echo $cc;?>').show();" onclick="document.getElementById('eQty<?php echo $cc;?>').disabled=false;"    /> 
      
        <input style="display:none;" type="submit" name="savq<?php echo $cc;?>" id="savq<?php echo $cc;?>" value="Save" id="submit" onkeypress="$('#savq<?php echo $cc;?>').show();" onclick="
          var iname=$('#iname<?php echo $cc;?>').val();
          var sdate=$('#sdate').val(); var user=$('#user').val();   var nQty=$('#eQty<?php echo $cc;?>').val(); var orderID =$('#orderID').val(); var itemID =$('#item<?php echo $cc;?>').val();parseInt(nQty); if(orderID!=''&& itemID!=''&& sdate!='' && iname!=''&& user!='' && nQty!=''  && nQty > 0  ) {  $.post('edipoqPro.php',{orderID:orderID,user:user,itemID:itemID,nQty:nQty, iname:iname,sdate:sdate},function(data){$('#ss<?php echo $cc;?>').html(data).show();});} else{document.getElementById('ss<?php echo $cc;?>').innerHTML='Valide item detail required!..';}
           
        " />
      
      
      
      
      
      
      
  </td>
  <td>
     <input type="number" style="color:blue; border:none; outline:none; caret-color:white; background:transparent; width:100%;"  name="rate<?php echo $cc;?>" id="rate<?php echo $cc;?>"  value="<?php echo $p['ipprice'];?>" onkeypress="$('#savr<?php echo $cc;?>').show();" onclick="document.getElementById('rate<?php echo $cc;?>').disabled=false;"    /> 
     
     
     <input style="display:none;" type="submit" name="savr<?php echo $cc;?>" id="savr<?php echo $cc;?>" value="Save" id="submit" onclick="
          var iname=$('#iname<?php echo $cc;?>').val();
          var sdate=$('#sdate').val(); var user=$('#user').val();   var ipprice=$('#rate<?php echo $cc;?>').val(); var orderID =$('#orderID').val(); var itemID =$('#item<?php echo $cc;?>').val();  if(orderID!=''&& itemID!=''&& sdate!='' && iname!=''&& user!=''   && ipprice!=''  && ipprice > 0  ) { $.post('editpPro.php',{orderID:orderID,user:user,itemID:itemID, ipprice:ipprice,iname:iname,sdate:sdate},function(data){$('#ss<?php echo $cc;?>').html(data).show();});} else{document.getElementById('ss<?php echo $cc;?>').innerHTML='Valide item detail required!..';}
           
        " />
      
      
  </td>
  <td></td>
</tr>
<!--<tr>
  <td height="30px"></td>
  <td>
  <php //echo "Store:". $r['iqty'];?>
  <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['ipprice'];?>" onclick="document.getElementById('rate<php// echo $cc;?>').disabled=false;" onchange="shareData()"  />  
  </td>
  <td> 
     <php
     //$tsprice=$tsprice+$p['ipprice']*$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['ipprice']*$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%;display:none;"  name="tprice" id="tprice" disabled="true" value="<?php echo $tsprice;?>"  />
  </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;
 ?> 

 