<?php 
if(!isset($_SESSION)) { 
  session_start(); 
  include('../includes/dbcon.php');
}
if(empty($_SESSION['hrm_id'])):
header('Location:../index.php');
endif;
$cval=0;
//$grn_no=0;
$bank= trim($_POST['bank']);

?>
<!DOCTYPE html>
<html lang="en">


<head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>SalesHub | Receipt Management </title>
  <!-- plugins:css -->
  <?php include('../includes/commonheader.php');?>
<style>
      div.scroll {
         display: block; 
            border: 0px solid red; 
            padding: 5px; 
            margin-top: 5px; 
            width: 100%; 
            height: 500px; 
            overflow-y: scroll; 
      }
    </style>


</head>
<body>
 <?php include('../includes/header.php');?>
 <?php include('../includes/leftsidebar.php');?>
           <!-- partial -->
 <div class="main-panel">        
        <div class="content-wrapper">

          <div class="page-header">
            <h3 class="page-title">
                New Receipt <?php   echo $bank; ?>
            </h3>
          
          </div>
          <div class="col-22 grid-margin">
              <div class="card">
                <div class="card-body">
              
          <!--                
    <form class="needs-validation" novalidate method="post" action="receipt_new_add.php" enctype="multipart/form-data" onsubmit="return validateForm()">    --->               
                    <div class="row">                     
                      <div class="col-md-4">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Rec No: </label>
                          <div class="col-sm-18">
                            <input type="text" class="form-control" id="rno" name="rno" value=<?php echo $bank ; ?> >
                          </div>
                        </div>




                      </div>
                      <div class="col-md-4">                  
                          <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Type </label>
                          <div class="col-sm-9">
                          <select class="form-control select2" style="width: 100%;" name="rtype" id="rtype" required >
           <option value="0">~~~Select ~~~~</option>  
          <?php            
          $querydoc=mysqli_query($con,"select * from receipt_type  ")or die(mysqli_error());
          
          while($rowd=mysqli_fetch_array($querydoc)){
          ?>
          <option value="<?php echo $rowd['receipt_type'];?>"><?php echo $rowd['receipt_type'];?></option>        
          <?php }?>
          </select> 
                          </div> 

                          </div>  

                      </div>                            
                  <div class="col-md-4">
                        <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Receipt Date: </label>
                          <div class="col-sm-8">
                            <input type="date" class="form-control" id="gdate" name="gdate" >

                          </div>
                        </div>

                    </div> <!-------End of first form raw------->

            

</div>
<div class="row">                     
                      
                                      
            


<!-------Third raw------->

</div>

<!---------end of third raw----------->


 <div class="scroll">             
                   <table id="order-listing" class="table">
                        
                      <thead>
                        <tr>
                          
                          <th>Receipt</th>
                          <th>Date</th>
                          <th>Chq No</th>
                          <th>Chq Date</th>
                          <th>Chq Bank</th>
                          <th>Customer</th>
                          <th>Amount</th>
                          <th>Deposit</th>
                                                
</tr>
</thead>

<tbody><?php  $rcount=0;
$sqlsp=mysqli_query($con,"SELECT chqheader.docid,chqheader.docdate,chqheader.chqno,chqheader.amount ,chqheader.chqdate,
chqheader.chqbank,customer_master.cus_name
FROM chqheader
LEFT JOIN customer_master ON chqheader.cus_id=customer_master.cus_id
WHERE deposit<>1 AND TYPE='Cheque' AND cancel<>1 ")or die(mysqli_error($con));
            $count=mysqli_num_rows($sqlsp); 
            if ($count>0) {
              while($rowsp=mysqli_fetch_array($sqlsp)){ 
                $rcount=$rcount+1;
               ?>

                  <tr>       
            <td> <?php echo $rowsp['docid'];   ?></td>
            <td> <?php echo $rowsp['docdate'];   ?></td>
            <td> <?php echo $rowsp['chqno'];   ?></td>
            <td> <?php echo $rowsp['chqdate'];   ?></td>
            <td> <?php echo $rowsp['chqbank'];   ?></td>
            <td> <?php echo $rowsp['cus_name'];   ?></td>
            <td> <?php echo $rowsp['amount'];   ?></td>
            <td><input type="checkbox" id="dep" name="dep" value=0></td>
            <td>
<form method="post" action="#" enctype="multipart/form-data" >
 <input type="hidden" class="form-control" id="docid[]" name="docid[]"   value="<?php echo $rowsp['docid'];?>">
 <input type="hidden" name="fname" id="fname" class="form-control todo-list-input" placeholder="Add To-do" value="<?php echo basename($_SERVER['PHP_SELF']);  ?>">
                
            <span id="totalDisplay"></span>       
            <div id="formfield">
             
            </div> 
                 <button type="submit" class="btn btn-info btn-rounded btn-icon" onclick="add()">
               <i class="fa fa-thumbs-up"></i>
                 </button>

             
                 


                  </form>


            </td>



          </tr>
                    
        <?php    }   ///while($rowsp=mysqli_fetch_array($sqlsp)){   

         
            }// if ($count>0) {
?>

</tbody>

</table>
</div>

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



<button type="submit" class="btn btn-primary">Save</button>
<button class="btn btn-light">Cancel</button>
 <!--  </form>-->
</div>






  <div class="content-wrapper">
         


        </div>  <!----- <div class="content-wrapper">------>
        </div>
          
          
  </div>

 </div><!-----End of main panel--~~~~~~~~~~~~~~~~~~~~~~~--------------->
 </div><!-----Dont Delete this DIV--~~~~~~~~~~~~~~~~~~~~~~~--------------->
</div>
</div>
  <!-- container-scroller -->
<?php include('../includes/footer.php');?>
<?php include('../includes/commonjs.php');?>
 
</body>


</html>

<script>
    $( document ).ready(function() {
         // alert("Please Select Order Type");

    });

function validateForm() { 

    //````````route````````````````````````````````````
    if($('#bname').val().trim().length == 0) {
           //alert("Please enter the route you visited !!!");               
            return false;
    } ////``````````````````````````````````````````

    



 } ///validateForm() { 

</script>

 <!-- End custom js for this page-->
  <script>
  $(function () {
    //Initialize Select2 Elements
    $('.select2').select2()

    //Initialize Select2 Elements
    $('.select2bs4').select2({
      theme: 'bootstrap4'
    })
  })



 $("button").click(function(){
    var category = $("#docid").val();
                 //var issue_qty = $("#qty").val();
                 //var invref= $("#invref").val();



 alert("aa");
 //document.getElementById("totalDisplay").value = 100;
  

  })  //// end of $('#rtype').on('change', function(){


//function add(){
  //var formfield = document.getElementById('formfield');
 // alert("Please enter the route you visited !!!")
  //var newField = document.createElement('input');
  //newField.setAttribute('type','text');
  //newField.setAttribute('name','text');
 // newField.setAttribute('class','text');
 // newField.setAttribute('value','ddd');
  //newField.setAttribute('siz',50);
 // newField.setAttribute('placeholder','Optional Field');
  //formfield.appendChild(newField);
//}
  
</script>



