<?php
if($_POST["user"] &&$_POST["sdate"] && $_POST["iname"] &&$_POST["wsprice"] &&  $_POST["icat"] && $_POST["ipprice"] && $_POST["isprice"] && $_POST["iQty"] && $_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->getThisItemStore($iname);
  if($Q->rowCount()<=0)
    {
        
   $rQ= $con->itemRegStore($iname,$icat,$ipprice,$wsprice,$isprice,$iQty,$expd);
   
   if($rQ->rowCount()>0)
      {
          $r= $con->getThisItemStore($iname)->fetch();
          if($r['itemID']!="")
          {
          $itemID=$r['itemID'];
          $cQ= $con->itemPurchaseEntryStore($itemID,$iname,$ipprice,$isprice,$nQty,$sdate,$user);
      ?>
      <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
       }
?>