Current File : //home/obabain/autoclutchess_obaba_in/ReceiptsMonthwise.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;
     
     %>
<!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>
<form action="SalesReport.jsp">
<%@include file="master.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">Receipts</h3>
    </div>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th>Particular</th>
<!-- <th style="text-align:right">Debit</th> -->
<th style="text-align:right">Amount</th>
<th style="text-align:right">Closing Balance</th>
</tr>
</thead>
<tbody>
<%
Double sum=0.00;
Double sum2=0.00;
rs=st.executeQuery("select 'Jan' as month ,ROUND(IFNULL(sum(debit),0),2)  tot  from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and  MONTH(date)='01' and (voucher_type='receipt' or voucher_type='bankrec')"
		
+"UNION select 'Feb' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='02' and (voucher_type='receipt' or voucher_type='bankrec')"
		 
+"UNION select 'Mar' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='03' and (voucher_type='receipt' or voucher_type='bankrec')"
		
+"UNION	select 'Apr' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='04' and (voucher_type='receipt' or voucher_type='bankrec')"
		
	+"UNION	select 'May' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='05' and (voucher_type='receipt' or voucher_type='bankrec')"
		
	+"UNION	select 'Jun' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='06' and (voucher_type='receipt' or voucher_type='bankrec')"
		
		+"UNION select 'Jul' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='07' and (voucher_type='receipt' or voucher_type='bankrec')"
		
		+"UNION select 'Aug' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='08' and (voucher_type='receipt' or voucher_type='bankrec')"
		
		+"UNION select 'Sep' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='09' and (voucher_type='receipt' or voucher_type='bankrec')"
		
		+"UNION select 'Oct' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='10' and (voucher_type='receipt' or voucher_type='bankrec')"
		
		+"UNION select 'Nov' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='11' and (voucher_type='receipt' or voucher_type='bankrec')"
		
		+"UNION select 'Dec' as month ,ROUND(IFNULL(sum(debit),0),2)  tot from account_vouchers where YEAR(IFNULL(date,NOW()))=(select YEAR(NOW()) ) and MONTH(date)='12' and (voucher_type='receipt' or voucher_type='bankrec')");
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><%=rs.getString("month") %></td>
<!-- <td></td> -->
<td align="right"><%=rs.getString("tot") %></td>
<td align="right"><%=sum %></td>
</tr>
<%} %>
<%
rs=st.executeQuery("select ROUND(sum(debit))tota from account_vouchers where  voucher_type='receipt' or voucher_type='bankrec' ");
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 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>
<td align="right" style="border-top:1px solid black;"><span style="border-bottom-style:double; border-width: 2px solid black;"><b><%=rs.getString("tota") %>.0</b></span></td>
</tr>
<%} %>
</tbody>
</table>
</div>

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

 <%@include file="footer.jsp" %>
</form>
</body>
<script type="text/javascript">
function goBack() {
    window.history.back(); 
};
</script>
</html>