Current File : //usr/local/tomcat8/work/Catalina/ms.obaba.in/ROOT/org/apache/jsp/ledgerById_jsp.java |
/*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.0.39
* Generated at: 2022-04-13 05:26:17 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import java.sql.*;
public final class ledgerById_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
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;
ResultSet rsmaster=null;
ResultSet ra=null;
String logo=null;
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(3);
_jspx_dependants.put("/footer.jsp", Long.valueOf(1619265334000L));
_jspx_dependants.put("/Connection.jsp", Long.valueOf(1633514572000L));
_jspx_dependants.put("/master.jsp", Long.valueOf(1635424135000L));
}
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("java.sql");
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = null;
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write(" ");
out.write("\n");
out.write(" \n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
out.write("<html>\n");
out.write("<head>\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");
out.write("\n");
out.write("</head>\n");
out.write("<body>\n");
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/obabain_market","obabain_ms21","Bz$nO8SSt");
out.write("\n");
out.write(" </body>\n");
out.write(" </html>\n");
out.write("\r\n");
out.write(" ");
out.write("\r\n");
out.write(" ");
Statement st=con.createStatement();
ResultSet rs=null;
String id=request.getParameter("Id");
String from=request.getParameter("from");
String to=request.getParameter("to");
rs=st.executeQuery("select tb.*,(CONCAT(UCASE(MID(ledger_name,1,1)),LCASE(MID(ledger_name,2)))) as ledgname from account_ledger tb where l_id="+id+"");
while(rs.next())
{
typ=rs.getString("type");
ledgername=rs.getString("ledgname");
ref_id=rs.getString("ref_id");
under=rs.getString("under");
opbal=rs.getString("opening_bal");
}
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n");
out.write("\r\n");
out.write(" <script src=\"https://code.jquery.com/jquery-1.12.4.js\"></script>\r\n");
out.write("<script src=\"https://code.jquery.com/ui/1.12.1/jquery-ui.js\"></script>\r\n");
out.write("<link href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\" rel=\"stylesheet\">\r\n");
out.write(" <link href=\"css/select2.min.css\" rel=\"stylesheet\">\r\n");
out.write(" <link href=\"css/jquery.datetimepicker.css\" rel=\"stylesheet\">\r\n");
out.write(" \r\n");
out.write(" <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">\r\n");
out.write(" <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\r\n");
out.write(" <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>\r\n");
out.write(" \r\n");
out.write("<style>\r\n");
out.write("tbody div{\r\n");
out.write(" overflow:scroll;\r\n");
out.write(" height:350px;\r\n");
out.write("}\r\n");
out.write(".borderless table {\r\n");
out.write(" border-top-style: none;\r\n");
out.write(" border-left-style: none;\r\n");
out.write(" border-right-style: none;\r\n");
out.write(" border-bottom-style: none;\r\n");
out.write("}\r\n");
out.write(".viewtable>thead>tr>th\r\n");
out.write("{\r\n");
out.write("width:10%;\r\n");
out.write("}\r\n");
out.write("\r\n");
out.write("</style>\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\n");
out.write(" \n");
out.write(" ");
out.write("\n");
out.write(" ");
Class.forName("com.mysql.jdbc.Driver");
Connection con1=DriverManager.getConnection("jdbc:mysql://localhost/obabain_market","obabain_ms21","Bz$nO8SSt");
String loginid=(String)session.getAttribute("logid");
String name=(String)session.getAttribute("uname");
String firstname=(String)session.getAttribute("firstname");
if(name==null || name==""){
response.sendRedirect("index.html");
}
out.write("\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
out.write("<html>\n");
out.write("<head>\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
out.write("<html>\n");
out.write("<head>\n");
out.write("<meta charset=\"utf-8\">\n");
out.write(" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n");
out.write(" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n");
out.write(" <title>Admin | Panel</title>\n");
out.write(" <!-- Bootstrap core CSS --><link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">\n");
out.write(" <link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"img/ico.ico\" />\n");
out.write(" <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\n");
out.write(" <link href=\"css/estilos.css\" rel=\"stylesheet\">\n");
out.write(" <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css\">\n");
out.write("\n");
out.write(" <link href=\"css/Mystyle.css\" rel=\"stylesheet\">\n");
out.write(" <script src=\"http://cdn.ckeditor.com/4.6.1/standard/ckeditor.js\"></script>\n");
out.write(" <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\n");
out.write("<script src=\"js/jscolor.js\"></script>\n");
out.write("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"></script>\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");
out.write("\n");
out.write("\n");
out.write(" \n");
out.write(" <!-- <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\n");
out.write(" <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script> -->\n");
out.write(" \n");
out.write("<style>\n");
out.write("body {\n");
out.write(" font-family: \"Lato\", sans-serif;\n");
out.write("}\n");
out.write("\n");
out.write("/* Fixed sidenav, full height */\n");
out.write(".sidenav {\n");
out.write(" \n");
out.write(" /* position: fixed; */\n");
out.write(" z-index: 1;\n");
out.write(" \n");
out.write(" left: 0;\n");
out.write(" background-color: white;\n");
out.write(" overflow-x: hidden;\n");
out.write(" height:170%;\n");
out.write(" /* padding-top: 10px; */\n");
out.write(" \n");
out.write("}\n");
out.write("\n");
out.write("/* Style the sidenav links and the dropdown button */\n");
out.write(".sidenav a, .dropdown-btn {\n");
out.write(" padding: 6px 8px 6px 16px;\n");
out.write(" text-decoration: none;\n");
out.write(" font-size: 16px;\n");
out.write(" color: #043722;\n");
out.write(" display: block;\n");
out.write(" border: none;\n");
out.write(" background: none;\n");
out.write(" width: 100%;\n");
out.write(" text-align: left;\n");
out.write(" cursor: pointer;\n");
out.write(" outline: none;\n");
out.write(" border-bottom:1px solid #bdc0c788;\n");
out.write(" font-weight:bold;\n");
out.write("}\n");
out.write("\n");
out.write("/* On mouse-over */\n");
out.write(".sidenav a:hover, .dropdown-btn:hover {\n");
out.write(" color: #17724D;\n");
out.write("}\n");
out.write("\n");
out.write("/* Main content */\n");
out.write(".main {\n");
out.write(" margin-left: 200px; /* Same as the width of the sidenav */\n");
out.write(" font-size: 20px; /* Increased text to enable scrolling */\n");
out.write(" padding: 0px 10px;\n");
out.write("}\n");
out.write("\n");
out.write("/* Add an active class to the active dropdown button */\n");
out.write(".active {\n");
out.write(" \n");
out.write(" color: #17724D;\n");
out.write("}\n");
out.write("\n");
out.write("/* Dropdown container (hidden by default). Optional: add a lighter background color and some left padding to change the design of the dropdown content */\n");
out.write(".dropdown-container {\n");
out.write(" display: none;\n");
out.write(" background-color: #009191;\n");
out.write(" \n");
out.write(" padding-left: 8px;\n");
out.write(" \n");
out.write("}\n");
out.write("\n");
out.write("/* Optional: Style the caret down icon */\n");
out.write(".fa-caret-down {\n");
out.write(" float: right;\n");
out.write(" padding-right: 8px;\n");
out.write("}\n");
out.write("\n");
out.write("/* Some media queries for responsiveness */\n");
out.write("@media screen and (max-height: 450px) {\n");
out.write(" .sidenav {padding-top: 15px;}\n");
out.write(" .sidenav a {font-size: 18px;}\n");
out.write("}\n");
out.write("</style>\n");
out.write("\n");
out.write("\n");
out.write("</head>\n");
out.write("<body>\n");
out.write("<nav class=\"navbar navbar-default\">\n");
out.write(" <div class=\"container\">\n");
out.write(" <div class=\"navbar-header\">\n");
out.write(" <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">\n");
out.write(" <span class=\"sr-only\">Toggle navigation</span>\n");
out.write(" <span class=\"icon-bar\"></span>\n");
out.write(" <span class=\"icon-bar\"></span>\n");
out.write(" <span class=\"icon-bar\"></span>\n");
out.write(" </button>\n");
out.write(" <a class=\"navbar-brand\" href=\"#\">Admin</a>\n");
out.write(" </div>\n");
out.write(" <div id=\"navbar\" class=\"collapse navbar-collapse\">\n");
out.write(" <ul class=\"nav navbar-nav\">\n");
out.write(" <li class=\"active\"><a href=\"Dashboard.jsp\">Dashboard</a></li>\n");
out.write(" <li><a href=\"customerNew.jsp\" >Add Customer</a></li>\n");
out.write(" <li><a href=\"supplier.jsp\" >Add Supplier</a></li>\n");
out.write(" <li><a href=\"SalesQuotationMain.jsp\" >Sales Quotation</a></li>\n");
out.write(" <li><a href=\"SalesInvoiceMain.jsp\"> Sales Invoice</a></li>\n");
out.write(" <li><a href=\"InventoryPurchase_Invoiceselection.jsp\">Add Stock</a></li> \n");
out.write(" <li><a href=\"enquiry.jsp\" >Enquiry</a></li>\n");
out.write("\n");
out.write(" </ul>\n");
out.write(" <ul class=\"nav navbar-nav navbar-right\">\n");
out.write(" <li><a href=\"#\">Welcome, ");
out.print(firstname );
out.write(" </a></li>\n");
out.write(" <li><a href=\"logout.jsp\">LogOut</a></li>\n");
out.write(" </ul>\n");
out.write(" </div><!--/.nav-collapse -->\n");
out.write(" </div>\n");
out.write(" </nav>\n");
out.write(" <!--header id=\"header\">\n");
out.write(" <div class=\"container\">\n");
out.write(" <div class=\"row\">\n");
out.write(" <div class=\"col-md-10\">\n");
out.write(" <h1><img alt=\"\" src=\"img/ANMS.png\"> ANMS ERP <small></small></h1>\n");
out.write(" </div>\n");
out.write(" <div class=\"col-md-2\">\n");
out.write(" <div class=\"dropdown crear\">\n");
out.write(" <button class=\"btn btn-info dropdown-toggle\" style=\"background:#009191\" type=\"button\" id=\"dropdownMenu1\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"true\">\n");
out.write(" Settings\n");
out.write(" <span class=\"caret\"></span>\n");
out.write(" </button>\n");
out.write(" <ul class=\"dropdown-menu\" aria-labelledby=\"dropdownMenu1\">\n");
out.write(" \n");
out.write(" <li><a href=\"SystemAdmin.jsp\">System Admin</a></li>\n");
out.write(" <li><a href=\"UserAdmin.jsp\">User Admin</a></li>\n");
out.write(" \n");
out.write(" </ul>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" </div>\n");
out.write(" </header-->\n");
out.write(" \n");
out.write(" \n");
out.write(" <div class=\"col-xs-2\" >\n");
out.write("<div class=\"sidenav \" >\n");
out.write("<button class=\"dropdown-btn \" style=\"background-color:#009191;color:white; \"><span class=\"glyphicon glyphicon-cog\"></span>Dashboard</button>\n");
out.write(" ");
Statement stmaster=con1.createStatement();
ResultSet rsmaster=stmaster.executeQuery("select * from ip_menu_creation where menu_parent_id=0 and status=0 order by sortorder asc");
while(rsmaster.next())
{
out.write("\n");
out.write(" <button class=\"dropdown-btn\" style=\"background-color:#3CB371;color:white;\"> <span class=\"glyphicon glyphicon-forward\" ></span> ");
out.print(rsmaster.getString("menu_name") );
out.write("\n");
out.write(" \n");
out.write(" </button>\n");
out.write(" \n");
out.write(" \n");
out.write(" \n");
out.write("<div class=\"dropdown-container\" style=\"background-color:#eae9e9;\">\n");
out.write(" ");
Statement stmt=con1.createStatement();
ResultSet ra=stmt.executeQuery("select * from ip_menu_creation where menu_parent_id="+rsmaster.getString("id")+" and status=0 order by sortorder asc");
while(ra.next())
{
out.write(" \n");
out.write(" <a href=\"");
out.print(ra.getString("redirection_page") );
out.write("\"style=\"margin-left:-12px;\">");
out.print(ra.getString("menu_name") );
out.write("</a>\n");
out.write(" ");
}
out.write("\n");
out.write("</div>\n");
}
out.write("\n");
out.write("\n");
out.write("</div>\n");
out.write("</div>\n");
out.write("</body>\n");
out.write("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js\"></script>\n");
out.write(" <script src=\"js/bootstrap.min.js\"></script>\t\n");
out.write("<script>\n");
out.write("/* Loop through all dropdown buttons to toggle between hiding and showing its dropdown content - This allows the user to have multiple dropdowns without any conflict */\n");
out.write("var dropdown = document.getElementsByClassName(\"dropdown-btn\");\n");
out.write("var i;\n");
out.write("\n");
out.write("for (i = 0; i < dropdown.length; i++) {\n");
out.write(" dropdown[i].addEventListener(\"click\", function() {\n");
out.write(" this.classList.toggle(\"active\");\n");
out.write(" \n");
out.write(" var dropdownContent = this.nextElementSibling;\n");
out.write(" if (dropdownContent.style.display === \"block\") {\n");
out.write(" dropdownContent.style.display = \"none\";\n");
out.write(" } else {\n");
out.write(" dropdownContent.style.display = \"block\";\n");
out.write(" }\n");
out.write(" return false;\n");
out.write(" });\n");
out.write("}\n");
out.write("</script>\n");
out.write("</html>\n");
out.write("\r\n");
out.write("<form action=\"ledgerByIdDA.jsp\">\r\n");
out.write("\r\n");
out.write("<div class=\"content\">\r\n");
out.write(" <div class=\"row\">\r\n");
out.write(" <div class=\"col-md-9\" >\r\n");
out.write(" <div class=\"panel panel-default\" >\r\n");
out.write(" <div class=\"panel-heading main-color-bg\">\r\n");
out.write(" <h3 class=\"panel-title\">Ledger Vouchers</h3>\r\n");
out.write(" </div>\r\n");
out.write(" \r\n");
out.write("<div class=\"panel-body\">\r\n");
out.write("<input type=\"hidden\" value=\"");
out.print(id );
out.write("\" name=\"Id\">\r\n");
out.write("<div class=\"headerbar-item pull-right\" style=\"margin-top:10px;\"><a class=\"btn btn-info\" style=\"background:#204b58\" onclick=\"goBack()\">Back</a>\r\n");
out.write("<a class=\"btn btn-info\" href=\"ledgerByIdpdfFrame.jsp?Id=");
out.print(id );
out.write("&from=");
out.print(from );
out.write("&to=");
out.print(to );
out.write("\" style=\"background:#204b58\" >Print</a>\r\n");
out.write("<a class=\"btn btn-info\" style=\"background:#204b58\" data-toggle=\"modal\" data-target=\"#myModalledg\">Period</a>\r\n");
out.write("</div>\r\n");
out.write("<div class=\"row\">\r\n");
out.write("<!-- <div class=\"form-group col-xs-2\">From date<input type=\"text\" class=\"form-control\" id=\"datetimepicker\"></div><div class=\"form-group col-xs-2\"> To date<input type=\"text\" id=\"datetimepicker2\" class=\"form-control\"></div> -->\r\n");
out.write("<div class=\"form-group col-xs-4\"><span style=\" font-size:large; margin-left:20px;\"><b>");
out.print(ledgername );
out.write("</b></span></div>\r\n");
out.write("</div>\r\n");
out.write("<table class=\"table\">\r\n");
out.write("<thead>\r\n");
out.write("<tr>\r\n");
out.write("<th style=\"width:150px;\">Date</th>\r\n");
out.write("<th style=\"width:150px;\">Vch.No.</th>\r\n");
out.write("<th style=\"width:150px;\">Particular</th>\r\n");
out.write("<th style=\"width:140px;\">Vch.Type</th>\r\n");
out.write("<th style=\"width:170px; text-align:right;\">Debit</th>\r\n");
out.write("<th style=\"width:170px; text-align:right; padding-right:30px;\">Credit</th>\r\n");
out.write("</tr>\r\n");
out.write("</thead>\r\n");
out.write("\r\n");
out.write("<tbody>\r\n");
out.write("<tr>\r\n");
out.write("<td colspan=\"6\">\r\n");
out.write(" <div class=\"scrollit\">\r\n");
out.write(" <table class=\"viewtable table-borderless viewtable-hover\">\r\n");
out.write(" \r\n");
out.write("\r\n");
if(typ.equals("2"))
{
rs=st.executeQuery("select (select ledger_name from account_ledger where l_id=account_voucher_main.account)parti, voucher_id,voucher_type, voucher_no,voucher_date,(case when cash_cheque='cash' then 'Payment' else 'Cheque Payment' end) as vtype,credit_amt as debit,0 as credit from account_voucher_main where particular="+id+" and voucher_type='payment' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=account_voucher_main.account)parti, voucher_id,voucher_type, voucher_no,voucher_date,'Receipt' as vtype,0,credit_amt from account_voucher_main where particular="+id+" and voucher_type='receipt' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select 'Purchase' as parti, pinvoice_id,'purchase' as voucher_type, purchase_invoice_no,invoice_date_created,'Purchase' as vtype,0,total from ip_puchase_invoice2 where supplier_id="+ref_id+" and invoice_date_created between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=account_voucher_sub.particular)parti ,voucher_id,voucher_type,(select voucher_no from account_voucher_main where voucher_id=account_voucher_sub.voucher_id) as voucher_no,voucher_date,(case when voucher_type='payment' then 'Payment' else 'Receipt' end) as voucher_type,(case when voucher_type='payment' then debit_amt else 0 end)as debit,(case when voucher_type='receipt' then debit_amt else 0 end)as credit from account_voucher_sub where bill_no="+id+" and type='O' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=tb.particulars)parti,tb.ref_no,'journal',tb.journal_no,created_date,'Journal',0 as debit,(select credit from journalentry where type=2 and ref_no=tb.ref_no)credit from journalentry tb where ref_no in (select ref_no from journalentry where particulars="+id+" and type=2 ) and type <>2 and created_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=debit_note.purchase_ledger)parti,voucher_id,'debitnote' as voucher_type,voucher_no,voucher_date,'DebitNote' as vtype ,0 as debit,total as credit from debit_note where supplier="+ref_id+" and voucher_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=tb.particulars)parti,tb.ref_no,'journal',tb.journal_no,created_date,'Journal',(select debit from journalentry where type=1 and ref_no=tb.ref_no)debit,0 as credit from journalentry tb where ref_no in (select ref_no from journalentry where particulars="+id+" and type=1 ) and type <>1 and created_date between '"+from+"' and '"+to+"' order by voucher_date desc");
}
else if(typ.equals("3"))
{
rs=st.executeQuery("select (select ledger_name from account_ledger where l_id=account_voucher_main.account)parti, voucher_id,voucher_type, voucher_no,voucher_date,(case when cash_cheque='cash' then 'Payment' else 'Cheque Payment' end) as vtype,credit_amt as debit,0 as credit from account_voucher_main where particular="+id+" and voucher_type='payment' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=account_voucher_main.account)parti, voucher_id,voucher_type, voucher_no,voucher_date,'Receipt' as vtype,0,credit_amt from account_voucher_main where particular="+id+" and voucher_type='receipt' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select 'Sales' as parti, sinvoice_id,'sales' as voucher_type, sales_invoice_no,invoice_date_created,'Sales' as vtype,total,0 from ip_sales_invoice2 where supplier_id="+ref_id+" and invoice_date_created between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=account_voucher_sub.particular)parti ,voucher_id,voucher_type,(select voucher_no from account_voucher_main where voucher_id=account_voucher_sub.voucher_id) as voucher_no,voucher_date,(case when voucher_type='payment' then 'Payment' else 'Receipt' end) as voucher_type,(case when voucher_type='payment' then debit_amt else 0 end)as debit,(case when voucher_type='receipt' then debit_amt else 0 end)as credit from account_voucher_sub where bill_no="+id+" and type='O' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=tb.particulars)parti,tb.ref_no,'journal',tb.journal_no,created_date,'Journal',0 as debit,(select credit from journalentry where type=2 and ref_no=tb.ref_no)credit from journalentry tb where ref_no in (select ref_no from journalentry where particulars="+id+" and type=2 ) and type <>2 and created_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=tb.particulars)parti,tb.ref_no,'journal',tb.journal_no,created_date,'Journal',(select debit from journalentry where type=1 and ref_no=tb.ref_no)debit,0 as credit from journalentry tb where ref_no in (select ref_no from journalentry where particulars="+id+" and type=1 ) and type <>1 and created_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=credit_note.purchase_ledger)parti,voucher_id,'creditnote' as voucher_type,voucher_no,voucher_date,'CreditNote' as vtype ,total as debit,0 as credit from credit_note where supplier="+ref_id+" and voucher_date between '"+from+"' and '"+to+"' order by voucher_date desc");
}
else if(typ.equals("0") && under.equals("26"))
{
rs=st.executeQuery(" select (select ledger_name from account_ledger where l_id=account_voucher_main.account)parti, voucher_id,voucher_type, voucher_no,voucher_date,'Receipt' as vtype,0 as debit,credit_amt as credit from account_voucher_main where particular="+id+" and voucher_type='receipt' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=account_voucher_main.account)parti, voucher_id,voucher_type, voucher_no,voucher_date,(case when cash_cheque='cash' then 'Payment' else 'Cheque Payment' end) as vtype,credit_amt as debit,0 as credit from account_voucher_main where particular="+id+" and voucher_type='payment' and voucher_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=account_voucher_sub.particular)parti ,voucher_id,voucher_type,(select voucher_no from account_voucher_main where voucher_id=account_voucher_sub.voucher_id) as voucher_no,voucher_date,(case when voucher_type='payment' then 'Payment' else 'Receipt' end) as voucher_type,(case when voucher_type='payment' then debit_amt else 0 end)as debit,(case when voucher_type='receipt' then debit_amt else 0 end)as credit from account_voucher_sub where bill_no="+id+" and type='O' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=tb.particulars)parti,tb.ref_no,'journal',tb.journal_no,created_date,'Journal',0 as debit,(select credit from journalentry where type=2 and ref_no=tb.ref_no)credit from journalentry tb where ref_no in (select ref_no from journalentry where particulars="+id+" and type=2 ) and type <>2 and created_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=account_voucher_sub.particular)parti ,voucher_id,voucher_type,(select voucher_no from account_voucher_main where voucher_id=account_voucher_sub.voucher_id) as voucher_no,voucher_date,(case when voucher_type='payment' then 'Payment' else 'Receipt' end) as voucher_type,(case when voucher_type='payment' then debit_amt else 0 end)as debit,(case when voucher_type='receipt' then debit_amt else 0 end)as credit from account_voucher_sub where bill_no="+id+" and type='O' and voucher_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=tb.particulars)parti,tb.ref_no,'journal',tb.journal_no,created_date,'Journal',(select debit from journalentry where type=1 and ref_no=tb.ref_no)debit,0 as credit from journalentry tb where ref_no in (select ref_no from journalentry where particulars="+id+" and type=1 ) and type <>1 and created_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=credit_note.purchase_ledger)parti,voucher_id,'creditnote' as voucher_type,voucher_no,voucher_date,'CreditNote' as vtype ,total as debit,0 as credit from credit_note where supplier="+ref_id+" and voucher_date between '"+from+"' and '"+to+"' order by voucher_date desc");
}
else if(under.equals("15") || under.equals("16") || under.equals("17"))
{
rs=st.executeQuery("select (select ledger_name from account_ledger where l_id=account_voucher_main.particular)parti, voucher_id,voucher_type, voucher_no,voucher_date,(case when cash_cheque='cash' then 'Payment' else 'Cheque Payment' end) as vtype,0 as debit,credit_amt as credit from account_voucher_main where account="+id+" and voucher_type='payment' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=account_voucher_main.particular)parti, voucher_id,voucher_type, voucher_no,voucher_date,'Receipt' as vtype,credit_amt,0 from account_voucher_main where account="+id+" and voucher_type='receipt' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=contra_voucher.particular)parti,v_id,voucher_type,voucher_no,voucher_date,'Contra' as vtype,amount,0 from contra_voucher where account="+id+" and voucher_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=contra_voucher.account)parti,v_id,voucher_type,voucher_no,voucher_date,'Contra' as vtype,0,amount from contra_voucher where particular="+id+" and voucher_date between '"+from+"' and '"+to+"' order by voucher_date desc");
/* +" union"
+" select (select ledger_name from account_ledger where l_id=account_voucher_sub.bill_no)parti ,voucher_id,voucher_type,(select voucher_no from account_voucher_main where voucher_id=account_voucher_sub.voucher_id) as voucher_no,voucher_date,(case when voucher_type='payment' then 'Payment' else 'Receipt' end) as voucher_type,(case when voucher_type='payment' then debit_amt else 0 end)as debit,(case when voucher_type='receipt' then debit_amt else 0 end)as credit from account_voucher_sub where bill_no="+id+" and type='O'");
*/
}
else /* if(typ.equals("1")) */
{
rs=st.executeQuery("select (select ledger_name from account_ledger where l_id=tb.particulars)parti,tb.ref_no as voucher_id,'journal' as voucher_type ,tb.journal_no as voucher_no,created_date as voucher_date ,'Journal' as vtype,0 as debit,(select credit from journalentry where type=2 and ref_no=tb.ref_no)credit from journalentry tb where ref_no in (select ref_no from journalentry where particulars="+id+" and type=2 ) and type <>2 and created_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=tb.particulars)parti,tb.ref_no as voucher_id,'journal' as voucher_type ,tb.journal_no as voucher_no,created_date as voucher_date,'Journal' as vtype,(select debit from journalentry where type=1 and ref_no=tb.ref_no)debit,0 as credit from journalentry tb where ref_no in (select ref_no from journalentry where particulars="+id+" and type=1 ) and type <>1 and created_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select ledger_name from account_ledger where l_id=account_voucher_sub.particular)parti ,voucher_id,voucher_type,(select voucher_no from account_voucher_main where voucher_id=account_voucher_sub.voucher_id) as voucher_no,voucher_date,(case when voucher_type='payment' then 'Payment' else 'Receipt' end) as voucher_type,(case when voucher_type='payment' then debit_amt else 0 end)as debit,(case when voucher_type='receipt' then debit_amt else 0 end)as credit from account_voucher_sub where bill_no="+id+" and type='O' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=account_voucher_main.account)parti, voucher_id,voucher_type, voucher_no,voucher_date,(case when cash_cheque='cash' then 'Payment' else 'Cheque Payment' end) as vtype,credit_amt as debit,0 as credit from account_voucher_main where particular="+id+" and voucher_type='payment' and voucher_date between '"+from+"' and '"+to+"'"
+" union"
+" select (select ledger_name from account_ledger where l_id=account_voucher_main.account)parti, voucher_id,voucher_type, voucher_no,voucher_date,'Receipt' as vtype,0,credit_amt from account_voucher_main where particular="+id+" and voucher_type='receipt' and voucher_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select supplier_name from ip_suppliers where supplier_id=debit_note.supplier)parti,voucher_id,'debitnote' as voucher_type,voucher_no,voucher_date,'DebitNote' as vtype ,total as debit,0 as credit from debit_note where purchase_ledger="+id+" and voucher_date between '"+from+"' and '"+to+"'"
+" union "
+" select (select client_name from ip_clients where client_id=credit_note.supplier)parti,voucher_id,'creditnote' as voucher_type,voucher_no,voucher_date,'CreditNote' as vtype ,0 as debit,total as credit from credit_note where purchase_ledger="+id+" and voucher_date between '"+from+"' and '"+to+"' order by voucher_date desc");
}
i=0;
j=0;
while(rs.next())
{
i=i+Double.parseDouble(rs.getString("credit"));
j=j+Double.parseDouble(rs.getString("debit"));
i1=String.format("%.2f", i);
j1=String.format("%.2f", j);
out.write("\r\n");
out.write("\r\n");
out.write("<tr>\r\n");
out.write("<td style=\"width:150px;\">");
out.print(rs.getString("voucher_date") );
out.write("</td>\r\n");
out.write("<td style=\"width:150px;\"><a href=\"editVouchLedgerwise.jsp?Id=");
out.print(rs.getString("voucher_id") );
out.write("&type=");
out.print(rs.getString("voucher_type") );
out.write('"');
out.write('>');
out.print(rs.getString("voucher_no") );
out.write("</a></td>\r\n");
out.write("<td style=\"width:150px;\">");
out.print(rs.getString("parti") );
out.write("</td>\r\n");
out.write("<td style=\"width:150px;\">");
out.print(rs.getString("vtype") );
out.write("</td>\r\n");
out.write("<td style=\"width:150px;\" align=\"right\">");
out.print(rs.getString("debit") );
out.write("</td>\r\n");
out.write("<td style=\"width:150px;\" align=\"right\">");
out.print(rs.getString("credit") );
out.write("</td>\r\n");
out.write("</tr>\r\n");
}
out.write("\r\n");
out.write("</table>\r\n");
out.write("</div>\r\n");
out.write("</td>\r\n");
out.write("</tr>\r\n");
out.write("</tbody>\r\n");
out.write("<tfoot>\r\n");
rs=st.executeQuery("select * from account_ledger where l_id="+id+"");
while(rs.next())
{
String opbaltype=rs.getString("dr_cr");
if(opbaltype.equals("C"))
{
cr=opbal;
dr="0.00";
}
else
{
dr=opbal;
cr="0.00";
}
}
out.write("\r\n");
out.write("<tr>\r\n");
out.write(" <td colspan=\"4\" align=\"right\" >Opening Balance: </td>\r\n");
out.write(" <td align=\"right\" style=\"padding-right:0px;\"> <span ><b>");
out.print(dr );
out.write("</b></span></td>\r\n");
out.write(" <td align=\"right\" style=\"padding-right:30px;\"><span ><b>");
out.print(cr );
out.write("</b></span></td>\r\n");
out.write(" \r\n");
out.write("\r\n");
out.write("</tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td colspan=\"4\" align=\"right\" >Current Balance: </td>\r\n");
out.write(" <td align=\"right\" style=\"padding-right:0px;\"> <span ><b>");
out.print(j1 );
out.write("</b></span></td>\r\n");
out.write(" <td align=\"right\" style=\"padding-right:30px;\"><span ><b>");
out.print(i1 );
out.write("</b></span></td>\r\n");
out.write(" \r\n");
out.write(" </tr>\r\n");
out.write(" ");
if(i>j)
{
s=Double.parseDouble(cr)+i-(j+Double.parseDouble(dr));
sum = String.format("%.2f", s);
sum2="";
}
else
{
su=Double.parseDouble(dr)+j-(i+Double.parseDouble(cr));
sum2 = String.format("%.2f", su);
sum="";
}
out.write("\r\n");
out.write(" <tr>\r\n");
out.write(" <td colspan=\"4\" align=\"right\" >Closing Balance: </td>\r\n");
out.write(" <td align=\"right\" style=\"padding-right:0px;\"><b>");
out.print(sum2 );
out.write("</b> </td>\r\n");
out.write(" <td align=\"right\" style=\"padding-right:30px;\"><b>");
out.print(sum );
out.write("</b> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" \r\n");
out.write(" </tfoot>\r\n");
out.write("</table>\r\n");
out.write("</div>\r\n");
out.write("<div class=\"modal fade\" id=\"myModalledg\" role=\"dialog\" >\r\n");
out.write(" <div class=\"modal-dialog modal-lg\">\r\n");
out.write(" <div class=\"modal-content\">\r\n");
out.write(" <div class=\"modal-header\">\r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write(" <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×</button>\r\n");
out.write(" \r\n");
out.write(" </div>\r\n");
out.write(" <div class=\"modal-body\">\r\n");
out.write(" <div class=\"panel-body\">\r\n");
out.write(" <div>\r\n");
out.write(" <div class=\"row\">\r\n");
out.write(" \t <div class=\"col-xs-6\">\r\n");
out.write(" \t From\r\n");
out.write(" <input type=\"date\" class=\"form-control\" name=\"fromdate\">\r\n");
out.write(" </div>\r\n");
out.write(" <div class=\"col-xs-6\">\r\n");
out.write(" To\r\n");
out.write(" <input type=\"date\" class=\"form-control\" name=\"todate\">\r\n");
out.write(" </div>\r\n");
out.write(" </div>\r\n");
out.write(" \r\n");
out.write(" </div>\r\n");
out.write("\r\n");
out.write(" \r\n");
out.write("</div>\r\n");
out.write(" </div>\r\n");
out.write(" <div class=\"modal-footer\">\r\n");
out.write(" <input type=\"submit\" value=\"Search\" class=\"btn btn-primary\"> \r\n");
out.write(" <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>\r\n");
out.write(" </div>\r\n");
out.write(" </div>\r\n");
out.write(" </div>\r\n");
out.write(" </div>\r\n");
out.write("</div>\r\n");
out.write("</div>\r\n");
out.write("</div>\r\n");
out.write("</div>\r\n");
out.write("\r\n");
out.write("</form>\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write(" <meta charset=\"utf-8\">\r\n");
out.write(" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n");
out.write(" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\r\n");
out.write(" <title>Admin | Panel</title>\r\n");
out.write(" <!-- Bootstrap core CSS -->\r\n");
out.write(" <link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"img/ico.ico\" />\r\n");
out.write(" <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\r\n");
out.write(" <link href=\"css/estilos.css\" rel=\"stylesheet\">\r\n");
out.write(" <script src=\"http://cdn.ckeditor.com/4.6.1/standard/ckeditor.js\"></script>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write(" <footer id=\"footer\">\r\n");
out.write(" <p>Copyright Obaba, © 2017</p>\r\n");
out.write(" </footer>\r\n");
out.write("\r\n");
out.write("</body>");
out.write("\r\n");
out.write("\r\n");
out.write("<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js\"></script>\r\n");
out.write(" <!-- Include all compiled plugins (below), or include individual files as needed -->\r\n");
out.write(" <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\"></script>\r\n");
out.write(" <script src=\"js/select2.min.js\"></script>\r\n");
out.write(" <script src=\"js/jquery.datetimepicker.full.js\"></script>\r\n");
out.write(" \r\n");
out.write(" <script>\r\n");
out.write(" $('select').select2();\r\n");
out.write(" </script>\r\n");
out.write(" <script>\r\n");
out.write(" jQuery('#datetimepicker').datetimepicker({\r\n");
out.write(" \t timepicker:false,\r\n");
out.write(" \t todayBtn: \"linked\"\r\n");
out.write(" \t //mask:true, // '9999/19/39 29:59' - digit is the maximum possible for a cell\r\n");
out.write(" \t});\r\n");
out.write(" \r\n");
out.write(" jQuery('#datetimepicker2').datetimepicker({\r\n");
out.write(" \t timepicker:false,\r\n");
out.write(" \t todayBtn: \"linked\"\r\n");
out.write(" \t //mask:true, // '9999/19/39 29:59' - digit is the maximum possible for a cell\r\n");
out.write(" \t});\r\n");
out.write(" </script>\r\n");
out.write("</body>\r\n");
out.write("<script type=\"text/javascript\">\r\n");
out.write("function goBack() {\r\n");
out.write(" window.history.back(); \r\n");
out.write("}; \r\n");
out.write("\r\n");
out.write("</script>\r\n");
out.write("\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}