KickJava   Java API By Example, From Geeks To Geeks.

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


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
20 package org.openbravo.erpCommon.ad_reports;
21
22 import org.openbravo.erpCommon.utility.ToolBar;
23
24 import org.openbravo.erpCommon.utility.*;
25 import org.openbravo.erpCommon.businessUtility.WindowTabs;
26 import org.openbravo.erpCommon.businessUtility.Tree;
27 import org.openbravo.erpCommon.businessUtility.TreeData;
28 import org.openbravo.base.secureApp.HttpSecureAppServlet;
29 import org.openbravo.base.secureApp.VariablesSecureApp;
30 import org.openbravo.xmlEngine.XmlDocument;
31 import java.io.*;
32 import java.util.*;
33 import javax.servlet.*;
34 import javax.servlet.http.*;
35
36 import org.openbravo.utils.Replace;
37 import org.openbravo.erpCommon.ad_combos.OrganizationComboData;
38
39
40 import org.openbravo.erpCommon.utility.DateTimeData;
41
42 public class ReportInvoiceVendorDimensionalAnalysesJR extends HttpSecureAppServlet {
43
44
45   public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
46     VariablesSecureApp vars = new VariablesSecureApp(request);
47
48     if (!Utility.hasProcessAccess(this, vars, "", "ReportInvoiceVendorDimensionalAnalysesJR")) {
49       bdError(response, "AccessTableNoView", vars.getLanguage());
50       return;
51     }
52
53     if (vars.commandIn("DEFAULT", "DEFAULT_COMPARATIVE")){
54       String JavaDoc strDateFrom = vars.getGlobalVariable("inpDateFrom", "ReportInvoiceVendorDimensionalAnalysesJR|dateFrom", "");
55       String JavaDoc strDateTo = vars.getGlobalVariable("inpDateTo", "ReportInvoiceVendorDimensionalAnalysesJR|dateTo", "");
56       String JavaDoc strDateFromRef = vars.getGlobalVariable("inpDateFromRef", "ReportInvoiceVendorDimensionalAnalysesJR|dateFromRef", "");
57       String JavaDoc strDateToRef = vars.getGlobalVariable("inpDateToRef", "ReportInvoiceVendorDimensionalAnalysesJR|dateToRef", "");
58       String JavaDoc strPartnerGroup = vars.getGlobalVariable("inpPartnerGroup", "ReportInvoiceVendorDimensionalAnalysesJR|partnerGroup", "");
59       String JavaDoc strcBpartnerId = vars.getInGlobalVariable("inpcBPartnerId_IN", "ReportInvoiceVendorDimensionalAnalysesJR|partner", "");
60       String JavaDoc strProductCategory = vars.getGlobalVariable("inpProductCategory", "ReportInvoiceVendorDimensionalAnalysesJR|productCategory", "");
61       String JavaDoc strmProductId = vars.getInGlobalVariable("inpmProductId_IN", "ReportInvoiceVendorDimensionalAnalysesJR|product", "");
62       String JavaDoc strNotShown = vars.getInGlobalVariable("inpNotShown", "ReportInvoiceVendorDimensionalAnalysesJR|notShown", "");
63       String JavaDoc strShown = vars.getInGlobalVariable("inpShown", "ReportInvoiceVendorDimensionalAnalysesJR|shown", "");
64       String JavaDoc strOrg = vars.getGlobalVariable("inpOrg", "ReportInvoiceVendorDimensionalAnalysesJR|Org", "0");
65       String JavaDoc strOrder = vars.getGlobalVariable("inpOrder","ReportInvoiceVendorDimensionalAnalysesJR|order","Normal");
66       String JavaDoc strMayor = vars.getGlobalVariable("inpMayor", "ReportInvoiceVendorDimensionalAnalysesJR|mayor", "");
67       String JavaDoc strMenor = vars.getGlobalVariable("inpMenor", "ReportInvoiceVendorDimensionalAnalysesJR|menor", "");
68       String JavaDoc strProducttype = vars.getGlobalVariable("inpProducttype", "ReportInvoiceVendorDimensionalAnalysesJR|producttype", "");
69       String JavaDoc strComparative = "";
70       if (vars.commandIn("DEFAULT_COMPARATIVE")) strComparative = vars.getRequestGlobalVariable("inpComparative", "ReportInvoiceVendorDimensionalAnalysesJR|comparative");
71       else strComparative = vars.getGlobalVariable("inpComparative", "ReportInvoiceVendorDimensionalAnalysesJR|comparative", "N");
72       printPageDataSheet(response, vars, strComparative, strDateFrom, strDateTo, strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strNotShown, strShown, strDateFromRef, strDateToRef, strOrg, strOrder, strMayor, strMenor, strProducttype);
73     }else if (vars.commandIn("EDIT_HTML", "EDIT_HTML_COMPARATIVE")) {
74       String JavaDoc strDateFrom = vars.getRequestGlobalVariable("inpDateFrom", "ReportInvoiceVendorDimensionalAnalysesJR|dateFrom");
75       String JavaDoc strDateTo = vars.getRequestGlobalVariable("inpDateTo", "ReportInvoiceVendorDimensionalAnalysesJR|dateTo");
76       String JavaDoc strDateFromRef = vars.getRequestGlobalVariable("inpDateFromRef", "ReportInvoiceVendorDimensionalAnalysesJR|dateFromRef");
77       String JavaDoc strDateToRef = vars.getRequestGlobalVariable("inpDateToRef", "ReportSInvoiceVendorDimensionalAnalysesJR|dateToRef");
78       String JavaDoc strPartnerGroup = vars.getRequestGlobalVariable("inpPartnerGroup", "ReportInvoiceVendorDimensionalAnalysesJR|partnerGroup");
79       String JavaDoc strcBpartnerId = vars.getRequestInGlobalVariable("inpcBPartnerId_IN", "ReportInvoiceVendorDimensionalAnalysesJR|partner");
80       String JavaDoc strProductCategory = vars.getRequestGlobalVariable("inpProductCategory", "ReportInvoiceVendorDimensionalAnalysesJR|productCategory");
81       String JavaDoc strmProductId = vars.getRequestInGlobalVariable("inpmProductId_IN", "ReportInvoiceVendorDimensionalAnalysesJR|product");
82       String JavaDoc strNotShown = vars.getInStringParameter("inpNotShown");
83       String JavaDoc strShown = vars.getInStringParameter("inpShown");
84       String JavaDoc strOrg = vars.getGlobalVariable("inpOrg", "ReportInvoiceVendorDimensionalAnalysesJR|Org", "0");
85       String JavaDoc strOrder = vars.getRequestGlobalVariable("inpOrder","ReportInvoiceVendorDimensionalAnalysesJR|order");
86       String JavaDoc strMayor = vars.getStringParameter("inpMayor", "");
87       String JavaDoc strMenor = vars.getStringParameter("inpMenor", "");
88       String JavaDoc strProducttype = vars.getRequestGlobalVariable("inpProducttype", "ReportInvoiceVendorDimensionalAnalysesJR|producttype");
89       String JavaDoc strComparative = vars.getStringParameter("inpComparative", "N");
90       printPageHtml(response, vars, strComparative, strDateFrom, strDateTo, strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strNotShown, strShown, strDateFromRef, strDateToRef, strOrg, strOrder, strMayor, strMenor, strProducttype, "html");
91     }else if (vars.commandIn("EDIT_PDF", "EDIT_PDF_COMPARATIVE")) {
92       String JavaDoc strDateFrom = vars.getRequestGlobalVariable("inpDateFrom", "ReportInvoiceVendorDimensionalAnalysesJR|dateFrom");
93       String JavaDoc strDateTo = vars.getRequestGlobalVariable("inpDateTo", "ReportInvoiceVendorDimensionalAnalysesJR|dateTo");
94       String JavaDoc strDateFromRef = vars.getRequestGlobalVariable("inpDateFromRef", "ReportInvoiceVendorDimensionalAnalysesJR|dateFromRef");
95       String JavaDoc strDateToRef = vars.getRequestGlobalVariable("inpDateToRef", "ReportSInvoiceVendorDimensionalAnalysesJR|dateToRef");
96       String JavaDoc strPartnerGroup = vars.getRequestGlobalVariable("inpPartnerGroup", "ReportInvoiceVendorDimensionalAnalysesJR|partnerGroup");
97       String JavaDoc strcBpartnerId = vars.getRequestInGlobalVariable("inpcBPartnerId_IN", "ReportInvoiceVendorDimensionalAnalysesJR|partner");
98       String JavaDoc strProductCategory = vars.getRequestGlobalVariable("inpProductCategory", "ReportInvoiceVendorDimensionalAnalysesJR|productCategory");
99       String JavaDoc strmProductId = vars.getRequestInGlobalVariable("inpmProductId_IN", "ReportInvoiceVendorDimensionalAnalysesJR|product");
100       String JavaDoc strNotShown = vars.getInStringParameter("inpNotShown");
101       String JavaDoc strShown = vars.getInStringParameter("inpShown");
102       String JavaDoc strOrg = vars.getGlobalVariable("inpOrg", "ReportInvoiceVendorDimensionalAnalysesJR|Org", "0");
103       String JavaDoc strOrder = vars.getRequestGlobalVariable("inpOrder","ReportInvoiceVendorDimensionalAnalysesJR|order");
104       String JavaDoc strMayor = vars.getStringParameter("inpMayor", "");
105       String JavaDoc strMenor = vars.getStringParameter("inpMenor", "");
106       String JavaDoc strProducttype = vars.getRequestGlobalVariable("inpProducttype", "ReportInvoiceVendorDimensionalAnalysesJR|producttype");
107       String JavaDoc strComparative = vars.getStringParameter("inpComparative", "N");
108       printPageHtml(response, vars, strComparative, strDateFrom, strDateTo, strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strNotShown, strShown, strDateFromRef, strDateToRef, strOrg, strOrder, strMayor, strMenor, strProducttype, "pdf");
109     } else pageErrorPopUp(response);
110   }
111
112   void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars, String JavaDoc strComparative, String JavaDoc strDateFrom, String JavaDoc strDateTo, String JavaDoc strPartnerGroup, String JavaDoc strcBpartnerId, String JavaDoc strProductCategory, String JavaDoc strmProductId, String JavaDoc strNotShown, String JavaDoc strShown, String JavaDoc strDateFromRef, String JavaDoc strDateToRef, String JavaDoc strOrg, String JavaDoc strOrder, String JavaDoc strMayor, String JavaDoc strMenor, String JavaDoc strProducttype) throws IOException, ServletException {
113     if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet");
114     String JavaDoc discard[]={"selEliminarHeader1"};
115     if (strComparative.equals("Y")) {
116       discard[0] = "selEliminarHeader2";
117     }
118     XmlDocument xmlDocument=null;
119     xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesFilterJR", discard).createXmlDocument();
120
121     ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "ReportInvoiceVendorDimensionalAnalysesFilterJR", false, "", "", "",false, "ad_reports", strReplaceWith, false, true);
122     toolbar.prepareSimpleToolBarTemplate();
123     xmlDocument.setParameter("toolbar", toolbar.toString());
124
125     try {
126       KeyMap key = new KeyMap(this, vars, "ReportInvoiceVendorDimensionalAnalysesFilterJR.html");
127       xmlDocument.setParameter("keyMap", key.getReportKeyMaps());
128     } catch (Exception JavaDoc ex) {
129       throw new ServletException(ex);
130     }
131     try {
132       WindowTabs tabs = new WindowTabs(this, vars, "org.openbravo.erpCommon.ad_reports.ReportInvoiceVendorDimensionalAnalysesJR");
133       xmlDocument.setParameter("parentTabContainer", tabs.parentTabs());
134       xmlDocument.setParameter("mainTabContainer", tabs.mainTabs());
135       xmlDocument.setParameter("childTabContainer", tabs.childTabs());
136       xmlDocument.setParameter("theme", vars.getTheme());
137       NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "ReportInvoiceVendorDimensionalAnalysesFilterJR.html", classInfo.id, classInfo.type, strReplaceWith, tabs.breadcrumb());
138       xmlDocument.setParameter("navigationBar", nav.toString());
139       LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "ReportInvoiceVendorDimensionalAnalysesFilterJR.html", strReplaceWith);
140       xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
141     } catch (Exception JavaDoc ex) {
142       throw new ServletException(ex);
143     }
144     {
145       OBError myMessage = vars.getMessage("ReportInvoiceVendorDimensionalAnalysesJR");
146       vars.removeMessage("ReportInvoiceVendorDimensionalAnalysesJR");
147       if (myMessage!=null) {
148         xmlDocument.setParameter("messageType", myMessage.getType());
149         xmlDocument.setParameter("messageTitle", myMessage.getTitle());
150         xmlDocument.setParameter("messageMessage", myMessage.getMessage());
151       }
152     }
153
154     xmlDocument.setParameter("calendar", vars.getLanguage().substring(0,2));
155     xmlDocument.setParameter("language", "LNG_POR_DEFECTO=\"" + vars.getLanguage() + "\";");
156     xmlDocument.setParameter("direction", "var baseDirection = \"" + strReplaceWith + "/\";\n");
157     xmlDocument.setParameter("dateFrom", strDateFrom);
158     xmlDocument.setParameter("dateFromdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
159     xmlDocument.setParameter("dateFromsaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
160     xmlDocument.setParameter("dateTo", strDateTo);
161     xmlDocument.setParameter("dateTodisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
162     xmlDocument.setParameter("dateTosaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
163     xmlDocument.setParameter("dateFromRef", strDateFromRef);
164     xmlDocument.setParameter("dateFromRefdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
165     xmlDocument.setParameter("dateFromRefsaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
166     xmlDocument.setParameter("dateToRef", strDateToRef);
167     xmlDocument.setParameter("dateToRefdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
168     xmlDocument.setParameter("dateToRefsaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
169     /*xmlDocument.setParameter("paramBPartnerId", strcBpartnerId);
170       xmlDocument.setParameter("bPartnerDescription", ReportInvoiceVendorDimensionalAnalysesJRData.selectBpartner(this, strcBpartnerId));
171       xmlDocument.setParameter("mProduct", strmProductId);
172       xmlDocument.setParameter("productDescription", ReportInvoiceVendorDimensionalAnalysesJRData.selectMproduct(this, strmProductId));*/

173     xmlDocument.setParameter("cBpGroupId", strPartnerGroup);
174     xmlDocument.setParameter("mProductCategoryId", strProductCategory);
175     xmlDocument.setParameter("adOrgId", strOrg);
176     xmlDocument.setParameter("normal", strOrder);
177     xmlDocument.setParameter("amountasc", strOrder);
178     xmlDocument.setParameter("amountdesc", strOrder);
179     xmlDocument.setParameter("mayor", strMayor);
180     xmlDocument.setParameter("menor", strMenor);
181     xmlDocument.setParameter("producttype", strProducttype);
182     xmlDocument.setParameter("comparative", strComparative);
183     try {
184       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "C_BP_Group_ID", "", "", Utility.getContext(this, vars, "#User_Org", "ReportInvoiceVendorDimensionalAnalysesJR"), Utility.getContext(this, vars, "#User_Client", "ReportInvoiceVendorDimensionalAnalysesJR"), 0);
185       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportInvoiceVendorDimensionalAnalysesJR", strPartnerGroup);
186       xmlDocument.setData("reportC_BP_GROUPID","liststructure", comboTableData.select(false));
187       comboTableData = null;
188     } catch (Exception JavaDoc ex) {
189       throw new ServletException(ex);
190     }
191
192
193     try {
194       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "M_Product_Category_ID", "", "", Utility.getContext(this, vars, "#User_Org", "ReportInvoiceVendorDimensionalAnalysesJR"), Utility.getContext(this, vars, "#User_Client", "ReportInvoiceVendorDimensionalAnalysesJR"), 0);
195       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportInvoiceVendorDimensionalAnalysesJR", strProductCategory);
196       xmlDocument.setData("reportM_PRODUCT_CATEGORYID","liststructure", comboTableData.select(false));
197       comboTableData = null;
198     } catch (Exception JavaDoc ex) {
199       throw new ServletException(ex);
200     }
201
202     xmlDocument.setData("reportAD_ORGID", "liststructure", OrganizationComboData.selectCombo(this, vars.getRole()));
203     xmlDocument.setData("reportCBPartnerId_IN", "liststructure", ReportInvoiceVendorDimensionalAnalysesJRData.selectBpartner(this, Utility.getContext(this, vars, "#User_Org", ""), Utility.getContext(this, vars, "#User_Client", ""), strcBpartnerId));
204     xmlDocument.setData("reportMProductId_IN", "liststructure", ReportInvoiceVendorDimensionalAnalysesJRData.selectMproduct(this, Utility.getContext(this, vars, "#User_Org", ""), Utility.getContext(this, vars, "#User_Client", ""), strmProductId));
205     try {
206       ComboTableData comboTableData = new ComboTableData(vars, this, "LIST", "", "M_Product_ProductType", "", Utility.getContext(this, vars, "#User_Org", "ReportInvoiceVendorDimensionalAnalysesJRData"), Utility.getContext(this, vars, "#User_Client", "ReportInvoiceVendorDimensionalAnalysesJRData"), 0);
207       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportInvoiceVendorDimensionalAnalysesJRData", "");
208       xmlDocument.setData("reportProductType","liststructure", comboTableData.select(false));
209       comboTableData = null;
210     } catch (Exception JavaDoc ex) {
211       throw new ServletException(ex);
212     }
213
214
215     if (vars.getLanguage().equals("en_US")) {
216       xmlDocument.setData("structure1", ReportInvoiceVendorDimensionalAnalysesJRData.selectNotShown(this, strShown));
217       xmlDocument.setData("structure2", strShown.equals("")?new ReportInvoiceVendorDimensionalAnalysesJRData[0]:ReportInvoiceVendorDimensionalAnalysesJRData.selectShown(this, strShown));
218     } else {
219       xmlDocument.setData("structure1", ReportInvoiceVendorDimensionalAnalysesJRData.selectNotShownTrl(this, vars.getLanguage(), strShown));
220       xmlDocument.setData("structure2", strShown.equals("")?new ReportInvoiceVendorDimensionalAnalysesJRData[0]:ReportInvoiceVendorDimensionalAnalysesJRData.selectShownTrl(this, vars.getLanguage(), strShown));
221     }
222
223     response.setContentType("text/html; charset=UTF-8");
224     PrintWriter out = response.getWriter();
225     out.println(xmlDocument.print());
226     out.close();
227   }
228
229   void printPageHtml(HttpServletResponse response, VariablesSecureApp vars, String JavaDoc strComparative, String JavaDoc strDateFrom, String JavaDoc strDateTo, String JavaDoc strPartnerGroup, String JavaDoc strcBpartnerId, String JavaDoc strProductCategory, String JavaDoc strmProductId, String JavaDoc strNotShown, String JavaDoc strShown, String JavaDoc strDateFromRef, String JavaDoc strDateToRef, String JavaDoc strOrg, String JavaDoc strOrder, String JavaDoc strMayor, String JavaDoc strMenor, String JavaDoc strProducttype, String JavaDoc strOutput) throws IOException, ServletException{
230     if (log4j.isDebugEnabled()) log4j.debug("Output: print html");
231     String JavaDoc strOrderby = "";
232     String JavaDoc[] discard = {"", "", "", "", ""};
233     String JavaDoc[] discard1={"selEliminarBody1", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard"};
234     if (strComparative.equals("Y")) discard1[0] = "selEliminarBody2";
235     String JavaDoc strTitle = "";
236     strTitle = Utility.messageBD(this, "From", vars.getLanguage()) + " "+strDateFrom+" " + Utility.messageBD(this, "To", vars.getLanguage()) + " "+strDateTo;
237     if (!strPartnerGroup.equals("")) strTitle = strTitle + ", " + Utility.messageBD(this, "ForBPartnerGroup", vars.getLanguage()) + " "+ReportInvoiceVendorDimensionalAnalysesJRData.selectBpgroup(this, strPartnerGroup);
238     if (!strProductCategory.equals("")) strTitle = strTitle+" " + Utility.messageBD(this, "And", vars.getLanguage()) + " " + Utility.messageBD(this, "ProductCategory", vars.getLanguage()) + " "+ReportInvoiceVendorDimensionalAnalysesJRData.selectProductCategory(this, strProductCategory);
239   
240
241     ReportInvoiceVendorDimensionalAnalysesJRData[] data = null;
242     String JavaDoc[] strShownArray = {"", "", "", "", ""};
243     if (strShown.startsWith("(")) strShown = strShown.substring(1, strShown.length()-1);
244     if (!strShown.equals("")) {
245       strShown = Replace.replace(strShown, "'", "");
246       strShown = Replace.replace(strShown, " ", "");
247       StringTokenizer st = new StringTokenizer(strShown, ",", false);
248       int intContador = 0;
249       while (st.hasMoreTokens()){
250         strShownArray[intContador] = st.nextToken();
251         intContador++;
252       }
253
254     }
255     ReportInvoiceVendorDimensionalAnalysesJRData[] dimensionLabel = null;
256     if (vars.getLanguage().equals("en_US")) {
257       dimensionLabel = ReportInvoiceVendorDimensionalAnalysesJRData.selectNotShown(this, "");
258     } else {
259       dimensionLabel = ReportInvoiceVendorDimensionalAnalysesJRData.selectNotShownTrl(this, vars.getLanguage(), "");
260     }
261     String JavaDoc[] strTextShow = {"", "", "", "", ""};
262     String JavaDoc[] strLevelLabel = {"", "", "", "", ""};
263     int intDiscard = 0;
264     int intProductLevel = 6;
265     int intAuxDiscard = -1;
266     for (int i = 0; i<5; i++){
267       if (strShownArray[i].equals("1")) {
268         strTextShow[i] = "C_BP_GROUP.NAME";
269         intDiscard++;
270         strLevelLabel[i] = dimensionLabel[0].name;
271       }
272       else if (strShownArray[i].equals("2")) {
273         strTextShow[i] = "AD_COLUMN_IDENTIFIER(to_char('C_Bpartner'), to_char( C_BPARTNER.C_BPARTNER_ID), to_char( 'es_ES'))";
274         intDiscard++;
275         strLevelLabel[i] = dimensionLabel[1].name;
276       }
277       else if (strShownArray[i].equals("3")) {
278         strTextShow[i] = "M_PRODUCT_CATEGORY.NAME";
279         intDiscard++;
280         strLevelLabel[i] = dimensionLabel[2].name;
281       }
282       else if (strShownArray[i].equals("4")) {
283         strTextShow[i] = "AD_COLUMN_IDENTIFIER(to_char('M_Product'), to_char( M_PRODUCT.M_PRODUCT_ID), to_char( 'es_ES'))";
284         intAuxDiscard = i;
285         intDiscard++;
286         intProductLevel = i+1;
287         strLevelLabel[i] = dimensionLabel[3].name;
288       }
289       else if (strShownArray[i].equals("5")) {
290         strTextShow[i] = "M_INOUT.DOCUMENTNO";
291         intDiscard++;
292         strLevelLabel[i] = dimensionLabel[4].name;
293       }
294       else {
295         strTextShow[i] = "''";
296         discard[i] = "display:none;";
297       }
298     }
299     if (intDiscard != 0 || intAuxDiscard != -1){
300       int k=1;
301       strOrderby = " ORDER BY NIVEL"+k+",";
302       while (k<intDiscard){
303         strOrderby = strOrderby+"NIVEL"+k+",";
304         k++;
305       }
306       if (k==1){
307         if (strOrder.equals("Normal")){
308           strOrderby = " ORDER BY NIVEL"+k;
309         } else if (strOrder.equals("Amountasc")){
310           strOrderby = " ORDER BY LINENETAMT ASC";
311         } else if (strOrder.equals("Amountdesc")){
312           strOrderby = " ORDER BY LINENETAMT DESC";
313         } else{
314           strOrderby = "1";
315         }
316       } else{
317         if (strOrder.equals("Normal")){
318           strOrderby += "NIVEL"+k;
319         } else if (strOrder.equals("Amountasc")){
320           strOrderby += "LINENETAMT ASC";
321         } else if (strOrder.equals("Amountdesc")){
322           strOrderby += "LINENETAMT DESC";
323         } else{
324           strOrderby = "1";
325         }
326       }
327
328     } else{
329       strOrderby = " ORDER BY 1";
330     }
331     String JavaDoc strHaving = "";
332     if (!strMayor.equals("") && !strMenor.equals("")) {strHaving = " HAVING SUM(LINENETAMT) > "+strMayor+" AND SUM(LINENETAMT) < "+strMenor;}
333     else if (!strMayor.equals("") && strMenor.equals("")) {strHaving = " HAVING SUM(LINENETAMT) > "+strMayor;}
334     else if (strMayor.equals("") && !strMenor.equals("")) {strHaving = " HAVING SUM(LINENETAMT) < "+strMenor;}
335     else{ strHaving = " HAVING SUM(LINENETAMT) <> 0 OR SUM(LINENETREF) <> 0";}
336     strOrderby = strHaving + strOrderby;
337     String JavaDoc strReportPath = "";
338     if (strComparative.equals("Y")){
339       strReportPath = "@basedesign@/org/openbravo/erpCommon/ad_reports/SimpleDimensionalComparative.jrxml";
340       data = ReportInvoiceVendorDimensionalAnalysesJRData.select(this, strTextShow[0], strTextShow[1], strTextShow[2], strTextShow[3], strTextShow[4], Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg), Utility.getContext(this, vars, "#User_Client", "ReportInvoiceVendorDimensionalAnalysesJR"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strProducttype, strDateFromRef, DateTimeData.nDaysAfter(this, strDateToRef,"1"), strOrderby);
341     } else {
342       strReportPath = "@basedesign@/org/openbravo/erpCommon/ad_reports/SimpleDimensionalNoComparative.jrxml";
343       data = ReportInvoiceVendorDimensionalAnalysesJRData.selectNoComparative(this, strTextShow[0], strTextShow[1], strTextShow[2], strTextShow[3], strTextShow[4], Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg), Utility.getContext(this, vars, "#User_Client", "ReportInvoiceVendorDimensionalAnalysesJR"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strProducttype, strOrderby);
344     }
345     if (data.length == 0 || data == null){
346       data = ReportInvoiceVendorDimensionalAnalysesJRData.set();
347     }
348
349     HashMap<String JavaDoc, Object JavaDoc> parameters = new HashMap<String JavaDoc, Object JavaDoc>();
350     parameters.put("LEVEL1_LABEL", strLevelLabel[0]);
351     parameters.put("LEVEL2_LABEL", strLevelLabel[1]);
352     parameters.put("LEVEL3_LABEL", strLevelLabel[2]);
353     parameters.put("LEVEL4_LABEL", strLevelLabel[3]);
354     parameters.put("LEVEL5_LABEL", strLevelLabel[4]);
355     parameters.put("DIMENSIONS", new Integer JavaDoc(intDiscard));
356     parameters.put("REPORT_TITLE", classInfo.name);
357     parameters.put("REPORT_SUBTITLE", strTitle);
358     parameters.put("PRODUCT_LEVEL", new Integer JavaDoc(intProductLevel));
359     renderJR(vars, response, strReportPath, strOutput, parameters, data, null );
360   }
361
362   /*void printPagePdf(HttpServletResponse response, VariablesSecureApp vars, String strDateFrom, String strDateTo, String strcBpartnetId, String strmWarehouseId, String strcProjectId, String strissotrx) throws IOException, ServletException{
363     if (log4j.isDebugEnabled()) log4j.debug("Output: print pdf");
364     XmlDocument xmlDocument=null;
365     xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportSalesOrderEdition_Pdf").createXmlDocument();
366     OrderEditionData[] data = null;
367     data = OrderEditionData.select(this, Utility.getContext(this, vars, "#User_Org", "SalesOrderFilter"), Utility.getContext(this, vars, "#User_Client", "SalesOrderFilter"), strdateFrom, strdateTo, strcBpartnetId, strmWarehouseId, strcProjectId, strissotrx);
368     xmlDocument.setData("structure1", data);
369     String strResult = xmlDocument.print();
370     if (log4j.isDebugEnabled()) log4j.debug(strResult);
371     renderFO(strResult, response);
372     }*/

373
374   public String JavaDoc getServletInfo() {
375     return "Servlet ReportInvoiceVendorDimensionalAnalysesJR. This Servlet was made by Jon Alegría";
376   } // end of getServletInfo() method
377
}
378
379
Popular Tags