<?php 

require_once("config/configDB.php"); 
require "financial_year_calculation.php";
require "userPermission.php";
require "piDieselInvoiceFetchData.php";

?>
<!DOCTYPE html>
<html>
<head>

<script>
 function my()
  {
	  
	  var liter=parseFloat(document.getElementById("liters1").value);
	 var rate=parseFloat(document.getElementById("rate1").value);
	 
	  
	  document.getElementById("amount").value=parseFloat(liter*rate).toFixed(2);
	  
  }


</script>

    <?php 
      require 'meta.php'; 
      require 'header.php'; 
    ?>
    
  
</head>
<body>
  <?php require 'menu.php' ?>
  <div class="container-fluid">
    <h3 class="text-center"><strong>Purchase Diesel Invoice Details</strong></h3>
    <form class="form-horizontal" action="piDieselInvoiceInsert.php" method="post" id="piDieselInvoice" onSubmit="return checkForm(this);" autocomplete="off">
      <div class="col-sm-12 row">
        <div class=" col-sm-1"></div>

        <div class="form-group col-sm-3">
          <label class="control-label">S.No</label>
          <input class="form-control input-lg" type="text" name="dieselinvoice" id="dieselinvoice" value="<?php echo $invoice_count; ?>" readonly >
        </div>
        
        <div class="form-group col-sm-3">
          <label class="control-label">Date</label>
          <input class="form-control input-lg datepicker-invoicedate"  type="text" name="invoicedate" autocomplete="off">
        </div>
        
        <div class="form-group col-sm-3">
          <label class="control-label">Available Stock </label>
          <input class="form-control input-lg" type="text" value="<?php echo $AStock; ?>" readonly>
        </div>
      </div>
      
      <div class=" col-sm-12 row"><br></div>

      <div class=" col-sm-12 row">
        <div class=" col-sm-1"></div>

        <div class="form-group col-sm-3">
          <label class="control-label">Bunk Name </label>
          <select class="form-control input-lg selectpicker select-trip-vehicle" data-show-subtext="true" data-live-search="true" name="supplierdetails">
            <option value="">Select Bunk</option>
            <?php   echo $sqlSupplierName;   ?>
          </select> 
        </div>
        
        <div class="form-group col-sm-3">
          <label class="control-label">Supplier Invoice No</label>
          <input class="form-control input-lg" type="text" name="supplierinvoice_no" placeholder="Supplier Invoice Number"  required>
        </div>
        
        <div class="form-group col-sm-3">
          <label class="control-label">Vehicle No(Tanker)</label>
          <input class="form-control input-lg " type="text" name="vehicleno" placeholder="Vehicle Number" required/>
        </div>
        
        
      </div>
      
      <div class=" col-sm-12 row"><br></div>

      <div class=" col-sm-12 row">
        <div class=" col-sm-1"></div>

        
        <div class="form-group col-sm-3">
          
          <label class="control-label">Litres</label>
          <input class="form-control input-lg " type="text" name="litres" id="liters1" placeholder="Litres" required onBlur="my()" />
          
        </div>
        
        <div class="form-group col-sm-3">
          <label class="control-label">Rate(Per Ltr)</label>
          <input class="form-control input-lg" type="text" name="rate1" id="rate1" placeholder="Purchase rate" required onBlur="my()">
        </div>
        
        <div class="form-group col-sm-3">
          <label class="control-label">Invoice Amount</label>
          <input class="form-control input-lg" type="text" name="amount" id="amount" placeholder="Purchase Amount" required readonly>
        </div>
        
      </div>
      
      
      <div class=" col-sm-12 row">
        <div class=" col-sm-1"></div>

        
        <div class="form-group col-sm-3">
          
          <label class="control-label">Payment </label>
            <select class="form-control input-lg " name="payment" required>
        <option value="">Please Select the Option </option>
       <option value="Cash And Carry">Cash And Carry</option>
       <option value="Accounts">Accounts</option>
       
        </select>
          
        </div>
        
        <div class="form-group col-sm-3">
          <label class="control-label">Paid&nbsp;Amt</label>
          <input class="form-control input-lg" type="text" name="received_amt"  >
        </div>
        
        <div class="form-group col-sm-3">
          <label class="control-label">Payment&nbsp;Mode</label>
          <select class="form-control input-lg selectpicker select-payment-type" data-live-search="true" name="paymenttype" id="supplierdetails">
            <option disabled selected>Select your Option</option>
            <option value="cash">Cash</option>
            <option value="cheque">Cheque</option>
            <option value="NEFT">NEFT</option>
          
          </select>     
        </div>
        
      </div>
      
      
      
      <div class=" col-sm-12 row">
        <div class=" col-sm-1"></div>

        
        <div class="form-group col-sm-9">
          
          <label class="control-label">Remarks</label>
            <textarea class="form-control input-lg " name="remark" ></textarea>
       
          
        </div>
        
        
      </div>
      
      <div class=" col-sm-12 row"><br></div>

    <div class="form-group">        
      <div class="col-sm-12 text-center">
        <button type="submit" name="myButton" class="btn btn-default btn-lg">Save</button>
      </div>
    </div>
    </form>   
  </div>
  <?php require 'footer.php' ?>
 
  <script type="text/javascript">var base_url = "<?= $base_url ?>";</script>
  
  <script type="text/javascript" src="piDieselInvoiceScript.js"></script>
  
  
  <script>

  var checkForm = function(form) {

    //
    // validate form fields
    //

    form.myButton.disabled = true;
    return true;
  };


</script>
  
<script>
$(document).ready(function(){
  
  var date_input=$('input[name="invoicedate"]'); //our date input has the name "date"
	var container=$('form >  .datepicker-invoicedate').length>0 ? $('form > .datepicker-invoicedate').parent() : "body";
	date_input.datepicker({ format: 'dd-mm-yyyy',container: container,todayHighlight: true,autoclose: true  });
    
  $('input[name="invoicedate"]').datepicker( "setDate", new Date()); 

});
</script>
</body>
</html>