Current File : //usr/local/tomcat8/work/Catalina/autoclutchess.obaba.in/ROOT/org/apache/jsp/testpdf3_jsp.java |
/*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.0.39
* Generated at: 2023-07-22 09:24:13 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 javax.sql.*;
import java.sql.*;
import java.sql.*;
public final class testpdf3_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
int str;
double sub;
String id=null;
ResultSet rs=null;
String pono=null;
String total=null;
String qno=null;
String podate=null;
String deptch=null;
String not=null;
String paym=null;
String notes=null;
String pfc=null;
String terms=null;
String disamt=null;
String deldate=null;
String disper=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 quote_date=null;
String freight=null;
String branch=null;
ResultSet rcom=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>(1);
_jspx_dependants.put("/Connection.jsp", Long.valueOf(1639226070539L));
}
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.sql");
_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(" \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_auto","obabain_auto","FemZ6PmH!");
out.write("\n");
out.write("</body>\n");
out.write("</html>\n");
out.write("\r\n");
out.write(" ");
Statement ss1=con.createStatement();
rcom=ss1.executeQuery("select * from ip_users");
while(rcom.next())
{
comp=rcom.getString("user_company");
add1=rcom.getString("user_address_1");
add2=rcom.getString("user_address_2");
city=rcom.getString("user_city");
zip=rcom.getString("user_zip");
phone=rcom.getString("user_phone");
email=rcom.getString("user_email");
web=rcom.getString("user_web");
gst=rcom.getString("user_vat_id");
bankname=rcom.getString("bank_name");
acno=rcom.getString("account_no");
ifsc=rcom.getString("ifsc");
branch=rcom.getString("bank_branch");
}
Statement st=con.createStatement();
id=request.getParameter("Id");
rs=st.executeQuery("select * from ip_porders2 where porder_id="+id+"");
while(rs.next())
{
pono=rs.getString("porder_number");
qno=rs.getString("porder_quote_no");
podate=rs.getString("porder_date_created");
deptch=rs.getString("porder_despatch_through");
paym=rs.getString("payment_method");
total=rs.getString("total");
notes=rs.getString("notes");
not=rs.getString("note");
pfc=rs.getString("porder_pfc");
terms=rs.getString("termsofdel");
disamt=rs.getString("porder_discount_amount");
disper=rs.getString("porder_discount_percent");
deldate=rs.getString("deldate");
quote_date=rs.getString("quote_date");
freight=rs.getString("freight");
}
out.write('\r');
out.write('\n');
out.write(' ');
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-Security-Policy\" content=\"frame-ancestors 'none'\">\r\n");
out.write(" <link href=\"css/Mystyle.css\" rel=\"stylesheet\">\r\n");
out.write("<style type=\"text/css\">\r\n");
out.write("footer {\r\n");
out.write(" font-size: 9px;\r\n");
out.write(" width:210mm;\r\n");
out.write(" text-align: left;\r\n");
out.write(" /* border-top:1px solid black; */\r\n");
out.write("}\r\n");
out.write("\r\n");
out.write("@page {\r\n");
out.write(" size: A4;\r\n");
out.write(" margin: 9mm 17mm 17mm 17mm;\r\n");
out.write("}\r\n");
out.write("\r\n");
out.write("@media print {\r\n");
out.write(" footer {\r\n");
out.write(" position: fixed;\r\n");
out.write(" bottom: 0;\r\n");
out.write(" /* border-top:1px solid black; */\r\n");
out.write(" width:210mm;\r\n");
out.write(" text-align:left;\r\n");
out.write(" \r\n");
out.write(" }\r\n");
out.write(" body {\r\n");
out.write(" width: 210mm;\r\n");
out.write(" height: 497mm;\r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write(" }\r\n");
out.write(" </style>\r\n");
out.write("<title></title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
Statement stmt=con.createStatement();
ResultSet rg=stmt.executeQuery("select count(item_id)count from ip_porder_items2 where porder_id="+id+"");
while(rg.next()){
str=Integer.parseInt( rg.getString("count"));
}
out.write("\r\n");
out.write("<div style=\"background-color:white; margin:50px 0px 0px 20px; width:780px; \" align=\"right\">Original Copy For Customer</div>\r\n");
out.write("<div style=\" width:210mm; height:295.2mm; border:1px solid black; padding:0px 5px 50px 0px; font-family:DejaVu Serif Condensed;\">\r\n");
out.write("<table style=\" width:210mm;\">\r\n");
out.write(" <thead><tr><td><div style=\" background-color:#DED9D1; font-size:x-large; width:210mm; text-align:center; font-family:Times New Roman; \"><b>");
out.print(comp );
out.write("</b></div></td></tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td>\r\n");
out.write(" <div style=\" width:210mm;font-size: medium; text-align:center; font-family:Times New Roman; \"><b><u>Purchase Order</u></b></div>\r\n");
out.write(" </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr><td><table style=\"width:210mm; border-bottom:1px solid black; font-size:15px;\" >\r\n");
out.write("<tr>\r\n");
Statement smaster=con.createStatement();
ResultSet rdetails=smaster.executeQuery("select * from ip_users");
while(rdetails.next())
{
out.write("\r\n");
out.write("<td style=\"padding-left:-40px; width:20%;\" valign=\"top\"><img alt=\"\" src=\"");
out.print(rdetails.getString("user_logo"));
out.write("\"><br><br> <b>Doc Ref:ACCPL/PUR/F/03</b>\r\n");
out.write("</td>\r\n");
out.write("\r\n");
}
out.write("\r\n");
out.write("<td style=\" width:70%; \">\r\n");
out.write("<table style=\"width:100%\"><tr>\r\n");
out.write("\r\n");
out.write("<td align=\"left\" style=\"font-family:Times New Roman; \">Order No</td>\r\n");
out.write("<td align=\"left\" style=\"font-family:Times New Roman; \"><b> :ACC/PO/00");
out.print(pono);
out.write("</b></td>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("<td align=\"left\" style=\"padding-left:10px;\" >Quotation No</td>\r\n");
out.write("<td align=\"left\"><b> :");
out.print(qno );
out.write("</b></td>\r\n");
out.write("<td align=\"left\" style=\"font-family:Times New Roman; \">Quotation date</td>\r\n");
out.write("<td align=\"left\" style=\"font-family:Times New Roman; \"><b> :");
out.print(quote_date );
out.write("</b></td>\r\n");
out.write("</tr>\r\n");
out.write("<tr>\r\n");
out.write("<td align=\"left\" style=\"font-family:Times New Roman; \">Order date</td>\r\n");
out.write("<td align=\"left\" style=\"font-family:Times New Roman; \"><b> :");
out.print(podate );
out.write("</b></td>\r\n");
out.write("\r\n");
out.write("<td align=\"left\" style=\"padding-left:10px;\">payment terms</td>\r\n");
Statement s=con.createStatement();
ResultSet r=s.executeQuery("select * from ip_payment_methods where payment_method_id="+paym+"");
while(r.next())
{
out.write("\r\n");
out.write("<td align=\"left\"> :");
out.print(r.getString("payment_method_name") );
out.write("</td>\r\n");
}
out.write("\r\n");
out.write("\r\n");
out.write("<td align=\"left\" style=\"font-family:Times New Roman; \">Freight</td>\r\n");
out.write("<td align=\"left\" style=\"font-family:Times New Roman; \"><b> :");
out.print(freight );
out.write("</b></td>\r\n");
out.write("</tr>\r\n");
out.write("<tr><td align=\"left\">Dispatch through</td>\r\n");
out.write("<td align=\"left\"> :");
out.print(deptch );
out.write("</td>\r\n");
out.write("\t<td align=\"left\" style=\"padding-left:10px;\">Terms of Delivery</td>\r\n");
out.write("\t<td align=\"left\" > :");
out.print(terms );
out.write("</td>\r\n");
out.write("\r\n");
out.write("\t<td align=\"left\">Delivery Date</td>\r\n");
out.write("<td align=\"left\" style=\"font-family:Times New Roman; \"><b> :");
out.print(deldate );
out.write("</b></td>\r\n");
out.write("</tr>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("</table>\r\n");
out.write("</td>\r\n");
out.write("</tr>\r\n");
out.write("</table>\r\n");
out.write("</td>\r\n");
out.write("</tr>\r\n");
out.write("<tr>\r\n");
out.write("<td>\r\n");
out.write("<div><table style=\"width:210mm;\"><tr><td style=\" width:34%;\" valign=\"top\">\r\n");
out.write("<span style=\"font-size:15px;\">\r\n");
out.write("\t\t \r\n");
out.write("\t\t\t\t\t<font style=\"font-family:Times New Roman;\"> <b>CUSTOMER:(Invoice To)</b></font><br>\r\n");
out.write("\t\t\t\t\t<font style=\"font-family:Times New Roman;\"> <b>");
out.print(comp );
out.write("</b></font><br>\r\n");
out.write("\t\t\t\t\t ");
out.print(add1 );
out.write("<br>\r\n");
out.write(" ");
out.print(add2 );
out.print(city );
out.write('-');
out.print(zip );
out.write("<br>\r\n");
out.write("\t\t\t\t\t Ph-No:+91 ");
out.print(phone );
out.write("<br>\r\n");
out.write("\t\t\t\t\t Email: ");
out.print(email );
out.write("<br>\r\n");
out.write("\t\t\t\t\t ");
out.print(web );
out.write("<br>\r\n");
out.write("\t\t\t\t\t State Code:29<br>\r\n");
out.write("\t\t\t\t\t GSTIN :");
out.print(gst );
out.write("\r\n");
out.write("\t\t\t\t\t </span></td>\r\n");
out.write("\t\t\t\t\t <td style=\" width:30%;\" valign=\"top\">\r\n");
out.write("\t\t\t\t\t <span style=\"font-size:15px;\">\r\n");
out.write("\t\t\t\t\t<font style=\"font-family:Times New Roman;\"><b>SHIPPING:(Dispatch To)</b></font><br>\r\n");
out.write("\t\t\t\t\t<font style=\"font-family:Times New Roman;\"><b>");
out.print(comp );
out.write("</b></font><br>\r\n");
out.write("\t\t\t\t\t");
out.print(notes );
out.write("<br>\r\n");
out.write("\t\t\t\t\t");
out.write("\r\n");
out.write("\t\t\t\t\t Ph-No:+91 ");
out.print(phone );
out.write("<br>\r\n");
out.write("\t\t\t\t\t Email: ");
out.print(email );
out.write("<br>\r\n");
out.write("\t\t\t\t\t ");
out.print(web );
out.write("<br>\r\n");
out.write("\t\t\t\t\t State Code:29<br>\r\n");
out.write("\t\t\t\t\t GSTIN :");
out.print(gst );
out.write("\t\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t</span>\r\n");
out.write("\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t<td style=\" width:30%;\" valign=\"top\">\r\n");
out.write("\t\t\t\t\t \r\n");
out.write("\t\t\t\t\t ");
Statement ss=con.createStatement();
ResultSet rr=ss.executeQuery("select * from ip_suppliers tb where supplier_id=(select supplier_id from ip_porders2 where porder_id="+id+")") ;
while(rr.next())
{
out.write("\r\n");
out.write("\t\t\t\t\t \r\n");
out.write(" <span style=\"font-size:15px;\">\r\n");
out.write("\t\t \r\n");
out.write("\t\t\t\t\t<font style=\"font-family:Times New Roman;\"><b>SUPPLIER:</b></font><br>\r\n");
out.write("\t\t\t\t\t <font style=\"font-family:Times New Roman;\"><b>");
out.print(rr.getString("supplier_name") );
out.write("</b><br>\r\n");
out.write("\t\t\t\t\t ");
out.print(rr.getString("supplier_address_1") );
out.write("</font>\r\n");
out.write(" ");
out.write("\r\n");
out.write(" ");
out.print(rr.getString("supplier_city") );
out.write("<br>\r\n");
out.write(" ");
out.print(rr.getString("supplier_state") );
out.write("<br>\r\n");
out.write(" ");
out.print(rr.getString("supplier_zip") );
out.write("<br>\r\n");
out.write("\t\t\t\t\t Ph-No:");
out.print(rr.getString("supplier_phone") );
out.write("<br>\r\n");
out.write("\t\t\t\t\t Email:");
out.print(rr.getString("supplier_email") );
out.write("<br>\t\t\t \r\n");
out.write("\t\t\t\tGSTIN:");
out.print(rr.getString("supplier_vat_id") );
out.write("\r\n");
out.write("\t\t\t\t\r\n");
out.write("\t\t\t\t\t </span>\r\n");
out.write("\t\t\t\t\t ");
}
out.write("\r\n");
out.write("\t\t\t\t\t </td>\r\n");
out.write("\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t</table>\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("\t\t\t\t\t </div>\r\n");
out.write("\t\t\t\t\t\r\n");
out.write("</td>\r\n");
out.write("</tr>\r\n");
out.write(" </thead>\r\n");
out.write(" <tbody>\r\n");
out.write("<tr><td>\r\n");
out.write("<table class=\"pdftable\" style=\"border-top:1px solid black;height:100px; font-size:13px; width:210mm;\">\r\n");
out.write("<thead>\r\n");
out.write("<tr>\r\n");
out.write("<th style=\"text-align:left\">No.</th>\r\n");
out.write("<th style=\"text-align:left\">HSN</th>\r\n");
out.write("<th style=\"text-align:left\">Product Description</th>\r\n");
out.write("<th style=\"text-align:right\">Qty</th>\r\n");
out.write("<th style=\"text-align:right\">UOM</th>\r\n");
out.write("<th style=\"text-align:right\">Price</th>\r\n");
out.write("<th style=\"text-align:right\">Amount</th>\r\n");
out.write("<th style=\"text-align:right\">CGST</th>\r\n");
out.write("<th style=\"text-align:right\">SGST</th>\r\n");
out.write("<th style=\"text-align:right\">IGST</th>\r\n");
out.write("<th style=\"text-align:right\">Total</th>\r\n");
out.write("</tr>\r\n");
out.write("</thead>\r\n");
out.write("<tr>\r\n");
for(int i=1;i<=str;i++){
Statement si=con.createStatement();
ResultSet ri=si.executeQuery("select * from ip_porder_items2 where porder_id="+id+" and item_order="+i+"");
while(ri.next())
{
out.write("\r\n");
out.write("<td>");
out.print(ri.getString("item_order"));
out.write("</td>\r\n");
out.write("<td>");
out.print(ri.getString("item_sku"));
out.write("</td>\r\n");
out.write("<td>\r\n");
out.print(ri.getString("item_name"));
out.write("<br>\r\n");
out.print(ri.getString("item_description"));
out.write("</td>\r\n");
out.write("<td align=\"right\">");
out.print(ri.getString("item_quantity"));
out.write("</td>\r\n");
out.write("<td align=\"right\">");
out.print(ri.getString("item_product_unit"));
out.write("</td>\r\n");
out.write("<td align=\"right\">");
out.print(ri.getString("item_price"));
out.write("</td>\r\n");
out.write("\r\n");
out.write("\r\n");
Statement s5=con.createStatement();
ResultSet r5=s5.executeQuery("select ROUND((item_quantity*item_price),2) amt from ip_porder_items2 where porder_id="+id+" and item_order="+i+"");
while(r5.next())
{
out.write("\r\n");
out.write("\r\n");
out.write("<td align=\"right\">\r\n");
out.print(r5.getString("amt"));
out.write("\r\n");
out.write("\r\n");
out.write("</td>\r\n");
out.write("\r\n");
Statement s2=con.createStatement();
ResultSet r2=s2.executeQuery("select tb.*,(case when tax_rate_name='IGST' then 0 else tax_rate_percent end) as tax_rate from ip_tax_rates tb where tax_rate_id=(select item_tax_rate_id from ip_porder_items2 where porder_id="+id+" and item_order="+i+")");
while(r2.next())
{
out.write("\r\n");
out.write("<td align=\"right\">\r\n");
out.write("\r\n");
out.write("\t(");
out.print(r2.getString("tax_rate") );
out.write("%)<br>\r\n");
out.write("\t");
Double a=Double.parseDouble(r5.getString("amt"));
int sum=(int) Math.round(a);
Double t= Double.parseDouble(r2.getString("tax_rate"));
out.write('\r');
out.write('\n');
out.print(sum*t/100 );
out.write("\r\n");
out.write("</td>\r\n");
}
out.write("\r\n");
out.write("\r\n");
Statement s3=con.createStatement();
ResultSet r3=s3.executeQuery("select tb.*,(case when tax_rate_name='IGST' then 0 else tax_rate_percent end) as tax_rate from ip_tax_rates tb where tax_rate_id=(select item_tax_rate_id from ip_porder_items2 where porder_id="+id+" and item_order="+i+")");
while(r3.next())
{
out.write("\r\n");
out.write("<td align=\"right\">\r\n");
out.write("\t(");
out.print(r3.getString("tax_rate"));
out.write("%)<br>\r\n");
out.write("\t");
Double a=Double.parseDouble(r5.getString("amt"));
int sum=(int) Math.round(a);
Double t=Double.parseDouble(r3.getString("tax_rate"));
out.write('\r');
out.write('\n');
out.print(sum*t/100 );
out.write("\r\n");
out.write("\r\n");
out.write("</td>\r\n");
}
out.write('\r');
out.write('\n');
Statement s4=con.createStatement();
ResultSet r4=s4.executeQuery("select tb.*,(case when tax_rate_name='IGST' then tax_rate_percent else 0 end) as tax_rate from ip_tax_rates tb where tax_rate_id=(select item_tax_rate_id from ip_porder_items2 where porder_id="+id+" and item_order="+i+")");
while(r4.next())
{
sub=Double.parseDouble(ri.getString("item_subtotal"));
out.write("\r\n");
out.write("<td align=\"right\">\r\n");
out.write("\r\n");
out.write("\t(");
out.print(r4.getString("tax_rate") );
out.write("%)<br>\r\n");
out.write("\t");
Double a=Double.parseDouble(r5.getString("amt"));
int sum=(int) Math.round(a);
Double t=Double.parseDouble(r4.getString("tax_rate"));
out.write('\r');
out.write('\n');
out.print(sum*t/100 );
out.write("\r\n");
out.write("\r\n");
out.write("</td>\r\n");
}
out.write("\r\n");
out.write("\r\n");
}
out.write("\r\n");
out.write("<td align=\"right\">");
out.print(ri.getString("item_subtotal"));
out.write("</td>\r\n");
}
out.write("\r\n");
out.write("\r\n");
out.write("</tr>\r\n");
}
out.write("\r\n");
out.write("<tr style=\"font-family:Times New Roman;\">\r\n");
out.write("<td></td>\r\n");
out.write("<td></td>\r\n");
out.write("<td></td>\r\n");
out.write("<td></td>\r\n");
out.write("<td></td>\r\n");
out.write("<td align=\"right\"><b>TOTAL</b></td>\r\n");
Statement smt1=con.createStatement();
ResultSet rmt=smt1.executeQuery("SELECT sum(item_subtotal)insubtot,ROUND(sum(item_quantity*item_price),2)as amttot,ROUND(sum(case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST' then ((item_quantity*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 else 0 end),2)as igst,ROUND(sum(case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST' then 0 else ((item_quantity*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 end),2)as sgst FROM ip_porder_items2 tb where porder_id="+id+"");
while(rmt.next())
{
out.write("\r\n");
out.write("<td align=\"right\"> <b>");
out.print(rmt.getString("amttot") );
out.write("</b></td>\r\n");
out.write("<td align=\"right\"><b>");
out.print(rmt.getString("sgst") );
out.write("</b></td>\r\n");
out.write("<td align=\"right\"><b>");
out.print(rmt.getString("sgst") );
out.write("</b></td>\r\n");
out.write("<td align=\"right\"><b>");
out.print(rmt.getString("igst") );
out.write("</b></td>\r\n");
out.write("<td align=\"right\"><b>");
out.print(rmt.getString("insubtot") );
out.write("</b></td>\r\n");
}
out.write("\r\n");
out.write("</tr>\r\n");
out.write("</table>\r\n");
out.write("</td></tr>\r\n");
out.write("<tr><td>\r\n");
out.write("\r\n");
out.write(" </td></tr>\r\n");
out.write(" <tr><td>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("</tbody>\r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write("</table>\r\n");
out.write("\r\n");
out.write("<footer>\r\n");
out.write("\r\n");
out.write("<table style=\"width:211.5mm; border-top:1px solid black;border-bottom:1px solid black; font-size:15px;\">\r\n");
out.write("<tr>\r\n");
Statement smt=con.createStatement();
ResultSet ra=smt.executeQuery("select sum(item_subtotal)sub from ip_porder_items2 where porder_id="+id+"");
while(ra.next())
{
out.write("\r\n");
out.write("<td align=\"right\" style=\"width:50%;font-family:Times New Roman;\"><b>Subtotal:</b></td><td style=\"width:50%; padding-right:5px;\" align=\"right\"><b>");
out.print(ra.getString("sub"));
out.write("</b>\r\n");
}
out.write("\r\n");
out.write("</td>\r\n");
out.write("</tr>\r\n");
out.write("\r\n");
out.write("<tr>\r\n");
out.write("<td align=\"right\">Discount%:</td><td align=\"right\" style=\"padding-right:5px;\"><b>");
out.print(disper );
out.write("</b></td>\r\n");
out.write("</tr>\r\n");
out.write("\r\n");
out.write("<tr>\r\n");
out.write("<td align=\"right\">Discount Amt:</td><td align=\"right\" style=\"padding-right:5px;\"><b>");
out.print(disamt );
out.write("</b></td>\r\n");
out.write("</tr>\r\n");
out.write("<tr>\r\n");
out.write("<td align=\"right\">Other Charges:</td><td align=\"right\" style=\"padding-right:5px;\"><b>");
out.print(pfc);
out.write("</b></td>\r\n");
out.write("</tr>\r\n");
out.write("<tr><td align=\"right\" style=\"font-family:Times New Roman;\"><b>Grandtotal:</b></td><td align=\"right\" style=\"padding-right:5px;\"><b>");
out.print(total);
out.write("</b></td>\r\n");
out.write("</tr>\r\n");
out.write("</table>\r\n");
out.write("<table style=\"width:212mm; \">\r\n");
out.write("<tr>\r\n");
String ones[]={"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"};
String tens[]={"","Ten","Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninety"};
String hundreds[]={"","Hundred","Thousands","Lakhs","Crores"};
String a=total;
Double n=Double.parseDouble(a);
int number=(int) Math.round(n);
String soFar="";
int len=a.length();
int div=0;
if(len==9)
{
div=number/100000;
soFar=ones[div]+" Lakhs";
number%=100000;
if(number/1000 <20)
{
div=number/1000;
soFar=soFar+" "+ ones[div]+" Thousand";
number%=1000;
if(number>100)
{
div=number/100;
soFar=soFar +" "+ones[div]+ " Hundred ";
number%=100;
if(number>=20)
{
div=number/10;
soFar=soFar+" "+tens[div];
number%=10;
soFar=soFar+" "+ones[number%10];
}
else
{
soFar=soFar+" "+ones[number];
}
}
else
div=number/10;
//soFar=soFar +" "+tens[div]+" "+ ones[number%10];
soFar=soFar +" "+ ones[number%10];
}else{
div=number/10000;
soFar=soFar+" "+tens[div];
number%=10000;
div=number/1000;
soFar=soFar+" "+ ones[div]+ " Thousand";
number%=1000;
div=number/100;
soFar=soFar +" "+ ones[div]+ " Hundred ";
number%=100;
//if(number==0)
div=number/10;
soFar=soFar +" "+ tens[div]+" "+ ones[number%10];
}
}
if(len==8)
{
if(number/1000 <20)
{
div=number/1000;
soFar=ones[div]+" Thousand";
number%=1000;
if(number>100)
{
div=number/100;
soFar=soFar +" "+ones[div]+ " Hundred ";
number%=100;
if(number>20)
{
div=number/10;
soFar=soFar+" "+tens[div];
number%=10;
soFar=soFar+" "+ones[number];
}
}
else{
div=number/10;
soFar=soFar +" "+ tens[div]+" "+ ones[number%10];
}
}
else{
div=number/10000;
soFar=soFar+" "+tens[div];
number%=10000;
div=number/1000;
soFar=soFar+" "+ ones[div]+ " Thousand";
number%=1000;
if(number==0)
{
soFar=soFar+" ";
}
else
{
if(number>100)
{
div=number/100;
soFar=soFar +" "+ ones[div]+ " Hundred ";
number%=100;
//if(number==0)
div=number/10;
soFar=soFar +" "+ tens[div]+" "+ ones[number%10];
}
/*else{
div=number/10;
soFar=soFar +" "+ tens[div]+" "+ ones[number%10];
}*/
}
}
}
String am="";
am=soFar + " Only";
if(len==7)
{
div=number/1000;
soFar=ones[div]+ " Thousand ";
number%=1000;
div=number/100;
soFar=soFar +" "+ ones[div]+ " Hundred ";
number%=100;
//if(number==0)
div=number/10;
soFar=soFar +" "+tens[div]+" "+ ones[number%10];
}
am="";
am=soFar + " Only";
if(len==6){
if (number % 100 < 20){
soFar = ones[number % 100];
number /= 100;
}
else {
soFar = ones[number % 10];
number /= 10;
soFar = tens[number % 10] + soFar;
number /= 10;
}
soFar=ones[number] + " Hundred and " + soFar;
}
am=soFar + " Only";
if(len==5)
{
div=number/10;
if(div >1)
{
soFar=tens[div];
number%=10;
if(number==0)
soFar=soFar + "Only" ;
else
soFar=soFar +" "+ ones[number];
}
else
soFar=ones[number];
}
if(len==4)
soFar=ones[number];
//am= ones[number] + " hundred and" + soFar;am=soFar +" only";
out.write("\r\n");
out.write(" \r\n");
out.write("\r\n");
out.write("<td style=\"padding-left:10px; border-bottom:1px solid black; font-size:15px; font-family:Times New Roman;\"><b>Amount in words:</b>");
out.print(am );
out.write("</td>\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("</tr>\r\n");
out.write("<tr>\r\n");
out.write("<td style=\"padding-left:10px; border-bottom:1px solid black; font-size:15px; font-family:Times New Roman;\"><b>Note:</b>");
out.print(not );
out.write("</td>\r\n");
out.write("</tr>\r\n");
out.write("</table>\r\n");
out.write("<p><b><font size=\"2\" >Declaration</font></b></p>\r\n");
out.write(" <span style=\"font-size:15px;\">1.Goods without valid GST invoice will not be accepted.<br>\r\n");
out.write(" 2.Test certificate must for all suppliers. <br>\r\n");
out.write(" 3.Mention P.O No in invoice.<br>\r\n");
out.write(" 4.All materials should be supplied as per specification.<br>\r\n");
out.write(" 5.Packing should be good and any damages/shortages can not be accepted.<br>\r\n");
out.write(" 6.Radio active contamination not accepted.<br>\r\n");
out.write(" 7.MSDS should be submitted where ever required.\r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write(" </span><br>\r\n");
out.write(" <hr>\r\n");
out.write(" <span style=\"padding-left:10px;font-size:15px;\">Bank Details:");
out.print(bankname );
out.write(": A/C NO:");
out.print(acno );
out.write("; IFSC CODE:");
out.print(ifsc );
out.write("; BRANCH: ");
out.print(branch );
out.write("</span>\r\n");
out.write(" <br>\r\n");
out.write("\r\n");
out.write(" <table style=\"width:211.5mm;font-size:15px;border-top:1px solid black; height:65px;\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td Style=\"padding-left:10px; width:40% \" valign=\"top\">\r\n");
out.write(" <span>Purchase Officer:</span>\r\n");
out.write(" </td>\r\n");
out.write(" <td Style=\"padding-left:10px;width:30% \" valign=\"top\">\r\n");
out.write(" Prepared by:\r\n");
out.write(" </td>\r\n");
out.write(" <td style=\"width:30%; font-family:Times New Roman; \" align=\"right\" valign=\"top\">\r\n");
out.write(" <span><b>For Auto Clutches Casting Pvt.Ltd.</b></span> \r\n");
out.write(" </td> \r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td>\r\n");
out.write(" </td>\r\n");
out.write(" <td>System Generated PO</td>\r\n");
out.write(" \r\n");
out.write(" <td style=\"padding-right:10px;width:30% ;font-family:Times New Roman;\" align=\"right\" valign=\"bottom\"> <br><br><br>\r\n");
out.write(" <br><b>Authorized Signatory</b></td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write("</footer>\r\n");
out.write("</div>\r\n");
out.write("</body>\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);
}
}
}