Current File : /home/obabain/anms_obaba_in/WorkCenterDetails.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
     <%@include file="master.jsp" %>
<%@include file="Connection.jsp" %> 
<%!
String shlr=null;
String shohr=null;
ResultSet resultSet = null;
%>
<%
Statement st1=con.createStatement();
String wid=request.getParameter("id");
resultSet =st1.executeQuery("select * from shop_rate_details");
while(resultSet.next())
{
	shlr=resultSet.getString("shop_labor_rate");
	shohr=resultSet.getString("shop_overhead_rate");
}

%>
<%@page import="java.sql.*,java.util.*"%>
<%@page import="java.sql.ResultSet"%>

<!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="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"  rel="stylesheet">
    <link href="css/select2.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.css">
    <link href="css/jquery.datetimepicker.css" rel="stylesheet">
<title>Insert title here</title>

<style type="text/css">
.vl {
    border-left: 1px solid #204b58;
    border-right: 1px solid #204b58;
    border-top: 1px solid #204b58;
    border-bottom: 1px solid #204b58;
    height: 110px;
    padding-top:20px;
    padding-left:15px;
}
.gl {
    border-left: 1px solid #204b58;
    border-right: 1px solid #204b58;
    border-top: 1px solid #204b58;
    border-bottom: 1px solid #204b58;
    height: 240px;
    padding-top:20px;
    padding-left:15px; 
}
.bl {
    border-left: 1px solid #204b58;
    border-right: 1px solid #204b58;
    border-top: 1px solid #204b58;
    border-bottom: 1px solid #204b58;
   /*  height: 135px; */
    padding-top:13px;
    padding-left:15px;
    padding-bottom:25px;
}
.cl {
    border-left: 1px solid #204b58;
    border-right: 1px solid #204b58;
    border-top: 1px solid #204b58;
    border-bottom: 1px solid #204b58;
   /*  height: 135px; */
    padding-top:13px;
    padding-left:15px;
    padding-bottom:25px;
}





</style>
</head>
<body>
<form action="assignProcess.jsp" method="post">
<input type="hidden" name="id" value="<%=wid%>">
<%-- <%@include file="master.jsp" %> --%>
<div class="content">
<div class="row">
<div class="col-md-9" style="background-color:white;">
<div class="panel panel-default" >
       <div class="panel-heading main-color-bg">
        <h3 class="panel-title">Work Centers - Detail Tab </h3>
              </div>
             </div>
     
     	<script>
		function show(elementID) {
		    var ele = document.getElementById(elementID);
		    if (!ele) {
		        alert("no such element");
		        return;
		    }
		    var pages = document.getElementsByClassName('page');
		    for(var i = 0; i < pages.length; i++) {
		        pages[i].style.display = 'none';
		    }
		    ele.style.display = 'block';
		}
</script>               
     <div align="left" >
<a onclick="show('Page1');"><input type="button" value="WORK CENTER" style="background:#008CBA;" class="btn btn-info"  /></a>
<a onclick="show('Page2');"><input type="button" value="DETAILS" style="background:#008CBA;" class="btn btn-info"  /></a>
<a onclick="show('Page3');"><input type="button" value="PROCESSES" style="background:#008CBA;" class="btn btn-info"  /></a>
 <a onclick="show('Page4');"><input type="button" value="MACHINES" style="background:#008CBA;" class="btn btn-info"  /></a>
 
<a href="work_centre_view.jsp" ><input type="button" value="All WORK CENTERS" style="background:#008CBA;" class="btn btn-info"  /></a>
 <!--   <a onclick="show('Page5');"><input type="button" value="CONTACT DETAILS" style="background:#008CBA;" class="btn btn-info"  /></a>
 <a onclick="show('Page6');"><input type="button" value="DOCUMENT DETAILS" style="background:#008CBA;" class="btn btn-info"  /></a> -->
 </div><br><br>
  <!--  <div id="Page1" class="page"  style="display:">   -->       
 <!-- <div class="row">
             <div class="form-group col-xs-3">
            <div class="onerow">
            <label>Shop Labor Rate :</label>
           <input  type="number"  min="1"  name="shoplabor_rate"  class="form-control input-group-lg reg_name"style="width:200px;margin-top:-28px;margin-left:130px;" >              
</div>
</div>
 <div class="form-group col-xs-3">
            <div class="onerow">
              <label style="margin-left:150px;">ShopOverheadRate:</label>
           <input type="number" min="1" name="sover_rate" class="form-control input-group-lg reg_name" style="width:200px;margin-left:289px;margin-top:-28px;" placeholder="Ex-Assembly Work Center">              
</div>
</div> 
<div class="form-group col-xs-3">
            <div class="onerow">
              <label>  Setup Rate</label>
           <input type="text" name="setup_rate" class="form-control input-group-lg reg_name" style="width:200px;margin:5px;">              
</div>
</div>
</div> -->

<!-- Work Centers Details Tab Started -->
<div id="Page1" class="page"  style="display:">
 
   <div class="row" >
  <div align="right" >
<a href="WorkCenterTab.jsp"><input type="button" value="Add New" style="background:#204b58;margin-right: 50px" class="btn btn-info"  /></a>
 </div>       
  
 <div class="panel-body">
            
                    <b>View WorkCenter:</b>         
            
      
<table id="myTable" class="table table-bordered" style="width:1120px;">
<tr>
	<!-- <th>ShopLaborRate </th>
	<th>ShopOverheadRate</th> -->
	<th>WorkCenter ID</th>
	<th>Description</th>
	<th>SetupRate</th>
	<th>SetupFactor</th>
	<th>LaborRate</th>
	<th>LaborFactor</th>
	<th>MfgOHRate</th>
	<th>MfgOHFactor</th>
	<th>Multi-Clockins</th>
	 <th>machines</th> 
	<th>Active</th>
	
</tr>
<%
try{
	Statement st=con.createStatement();
String sql ="select tb.*,(case when active=1 then 'checked' else '' end)as act,(case when multi_clockins=1 then 'checked' else '' end)as multi from workcentertab tb where id="+wid+"";
resultSet = st.executeQuery(sql);
while(resultSet.next()){
%>





<tbody>

	<tr>

	
<td><a href="#">
  <%=resultSet.getString("workcenter_id") %>  </a>       
           
	</td>

	<td>
 <%=resultSet.getString("description") %> 
	</td>


	 <td>
 <%=resultSet.getString("setup_rate") %> 
	</td>
 
	<td>
 <%=resultSet.getString("setup_factor") %> 
 	</td>
 
	<td>
 <%=resultSet.getString("labor_rate") %> 
 	</td>
  
 	<td>
<%--  <a href="editTask_template.jsp?Id=<%=resultSet.getString("id") %>"><span class="glyphicon glyphicon-pencil"></span></a>  --%>
 	
 	<%=resultSet.getString("labor_factor") %> 
 	
 	
 	</td>
 
 	<td>
 	
 	<%=resultSet.getString("mfg_oh_Rate") %> 
 	
 
 
 
 	</td>
 	
 	<td> <%=resultSet.getString("mfg_oh_factor") %> </td>
 	
 	<td> <input type="checkbox" <%=resultSet.getString("multi") %> >  </td>
 	
   <td>     <%=resultSet.getString("machines") %>      </td>

   <td>  <input type="checkbox" <%=resultSet.getString("act") %> >     </td>
<!-- <td></td> -->
</tr>
<%
}

} catch (Exception e) {
e.printStackTrace();
}
%>


</tbody>
</table>
			</div>  
					</div>
 <div class="row">
<div class="form-group col-xs-3">
            <div class="onerow" >
               <label>Shop Labor Rate</label>
           <input type="number" name="mfg_oh_Rate" value="<%=shlr %>" class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>
<div class="form-group col-xs-3">
            <div class="onerow">
               <label>Shop Overhead Rate</label>
           <input type="number" name="mfg_oh_Rate" value="<%=shohr %>" class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>
 </div>
 
 </div> 
 
<div id="Page2" class="page"  style="display:none">
<div align="right" >
<!-- <a href="WorkCenterTab.jsp"><input type="button" value="Add New" style="background:#204b58;margin-right: 50px" class="btn btn-info"  /></a> -->
 </div> 
  <%
      Statement std=con.createStatement();
      ResultSet rs=std.executeQuery("select tb.*,round(sover_rate)as so,round(shoplabor_rate)as sl,(case when active=1 then 'checked' else '' end)as act,(case when multi_clockins=1 then 'checked' else '' end)as multi from workcentertab tb where id="+wid+"");
      while(rs.next())
      {
      %>
<div class="vl"> 
     
  
              <div class="row">
             <div class="form-group col-xs-3">
            <div class="onerow">
            <label >   Work Center ID</label>
           <input type="text" name="workcenter_id" value="<%=rs.getString("workcenter_id")%> " class="form-control input-group-lg reg_name" style="width:200px;margin-top:-28px;margin-left:130px;" placeholder="Ex-ASSY">              
</div>
</div>
<div class="form-group col-xs-3">
            <div class="onerow">
              <label style="margin-left:150px;">Multi-Clockins</label>
           <input type="checkbox" value="1" name="machines" class="" style="margin-left:252px;margin-top:-20px;" <%=rs.getString("multi")%> >              
</div>
</div>
<div class="form-group col-xs-3">
            <div class="onerow">
             <label style="margin-left:65px;">Active</label>    
          <!--  <input type="text" name="cnumber" class="form-control input-group-lg reg_name" style="width:200px;margin:5px;">            -->   

  <input type="checkbox" name="active" value="1"class="" style="margin-left:15px;margin-top:-20px;" <%=rs.getString("act")%> >
					

</div>
</div>
</div>

<div class="row">
<div class="form-group col-xs-3">
            <div class="onerow">
              <label>  Description</label>
           <input type="text" name="description" value="<%=rs.getString("description")%> " class="form-control input-group-lg reg_name" style="width:200px;margin-top:-28px;margin-left:130px;" placeholder="Ex-Assembly Work Center">              
</div>
</div></div>

</div><br>
<!-- </div> -->


<div class="gl">
 <div class="row">
 <div class="form-group col-xs-3">
            <div class="onerow">
              <label> Shop Labor Rate</label>
           <input type="number" name="setup_rate" id="slr" onchange="setupRate()" value="<%=rs.getString("sl")%>" class="form-control input-group-lg reg_name" style="width:200px;">              
</div></div>
 <div class="form-group col-xs-3">
            <div class="onerow">
              <label > Setup Cost Factor</label>
           <input type="text" name="setup_factor" id="scf" onchange="setupRate()" value="<%=rs.getString("setup_factor")%> " class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>
<div class="form-group col-xs-3">
            <div class="onerow">
              <label > SetupRate</label>
           <input type="text" name="setup_factor" id="setupR" value="<%=rs.getString("setup_rate")%>" class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>


</div>
<div class="row">
<div class="form-group col-xs-3">
            <div class="onerow">
               <label>Shop Labor Rate</label>
           <input type="number" name="labor_rate" onchange="laborRate()" id="slr2" value="<%=rs.getString("sl")%>" class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>
 <div class="form-group col-xs-3">
            <div class="onerow">
              <label>Labor Cost Factor</label>
           <input type="text" name="labor_factor" id="lcf" onchange="laborRate()"  value="<%=rs.getString("labor_factor")%> " class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>
<div class="form-group col-xs-3">
            <div class="onerow">
              <label>Labor Rate</label>
           <input type="text" name="labor_factor" id="labourR"  value="<%=rs.getString("labor_rate")%> " class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>

</div>
<div class="row">
<div class="form-group col-xs-3">
            <div class="onerow">
               <label>Shop Overhead Rate</label>
           <input type="number" name="mfg_oh_Rate" id="sohr" onchange="OHRate()" value="<%=rs.getString("so")%>" class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>

<div class="form-group col-xs-3">
            <div class="onerow">
             <label>Mfg OH Cost Factor</label>
           <input type="text" name="mfg_oh_factor" id="ohcf" onchange="OHRate()" value="<%=rs.getString("mfg_oh_factor")%> " class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>
<div class="form-group col-xs-3">
            <div class="onerow">
               <label >  Mfg OH Rate</label>
           <input type="text" name="mfg_oh_Rate" id="ohR" value="<%=rs.getString("mfg_oh_Rate")%> " class="form-control input-group-lg reg_name" style="width:200px;">              
</div>
</div>


</div>


 </div>
 <%} %>
 </div><!--  View of Details Tab Ended -->
 <br>
 
 
 <!-- -Work Center- Work Center tab View Page  start-->
 
 
 
 
 <!-- -Work Center-Work Center View ended   ---->
 
 
 
                                                            <!--  Work Centers- Process Tab  Started  -->
 
 <div id="Page3" class="page"  style="display:none">

<div class="bl"> 
      
  <div align="right" >
<a href="processes_Detail.jsp"><input type="button" value="Add New" style="background:#204b58;margin-right: 50px" class="btn btn-info"  /></a>
 </div> 
           
<table id="myTable" class="table table-bordered"style="width:700px; border:2 ">
<tr>

<th>Work Center ID</th>
<th > Description</th>
<th style="width:150px;" >Active </th>
<!-- <th></th> -->
</tr>

<%
try{
	
	Statement st=con.createStatement();
	 st=con.createStatement();
String sql ="select * from workcentertab where id="+wid+"";
resultSet = st.executeQuery(sql);
while(resultSet.next()){
%>





<tbody>

<tr>

<td>
<%=resultSet.getString("workcenter_id") %>
</td>

<td >
<%=resultSet.getString("description") %>
</td>


<td style="width:180px;">



       <input type="checkbox" class="v_checkbox" value=" <%=resultSet.getString("active")%>"  checked/> 
   
      
      </td>
<%-- <td>

       <a href="Account_tag.jsp?t_id=<%=resultSet.getString("t_id") %>"><span class="glyphicon glyphicon-trash"></span> </a>
        
        </td> --%>



</tr>
 <%
}

} catch (Exception e) {
e.printStackTrace();
}
%>

</tbody>
</table>

<hr>

</div>
<br>
<div class="bl">Select Process
<select style="width:30%;" name="process">
<option value="0">select</option>
<%
Statement str=con.createStatement();
ResultSet rr=str.executeQuery("select * from processes ");
while(rr.next())
{
%>
<option value="<%=rr.getString("id") %>"><%=rr.getString("procedd_id") %>-<%=rr.getString("description") %></option>
<%} %>
</select>

<input type="submit" class="btn btn-primary" value="Add">
</div>
<br>
<div class="cl">

<div class="panel-body">
<table id="myTable" class="table table-bordered" style="width:1120px; border:;margin-left:-26px;  ">
<tr>
	<!-- <th>ShopLaborRate </th>
	<th>ShopOverheadRate</th> -->
	<th>Processes ID</th>
	<th>Description</th>
	<th>Machine ID</th>
	<th> Setup Hours</th>
	<th>Items Process</th>
	<th>Hours/Process</th>
	<th>Processes/Hour</th>
	
	<th>Hours Type</th>
	<th>Days to Next</th>
	<!-- <th>machines</th> -->
	<th>Active</th>
	
</tr>
<%
try{
	Statement st=con.createStatement();
String sql ="select tb.*,(case when active=1 then 'checked' else '' end)act,(select machin_id from machin_details where id=tb.machine_id)machine from processes tb where id in(select process_id from workcenter_details where workcenter_id="+wid+")";
resultSet = st.executeQuery(sql);
while(resultSet.next()){
%>





<tbody>

	<tr>

	<%-- <td>
  <%=resultSet.getString("shoplabor_rate") %>         
           
	</td>

	<td>
 <%=resultSet.getString("sover_rate") %> 
	</td> --%>
<td>
  <%=resultSet.getString("procedd_id") %>         
           
	</td>

	<td>
 <%=resultSet.getString("description") %> 
	</td>


	 <td>
 <%=resultSet.getString("machine") %> 
	</td>
 
	<td>
 <%=resultSet.getString("setup_hrs") %> 
 	</td>
 
	<td>
 <%=resultSet.getString("item_process") %> 
 	</td>
  
 	<td>
<%--  <a href="editTask_template.jsp?Id=<%=resultSet.getString("id") %>"><span class="glyphicon glyphicon-pencil"></span></a>  --%>
 	
 	<%=resultSet.getString("hrs_per_process") %> 
 	
 	
 	</td>
 
 	<td>
 	
 	<%=resultSet.getString("process_hrs") %> 
 	

 
 
 	</td>
 	
 	<td> <%=resultSet.getString("hrs_type") %> </td>
 	
 	<td>  <%=resultSet.getString("daystonext") %>  </td>
 	
   <%-- <td> <%=resultSet.getString("machines") %></td> --%>

   <td> <input type="checkbox" <%=resultSet.getString("act") %>  >   </td>
<!-- <td></td> -->
</tr>
<%
}

} catch (Exception e) {
e.printStackTrace();
}
%>


</tbody>
</table>
 <!-- <div align="right" >
<a href="WorkCenterTab.jsp"><input type="button" value="Back" style="background:#204b58;margin-right: 50px" class="btn btn-info"  /></a>
 </div> -->
						</div>  


</div>


</div>


              <!-- ----------   Work Center-   Machine TAB Started -->
              
 <div id="Page4" class="page"  style="display:none">

<div class="bl"> 
     
  <div align="right" >
<a href="machine_details.jsp"><input type="button" value="Add New" style="background:#204b58;margin-right: 50px" class="btn btn-info"  /></a>
 </div> 
           
<table id="myTable" class="table table-bordered"style="width:700px; border:2;margin-top:-12px;margin-left:40px;">
<tr>

<th>Work Center ID</th>
<th > Description</th>
<th style="width:150px;" >Active </th>
<!-- <th></th> -->
</tr>

<%
try{
	
	Statement st=con.createStatement();
	 st=con.createStatement();
String sql ="select * from workcentertab where id="+wid+"";
resultSet = st.executeQuery(sql);
while(resultSet.next()){
%>

<tbody>

<tr>

<td>
<%=resultSet.getString("workcenter_id") %>
</td>

<td >
<%=resultSet.getString("description") %>
</td>


<td style="width:180px;">



       <input type="checkbox" class="v_checkbox" value=" <%=resultSet.getString("active")%>"  checked/> 
   
      
      </td>
<%-- <td>

       <a href="Account_tag.jsp?t_id=<%=resultSet.getString("t_id") %>"><span class="glyphicon glyphicon-trash"></span> </a>
        
        </td> --%>



</tr>
 <%
}

} catch (Exception e) {
e.printStackTrace();
}
%>

</tbody>
</table>

</div>

<br>
<div class="cl" >
<div class="panel-body">
<table id="myTable" class="table table-bordered" style=" border:2;margin-left:-26px;  ">
<tr>
	<!-- <th>ShopLaborRate </th>
	<th>ShopOverheadRate</th> -->
	<!-- <th>Processes ID</th>
	<th>Description</th> -->
	<th>Machine ID</th>
	<th>Description</th>
	<th>Active</th>
	<!-- <th>Items Process</th>
	<th>Hours/Process</th>
	<th>Processes/Hour</th>
	
	<th>Hours Type</th>
	<th>Days to Next</th>
	<th>machines</th>
	<th>Active</th> -->
	
</tr>
<%
try{
	Statement st=con.createStatement();
String sql ="select tb.*,(case when active=1 then 'checked' else '' end)as act from machin_details tb where id in(select machine_id from workcenter_details where workcenter_id="+wid+")";
resultSet = st.executeQuery(sql);
while(resultSet.next()){
%>

<tbody>

	<tr>

	<%-- <td>
  <%=resultSet.getString("shoplabor_rate") %>         
           
	</td>

	<td>
 <%=resultSet.getString("sover_rate") %> 
	</td> --%>
<td>
  <%=resultSet.getString("machin_id") %>         
           
	</td>

	<td>
 <%=resultSet.getString("machin_description") %> 
	</td>
<td>
<input type="checkbox" class="v_checkbox"  <%=resultSet.getString("act")%>  />
</td>


</tr>
<%
}

} catch (Exception e) {
e.printStackTrace();
}
%>


</tbody>
</table>
 <!-- <div align="right" >
<a href="WorkCenterTab.jsp"><input type="button" value="Back" style="background:#204b58;margin-right: 50px" class="btn btn-info"  /></a>
 </div> -->
						</div>  


 </div> 


</div>


<!-- ----------ended -->
 
 <div class="row">
 
</div>
<!--  <div class="modal-footer" id="contact_submit">
  <a class="btn btn-danger" style="float:left;" onclick="goBack()">Back</a>
        <a class="btn btn-default" href="WorkCenterTab.jsp">Reset</a>
        <button type="submit" style="background:#204b58" class="btn btn-info" >Save Changes</button>
        
      </div> -->
</div>


	        
</div>
</div>
<%@include file="footer.jsp" %>
</form>
<script type="text/javascript">
function goBack() {
    window.history.back();
   
};
</script>

<script>
function setupRate()
{
	var x=document.getElementById("slr").value;
	var y=document.getElementById("scf").value;
	var s=x*y;
	var result=document.getElementById("setupR");
	result.value=s;
	};
	
	function laborRate()
	{
		var x=document.getElementById("slr2").value;
		var y=document.getElementById("lcf").value;
		var s=x*y;
		var result=document.getElementById("labourR");
		result.value=s;
		};
		
		function OHRate()
		{
			var x=document.getElementById("sohr").value;
			var y=document.getElementById("ohcf").value;
			var s=x*y;
			var result=document.getElementById("ohR");
			result.value=s;
			};
		
</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 src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker-standalone.css"></script>
    <script>
    $('select').select2();
    </script>
</body>
</html>