KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openbravo > erpCommon > ad_reports > ReportTotalProductTemplate


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.erpCommon.ad_reports;
20
21 import org.openbravo.erpCommon.utility.*;
22 import org.openbravo.erpCommon.businessUtility.WindowTabs;
23 import org.openbravo.base.secureApp.HttpSecureAppServlet;
24 import org.openbravo.base.secureApp.VariablesSecureApp;
25 import org.openbravo.xmlEngine.XmlDocument;
26 import java.io.*;
27 import javax.servlet.*;
28 import javax.servlet.http.*;
29
30 public class ReportTotalProductTemplate extends HttpSecureAppServlet {
31
32
33   public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
34     VariablesSecureApp vars = new VariablesSecureApp(request);
35
36     if (!Utility.hasProcessAccess(this, vars, "", "ReportTotalProductTemplate")) {
37       bdError(response, "AccessTableNoView", vars.getLanguage());
38       return;
39     }
40     if (vars.commandIn("FIND"))
41       printPageDataHtml(response, vars);
42     else
43       printPageDataSheet(response, vars);
44   }
45
46   void printPageDataHtml(HttpServletResponse response, VariablesSecureApp vars)
47     throws IOException, ServletException {
48     if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet");
49     response.setContentType("text/html; charset=UTF-8");
50     PrintWriter out = response.getWriter();
51
52     XmlDocument xmlDocument=null;
53     ReportTotalProductTemplateData[] data=null;
54     xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportTotalProductTemplateEdit").createXmlDocument();
55
56         
57
58     data = ReportTotalProductTemplateData.select(this, Utility.getContext(this, vars, "#User_Client", "ReportTotalProductTemplate"), Utility.getContext(this, vars, "#User_Org", "ReportTotalProductTemplate"));
59     vars.removeSessionValue("Default.value");
60     xmlDocument.setParameter("direction", "var baseDirection = \"" + strReplaceWith + "/\";\n");
61     xmlDocument.setParameter("paramLanguage", "LNG_POR_DEFECTO=\"" + vars.getLanguage() + "\";");
62     xmlDocument.setData("structure1", data);
63     out.println(xmlDocument.print());
64     out.close();
65   }
66   
67  /* void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars)
68     throws IOException, ServletException {
69     if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet");
70     response.setContentType("text/html; charset=UTF-8");
71     PrintWriter out = response.getWriter();
72     
73     XmlDocument xmlDocument=null;
74     
75     xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportTotalProductTemplateEdit").createXmlDocument();
76
77     ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "ReportTotalProductTemplate", false, "", "", "",false, "ad_reports", strReplaceWith, false, true);
78     toolbar.prepareSimpleToolBarTemplate();
79     xmlDocument.setParameter("toolbar", toolbar.toString());
80
81     try {
82       KeyMap key = new KeyMap(this, vars, "ReportTotalProductTemplate.html");
83       xmlDocument.setParameter("keyMap", key.getReportKeyMaps());
84     } catch (Exception ex) {
85       throw new ServletException(ex);
86     }
87     try {
88       WindowTabs tabs = new WindowTabs(this, vars, "org.openbravo.erpCommon.ad_reports.ReportTotalProductTemplate");
89       xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
90       xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
91       xmlDocument.setParameter("childTabContainer", tabs.childTabs());
92       xmlDocument.setParameter("theme", vars.getTheme());
93       NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "ReportTotalProductTemplate.html", classInfo.id, classInfo.type, strReplaceWith, tabs.breadcrumb());
94       xmlDocument.setParameter("navigationBar", nav.toString());
95       LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "ReportTotalProductTemplate.html", strReplaceWith);
96       xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
97     } catch (Exception ex) {
98       throw new ServletException(ex);
99     }
100     {
101       OBError myMessage = vars.getMessage("ReportTotalProductTemplate");
102       vars.removeMessage("ReportTotalProductTemplate");
103       if (myMessage!=null) {
104         xmlDocument.setParameter("messageType", myMessage.getType());
105         xmlDocument.setParameter("messageTitle", myMessage.getTitle());
106         xmlDocument.setParameter("messageMessage", myMessage.getMessage());
107       }
108     }
109
110      
111     vars.removeSessionValue("Default.value");
112     xmlDocument.setParameter("direction", "var baseDirection = \"" + strReplaceWith + "/\";\n");
113     xmlDocument.setParameter("paramLanguage", "LNG_POR_DEFECTO=\"" + vars.getLanguage() + "\";");
114     
115     out.println(xmlDocument.print());
116     out.close();
117   }*/

118   
119   void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars)
120     throws IOException, ServletException {
121     if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet");
122     response.setContentType("text/html; charset=UTF-8");
123     PrintWriter out = response.getWriter();
124     String JavaDoc discard[]={"discard"};
125     XmlDocument xmlDocument=null;
126     ReportTotalProductTemplateData[] data=null;
127     xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportTotalProductTemplate").createXmlDocument();
128
129     ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "ReportTotalProductTemplate", false, "", "", "",false, "ad_reports", strReplaceWith, false, true);
130     toolbar.prepareSimpleToolBarTemplate();
131     xmlDocument.setParameter("toolbar", toolbar.toString());
132
133     try {
134       KeyMap key = new KeyMap(this, vars, "ReportTotalProductTemplate.html");
135       xmlDocument.setParameter("keyMap", key.getReportKeyMaps());
136     } catch (Exception JavaDoc ex) {
137       throw new ServletException(ex);
138     }
139     try {
140       WindowTabs tabs = new WindowTabs(this, vars, "org.openbravo.erpCommon.ad_reports.ReportTotalProductTemplate");
141       xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
142       xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
143       xmlDocument.setParameter("childTabContainer", tabs.childTabs());
144       xmlDocument.setParameter("theme", vars.getTheme());
145       NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "ReportTotalProductTemplate.html", classInfo.id, classInfo.type, strReplaceWith, tabs.breadcrumb());
146       xmlDocument.setParameter("navigationBar", nav.toString());
147       LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "ReportTotalProductTemplate.html", strReplaceWith);
148       xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
149     } catch (Exception JavaDoc ex) {
150       throw new ServletException(ex);
151     }
152     {
153       OBError myMessage = vars.getMessage("ReportTotalProductTemplate");
154       vars.removeMessage("ReportTotalProductTemplate");
155       if (myMessage!=null) {
156         xmlDocument.setParameter("messageType", myMessage.getType());
157         xmlDocument.setParameter("messageTitle", myMessage.getTitle());
158         xmlDocument.setParameter("messageMessage", myMessage.getMessage());
159       }
160     }
161
162     //data = ReportTotalProductTemplateData.select(this, Utility.getContext(this, vars, "#User_Client", "ReportTotalProductTemplate"), Utility.getContext(this, vars, "#User_Org", "ReportTotalProductTemplate"));
163
vars.removeSessionValue("Default.value");
164     xmlDocument.setParameter("direction", "var baseDirection = \"" + strReplaceWith + "/\";\n");
165     xmlDocument.setParameter("paramLanguage", "LNG_POR_DEFECTO=\"" + vars.getLanguage() + "\";");
166     //xmlDocument.setData("structure1", data);
167
out.println(xmlDocument.print());
168     out.close();
169   }
170
171   public String JavaDoc getServletInfo() {
172     return "Servlet ReportSalesOrderOpenItem. This Servlet was made by Jon Alegría";
173   } // end of getServletInfo() method
174
}
175
176
Popular Tags