<?php 

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

require_once("config/configDB.php");

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

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


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

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



<div class="container-fluid">
    <form class="form-horizontal" action="productMasterInsert.php" method="post" onSubmit="return checkForm(this);" autocomplete="off">
   
    <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="<?php echo $invoice; ?>" readonly>
      </div>
      <label class="label-command col-sm-4" for="email">( Example : PRD0001)</label>
    </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" for="email">Product&nbsp;Type</label>
      <div class="col-sm-5">
         <select class="form-control"  name="product_type" required>
        <option>Select Option</option>
        <option>Spare</option>
        <option>Explosive</option>
       
        </select>
      </div>
    </div>
    
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">Qty Type</label>
      <div class="col-sm-5">
        <select class="form-control"  name="qty_type" required>
        <option>Select Option</option>
        <option>Ltrs</option>
        <option>Nos</option>
        <option>Kgs</option>
        </select>
      </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">GST %</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter GST Price per Unit" name="gst" required>
      </div>
    </div>
    <div class="form-group">
      <label class="control-label col-sm-3" for="email">HSN Code</label>
      <div class="col-sm-5">
        <input type="text" class="form-control" placeholder="Enter HSN Code" name="hsn_code">
      </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">        
      <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" name="myButton" class="btn btn-default">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>