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

$sql_InvoiceQuery   = mysqli_query($conn,"SELECT count(*) as code FROM purchase_product_master");
$rowInvoiceCount    = mysqli_fetch_array($sql_InvoiceQuery,MYSQLI_ASSOC);
$code_count      = $rowInvoiceCount['code']+1;

?>

<!DOCTYPE html>
<html>
<head>
    <title>Product Master</title>
    <?php require 'header.php' ?>


   <!--<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(function() {
    $("#btn").click(function() {
        $("button").attr("disabled", "disabled");
        setTimeout(function() {
            $("button").removeAttr("disabled");      
        }, 3000);
    });
});

</script>-->

</head>
<body>
    <?php require 'menu.php' ?>
    <div class="container-fluid text-center">
    <div class="row col-sm-12">
      <strong><h3>Purchase Product Master</h3></strong>
      </div>
    </div>
    <br><br>



<div class="container-fluid">
    <form class="form-horizontal" action="purchase_productMasterInsert.php" method="post" onSubmit="return checkForm(this);" name="myForm">
   
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Product Code</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter Item Code" name="productcode" required value="MPR-<?php echo $code_count;?>" readonly>
      </div>
      
    </div>

    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Product Name</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter Product Name" name="productname" required>
      </div>
    </div>

<div class="form-group">
	<label class="control-label col-sm-3">Qty Type</label>
        <div class="col-sm-5">
        <select type="text" class="form-control input-lg" name="qty_type" id="qty_type">
		<option value="">--Select Qty--</option>
		<option>KGS</option>
		<option>Ltr</option>
		<option>Box</option>
        <option>NOS</option>
		</select>
        </div>
		</div>
    
<div class="form-group">
      <label class="control-label col-sm-3" for="email">GST%</label>
      <div class="col-sm-5">
        <input type="number" class="form-control" placeholder="Enter GST % " name="gst" required>
      </div>
    </div>
    
    
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">HSN</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter HSN " name="hsn_code" required>
      </div>
    </div>

    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Rate</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter Purchase Rate" name="purchase_rate" required>
      </div>
    </div>
   
    
    <div class="form-group">
      <label class="control-label col-sm-3" for="email"> Description</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter Item Description" name="description" >
      </div>
    </div>
	
	<div class="form-group">
      <label class="control-label col-sm-3" for="email"> &nbsp;</label>
      <div class="col-sm-5">
        <button type="submit" name="myButton" class="btn btn-default" id="btn">Submit</button>
      </div>
    </div>
	
  </form>   
</div>


    <?php require 'footer.php' ?>
    <script>

  var checkForm = function(form) {

    //
    // validate form fields
    //

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

</script>
</body>
</html>