Current File : //home/obabain/public_html/abc/PurchaseReg_Month_PDF.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;
     String mnth=null;
     String typ=null;
     String ref_id=null;
     String under=null;
     double i=0;
     double j=0;
     double s=0;
     double su=0;
     String sum=null;
     String sum2=null;
     String i1=null;
     String j1=null;
     String ledgername=null;
     String opbal=null;
     String cr=null;
     String dr=null;
     String addr=null;
     String comp=null;
  	String add1=null;
  	String add2=null;
  	String city=null;
  	String zip=null;
  	String phone=null;
  	String email=null;
  	String web=null;
  	String gst=null;
  	String bankname=null;
  	String acno=null;
  	String ifsc=null;
  	String branch=null;
  	String logo=null;
  	String state=null;
  	String curryear=null;
  	String currdate=null;
     %>
      <%
     Statement st=con.createStatement();
     ResultSet rs=null;
     String loginid=(String)session.getAttribute("logid");
     rs=st.executeQuery("select tb.*,upper(tb.user_company)company from ip_users tb where login_id="+loginid+"");
    while(rs.next())
    {
   		comp=rs.getString("company");
   	   	 add1=rs.getString("user_address_1");
   		 add2=rs.getString("user_address_2");
   		 city=rs.getString("user_city");
   		 zip=rs.getString("user_zip");
   		 state=rs.getString("user_state");
   		 
   		 phone=rs.getString("user_phone");
   		 email=rs.getString("user_email");
   		 web=rs.getString("user_web");
   		 gst=rs.getString("user_vat_id");
   		  bankname=rs.getString("bank_name");
   			 acno=rs.getString("account_no");
   			 ifsc=rs.getString("ifsc");
   			 branch=rs.getString("bank_branch");
   	 
    }
   
     
     
     
     
     String month=request.getParameter("month");
     
     if(month.equals("Jan"))
    	 mnth="January";
     else if(month.equals("Feb"))
    	 mnth="February";
     else if(month.equals("Mar"))
    	 mnth="March";
     else if(month.equals("Apr"))
    	 mnth="April";
     else if(month.equals("May"))
    	 mnth="May";
     else if(month.equals("Jun"))
    	 mnth="June";
     else if(month.equals("Jul"))
    	 mnth="July";
     else if(month.equals("Aug"))
    	 mnth="August";
     else if(month.equals("Sep"))
    	 mnth="September";
     else if(month.equals("Oct"))
    	 mnth="October";
     else if(month.equals("Nov"))
    	 mnth="November";
     else if(month.equals("Dec"))
    	 mnth="December";
     
     yr=Integer.parseInt(request.getParameter("yr"));
     if(yr==0)
     {
    	ResultSet ry=st.executeQuery("select YEAR(NOW())as fyear");
    	while(ry.next())
    	{
    		year=Integer.parseInt(ry.getString("fyear"));
    	}
     }
     else
     {
    	 year=yr;
     } 
     %>
<!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">
<link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/estilos.css" rel="stylesheet">
    
    <link href="css/Mystyle.css" rel="stylesheet">
<style>
/* tbody div{
    overflow:scroll;
    height:350px;
}
.borderless table {
    border-top-style: none;
    border-left-style: none;
    border-right-style: none;
    border-bottom-style: none;
} */
.viewtable>thead>tr>th
{
width:10%;
}

</style>
<title>Insert title here</title>
</head>
<body style="background-color:white;">
<div style="font-size:x-large; width:210mm; text-align:center; font-family:Times New Roman; "><b><%=comp %></b></div> 
<div style=" width:210mm;font-size: medium; text-align:center; font-family:Times New Roman;"><u><b>Purchase Register</b></u></div>
<table class="table">
<thead>
<tr>
<th style="width:10%;">Date</th>
<th style="width:10%;">Particulars</th>
<th style="width:10%;">Vch.No.</th>

<th style="text-align:right;width:10%; padding-right:35px;">Credit</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="6">
 <div class="scrollit">
 <table class="viewtable table-borderless viewtable-hover">
<%
double debittot=0;
double credittot=0;
String deb="0.00";
String cred="0.00";

//rs=st.executeQuery("select tb.*,(select supplier_name from ip_suppliers where supplier_id=tb.supplier_id)suppl from ip_puchase_invoice tb where MONTHNAME(invoice_date_created)='"+mnth+"'limit "+iPageNo+","+iShowRows+"");
if(mnth=="January" || mnth=="February" || mnth=="March")
{
	year=year+1;
}
rs=st.executeQuery("select tb.*,(select supplier_name from ip_suppliers where supplier_id=tb.supplier_id)suppl from ip_puchase_invoice tb where branch_id="+loginid+" and MONTHNAME(invoice_date_created)='"+mnth+"' and YEAR(invoice_date_created)="+year+"");
while(rs.next())
{
	debittot=debittot+Double.parseDouble(rs.getString("total"));
	 deb = String.format("%.2f", debittot);
%>
<tr>
<td>
<%=rs.getString("invoice_date_created") %>
</td>
<td>
<%=rs.getString("suppl") %>
</td>
<td>
<%=rs.getString("purchase_invoice_no") %>
</td>
<td align="right">
<%=rs.getString("total") %>
</td>
</tr>
<%} %>

<%-- <%
  //// calculate next record start record  and end record 
        try{
            if(iTotalRows<(iPageNo+iShowRows))
            {
                iEndResultNo=iTotalRows;
            }
            else
            {
                iEndResultNo=(iPageNo+iShowRows);
            }
            
            iStartResultNo=(iPageNo+1);
            iTotalPages=((int)(Math.ceil((double)iTotalRows/iShowRows)));
         
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
 
%><tr>
<td colspan="5" align="center">
<div>
<%
        //// index of pages 
         
        int i=0;
        int cPage=0;
        
        
        if(iTotalRows!=0)
        {
        cPage=((int)(Math.ceil((double)iEndResultNo/(iTotalSearchRecords*iShowRows))));
         
        int prePageNo=(cPage*iTotalSearchRecords)-((iTotalSearchRecords-1)+iTotalSearchRecords);
        if((cPage*iTotalSearchRecords)-(iTotalSearchRecords)>0)
        {
         %>
          <a href="PurchaseReportMonth_view.jsp?month=<%=mnth %>&iPageNo=<%=prePageNo%>&cPageNo=<%=prePageNo%>"> << Previous</a>
         <%
        }
         
        for(i=((cPage*iTotalSearchRecords)-(iTotalSearchRecords-1));i<=(cPage*iTotalSearchRecords);i++)
        {
          if(i==((iPageNo/iShowRows)+1))
          {
          %>
           <a href="PurchaseReportMonth_view.jsp?month=<%=mnth %>&iPageNo=<%=i%>" style="cursor:pointer;color: red"><b><%=i%></b></a>
          <%
          }
          else if(i<=iTotalPages)
          {
          %>
           <a href="PurchaseReportMonth_view.jsp?month=<%=mnth %>&iPageNo=<%=i%>"><%=i%></a>
          <% 
          }
        }
        if(iTotalPages>iTotalSearchRecords && i<iTotalPages)
        {
         %>
         <a href="PurchaseReportMonth_view.jsp?month=<%=mnth %>&iPageNo=<%=i%>&cPageNo=<%=i%>"> >> Next</a> 
         <%
        }
        }
         
      %>
      <span style="margin-left:50px;"><b>Rows <%=iStartResultNo%> - <%=iEndResultNo%>   Total Result  <%=iTotalRows%> </b></span> --%>
      </table>
      </div>
      </td>
      </tr>
      <tr>
<td colspan="4" align="right" style="padding-right: 15px;"><b><%=deb %></b></td>

</tr>
</tbody>
</table>

</body>

</html>