<?php
 
if(isset($_POST["sdate"]))
{ 
    $sdate= $_POST['sdate']; 
    require_once"labClass.php";
    $con=new labClass(); 
    //////////////////////////////
        $pOpt="CASH";
        $e= $con->getMuamalaCash($pOpt,$sdate);
          if($e->rowCount()>0)
           {
          $nn=$e->fetch();
          $tPrice= $nn['amount'];
          $r= $con->undo_ConfirmCash($pOpt,$sdate);
              if($r->rowCount()>0)
               { 
    
                $recID=1;
                $r= $con->getBalance($recID)->fetch();
                $bal=$r['cbalance']-$tPrice;
                $u= $con->updateBalance($recID,$bal);
                if($u->rowCount()>0)
                 {
                      ?>
                      <h6 class="text-success">Save!..</h6>
                      <?php
                 }
                 else{
                      ?>
                       <h6 class="text-success">Transaction update failed!..</h6>
                      <?php
                     }
                 
               }
               else{
                  ?>
                  <h6 class="text-danger">Transaction confirmation failed!..</h6>
                 <?php
                   }
              }
           else{
              ?>
                  <h6 class="text-danger">Transaction not found!..</h6>
              <?php
               }
    //////////////
            
        
   }
   else{
       echo "All field required!.";
   } 
?>