Current File : //home/obabain/khb_obaba_in/ProductionOrder.jsp
 
<%@page import="java.sql.*,java.util.*"%>
<%@page import="java.sql.ResultSet"%>
 
 <%@include file="master.jsp" %>
 <%@ include file="Connection.jsp" %>
 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%><%-- <% Statement st= con.createStatement();%> --%>
   <%! int id;%>
 
      <% //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>
<%-- <%ResultSet resultSet = null;%> --%>


<%-- <% String id=request.getParameter("mo_id"); %>  --%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
<!--   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</head>
<body>
  

<div class="row">
<form  action="" method="post" id="" name="">
<section id="main">
<div class="content">
 <div class="row" style="width:100%" >
    <div class="col-md-9" >
       <div class="panel panel-default" >
         <div class="panel-heading main-color-bg">
          <h3 class="panel-title">Product Order</h3>
         </div>
   
  <div class="panel-body">
    
         <br>  
           <!--  <div class="pull-right" > 
          
<div class="headerbar-item pull-right" style="margin-top:10px;">
 <a href="M_orderForm.jsp" style="background:#204b58;" class="btn btn-info">Addnew</a>
       <div class="onerow" ><div class="btn">
     <a href="ViewM_orderForm.jsp"><button  type="button" class="btn btn-danger">Confirm</button></a>            
<a class="btn btn-info" style="background:#204b58"  href="ProductPrintPdf.jsp">Print</a>
</div>
            </div> --> 
           

      <br>   
     <b style="color:red">Products Details :</b><br> 
  <table class="table table-bordered">
    <thead>
      <tr class="p-3 mb-2 bg-info text-white">
        <th>Reference Number</th>
        <th>Schedule Date</th>
        <th>Product Name</th>
        <th>Product Quantity</th>
       <!--  <th>Rate</th> -->
        <th>Amount</th>
         <th>Confirm</th>
          <th>Print</th>     
      </tr>
    </thead>
   <!--  select *  from manufacture_order order by mo_id desc limit 1 -->
    <%--  <%
       try
       {
	    st=con.createStatement();
        //ResultSet rs1 = st.executeQuery("select tb.*,((quantity*p_price)*(manufacture_order.ProductQty))cost,mocus_id,Scheduledate,(select Product from manufacture_order where p_id='19')Prod,ProductQty from  manufacture_order,bom_rawmaterial tb where tb.d1_id=manufacture_order.p_id group by d1_id");  
        ResultSet rs1=st.executeQuery("select tb.*,(select sum(quantity*p_price) from bom_rawmaterial where d1_id=tb.p_id and type='R')* tb.ProductQty as a from manufacture_order tb ");
        while(rs1.next())
        {
     %> --%>
    
      <tbody>
       <%
      Statement st= con.createStatement();
ResultSet rs123=st.executeQuery("select * from manufacture_order");
while(rs123.next()){
id=rs123.getInt("mo_id");  
	System.out.print(id);


%>    
      
         <tr>
     <td scope="col">
       
       <a href="ViewP_RawMaterial.jsp?id=<%=rs123.getString("mo_id") %>">  <%=rs123.getString("mocus_id") %></a>
    
     </td>

     <td scope="col">
         <%=rs123.getString("Scheduledate") %>
     </td>

  <td scope="col">
         <%=rs123.getString("Product") %>
     </td>


     <td scope="col">
        <%=rs123.getString("ProductQty") %>
     </td>
     
     <%
     Statement st1= con.createStatement();
     ResultSet rr=st1.executeQuery("select sum(quantity*p_price)*(select ProductQty from manufacture_order where mo_id="+rs123.getString("mo_id")+")amt from bom_rawmaterial where d1_id=(select p_id from manufacture_order where mo_id="+rs123.getString("mo_id")+")");
     while(rr.next()){
     %>
     
     <td scope="col">
         <%=rr.getString("amt") %>
     </td>
    <%--  <%} %> --%>
     
     <td>
          <a href="ViewM_orderForm.jsp?id=<%=rs123.getString("mo_id") %>"><button  type="button" class="btn btn-danger">Confirm</button></a>            
     
     </td>
     <td>
     <a class="btn btn-info" style="background:#204b58"  href="ProductPrintPdf.jsp?id=<%=rs123.getString("mo_id") %>">Print</a>
     
     </td>
    
     </tr>
 
 <!-- <td>
 </td>
 <td></td> -->
    </tbody> 
     <%}
        }
     %> 
  </table>
     <br> <br> <br>
     
     
   <!-- </div> -->
  <!-- <div id="menu1" class="tab-pane fade">  -->
  
  
 <%--   <div class="col-md-5" >
   <b style="color:red">Raw Materials List :</b>
    <table class="table table-bordered">
    <thead>
      <tr class="p-3 mb-2 bg-info text-white">
        <th>Raw Material</th>
        <th>Quantity</th>
       <!--  <th>Product Name</th> -->
        <!-- <th>Product Quantity</th> -->
        <th>Rate</th>
        <th>Amount</th>     
      </tr>
    </thead>
   <!--  select *  from manufacture_order order by mo_id desc limit 1 
   
   select tb.*,(quantity*p_price)cost,(select p_id from manufacture_order where p_id=tb.d1_id)as wc,quantity from  manufacture_order,bom_rawmaterial tb where tb.d1_id=(manufacture_order.p_id='15')
   
   -->
     <%
       try
       {
	    st=con.createStatement();
       // ResultSet rs = st.executeQuery("select tb.*,(quantity*p_price)cost from  manufacture_order,bom_rawmaterial tb where tb.d1_id=manufacture_order.p_id  group by p_id");  
        
       ResultSet rs = st.executeQuery("select tb.*,(tb.quantity*tb.p_price)cost  from bom_rawmaterial tb where d1_id=(select p_id from manufacture_order where mo_id="+id+") and type='R'");
       while(rs.next())
        {
     %>
    
      <tbody>
         <tr>
     <td scope="col">
         <%=rs.getString("product") %>
     </td>

     <td scope="col">
         <%=rs.getString("quantity") %>
     </td>


     <td scope="col">
        <%=rs.getString("p_price") %>
     </td>
     
     <td scope="col">
        <%=rs.getString("cost") %>
     </td>
 <!-- 
 <td>
 </td>
 <td></td> -->
    </tbody> 
      <%
        }

       } 
       catch (Exception e) 
       {
        e.printStackTrace();
       }
    %>
  </table>
   </div> --%>
    <!-- </div> -->
     <!--  </div> -->
     
     
   
</div>
 <div class="modal-footer" id="contact_submit">
   <a href="M_orderForm.jsp"> <input type="button" value="Back" style="background:#204b58;" class="btn btn-info pull-left"  onclick="goBack()"/></a>
 </div>


   </div>
  
  

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

</section>
</form>

 <script type="text/javascript">
    function goBack()
    {
     window.history.back();
    };
 </script>
   
</div>
</body>

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</html>