Current File : /home/obabain/autoclutchess_obaba_in/ShotblastAddItem.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@include file="Connection.jsp" %>
    <%@include file="master.jsp" %>
<%
Statement st=con.createStatement();
ResultSet rs = null;
int count=0;
%>
<%  String id=request.getParameter("Id");%>
<!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">

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
   <link href="css/select2.min.css" rel="stylesheet">
    <link href="css/jquery.datetimepicker.css" rel="stylesheet">
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
    
     <style type="text/css">
  .template { display:none ; }
  </style>  
   
<title>Raw Material Quality Plan</title>
</head>
<body>


<script>
function checkExist(){
    var xmlhttp = new XMLHttpRequest();
    var username = document.forms["jv"]["num"].value;
    var url = "SalesTransferExist.jsp?username=" + username;
    xmlhttp.onreadystatechange = function(){
        if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
            if(xmlhttp.responseText == "Duplicate No.")
                document.getElementById("isE").style.color = "red";
            else
                document.getElementById("isE").style.color = "green";
            document.getElementById("isE").innerHTML = xmlhttp.responseText;
        }
        
    };
    
    xmlhttp.open("GET",url,true);
    xmlhttp.send();

}
</script>
 <%!String lpo=null;
    String lpodate=null;
    String 	batch=null;
    %>
<%   
    
	/* rs=st.executeQuery("select * from ip_porders where porder_number="+pono+"");
	while(rs.next())
	{
		POID=rs.getString("porder_id");
	} */
	rs=st.executeQuery("select * from shotblast1  where id="+id+"");
    while(rs.next())
    {
    
    	 lpo=rs.getString("date");
    	    lpodate=rs.getString("shift");
    		batch=rs.getString("batch");
    }
    
    %>
<form action="ShotblastingDAAdd.jsp"  id="contact" name="form1">

<div class="content">
 <div class="row">
    <div class="col-md-9"  >
       <div class="panel panel-default">
       <div class="panel-heading main-color-bg">
        <h3 class="panel-title">Fettling Process</h3>
        
   <a style="background:;margin-top:-23px;margin-right:30px;" class="btn btn-danger pull-right" href="Shotblasting_view.jsp">View</a>
  
    </div>
     <div class="row"> 
    <div class="col-xs-3">
       <label for="lastname" style="margin-left:5px; color:black;">Date</label>
          <input type="text" name="date" class="form-control"  value="<%=lpo %>" readonly">
          
                   </div> 
                   
                  <div class="col-sm-3 ">
									<label for="lastname" style="margin-left: 5px;">Shift</label> <input
										type="text" name="shift" class="form-control" value="<%=lpodate %>" readonly>
										 <input
										type="hidden" name="wid" class="form-control" value="<%=id %>" >
								</div>
                    <div class="col-xs-3">
       <label for="lastname" style="margin-left:5px; color:black;">No. of Batches</label>
          <input type="text" name="batch" class="amt form-control" style="width:180px;" value="<%=batch %>" readonly>
                   </div> 
                   </div>   
      <div class="panel-body">
      <div class="row"> 
          
       
     
       
  
      
          
      
          
            <hr>
            
            
            
          <div style="overflow-x:auto;">
          <table class="table table-bordered table-hover additionalMargin alignment" id="table1" style="width:50%;">
            <!-- <caption style="text-align,:center;" center;><span style="color:green;text-align: center;"><b>Chemical Composition         &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Visual Inspection </b></span></caption> -->
          <thead>
                                                                                        <tr class="success">
           <th rowspan=1 style="text-align:center">Heat No.</th> 
             <th rowspan=1 style="text-align:center">Part Name </th>
            
             <th rowspan=1 style="text-align:center">Part No.</th>
             <th rowspan=1 style="text-align:center">Qty(nos)</th>
             <th rowspan=1 style="text-align:center"> Shotblating Rejection Qty</th>
               <th rowspan=1 style="text-align:center"> Fettling Rejection Qty</th>
                 <th rowspan=1 style="text-align:center"> Re-Shotblating Rejection Qty</th>
             
             <th rowspan=1 style="text-align:center">Total Time(sec)</th>
             <th rowspan=1 style="text-align:center">Remarks</th><th></th></tr></thead>
    <tr class='template'>
    
  <td>
       <span class="project" style=""> 
 
  
  <select class=" selectMat form-control input-group-lg reg_name" name="heatno[]" id="ddlsname" style="width:100px;">
                <option value="0">select</option>
          <%
          rs=st.executeQuery("select * from melt2");
          while(rs.next())
        	  
        	  
        	  
          {
          %>          
        
          
          <option value="<%=rs.getString("heatno")%>"><%=rs.getString("heatno") %>&nbsp;--&nbsp;<%=rs.getString("partname") %>&nbsp;--&nbsp;<%=rs.getString("partno") %>--<%=rs.getString("qty") %></option>
          <%} %>
                </select>       </span>                                                    
     </td>        
                  
    <td>
       <span class="project" style=""> 
                <input type="text" class="descr form-control input-group-lg reg_name " name="partname[]" style="width:100px;">  
       
           </span>                                                    
     </td> 
     
     
     <td>
       <span class="project" style=""> 
                <input type="text" class="revno form-control input-group-lg reg_name " name="partno[]" style="width:100px;">  
       
           </span>                                                    
     </td> 
     
     
       <td>
       <span class="project" style=""> 
         <input type="text" class="drgno form-control input-group-lg reg_name " name="qty[]" style="width:100px;" >  
       </span>                                                    
     </td>
      <td>
       <span class="project" style=""> 
         <input type="text" class="form-control " name="srejqty[]" style="width:100px;" >  
       </span>                                                    
     </td>
      <td>
       <span class="project" style=""> 
         <input type="text" class="form-control " name="frejqty[]" style="width:100px;" >  
       </span>                                                    
     </td>
       <td>
       <span class="project" style=""> 
         <input type="text" class="form-control " name="resrejqty[]" style="width:100px;" >  
       </span>                                                    
     </td>
     <td>
       <span class="project" style=""> 
         <input type="text" class="form-control " name="time[]" style="width:100px;" >  
       </span>                                                    
     </td>
     
         <td>
       <span class="project" style=""> 
         <input type="text" class="form-control " name="remark[]" style="width:100px;" >  
       </span>                                                    
     </td>
    
       
      <td><a href='#'  onclick='deleteRow(this)'><i class='glyphicon glyphicon-trash'></a></td>
              
     </tr>
     </table>
      <a id='add' class="pull-left btn btn-default">ADD</a><br>
    </div>
   </div>  <br>
   
   
   
   
  
          
  
            
            
   
            
       <div class="modal-footer" id="contact_submit">
         <input type="button" value="Back" style="background:#204b58;" class="pull-left btn btn-info" onclick="goBack()"> 
          <a class="btn btn-default"  href="">Reset</a>
        <input type="submit" style="background:#204b58;" class="btn btn-info" id="save" onclick="debitcredit();">
      </div>                                     
      </div>    
    </div>
    </div>
    </div>
    </div>             
</form>
</body>

<script>
    $(document).on("change",".selectMat",function(){
      
      var p=[];
      var str=$(".selectMat:last").find("option:selected").text();
      //alert(str);
      p=str.split('--');
      var a=p[1];
      $(".descr:last").val(a);
      $(".revno:last").val(p[2]);
      $(".drgno:last").val(p[3]);
      $(".div:last").val(p[4]);
      $(".buyer:last").val(p[5]);
      $(".price:last").val(p[6]);
    });
    </script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/js/select2.min.js"></script> 
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>  
<script>
$(function() {
    initThings();
    $('#add').on('click', function() { add_row($('#table1')); });
});


function add_row($table) {
    var tr_id = $table.find('tr').length - 1;
    var $template = $table.find('tr.template');
    var $tr = $template.clone().removeClass('template').prop('id', tr_id);

    $tr.find(':input').each(function() {
        if($(this).hasClass('hasDatepicker')) {
            $(this).removeClass('hasDatepicker').removeData('datepicker');
        }

        var input_id = $(this).prop('id');
        input_id = input_id + tr_id;
        $(this).prop('id', input_id);

        var new_name = $(this).prop('name');
        new_name = new_name.replace('[0]', '['+ tr_id +']');
        $(this).prop('name', new_name);

        $(this).prop('value', '');
    });
    $table.find('tbody').append($tr);
    $('.byto:last').val(1);

    $(".dateControl", $tr).datepicker({
        dateFormat: "dd-mm-yy"
    });

    $(".selectType", $tr).select2();
    $(".qty", $tr).select2();
    $(".selectType:last").val(0).trigger("change");
    $(".qty:last").val(0).trigger("change");
    $(".selectStatus:last").val(-1).trigger("change");
    $(".selectUnit:last").val(0).trigger("change");
    
}

function initThings() {
    add_row($('#table1'));
} 
	        </script>
	        <script src="js/select2.min.js"></script>
    <script src="js/jquery.datetimepicker.full.js"></script>
   
    <script>
    $('.select1').select2();
    </script>
    <script>
$(document).on("change", ".amt", function() {
    var sum = 0;
    $(".amt").each(function(){
        sum += +$(this).val();
        
    });
    $(".total").val(sum);
    
    $( ".amt" ).focus();
    $(".amt2:last").val(0);
    	
});

$(document).on("change", ".amt2", function() {
    var sum = 0;
    $(".amt2").each(function(){
        sum += +$(this).val();
    });
    $(".total2").val(sum);
  
});

$(document).on("change", ".byto", function() {
    var sum = 0;
    $(".amt").each(function(){
        sum += +$(this).val();
    });
    $(".total2").val(sum);
    $(".amt2:last").val(sum);
    $(".amt:last").val(0);
  
});
$(document).ready(function($){
	$('.byto').val(1);
})
      
	        </script>
	        
	        <script  langauge="JavaScript">
function deleteRow(btn) {
	  var row = btn.parentNode.parentNode;
	  row.parentNode.removeChild(row);
	  var sum = 0;
	  var sum2=0;
	    $(".amt").each(function(){
	        sum += +$(this).val();
	    });
	    $(".total").val(sum);
	    
	    $(".amt2").each(function(){
	        sum2 += +$(this).val();
	    });
	    $(".total2").val(sum2);
	    
	};
</script>
<script src="js/jquery.datetimepicker.full.js"></script>
<script>
     jQuery('#datetimepicker').datetimepicker({
    	 timepicker:false,
    	 todayBtn: "linked"
    	 //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.getFullYear() + "/" + (d.getMonth()+1) + "/" + d.getDate();
    	 $('#datetimepicker').val(da);
    	 
     });
    </script>
 
   <script type="text/javascript">
function goBack() {
    window.history.back();
   
};
</script>

</html>