<?php 
require_once("config/configDB.php"); 
require "userPermission.php";
require_once("config/constant.php");


$sql_expense = mysqli_query($conn,"SELECT id, expense FROM expense_master where flag=1 ");
$row_expense = '';


$sqlInvoiceCount = mysqli_query($conn,"SELECT count(*) as invoice FROM expense_entry");
 
$rowInvoiceCount=mysqli_fetch_array($sqlInvoiceCount,MYSQLI_ASSOC);

$invoice   = $rowInvoiceCount['invoice']+1;


?>
<!DOCTYPE html>
<html>
<head>
    <title>Expense Entry</title>
    <?php require 'header.php' ?>
    
</head>
<body>
    <?php require 'menu.php' ?>
<div class="container-fluid">
    <form class="form-horizontal" action="expenseEntryInsert.php" method="post" onSubmit="return checkForm(this);" autocomplete="off">
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Cash No</label>
      <div class="col-sm-5">
      <input type="text" class="form-control" name="cashno" value="<?php echo $EXPENSEINVOICEPREFIX.''.$invoice; ?>" readonly>
      </div>

    </div>
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Date</label>
      <div class="col-sm-5">
        <input type="text" class="form-control datepickers" name="expensedate" id="date">
      </div>
      
    </div>
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Expense Type</label>
      <div class="col-sm-5">
      <select class="form-control" id="sel1" name="expensetype">
        <option>Select Expense Type</option>
        <?php
        while($row = mysqli_fetch_array($sql_expense)){
        ?>
        <option value="<?php echo $row['id'] ?>" > <?php echo $row['expense']; ?> </option>
        <?php
        }
        ?>
        
      </select>
      </div>
    </div>
    
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Expenser</label>
      <div class="col-sm-5">
      <input type="text" class="form-control" id="sel1" name="expenser">
       
        
     
      </div>
    </div>
    
    
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Expense Qty</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" name="expense">
      </div>
    </div>
    
   
    <!-- <div class="form-group">
      <label class="control-label col-sm-3" for="email">Payment Type</label>
      <div class="col-sm-5">
      <select class="form-control" id="sel1" name="paymenttype">
        <option>Select Payment</option>
        
        </select>
      </div>
      
    </div>
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Silver AQUA</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" name="silverAQUA">
      </div>
    </div>
  
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Available Amount</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" name="availableAmount">
      </div>
    </div> -->
    
    
    
     <div class="form-group">
      <label class="control-label col-sm-3" for="email">Expense Mode</label>
      <div class="col-sm-5">
      <select class="form-control" id="mode" name="mode">
        <option>Select Expense Mode</option>
       <option>Bank</option>
       <option>Gpay</option>
       <option>Phonepe</option>
       <option>Cash</option>
       <option>Cheque</option>
       <option>Other Upi</option>
        
      </select>
      </div>
    </div>
    
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Amount</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" name="amount">
      </div>
    </div>  
    
     <div class="form-group">
      <label class="control-label col-sm-3" for="email">Rermark</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" name="remark">
      </div>
    </div>
    
   
    <div class="form-group">        
      <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" class="btn btn-default" name="myButton">Submit</button>
      </div>
    </div>
  </form>   
</div>


    <?php require 'footer.php' ?>

        <!-- Include jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

<!-- Include Date Range Picker -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/js/bootstrap-datepicker.min.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[id="date"]'); 
            var container=$('form >  .datepickers').length>0 ? $('form > .datepickers ').parent() : "body";
            date_input.datepicker({
                format: 'dd-mm-yyyy',
                container: container,
                todayHighlight: true,
                autoclose: true,
            });     
            

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