Current File : //home/obabain/khb_obaba_in/IssueCreation2.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
    <%@include file="Connection.jsp" %>
    
<%
Statement st=con.createStatement();
ResultSet rs = null;
%> 
    <%!String lpo=null;
    int inid=0;
    String date=null;
    String polno=null;
    %>
    <%    
	Statement st1=con.createStatement();
    ResultSet rs3=st.executeQuery("select tb.*,IFNULL((tb.issueno),0)pono from issue1 tb where id=(select max(id) from issue1)");
    while(rs3.next())
    {
    lpo=rs3.getString("pono");
    }
    rs3=st.executeQuery("select NOW() as date");
    while(rs3.next())
    {
    date=rs3.getString("date");
    }
    ResultSet rn=st.executeQuery("select * from issue_increament where type='PO'");
    while(rn.next())
    {
    	polno=rn.getString("sl_no");
    }
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>


<title>Insert title here</title>
</head>
<body>
<%@include file="master.jsp" %>
<form action="issue_creationInsert.jsp"  method="post" >

<section id="main">
<div class="container">
 <div class="row" style="width:110%">
    <div class="col-md-10" >
       <div class="panel panel-default" >
       <div class="panel-heading main-color-bg">
        <h3 class="panel-title">Issue Products </h3>
        <a style="background:;margin-top:-23px; " class="btn btn-success pull-right" href="ViewIsuue.jsp">View</a>
    </div>
    
        
           <br><div class="panel-body"  >
   <div class="row" > 
      
     
  
             
       
      <div class="col-xs-2">
        <label for="lastname" style="margin-left:10px;">Issue No</label>
         <input type="text" name="po_no" class="amt form-control" id="pono" value="<%=polno%>" readonly>  
                        
      </div>

       <div class="col-xs-2">
          <label for="lastname" style="margin-left:5px; color:;">Issue Date</label>
          <input    type="date" name="po_date"   class="form-control "> 
      </div> 
     
      
   
   
         
       </div>
     <br>
  <hr>    
  <table class="table table-bordered table-hover" id="tab_logic">
        <thead>
          <tr>
            <th class="text-center"> # </th>
            <th class="text-center"> Select Product </th>
            <th class="text-center"> Opening Stock </th>
            <th class="text-center"> Issue Qty </th>
            <th class="text-center"> Closing Stock </th>
          </tr>
        </thead>
        <tbody>
          <tr id='addr0'>
            <td>1</td>
            <td>
            
          
            <select name="material[]" class="itemselect form-control" style="width:180px;" required>
       <option value="0">Select</option>
      <%
      ResultSet rsmat=st.executeQuery("select tb.*,(select sum(qty_pur) from ip_stock_register where product_id=tb.product_id group by product_id)sqty from ip_products tb where family_id!=7 order by product_name ");
      while(rsmat.next())
      {
      %>
      <option value=" <%=rsmat.getString("product_id") %>">  <%=rsmat.getString("product_name") %>&nbsp;&nbsp;&nbsp;--<%=rsmat.getString("sqty") %></option>
      <%} %> 
      </select>
            
            </td>
            <td><input type="text" name='Opening[]' placeholder='Enter Qty' class="revno form-control qty" step="0" min="0" readonly /></td>
            <td><input type="text" name='qty[]'  class="form-control price" step="0.00" min="0" required/></td>
            <td><input type="text" name='order_qty[]' placeholder='0.00' class="form-control total" readonly/></td>
          </tr>
          <tr id='addr1'></tr>
        </tbody>
      </table>
  
  
  
  
  
    <a id="add_row" class="btn btn-default pull-left">Add Row</a>
      <a id='delete_row' class="pull-right btn btn-default">Delete Row</a>
  
  
  
  
  
  
  
  
  
           </div>      
         <div class="modal-footer" id="contact_submit">
         <input type="button" value="Back" style="background:#204b58;margin-right:720px" class="btn btn-info" onclick="goBack()" />
          <a class="btn btn-default"  href="">Reset</a>
        <input type="submit" style="background:#204b58;" class="btn btn-info" value="Save changes">
      </div>      
      
      <br>   
   
   
         
     </div>
     </div>  
    
  </div>
  </div>
</section>

</form>


<script type="text/javascript">
function validate()
{
	 
	 // var t2=document.po.expdate.value;
	  
	 var t1=document.getElementById("datetimepicker").value;
	  var t4=document.getElementById("pono").value;
	  if( t1==null || t1=="" || t4==null || t4=="" )		  
		 alert('Fill all mandatory fields');
  
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></script>
    <script src="js/select2.min.js"></script>
    <script src="js/jquery.datetimepicker.full.js"></script>
   
   
     <script>
     jQuery('#datetimepicker').datetimepicker({
    	 timepicker:false,
    	 todayBtn: "linked",
    		 format: 'd/m/Y'
    		 //var date = $('#datetimepicker').datetimepicker({ dateFormat: 'dd-mm-yy' }).val();
    	 //mask:true, // '9999/19/39 29:59' - digit is the maximum possible for a cell
    	});
     jQuery('#datetimepicker').datetimepicker({
    	 timepicker:false,
    	 todayBtn: "linked",
    		 format: 'd/m/Y'
    		 //var date = $('#datetimepicker').datetimepicker({ dateFormat: 'dd-mm-yy' }).val();
    	 //mask:true, // '9999/19/39 29:59' - digit is the maximum possible for a cell
    	});
     jQuery('#datetimepicker1').datetimepicker({
    	 timepicker:false,
    	 todayBtn: "linked",
    		 format: 'd/m/Y'
    		 //var date = $('#datetimepicker').datetimepicker({ dateFormat: 'dd-mm-yy' }).val();
    	 //mask:true, // '9999/19/39 29:59' - digit is the maximum possible for a cell
    	});
     
     $(document).ready(function(){
    	 var d=new Date();
    	 var da=  d.getDate() + "/" + (d.getMonth()+1) + "/" +d.getFullYear();
    	 $('#datetimepicker1').val(da);
     });
     $(document).ready(function(){
    	 var d=new Date();
    	 var da=  d.getDate() + "/" + (d.getMonth()+1) + "/" +d.getFullYear();
    	 $('#datetimepicker').val(da);
     });
     
     
    </script>
    
</body>

 <script type="text/javascript">
 $(document).ready(function(){
	    var i=1;
	    $("#add_row").click(function(){b=i-1;
	      	$('#addr'+i).html($('#addr'+b).html()).find('td:first-child').html(i+1);
	      	$('#tab_logic').append('<tr id="addr'+(i+1)+'"></tr>');
	      	i++; 
	  	});
	    $("#delete_row").click(function(){
	    	if(i>1){
			$("#addr"+(i-1)).html('');
			i--;
			}
			calc();
		});
		
		$('#tab_logic tbody').on('keyup change',function(){
			calc();
		});
		$('#tax').on('keyup change',function(){
			calc_total();
		});
		

	});

	function calc()
	{
		$('#tab_logic tbody tr').each(function(i, element) {
			var html = $(this).html();
			if(html!='')
			{
				var qty = $(this).find('.qty').val();
				var price = $(this).find('.price').val();
				$(this).find('.total').val(qty-price);
				
				calc_total();
			}
	    });
	}

	function calc_total()
	{
		total=0;
		$('.total').each(function() {
	        total += parseInt($(this).val());
	    });
		$('#sub_total').val(total.toFixed(2));
		tax_sum=total/100*$('#tax').val();
		$('#tax_amount').val(tax_sum.toFixed(2));
		$('#total_amount').val((tax_sum+total).toFixed(2));
	}

</script>


 <script>
$(document).on("change",".itemselect",function(){
	
	var p=[];
	var a=$(".itemselect:last").find("option:selected").text();
	p=a.split('--');
	
	$(".item:last").val(p[0]);
	$(".descr:last").val(p[2]);
	$(".revno:last").val(p[1]);
	
	$(".drawno:last").val(p[3]);
	$(".materialgroup:last").val(p[4]);
	$(".price:last").val(p[5]);
	$(".discount:last").val(p[6]);
	$(".curr:last").val(p[7]);
	$(".ouom:last").val(p[8]);
	$(".sloc:last").val(p[9]);
	
});
</script>






</html>