KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openbravo > erpReports > RptC_Order


1 /*
2  *************************************************************************
3  * The contents of this file are subject to the Openbravo Public License
4  * Version 1.0 (the "License"), being the Mozilla Public License
5  * Version 1.1 with a permitted attribution clause; you may not use this
6  * file except in compliance with the License. You may obtain a copy of
7  * the License at http://www.openbravo.com/legal/license.html
8  * Software distributed under the License is distributed on an "AS IS"
9  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
10  * License for the specific language governing rights and limitations
11  * under the License.
12  * The Original Code is Openbravo ERP.
13  * The Initial Developer of the Original Code is Openbravo SL
14  * All portions are Copyright (C) 2001-2006 Openbravo SL
15  * All Rights Reserved.
16  * Contributor(s): ______________________________________.
17  ************************************************************************
18 */

19 package org.openbravo.erpReports;
20
21 import org.openbravo.erpCommon.utility.*;
22 import org.openbravo.erpCommon.businessUtility.Tree;
23 import org.openbravo.erpCommon.businessUtility.TreeData;
24 import org.openbravo.erpCommon.businessUtility.WindowTabs;
25 import org.openbravo.base.secureApp.HttpSecureAppServlet;
26 import org.openbravo.base.secureApp.VariablesSecureApp;
27 import org.openbravo.xmlEngine.XmlDocument;
28 import java.io.*;
29 import java.util.HashMap JavaDoc;
30 import java.util.Date JavaDoc;
31 import java.text.*;
32 import javax.servlet.*;
33 import javax.servlet.http.*;
34
35 import org.openbravo.utils.Replace;
36 import org.openbravo.erpCommon.ad_combos.OrganizationComboData;
37
38 import org.openbravo.erpCommon.utility.DateTimeData;
39
40 import net.sf.jasperreports.engine.*;
41 import net.sf.jasperreports.engine.design.JasperDesign;
42 import java.sql.Connection JavaDoc;
43 import net.sf.jasperreports.engine.xml.JRXmlLoader;
44 import net.sf.jasperreports.engine.export.JRHtmlExporter;
45 import net.sf.jasperreports.engine.export.JRHtmlExporterParameter;
46
47 public class RptC_Order extends HttpSecureAppServlet {
48   
49   
50   public void init (ServletConfig config) {
51     super.init(config);
52     boolHist = false;
53   }
54
55   public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
56     VariablesSecureApp vars = new VariablesSecureApp(request);
57
58     if (vars.commandIn("DEFAULT")) {
59       String JavaDoc strcOrderId = vars.getSessionValue("RptC_Order.inpcOrderId_R");
60       
61       if (strcOrderId.equals("")) strcOrderId = vars.getSessionValue("RptC_Order.inpcOrderId");
62       if (log4j.isDebugEnabled()) log4j.debug("strcOrderId: "+ strcOrderId);
63       printPagePartePDF(response, vars, strcOrderId);
64     } else pageError(response);
65   }
66
67
68    void printPagePartePDF(HttpServletResponse response, VariablesSecureApp vars, String JavaDoc strcOrderId) throws IOException,ServletException{
69     if (log4j.isDebugEnabled()) log4j.debug("Output: RptC_Order - pdf");
70     JasperPrint jasperPrint;
71     
72     RptCOrderHeaderData[] data = RptCOrderHeaderData.select(this, strcOrderId);
73     
74     if (log4j.isDebugEnabled()) log4j.debug("data: "+(data==null?"null":"not null"));
75     
76     if (data == null || data.length == 0) data = RptCOrderHeaderData.set();
77     
78     String JavaDoc strReportName = "@basedesign@/org/openbravo/erpReports/C_OrderJR.jrxml";
79     response.setHeader("Content-disposition", "inline; filename=SalesOrderJR.pdf");
80     
81     HashMap JavaDoc<String JavaDoc, Object JavaDoc> parameters = new HashMap JavaDoc<String JavaDoc, Object JavaDoc>();
82     
83     renderJR(vars, response, strReportName, "pdf", parameters, data, null );
84     
85   }
86
87   public String JavaDoc getServletInfo() {
88     return "Servlet that presents the RptCOrders seeker";
89   } // End of getServletInfo() method
90
}
91
Popular Tags