Current File : //home/obabain/autoclutchess_obaba_in/WipForm.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 rs1=st1.executeQuery("select tb.*,IFNULL((tb.c_no),0)pono from ip_wcasting tb where cid=(select max(cid) from ip_wcasting)");
    while(rs1.next())
    {
    lpo=rs1.getString("pono");
    }
    rs1=st1.executeQuery("select NOW() as date");
    while(rs1.next())
    {
    date=rs1.getString("date");
    }
    ResultSet rn=st.executeQuery("select * from  ip_wincreament 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="WipForm_Insert.jsp"  method="post" >

<section id="main">
<div class="container">
 <div class="row" >
    <div class="col-md-10"  style="width:1140px;margin-left:120px;margin-top:-280px;" >
       <div class="panel panel-default" >
       <div class="panel-heading main-color-bg">
        <h3 class="panel-title">WORK IN PROCESS OF CASTING</h3>
        <a style="background:;margin-top:-23px; " class="btn btn-success pull-right" href="wip_casting_View.jsp">View</a>
    </div>
     
          <div class="panel-body">
         
           <br>
   <div class="row"> 
   <div class="col-xs-2">
        <label for="lastname" style="margin-left:10px;">Casting No</label>
         <input type="text" name="cno" class="form-control" value="<%=polno%>" >  
      </div>
    <div class="col-xs-2">
        <label for="lastname" style="margin-left:10px;">Date</label>
         <input type="date" name="cdate" class="form-control">  
      </div>
   
      <div class="col-xs-2">
        <label for="lastname" style="margin-left:10px;">P.O No</label>
         <input type="text" name="po_no" class="amt form-control">  
                        
      </div>

       <div class="col-xs-2">
          <label for="lastname" style="margin-left:5px; color:;">P.O Date</label>
          <input type="date" name="po_date"   class="form-control "> 
      </div> 
       </div>
    
  <hr>   
    <div style="overflow-x:auto;">  
  <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"> Material </th>
            <th class="text-center"> P.O Qty </th>
            <th class="text-center">WO&nbsp;Qty </th>
            <th class="text-center"> Fdy </th>
            <th class="text-center"> Fet </th>
            <th class="text-center"> HT </th>
            <th class="text-center">F.Insp </th>  
            <th class="text-center"> Total Qty </th>
            <th class="text-center"> Rejection Qty </th>
            <th class="text-center"> Des Qty </th>
            <th class="text-center"> Bal Qty </th>
          </tr>
        </thead>
        <tbody>
          <tr id='addr0'>
            <td>1</td>
            <td>
            <select name="product[]" class="itemselect form-control" style="width:220px;" required>
       <option value="0">Select</option>
      <%
      ResultSet rsmat=st.executeQuery("select * from ip_products where family_id=7");
      while(rsmat.next())
      {
      %>
      <option value=" <%=rsmat.getString("product_id") %>">  <%=rsmat.getString("product_name") %></option>
      <%} %>  
      </select>
            
            </td>
            <td><input type="text" name='material[]' class="revno form-control qty"  style ="width:150px" required/></td>
            <td><input type="text" name='po_qty[]'  class="form-control price"   style="width:150px;" /></td>
            <td><input type="text" name='wqty[]'   class="form-control" style="width:150px;" value="0" ></td>
      <td><input type="text" name='fdy[]'   class="form-control" style="width:150px;" value="0" ></td>
           
            <td>
    <input type="text" name="fet[]"  id="PRICE" class="amt form-control" style="width:150px;"value="0" >
    </td>
    <td>
    <input type="text" name="ht[]" id="QTY1" class="amt form-control" style="width:150px;" value="0">    
    </td>
    <td>
    <input type="text" name="f_insp[]" id="PRICE1" class="amt form-control" style="width:150px;" value="0">
    </td>   
     
     <td>
    <input type="text" name="total[]" id="TOTAL" class="amt form-control" style="width:150px;" value="0"/>
    </td>   
      <td>
    <input type="text" name="rej_qty[]" class="amt form-control" style="width:150px;" value="0">
    </td> 

         
         <td>
    <input type="text" name="disp[]"  class="form-control" style="width:150px;" value="0"/>
    </td>
     <td>
    <input type="text" name="bal[]"  class="amt form-control" style="width:150px;" value="0"/>
    </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-danger">Delete Row</a>
  
  </div>
  
  
  
  
  
  
  
           </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>







</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>


<script>
function goBack() {
  window.history.back();
}
</script>



</html>