Current File : /home/obabain/khb_obaba_in/ViewProduct.jsp |
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ include file="Connection.jsp" %>
<%@include file="master.jsp" %>
<%!
public int nullIntconv(String str)
{
int conv=0;
if(str==null)
{
str="0";
}
else if((str.trim()).equals("null"))
{
str="0";
}
else if(str.equals(""))
{
str="0";
}
try{
conv=Integer.parseInt(str);
}
catch(Exception e)
{
}
return conv;
}
%>
<%
Statement st=con.createStatement();
//ResultSet rsPagination = null;
ResultSet rsRowCnt = null;
int iShowRows=10; // Number of records show on per page
int iTotalSearchRecords=10; // Number of pages index shown
int iTotalRows=nullIntconv(request.getParameter("iTotalRows"));
int iTotalPages=nullIntconv(request.getParameter("iTotalPages"));
int iPageNo=nullIntconv(request.getParameter("iPageNo"));
int cPageNo=nullIntconv(request.getParameter("cPageNo"));
String filt=request.getParameter("filter");
if(iPageNo==0)
{
iPageNo=0;
}
else {
iPageNo=Math.abs((iPageNo-1)*iShowRows);
}
int iStartResultNo=0;
int iEndResultNo=0;
if(filt==null)
{
rsRowCnt=st.executeQuery("select count(*)as cnt from ip_products ");
if(rsRowCnt.next())
{
iTotalRows=rsRowCnt.getInt("cnt");
}
}
else
{
rsRowCnt=st.executeQuery("select count(*)as cnt from ip_products where product_name like '%"+filt+"%'");
if(rsRowCnt.next())
{
iTotalRows=rsRowCnt.getInt("cnt");
}
}
%>
<!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://code.jquery.com/jquery-3.3.1.js'></script>
<script src='https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js'></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js" charset="utf-8"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">
<title>Insert title here</title>
<style>
.scrollmenu {
overflow: auto;
white-space: nowrap;
}
</style>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable();
} );
</script>
<form>
<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" style="background: linear-gradient(55deg, #0fb8ad 0%, #1fc8db 40%, #2cb5e8 85%);">
<h3 class="panel-title"><a href="viewproduct_2.jsp">
<span class="glyphicon glyphicon-th"></span>
</a> Products / Inventory View</h3>
<div class="headerbar-item pull-right" style="margin-top:-23px;">
<!-- <a class="btn btn-primary" style="background:#204b58" href="AddProduct2.jsp">Create Casting</a>-->
<a class="btn btn-primary" style="background:#204b58" href="castingView.jsp">Casting Items View</a>
<a style="background:#204b58" class="btn btn-info" onclick="goBack()">Back</a>
<a class="btn btn-primary" style="background:#204b58" href="AddProduct.jsp">New</a>
</div>
</div>
</div>
<div class="scrollmenu">
<table class="table table-bordered" id="example" style="align:center;" >
<thead>
<tr>
<th>Sl.No</th>
<th></th>
<th>Product Group</th>
<!--th>HSN</th-->
<th>Product Name</th>
<!-- <th width=150px;>Specification</th>
-->
<!-- <th>Grade</th> -->
<!--th>Price</th -->
<th>Opening <br>stock</th>
<th>Inward <br>stock</th>
<th>Outward <br>stock</th>
<th>Issue <br>QTY</th>
<th>Closing <br>stock </th>
<th>Unit</th>
<!-- <th>Qty No</th>
<th>Qty Wt</th> -->
<th >Edit</th>
<th>Delete</th>
<!-- <th></th> -->
</tr>
</thead>
<tbody>
<%
try{
ResultSet rs=null;
int i=0;
rs=st.executeQuery("select tb.*,(select sum(qty_pur)*-1 from ip_stock_register where product_id=tb.product_id and type='Q')rej,IFNULL((select sum(qty_pur)*-1 from ip_stock_register where product_id=tb.product_id and type='I'),0)issue,IFNULL((select qty_pur from ip_stock_register where product_id=tb.product_id and type='open'),0)opening,IFNULL((select sum(qty_pur) from ip_stock_register where product_id=tb.product_id and type='P'),0)inw,IFNULL((select sum(qty_pur)*-1 from ip_stock_register where product_id=tb.product_id and type='S'),0)outw,(select case when ((select sum(qty_pur)from ip_stock_register where product_id=tb.product_id ))<(select product_qua from ip_products where product_id=tb.product_id) then '#F9E79F' else 'white' end)bg,(select case when ((select sum(qty_pur)from ip_stock_register where product_id=tb.product_id ))<(select product_qua from ip_products where product_id=tb.product_id) then 'red' else 'black' end)col,(select case when ((select sum(qty_pur)from ip_stock_register where product_id=tb.product_id ))<((select product_qua from ip_products where product_id=tb.product_id)) then 'img/red-warning-sign.png' else 'img/images.jpg' end)al,(select sum(qty_pur) from ip_stock_register where product_id=tb.product_id)avl,(select family_name from ip_families where family_id=tb.family_id)family,(select unit_name_plrl from ip_units where unit_id=tb.unit_id)unit,(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.tax_rate_id)tax_rate from ip_products tb where branch_id="+loginid+" order by product_name asc ");
while(rs.next())
{
i+=1;
%>
<%-- <tr style="color:<%=rs.getString("col")%>; background-color:<%=rs.getString("bg")%>"> --%>
<tr>
<td><%=i %></td>
<td><img src="<%=rs.getString("al")%>"></td>
<td><%=rs.getString("family") %></td>
<!--td><%=rs.getString("product_sku")%></td-->
<td><a href="ViewProduct2.jsp?id=<%= rs.getString("product_id")%>"><%=rs.getString("product_name")%></a></td>
<%-- <td style="width:-50px;"><%=rs.getString("product_description")%></td>
--%>
<%-- <td><%=rs.getString("mat_grade")%></td> --%>
<!--td><%=rs.getString("product_price")%></td -->
<td><%=rs.getString("opening")%></td>
<td><%=rs.getString("inw")%></td>
<td><%=rs.getString("outw")%></td>
<td><%=rs.getString("issue")%></td>
<td style="color:<%=rs.getString("col")%>;"><%=rs.getString("avl") %></td>
<%-- <td> <%=rs.getString("product_qua") %></td> --%>
<td><%=rs.getString("unit")%></td>
<!-- <td></td>
<td></td> -->
<!-- <td> -->
<!-- <div class="options btn-group">
<a class="btn btn-default dropdown-toggle fontstyle" data-toggle="dropdown">
<li class="glyphicon glyphicon-cog"><span class="fontstyle">Options</span></li> -->
<%-- </a>
<ul class="dropdown-menu">
<%if(rs.getString("family_id").equals("2"))
{%>
<li>
<a href="RawMaterial_QplanView.jsp?Id=<%=rs.getString("product_id")%>">
<span class="fontstyle">Raw Material Specification</span>
</a>
</li>
<%}else
{%> --%>
<%-- <li>
<a href="Temparature_view.jsp?Id=<%=rs.getString("product_id")%>">
<span class="fontstyle">Temperature</span>
</a>
</li>
<li>
<a href="mechanicalPview.jsp?Id=<%=rs.getString("product_id")%>">
<span class="fontstyle">Mechanical Property</span>
</a>
</li>
<li>
<a href="chemical_cview.jsp?Id=<%=rs.getString("product_id")%>">
<span class="fontstyle">Chemical Property</span>
</a>
</li>
<li>
<a href="heat_view.jsp?Id=<%=rs.getString("product_id")%>">
<span class="fontstyle">Heat Treatment</span>
</a>
</li> --%>
<%-- <%} %>
</ul>
</div> --%>
<!-- </td> -->
<td> <a href="editProduct.jsp?Id=<%=rs.getString("product_id")%>"> <span class="glyphicon glyphicon-edit"></span></a> </td>
<td> <a href="deleteProduct.jsp?Id=<%=rs.getString("product_id")%>" onclick = "if (! confirm('Continue?')) { return false; }"> <span class="glyphicon glyphicon-remove"></span></a> </td>
<% }
}
catch(Exception el){}
%>
</tr>
</tbody>
</table>
</div>
</div>
</div></div>
<%@include file="footer.jsp" %>
</form>
<script type="text/javascript">
function goBack() {window.history.back();};
</script>
</body>
</html>