 
 <div class="container mt-3" style="margin-top:2px;">

 <div  class="mt-4 p-5 bg-white text-dark rounded" >
  <h6>BALANCE WITH DRAW FORM:</h6> 
  
     Balance to date:<p/><?php
     ini_set('display_errors', 1);
     ini_set('display_startup_errors', 1);
     error_reporting(E_ALL);
           require_once"labClass.php";
           $con=new labClass();
           $sdate=$_POST['sdate'];
           $recID=1;
           $r= $con->getBalance($recID)->fetch();
           echo "Shop:".$bal=$r['cbalance'];echo"<br/>";
           $recID=2;
           $r= $con->getBalance($recID)->fetch();
           echo "Other source:" .$bal2=$r['cbalance'];echo"<p/>";
           echo "Total:".$bal+$bal2;
           ?>
    <div class="row">
          <div class="col">
              
    <div class="form-floating mb-3 mt-3">
          <h6>Source:</h6>
         <select  name="sourceID" id="sourceID" class="form-select">
          <option value="">Select source</option>
        <?php
         $r=$con->getAllBalance()->fetchAll();
         foreach ($r as $v): ?>
          <option value="<?php echo $v['ID'];?>">
            <?php echo $v['descrip']; ?> 
          </option>
        <?php endforeach; ?>
        <option value="Total withdraw">Total withdraw</option>
      </select>
       <sup class="text-danger" id="s"> </sup>
        </div>
        </div>
    <div class="col">
    <div class="form-floating mb-3 mt-3"> 
       <h6>Reason for withdraw:</h6>
      <input type="text" style="width:100%; height:50px; border-radius:12px; border-color:white;" id="tname"  placeholder="Withdraw reason:"  name="tname" required>
     <sup class="text-danger" id="in"> </sup>
    </div>
</div>
 <div class="col">
       <div class="form-floating mb-3 mt-3"> 
        <h6>Amount:</h6>
      <input type="number" style="width:100%; height:50px; border-radius:12px; border-color:white;" id="tPrice" placeholder="Amount:" name="tPrice" required>
       
     <sup class="text-danger" id="q"> </sup>
    </div>
  </div>
<div class="col-sm justify-content-center">

  <div class="form-floating mb-3 mt-3"> 
  <button type="submit" id="submit" value="Submit" name="submit" class="btn btn-primary" style="height:60px;" onclick="saveData()">Submit</button>

</div>
</div>
</div>

</div>
 </div>
 <small><h6>Balance withdraw report:</h6></small>
  <table class="table"><tr>
  <td style="width:15%;">Sort by date range:</td><td style="width:10%;" ><input type="date" style="width:200px;" class="form-control" id="dat1" name="dat1"  value="<?php echo Date("Y-m-d");?>" >
  </td>
  <td>and:</td><td style="width:10%;">
          <input type="date" style="width:200px;" class="form-control" id="dat2" name="dat2" value="<?php echo Date("Y-m-d");?>">
  </td><td style="width:10%;">  
  <button type="submit" class="btn btn-primary" style="width:100%; height:40px;" onclick="var sdate=$('#sdate').val(); var dat1=$('#dat1').val(); var dat2=$('#dat2').val();  $.post('withdrawRBdt.php',{sdate:sdate,dat1:dat1,dat2:dat2},function(data){$('#dispR').html(data).show();});">Generate</button>
 </td>  
 
 </tr>
 </table>
<div id="dispR">
 <?php
  require_once "withdrawR.php";
  ?>
  
</div>
 
 <script>
 

 
function saveData(){ 
var ecc=0; 
var tname =document.getElementById('tname').value; 
$.trim(tname);
var user =document.getElementById('user').value; 
$.trim(user);
var submit =document.getElementById('submit').value;
var tPrice =document.getElementById('tPrice').value;

var sourceID =document.getElementById('sourceID').value;
var sdate =document.getElementById('sdate').value; 
var vN =/[\(A-Za-z)]/g; 
var nV =/[a-z\s]/i;
  var j=0,k=0, g=0,i=0;
//FIRST NAME VALIDATION
  
if(tPrice==""){ 

         ecc++;
          document.getElementById('q').innerHTML="Quantity is required!..";
    }
else{

document.getElementById('q').innerHTML="";
    }
     
     if(sourceID==""){ 

         ecc++;
          document.getElementById('s').innerHTML="Source is required!..";
    }
else{

document.getElementById('s').innerHTML="";
    }
if(  tname==""){ 

         ecc++;
             document.getElementById('in').innerHTML="Test name is required!..";
 

               }
else{

document.getElementById('in').innerHTML="";
    }
  
    if(ecc==0)
    { 
        $.post("balancewithdrawPro.php",
          {submit:submit,tname:tname,tPrice:tPrice,sourceID:sourceID,sdate:sdate,user:user},
          function(data){
      $('#disp').html(data).show();

    });
    }
 
} 
 
 
</script>