<?php
if($_POST["user"] &&$_POST["sdate"] && $_POST["iname"] &&$_POST["wsprice"] &&  $_POST["icat"] && $_POST["ipprice"] && $_POST["isprice"]  && $_POST["expd"])
{ 
    $sdate= $_POST['sdate'];
    $user= $_POST['user'];
    $wsprice= $_POST['wsprice'];
    $isprice= $_POST['isprice'];
    $ipprice= $_POST['ipprice'];
    $icat= $_POST['icat'];
	$iname= $_POST['iname'];
    $iQty= $_POST['iQty'];
    $nQty= $_POST['iQty'];
    $expd= $_POST['expd']; 
  //CHECKING ENDS HER
  require_once"labClass.php";
  $con=new labClass();
  $Q= $con->getThisItem($iname);
  if($Q->rowCount()<=0)
    {
        
   $rQ= $con->itemReg($iname,$icat,$ipprice,$wsprice,$isprice,$iQty,$expd);
   
   if($rQ->rowCount()>0)
      {
         // $Q= $con->itemRegStore($iname,$icat,$ipprice,$wsprice,$isprice,$iQty,$expd);
          $r= $con->getThisItem($iname)->fetch();
          if($r['itemID']!="")
          {
          $itemID=$r['itemID'];
          $cQ= $con->itemPurchaseEntry($itemID,$iname,$ipprice,$isprice,$nQty,$sdate,$user);
           $iQty=0;
           $Q= $con->itemRegStore($iname,$icat,$ipprice,$wsprice,$isprice,$iQty,$expd)
      ?>
      <h6 class="text-success">Save!..</h6>
      <?php
          }
           else{
       ?>
        <h6 class="text-danger">Item does not exist!..</h6>
       <?php
       }
       }
       }
  else{
       ?>
        <h6 class="text-danger">Similar item  exist!..</h6>
       <?php
       }
       }
  else{
       ?>
       <h6 class="text-danger">All field required!..</h6>
       <?php
       }
?>