<?php
  
 
if($_POST["recID"])

{
$recID= $_POST['recID'];
require_once"labClass.php";
$con=new labClass();
$r= $con->getThisTrans($recID);
 if($r->rowCount()>0)
      {
     $v=$r->fetch();
     $tPrice=$v['amount'];
     $sdate=$v['dateR'];
     $pOpt="CASH";
       $pOpt="CASH";
 $k= $con->getMuamalaCash($pOpt,$sdate);
 if($k->rowCount()>0)
      {
   $cs=$k->fetch() ;
   if($cs['statusB']=="Saved"){
       
     $e= $con->getMuamalaCash($pOpt,$sdate);
     if($e->rowCount()>0)
      {
      $nn=$e->fetch();
          //
     $tPrice= $tPrice+$nn['amount'];
     $r= $con->updateToDayCash($tPrice,$pOpt,$sdate);
     $Qr= $con->deletrD($recID);
    //////////
     if($Qr->rowCount()>0)
      {
          
      ?>
      <h6 class="text-success">Deleted!..</h6>
      <?php
     }
    else{
       ?>
        <h6 class="text-danger">Error occurred!..</h6>
       <?php
       } 
       ////
      }
    else{
       ?>
        <h6 class="text-danger">Trans occurred!..</h6>
       <?php
       } 
       //////////
      }
   else{
       ?>
        <h6 class="text-danger">Record not found!..</h6>
       <?php
       }
}
else{
    echo "Expenses id required!";
}
          
      }
else{
   echo "Transaction closed up can't delete!";

}
}
else{
    echo "Transaction not found!";
}

?>