Current File : /home/obabain/autoclutchess_obaba_in/stockproductreporttt.jsp |
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ include file="Connection.jsp" %>
<%@include file="master.jsp" %>
<% String from=request.getParameter("from");
String to=request.getParameter("to");
String pid=request.getParameter("pid");
Statement st=con.createStatement();
Statement st1=con.createStatement();
Statement st2=con.createStatement();
Statement st5=con.createStatement();
%>
<%-- <%!
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_products1 ");
if(rsRowCnt.next())
{
iTotalRows=rsRowCnt.getInt("cnt");
}
}
else
{
rsRowCnt=st.executeQuery("select count(*)as cnt from ip_products1 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>
<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">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/select/1.3.0/css/select.dataTables.min.css">
<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/buttons/1.5.6/js/dataTables.buttons.min.js'></script>
<script src='https://cdn.datatables.net/buttons/1.5.6/js/buttons.flash.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js'></script>
<script src='https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js'></script>
<script src='https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js'></script>
<script src='https://cdn.datatables.net/select/1.3.0/js/dataTables.select.min.js'></script>
<script >
$(document).ready(function() {
$('#someTable').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy',
'csv',
'excel',
'pdf',
{
extend: 'print',
text: 'Print all (not just selected)',
exportOptions: {
modifier: {
selected: null
}
}
}
],
select: true
} );
} );
</script>
<script>
$(function () {
var $chk = $("#grpChkBox input:checkbox");
var $tbl = $("#someTable");
var $tblhead = $("#someTable th");
$chk.prop('checked', true);
$chk.click(function () {
var colToHide = $tblhead.filter("." + $(this).attr("name"));
var index = $(colToHide).index();
$tbl.find('tr :nth-child(' + (index + 1) + ')').toggle();
});
});
</script>
</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> Stock Report View</h3>
<div class="headerbar-item pull-right" style="margin-top:-23px;">
<a href="stockproductgroup.jsp" class="btn btn-danger" style="width:200px;">Product Group Selection</a>
<a style="background:#204b58" class="btn btn-info" onclick="goBack()">Back</a>
</div>
</div>
</div>
<div id="grpChkBox">
<div style="margin-top:-20px;margin-left:70px;" class="options btn-group pull-right">
<a class="btn btn-success dropdown-toggle fontstyle" data-toggle="dropdown">
Options</a>
<ul class="dropdown-menu">
<li style="margin-left:20px;"><input type="checkbox" name="code">Sl.No</li>
<li style="margin-left:20px;"><input type="checkbox" name="Sname"></li>
<li style="margin-left:20px;"><input type="checkbox" name="person">Product Group</li>
<li style="margin-left:20px;"><input type="checkbox" name="phone">Product Name</li>
<li style="margin-left:20px;"><input type="checkbox" name="email">Opening <br>stock</li>
<li style="margin-left:20px;"><input type="checkbox" name="Stype">Price</li>
<li style="margin-left:20px;"><input type="checkbox" name="address">Value</li>
<li style="margin-left:20px;"><input type="checkbox" name="Region">Inward <br>stock</li>
<li style="margin-left:20px;"><input type="checkbox" name="reffered">Price</li>
<li style="margin-left:20px;"><input type="checkbox" name="oneTime">Value</li>
<!-- <li style="margin-left:20px;"><input type="checkbox" name="code1">Outward <br>stock</li>
<li style="margin-left:20px;"><input type="checkbox" name="Sname1">Price</li>
<li style="margin-left:20px;"><input type="checkbox" name="person1">Value</li>-->
<li style="margin-left:20px;"><input type="checkbox" name="phone1">Issue <br>QTY</li>
<li style="margin-left:20px;"><input type="checkbox" name="email1">Price</li>
<li style="margin-left:20px;"><input type="checkbox" name="Stype1">Value</li>
<li style="margin-left:20px;"><input type="checkbox" name="address1">Closing <br>stock </li>
<li style="margin-left:20px;"><input type="checkbox" name="Region1">Price</li>
<li style="margin-left:20px;"><input type="checkbox" name="reffered1">Value</li>
<!-- <li style="margin-left:20px;"><input type="checkbox" name="oneTime1">Grand Total</li>-->
<li style="margin-left:20px;"><input type="checkbox" name="oneTime2">Unit</li>
</ul></div>
</div>
<div style="overflow-x:auto;width:100%;">
<table id="someTable" class="table table-striped table-bordered">
<thead>
<tr>
<th class="code">Sl.No</th>
<th class="Sname"></th>
<th class="person">Product id</th>
<th class="person">Product Group</th>
<th class="phone">Product Name</th>
<th class="email">Opening <br>stock</th>
<th class="Stype">Price</th>
<th class="address">Value</th>
<th class="Region">Inward <br>stock</th>
<th class="reffered">Price</th>
<th class="oneTime">Value</th>
<!--<th class="code1">Outward <br>stock</th>
<th class="Sname1">Price</th>
<th class="person1">Value</th>-->
<th class="phone1">Issue <br>QTY</th>
<th class="email1">Price</th>
<th class="Stype1">Value</th>
<th class="address1">Closing <br>stock </th>
<th class="Region1">Price</th>
<th class="reffered1">Value</th>
<th class="oneTime2">Unit</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 ,(product_price*opening_stock)stock from ip_products tb where family_id="+pid+" order by product_name asc ");
*/
/*
rs=st.executeQuery("select tb.*,IFNULL((select sum(qty_pur) from ip_stock_register where product_id=tb.product_id and type='open'),0)open1,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='I'),0)issue,IFNULL((select sum(qty_pur) from ip_stock_register where product_id=tb.product_id and type='Q'),0)out1,(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 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,IFNULL((select sum(qty_pur) from ip_stock_register where product_id=tb.product_id),0)cls from ip_products tb where rev_no between '"+from+"' and '"+to+"' and family_id="+pid+"");
*/
rs=st.executeQuery("select tb.*,IFNULL((select sum(qty_pur) from ip_stock_registerr where product_id=tb.product_id and last_updated_date between '2021-04-01' and '2022-03-31' ),0)open,IFNULL((select sum(qty_pur) from ip_stock_registerr where product_id=tb.product_id and type='P' and last_updated_date between '"+from+"' and '"+to+"'),0)inw,IFNULL((select sum(qty_pur*-1) from ip_stock_registerr where product_id=tb.product_id and type='I' and last_updated_date between '"+from+"' and '"+to+"'),0)issue,IFNULL((select sum(qty_pur) from ip_stock_registerr where product_id=tb.product_id and type='Q' and last_updated_date between '"+from+"' and '"+to+"'),0)out1,(select family_name from ip_families1 where family_id=tb.family_id)family,(select unit_name_plrl from ip_units where unit_id=tb.unit_id)unit,(select case when ((select sum(qty_pur)from ip_stock_registerr where product_id=tb.product_id ))<(select product_qua from ip_products1 where product_id=tb.product_id) then '#F9E79F' else 'white' end)bg,(select case when ((select sum(qty_pur)from ip_stock_registerr where product_id=tb.product_id ))<(select product_qua from ip_products1 where product_id=tb.product_id) then 'red' else 'black' end)col,(select case when ((select sum(qty_pur)from ip_stock_registerr where product_id=tb.product_id ))<((select product_qua from ip_products1 where product_id=tb.product_id)) then 'img/red-warning-sign.png' else 'img/images.jpg' end)al,IFNULL((select sum(qty_pur) from ip_stock_registerr where product_id=tb.product_id ),0)cls from ip_products1 tb where family_id='"+pid+"'");
while(rs.next())
{
i+=1;
String open=rs.getString("inwty");
String price1=rs.getString("avgprice");
String outw1=rs.getString("inw");
String issue1=rs.getString("issue");
String avl1=rs.getString("out1");
String op=rs.getString("open");
String cls1=rs.getString("cls");
String mr1=rs.getString("mr1");
String mr2=rs.getString("mr2");
Double subtot=0.0;
Double subtot1=0.0;
Double subtot2=0.0;
Double subtot3=0.0;
Double subtot4=0.0;
Double pavan=0.0;
Double pavan1=0.0;
Double sum=0.0;
subtot=(Double.parseDouble(op)*Double.parseDouble(price1));
subtot1=(Double.parseDouble(outw1)*Double.parseDouble(price1));
subtot2=(Double.parseDouble(issue1)*Double.parseDouble(price1));
subtot3=(Double.parseDouble(avl1)*Double.parseDouble(price1));
subtot4=(Double.parseDouble(cls1)*Double.parseDouble(price1));
// sum=(subtot1+subtot2+subtot3+subtot4);
pavan=(Double.parseDouble(mr1)+Double.parseDouble(outw1)-Double.parseDouble(issue1));
pavan1=(Double.parseDouble(mr2)+subtot1-subtot2);
%>
<tr>
<td><%=i %></td>
<td><img src="<%=rs.getString("al")%>"></td>
<td><%=rs.getString("product_id")%></td>
<td><%=rs.getString("family")%></td>
<td><a href="ViewProduct2.jsp?id=<%= rs.getString("product_id")%>"><%=rs.getString("product_name")%></a></td>
<td><%=rs.getString("open")%></td>
<td> <%=rs.getString("avgprice")%> </td>
<td> <%=subtot%> </td>
<td><%=rs.getString("inw")%></td>
<td> <%=rs.getString("avgprice")%> </td>
<td> <%=subtot1%> </td>
<!--<td><%=rs.getString("out1")%></td>
<td> <%=rs.getString("avgprice")%> </td>
<td> <%=subtot3%> </td>-->
<td><%=rs.getString("issue")%></td>
<td> <%=rs.getString("avgprice")%> </td>
<td> <%=subtot2%> </td>
<td><%=rs.getString("cls")%></td>
<td> <%=rs.getString("avgprice")%> </td>
<td> <%=subtot4%> </td>
<td><%=rs.getString("unit")%> </td>
<% }
}
catch(Exception el){}
%>
</tr>
</tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</div>
</div></div>
<%@include file="footer.jsp" %>
</form>
<script type="text/javascript">
function goBack() {window.history.back();};
</script>
</body>
</html>