<?php
if($_POST["defect"] &&$_POST["itemID"] && $_POST["iname"] && $_POST["user"] && $_POST["ipprice"] && $_POST["isprice"] && $_POST["nQty"] && $_POST["sdate"])
{   
    $defect= $_POST['defect'];
    $isprice= $_POST['isprice'];
    $ipprice= $_POST['ipprice'];
    $user= $_POST['user'];
	$iname= $_POST['iname'];
    $nQty= $_POST['nQty'];
    $itemID= $_POST['itemID'];
    $tQty= $_POST['tQty'];
    $sdate= $_POST['sdate']; 
  //CHECKING ENDS HER
  require_once"labClass.php";
  $con=new labClass();
  $Q= $con->getThisItemBID($itemID,$iname);
  if($Q->rowCount()>0)
    {
   $rQ= $con->itemDumpEntry($defect,$itemID,$iname,$ipprice,$isprice,$nQty,$sdate,$user);
   //print_r($rQ);
   if($rQ->rowCount()>0)
      {
       //itemID:itemID,iqty:iqty,nQty:nQty,isprice:isprice,ipprice:ipprice,iname:iname,tQty:tQty
        $Qr= $con->updateItemQ($iname,$tQty,$itemID);
        if($Qr->rowCount()>0)
      {
      ?>
      <h6 class="text-success">Save!..</h6>
      <?php
        }
  else{
       ?>
        <h6 class="text-danger">Item error occurred!..</h6>
       <?php
       }
       }
    }
  else{
       ?>
        <h6 class="text-danger">Item does not exist!..</h6>
       <?php
       }
       }
  else{
       ?>
       <h6 class="text-danger">All field required!..</h6>
       <?php
       }
?>