Current File : //home/obabain/anms_obaba_in/salesmon.jsp |
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@include file="Connection.jsp" %>
<%!
int yr=0;
int year=0;
int month=0;
%>
<%
Statement st=con.createStatement();
ResultSet rs=null;
rs=st.executeQuery("select MONTH(NOW()) as currmonth");
while(rs.next())
{
month=Integer.parseInt(rs.getString("currmonth"));
}
rs=st.executeQuery("select MONTH(NOW()) as currmonth");
while(rs.next())
{
month=Integer.parseInt(rs.getString("currmonth"));
}
ResultSet ry=st.executeQuery("select YEAR(NOW())as fyear");
while(ry.next())
{
year=Integer.parseInt(ry.getString("fyear"));
}
if(month==01 || month==02 || month==03)
{
yr=year;
year=year-1;
}
else
{
yr=year+1;
}
%>
<!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">
<style>
.doubleUnderline {
text-decoration:underline;
border-bottom: 1px double #000;
}
</style>
<title>Reports</title>
</head>
<body>
<%@include file="master.jsp" %>
<form action="SalesReport.jsp">
<div class="content">
<div class="row" style="width:90%">
<div class="col-md-9" >
<div class="panel panel-default" >
<div class="panel-heading main-color-bg">
<h3 class="panel-title">Total Sales</h3>
</div>
<div class="panel-body">
<%-- <div class="col-md-3">
<select class="form-control">
<option>select year</option>
<%
rs=st.executeQuery("select * from fiscalyear");
while(rs.next())
%>
<option><%=rs.getString("f_year") %></option>
<%} %>
</select>
</div> --%>
<table class="table table-hover">
<thead>
<tr>
<th>Particular</th>
<th></th>
<!-- <th style="text-align:right">Debit</th> -->
<th style="text-align:right">Total Sales Amount</th>
</tr>
</thead>
<tbody>
<%
Double sum=0.00;
Double sum2=0.00;
rs=st.executeQuery("select 'Apr' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='04' and YEAR(IFNULL(invoice_date_created,NOW()))="+year+""
+" UNION select 'May' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='05' and YEAR(IFNULL(invoice_date_created,NOW()))="+year+""
+" UNION select 'Jun' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='06' and YEAR(IFNULL(invoice_date_created,NOW()))="+year+""
+" UNION select 'Jul' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='07' and YEAR(IFNULL(invoice_date_created,NOW()))="+year+""
+" UNION select 'Aug' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='08' and YEAR(IFNULL(invoice_date_created,NOW()))="+year+""
+" UNION select 'Sep' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='09' and YEAR(IFNULL(invoice_date_created,NOW()))="+year+""
+" UNION select 'Oct' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='10' and YEAR(IFNULL(invoice_date_created,NOW()))="+year+""
+" UNION select 'Nov' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='11' and YEAR(IFNULL(invoice_date_created,NOW()))="+year+""
+" UNION select 'Dec' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='12' and YEAR(IFNULL(invoice_date_created,NOW()))="+year+""
+" UNION select 'Jan' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='01' and YEAR(IFNULL(invoice_date_created,NOW()))="+yr+" "
+" UNION select 'Feb' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='02' and YEAR(IFNULL(invoice_date_created,NOW()))="+yr+""
+" UNION select 'Mar' as month ,ROUND(IFNULL(sum(total),0),2) tot from ip_sales_invoice3 where MONTH(IFNULL(invoice_date_created,NOW()))='03' and YEAR(IFNULL(invoice_date_created,NOW()))="+yr+"");
while(rs.next())
{
Double cr=Double.parseDouble(rs.getString("tot"));
int s=(int)(Math.round(cr));
if(s>0)
{
sum=sum+s;
sum2=sum;
}
//else sum=0.0;
%>
<tr>
<td><a href="salesmon.jsp?month=<%=rs.getString("month") %>&yr=<%=year%>"><%=rs.getString("month") %></a></td>
<!-- <td></td> -->
<td></td>
<td align="right"><%=rs.getString("tot") %></td>
</tr>
<%} %>
<%
rs=st.executeQuery("select ROUND(sum(total))tota from ip_sales_invoice3 ");
while(rs.next())
{
%>
<tr>
<td style="border-top:1px solid black;"><b>Grand Total </b></td>
<!-- <td style="border-top:1px solid black;"></td> -->
<td style="border-top:1px solid black;"align="right"></td>
<td align="right" style="border-top:1px solid black;"><span style="border-bottom-style:double; border-width: 2px solid black;"><b><%=rs.getString("tota") %>.00</b></span></td>
</tr>
<%} %>
</tbody>
</table>
<div class="modal-footer" id="contact_submit">
<input type="button" value="Back" style="background:#204b58;" class="pull-left btn btn-info" onclick="goBack()" />
</div>
</div>
</div>
</div>
</div>
</div>
<%@include file="footer.jsp" %>
</form>
</body>
<script type="text/javascript">
function goBack() {
window.history.back();
};
</script>
</html>