<?php

if($_POST["tsp"] && $_POST["sdate"] && $_POST["inam"] && $_POST["user"] && $_POST["orderID"])
{  
  $tsp= $_POST['tsp'];
  $time= $_POST['confrv'];  
  $orderID= $_POST['orderID'];
  $iname= $_POST['inam'];
 
  require_once"labClass.php";
  $con=new labClass();
  $Q= $con->getThisItemPorder($orderID,$iname);
  if($Q->rowCount()>0)
    {
     $p=$Q->fetch(); 
     $tpp=$p['ipprice']*$p['eQty'];
     $bal=$tsp-$tpp;
     $rQ= $con->correctCoDebit($orderID, $bal,$iname);//delPurchOrderItem($orderID,$iname);
    //print_r($rQ->ErrorInfo());
     if($rQ->rowCount()>0)
      { 
          /*$r= $con->correctCoDebit($orderID,$bal);
          print_r($r->ErrorInfo());
          if($r->rowCount()>0)
      { */
      ?>
      <h6 class="text-success">Deleted</h6>
      <?php
     /* }
     else{
       ?>
        <h6 class="text-danger">Updating debit failed!..</h6>
       <?php
        }*/
       }
     else{
       ?>
        <h6 class="text-danger">Deleting failed!..</h6>
       <?php
        }
        }
    else{
       ////////////////////////
       ?>
        <h6 class="text-danger">Order do not exist!..</h6>
       <?php
       }
       }
  else{
       ?>
       <h6 class="text-danger">All field required!..</h6>
       <?php
       }
?>