<?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;
$edate=date("Y-m-d"); 

//////////////// Get Sequence Number ----------------------- 
 $querydoc=mysqli_query($con,"select * from sequence where seq_id=5 ")or die(mysqli_error());

  //  while($row=mysqli_fetch_array($querydoc)){ 
  //  $invd_no=$row['cno'];  
  //  }

//////////////////End of gettinh sequence Number ------------------
?>
<!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>Invox | Collection Management </title>
  <!-- plugins:css -->
  <?php include('../includes/commonheader.php');?>



</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">
                Debit Note Reprint
            </h3>
          
          </div>
          <div class="col-8 grid-margin">
              <div class="card">
                <div class="card-body">

              
         
                 
    <form class="needs-validation" novalidate method="post"  enctype="multipart/form-data" onsubmit="return validateForm()"> 
       
                  
                    <div class="row">                     
                
                      <div class="col-md-6">
                          <div class="form-group row">
                          <label class="col-sm-3 col-form-label">Debit Note</label>
                          <div class="col-sm-9">
                    
           
<select class="form-control select2" style="width: 100%;" name="inv_no" id="inv_no" required >
           <option value="0">~~~Select ~~~~</option>  
          <?php            
          $querydoc=mysqli_query($con,"select * from seheader where doctype='Dn'   ")or die(mysqli_error());
          
          while($rowd=mysqli_fetch_array($querydoc)){
          ?>
          <option value="<?php echo $rowd['docid'];?>"><?php echo $rowd['docid'];?></option>        
          <?php }?>
          </select> 


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





          
          
  </div>

 </div><!-----End of main panel--~~~~~~~~~~~~~~~~~~~~~~~--------------->
 </div><!-----Dont Delete this 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 inv_new_no = $("#inv_no").val();
//alert(inv_new_no);


//var invoiceWindow = window.open("inv_final_print_pdf.php?inv_no=" + inv_new_no, "Invoice", "width=800,height=800");

    var invoiceWindow = window.open("dn.php?docid=" + inv_new_no, "Invoice", "width=800,height=800");
function printAndClose() {
invoiceWindow.print();
};
invoiceWindow.print();
invoiceWindow.onafterprint = function() {
invoiceWindow.close();
window.location.href = "inv_new.php";
};





    }); 





</script>



