Current File : /home/obabain/khb_obaba_in/CostedofBillMaterial.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;
%>
<%@include file="master.jsp"%>
<style type="text/css">
.highlight-error {
	border-color: red;
}


.inlineTable {
            display: inline-block;
        }

.panel-default>.panel-heading-custom {
	background: #ff0000;
	color: #fff;
}
</style>
<!-- <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>
<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>

<body>
	<div class="row">
		<form action="addcustomer.jsp" method="post" id="contact" name="form1">
			<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">Costed Bill of Material Enquiry Form:</h3>
								</div>

								<br> <br>

								<div class="panel-body">

									<div class="row">

									<div class="col-xs-3">
	<label for="lastname" >Select Product:</label> 
	 
													
									
	<label for="lastname" style="margin: 5px;"> </label>
	<select id="select" style="margin:5px;" name="prod" class="form-control">
	                        <option value="0">select</option>
	                        <%
	                        rs=st.executeQuery("select * from bom_rawmaterial where type='F'");
	                        while(rs.next())
	                        {
	                        %>
                            <option value="<%=rs.getString("fg_id")%>"><%=rs.getString("product")%></option>
                            <%} %>
                  </select>
									</div>			
									</div>

  <hr>  
            <b>Details:</b>         
            
       <div class="panel-body">
      
<table id="myTable" class="table table-bordered" style="width:850px; border:2 ">
<thead>
<tr>
<th>Product</th>
<th>Quantity</th>
<th>WorkCenter</th>
<th>Unit of Cost</th>
<th>Cost</th>
</tr>
</thead>
<tbody>
<%
String prod=request.getParameter("prod");
rs=st.executeQuery("select tb.*,(quantity*p_price)cost,(select unit_name_plrl from ip_units where unit_id=tb.unit)runit,(select workcentername from workcenter where w_id=tb.workcenter)wc from bom_rawmaterial tb where type='R'");
while(rs.next())
{
%>
<tr>

<td class="choice <%=rs.getString("d1_id") %>">

<%=rs.getString("product") %>
  
</td>

<td class="choice <%=rs.getString("d1_id") %>">
<%=rs.getString("quantity") %>
</td>

<td class="choice <%=rs.getString("d1_id") %>"><%=rs.getString("wc") %>
</td>

<td class="choice <%=rs.getString("d1_id") %>">
<%=rs.getString("p_price") %>
</td>
<td class="cost choice <%=rs.getString("d1_id") %>" id="cost">
<%=rs.getString("cost") %>
</td>
<%-- <td class="cost choice <%=rs.getString("d1_id") %>">
<input type="text" class="a" value="<%=rs.getString("cost") %>"> 

</td> --%>
</tr>
<%} %>
</tbody>
</table>

<label for="lastname" style="margin-left:700px;">Total:</label> 
<table class="table" style="width:11%; margin-left:750px;">
<%

rs=st.executeQuery("select sum(quantity*p_price) as tot,d1_id from bom_rawmaterial where type='R' group by d1_id  ");
while(rs.next())
{
%>

<tr>

<td class="choice <%=rs.getString("d1_id") %>">
<input type="text" value="<%=rs.getString("tot") %>" class="form-control">
</td>
</tr>
<%} %>
</table>
	<!--  <input id="lastname" style="width:120px;margin-right:104px;" type="text" 
                       title=""
                     name="contactperson" class="total form-control pull-right"/> -->


</div> 
		                
							</div>
						</div>
					</div>
				</div>
	</div>
	
	</section>
	<%-- <% }else{ 
     response.sendRedirect("login.jsp");
    } %> --%>
	<script src="http://cdn.ckeditor.com/4.6.1/standard/ckeditor.js"></script>
	<script src="http://cdn.ckeditor.com/4.6.1/standard/ckeditor.js"></script>

	<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
	<script
		src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
	<script
		src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
	<script
		src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
	<script type="text/javascript">
		$('[data-type="adhaar-number"]').keyup(
				function() {
					var value = $(this).val();
					value = value.replace(/\D/g, "").split(/(?:([\d]{4}))/g)
							.filter(s = s.length > 0).join("-");
					$(this).val(value);
				});

		$('[data-type="adhaar-number"]').on("change, blur", function() {
			var value = $(this).val();
			var maxLength = $(this).attr("maxLength");
			if (value.length != maxLength) {
				$(this).addClass("highlight-error");
				alert("Aadhar card number not valid");
			} else {
				$(this).removeClass("highlight-error");
			}
		});
	</script>
	
	
	<!-- <script>
	$(document).ready(function(){
		$('#myTable').hide();
	})
	$('#select').change(function(){
		var a=$('#select').val();
		$('#pid').val(a);
		alert(a);
		$('#myTable').show();
		    });
	</script>
	 -->
	
	<script>
	 $('.choice').hide();
	 var  total=0;
	$(document).ready(function(){		
	     $("#select").change(function(){
	        var textselected =  document.getElementById("select").value ;
	        //alert(textselected);
	            target = '.' + textselected;
	           // alert(target);
	         $('.choice').hide();
	        $(target).show();
	        var sum = 0;
	        var total = 0;
	       
	
    });
	});

	</script>
	</form>
	</div>
</body>
</html>