KickJava   Java API By Example, From Geeks To Geeks.

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


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.Utility;
23 import org.openbravo.erpCommon.utility.ComboTableData;
24 import org.openbravo.erpCommon.businessUtility.Tree;
25 import org.openbravo.erpCommon.businessUtility.TreeData;
26 import org.openbravo.base.secureApp.HttpSecureAppServlet;
27 import org.openbravo.base.secureApp.VariablesSecureApp;
28 import org.openbravo.xmlEngine.XmlDocument;
29 import java.io.*;
30 import java.util.*;
31 import javax.servlet.*;
32 import javax.servlet.http.*;
33
34 import org.openbravo.utils.Replace;
35 import org.openbravo.erpCommon.ad_combos.OrganizationComboData;
36
37
38 import org.openbravo.erpCommon.utility.DateTimeData;
39
40 public class ReportRefundInvoiceCustomerDimensionalAnalyses extends HttpSecureAppServlet {
41
42
43   public void init (ServletConfig config) {
44     super.init(config);
45     boolHist = false;
46   }
47
48   public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {
49     VariablesSecureApp vars = new VariablesSecureApp(request);
50
51     if (!Utility.hasProcessAccess(this, vars, "", "RV_ReportRefundInvoiceCustomerDimensiona")) {
52       bdError(response, "AccessTableNoView", vars.getLanguage());
53       return;
54     }
55
56     if (vars.commandIn("DEFAULT", "DEFAULT_COMPARATIVE")){
57       String JavaDoc strDateFrom = vars.getGlobalVariable("inpDateFrom", "ReportRefundInvoiceCustomerDimensionalAnalyses|dateFrom", "");
58       String JavaDoc strDateTo = vars.getGlobalVariable("inpDateTo", "ReportRefundInvoiceCustomerDimensionalAnalyses|dateTo", "");
59       String JavaDoc strDateFromRef = vars.getGlobalVariable("inpDateFromRef", "ReportRefundInvoiceCustomerDimensionalAnalyses|dateFromRef", "");
60       String JavaDoc strDateToRef = vars.getGlobalVariable("inpDateToRef", "ReportRefundInvoiceCustomerDimensionalAnalyses|dateToRef", "");
61       String JavaDoc strPartnerGroup = vars.getGlobalVariable("inpPartnerGroup", "ReportRefundInvoiceCustomerDimensionalAnalyses|partnerGroup", "");
62       String JavaDoc strcBpartnerId = vars.getInGlobalVariable("inpcBPartnerId_IN", "ReportRefundInvoiceCustomerDimensionalAnalyses|partner", "");
63       String JavaDoc strProductCategory = vars.getGlobalVariable("inpProductCategory", "ReportRefundInvoiceCustomerDimensionalAnalyses|productCategory", "");
64       String JavaDoc strmProductId = vars.getInGlobalVariable("inpmProductId_IN", "ReportRefundInvoiceCustomerDimensionalAnalyses|product", "");
65       String JavaDoc strNotShown = vars.getInGlobalVariable("inpNotShown", "ReportRefundInvoiceCustomerDimensionalAnalyses|notShown", "");
66       String JavaDoc strShown = vars.getInGlobalVariable("inpShown", "ReportRefundInvoiceCustomerDimensionalAnalyses|shown", "");
67       String JavaDoc strOrg = vars.getGlobalVariable("inpOrg", "ReportRefundInvoiceCustomerDimensionalAnalyses|org", "0");
68       String JavaDoc strsalesrepId = vars.getGlobalVariable("inpSalesrepId", "ReportRefundInvoiceCustomerDimensionalAnalyses|salesrep", "");
69       String JavaDoc strOrder = vars.getGlobalVariable("inpOrder","ReportRefundInvoiceCustomerDimensionalAnalyses|order","Normal");
70       String JavaDoc strMayor = vars.getGlobalVariable("inpMayor", "ReportRefundInvoiceCustomerDimensionalAnalyses|mayor", "");
71       String JavaDoc strMenor = vars.getGlobalVariable("inpMenor", "ReportRefundInvoiceCustomerDimensionalAnalyses|menor", "");
72       String JavaDoc strRatioMayor = vars.getGlobalVariable("inpRatioMayor", "ReportRefundInvoiceCustomerDimensionalAnalyses|ratioMayor", "");
73       String JavaDoc strRatioMenor = vars.getGlobalVariable("inpRatioMenor", "ReportRefundInvoiceCustomerDimensionalAnalyses|ratioMenor", "");
74       String JavaDoc strComparative = "";
75       if (vars.commandIn("DEFAULT_COMPARATIVE")) strComparative = vars.getRequestGlobalVariable("inpComparative", "ReportRefundInvoiceCustomerDimensionalAnalyses|comparative");
76       else strComparative = vars.getGlobalVariable("inpComparative", "ReportRefundInvoiceCustomerDimensionalAnalyses|comparative", "N");
77       printPageDataSheet(response, vars, strComparative, strDateFrom, strDateTo, strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strNotShown, strShown, strDateFromRef, strDateToRef, strOrg, strsalesrepId, strOrder, strMayor, strMenor, strRatioMayor, strRatioMenor);
78     }else if (vars.commandIn("EDIT_HTML", "EDIT_HTML_COMPARATIVE")) {
79       String JavaDoc strDateFrom = vars.getRequestGlobalVariable("inpDateFrom", "ReportRefundInvoiceCustomerDimensionalAnalyses|dateFrom");
80       String JavaDoc strDateTo = vars.getRequestGlobalVariable("inpDateTo", "ReportRefundInvoiceCustomerDimensionalAnalyses|dateTo");
81       String JavaDoc strDateFromRef = vars.getRequestGlobalVariable("inpDateFromRef", "ReportRefundInvoiceCustomerDimensionalAnalyses|dateFromRef");
82       String JavaDoc strDateToRef = vars.getRequestGlobalVariable("inpDateToRef", "ReportRefundInvoiceCustomerDimensionalAnalyses|dateToRef");
83       String JavaDoc strPartnerGroup = vars.getRequestGlobalVariable("inpPartnerGroup", "ReportRefundInvoiceCustomerDimensionalAnalyses|partnerGroup");
84       String JavaDoc strcBpartnerId = vars.getRequestInGlobalVariable("inpcBPartnerId_IN", "ReportRefundInvoiceCustomerDimensionalAnalyses|partner");
85       String JavaDoc strProductCategory = vars.getRequestGlobalVariable("inpProductCategory", "ReportRefundInvoiceCustomerDimensionalAnalyses|productCategory");
86       String JavaDoc strmProductId = vars.getRequestInGlobalVariable("inpmProductId_IN", "ReportRefundInvoiceCustomerDimensionalAnalyses|product");
87       String JavaDoc strNotShown = vars.getInStringParameter("inpNotShown");
88       String JavaDoc strShown = vars.getInStringParameter("inpShown");
89       String JavaDoc strOrg = vars.getGlobalVariable("inpOrg", "ReportRefundInvoiceCustomerDimensionalAnalyses|org", "0");
90       String JavaDoc strsalesrepId = vars.getRequestGlobalVariable("inpSalesrepId", "ReportRefundInvoiceCustomerDimensionalAnalyses|salesrep");
91       String JavaDoc strOrder = vars.getRequestGlobalVariable("inpOrder","ReportRefundInvoiceCustomerDimensionalAnalyses|order");
92       String JavaDoc strMayor = vars.getStringParameter("inpMayor", "");
93       String JavaDoc strMenor = vars.getStringParameter("inpMenor", "");
94       String JavaDoc strRatioMayor = vars.getStringParameter("inpRatioMayor", "");
95       String JavaDoc strRatioMenor = vars.getStringParameter("inpRatioMenor", "");
96       String JavaDoc strComparative = vars.getStringParameter("inpComparative", "N");
97       printPageHtml(response, vars, strComparative, strDateFrom, strDateTo, strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strNotShown, strShown, strDateFromRef, strDateToRef, strOrg, strsalesrepId, strOrder, strMayor, strMenor, strRatioMayor, strRatioMenor);
98     } else pageErrorPopUp(response);
99   }
100
101   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 strsalesrepId, String JavaDoc strOrder, String JavaDoc strMayor, String JavaDoc strMenor, String JavaDoc strRatioMayor, String JavaDoc strRatioMenor) throws IOException, ServletException {
102     if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet");
103     String JavaDoc discard[]={"selEliminarHeader1"};
104     String JavaDoc strCommand = "EDIT_PDF";
105     if (strComparative.equals("Y")) {
106       discard[0] = "selEliminarHeader2";
107       strCommand = "EDIT_PDF_COMPARATIVE";
108     }
109     XmlDocument xmlDocument=null;
110     xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportRefundInvoiceCustomerDimensionalAnalysesFilter", discard).createXmlDocument();
111     xmlDocument.setParameter("calendar", vars.getLanguage().substring(0,2));
112     xmlDocument.setParameter("language", "LNG_POR_DEFECTO=\"" + vars.getLanguage() + "\";");
113     xmlDocument.setParameter("direction", "var baseDirection = \"" + strReplaceWith + "/\";\n");
114     xmlDocument.setParameter("dateFrom", strDateFrom);
115     xmlDocument.setParameter("dateTo", strDateTo);
116     xmlDocument.setParameter("dateFromRef", strDateFromRef);
117     xmlDocument.setParameter("dateToRef", strDateToRef);
118     xmlDocument.setParameter("cBpGroupId", strPartnerGroup);
119     xmlDocument.setParameter("mProductCategoryId", strProductCategory);
120     xmlDocument.setParameter("adOrgId", strOrg);
121     xmlDocument.setParameter("salesRepId", strsalesrepId);
122     xmlDocument.setParameter("normal", strOrder);
123     xmlDocument.setParameter("amountasc", strOrder);
124     xmlDocument.setParameter("amountdesc", strOrder);
125     xmlDocument.setParameter("ratioasc", strOrder);
126     xmlDocument.setParameter("ratiodesc", strOrder);
127     xmlDocument.setParameter("mayor", strMayor);
128     xmlDocument.setParameter("menor", strMenor);
129     xmlDocument.setParameter("ratioMayor", strRatioMayor);
130     xmlDocument.setParameter("ratioMenor", strRatioMenor);
131     xmlDocument.setParameter("comparative", strComparative);
132     xmlDocument.setParameter("command", strCommand);
133     try {
134       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "C_BP_Group_ID", "", "", Utility.getContext(this, vars, "#User_Org", "ReportRefundInvoiceCustomerDimensionalAnalyses"), Utility.getContext(this, vars, "#User_Client", "ReportRefundInvoiceCustomerDimensionalAnalyses"), 0);
135       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportRefundInvoiceCustomerDimensionalAnalyses", strPartnerGroup);
136       xmlDocument.setData("reportC_BP_GROUPID","liststructure", comboTableData.select(false));
137       comboTableData = null;
138     } catch (Exception JavaDoc ex) {
139       throw new ServletException(ex);
140     }
141
142
143     try {
144       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "M_Product_Category_ID", "", "", Utility.getContext(this, vars, "#User_Org", "ReportRefundInvoiceCustomerDimensionalAnalyses"), Utility.getContext(this, vars, "#User_Client", "ReportRefundInvoiceCustomerDimensionalAnalyses"), 0);
145       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportRefundInvoiceCustomerDimensionalAnalyses", strProductCategory);
146       xmlDocument.setData("reportM_PRODUCT_CATEGORYID","liststructure", comboTableData.select(false));
147       comboTableData = null;
148     } catch (Exception JavaDoc ex) {
149       throw new ServletException(ex);
150     }
151
152     xmlDocument.setData("reportAD_ORGID", "liststructure", OrganizationComboData.selectCombo(this, vars.getRole()));
153     try {
154       ComboTableData comboTableData = new ComboTableData(vars, this, "TABLE", "SalesRep_ID", "AD_User SalesRep", "", Utility.getContext(this, vars, "#User_Org", "ReportRefundInvoiceCustomerDimensionalAnalyses"), Utility.getContext(this, vars, "#User_Client", "ReportRefundInvoiceCustomerDimensionalAnalyses"), 0);
155       Utility.fillSQLParameters(this, vars, null, comboTableData, "ReportRefundInvoiceCustomerDimensionalAnalyses", strsalesrepId);
156       xmlDocument.setData("reportSalesRep_ID","liststructure", comboTableData.select(false));
157       comboTableData = null;
158     } catch (Exception JavaDoc ex) {
159       throw new ServletException(ex);
160     }
161
162     xmlDocument.setData("reportCBPartnerId_IN", "liststructure", ReportRefundInvoiceCustomerDimensionalAnalysesData.selectBpartner(this, Utility.getContext(this, vars, "#User_Org", ""), Utility.getContext(this, vars, "#User_Client", ""), strcBpartnerId));
163     xmlDocument.setData("reportMProductId_IN", "liststructure", ReportRefundInvoiceCustomerDimensionalAnalysesData.selectMproduct(this, Utility.getContext(this, vars, "#User_Org", ""), Utility.getContext(this, vars, "#User_Client", ""), strmProductId));
164
165
166     if (vars.getLanguage().equals("en_US")) {
167       xmlDocument.setData("structure1", ReportRefundInvoiceCustomerDimensionalAnalysesData.selectNotShown(this, strShown));
168       xmlDocument.setData("structure2", strShown.equals("")?new ReportRefundInvoiceCustomerDimensionalAnalysesData[0]:ReportRefundInvoiceCustomerDimensionalAnalysesData.selectShown(this, strShown));
169     } else {
170       xmlDocument.setData("structure1", ReportRefundInvoiceCustomerDimensionalAnalysesData.selectNotShownTrl(this,vars.getLanguage(), strShown));
171       xmlDocument.setData("structure2", strShown.equals("")?new ReportRefundInvoiceCustomerDimensionalAnalysesData[0]:ReportRefundInvoiceCustomerDimensionalAnalysesData.selectShownTrl(this,vars.getLanguage(),strShown));
172     }
173
174     response.setContentType("text/html; charset=UTF-8");
175     PrintWriter out = response.getWriter();
176     out.println(xmlDocument.print());
177     out.close();
178   }
179
180   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 strsalesrepId, String JavaDoc strOrder, String JavaDoc strMayor, String JavaDoc strMenor, String JavaDoc strRatioMayor, String JavaDoc strRatioMenor) throws IOException, ServletException{
181     if (log4j.isDebugEnabled()) log4j.debug("Output: print html");
182     XmlDocument xmlDocument=null;
183     String JavaDoc strOrderby = "";
184     String JavaDoc[] discard = {"", "", "", "", "",""};
185     String JavaDoc[] discard1={"selEliminarBody1", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard", "discard"};
186     if (strComparative.equals("Y")) discard1[0] = "selEliminarBody2";
187     String JavaDoc strTitle = "";
188     strTitle = Utility.messageBD(this, "From", vars.getLanguage()) + " "+strDateFrom+" " + Utility.messageBD(this, "To", vars.getLanguage()) + " "+strDateTo;
189     if (!strPartnerGroup.equals("")) strTitle = strTitle + ", " + Utility.messageBD(this, "ForBPartnerGroup", vars.getLanguage()) + " "+ReportRefundInvoiceCustomerDimensionalAnalysesData.selectBpgroup(this, strPartnerGroup);
190     if (!strProductCategory.equals("")) strTitle = strTitle+", " + Utility.messageBD(this, "ProductCategory", vars.getLanguage()) + " "+ReportInvoiceCustomerDimensionalAnalysesData.selectProductCategory(this, strProductCategory);
191     if (!strsalesrepId.equals("")) strTitle = strTitle+" " + Utility.messageBD(this, "And", vars.getLanguage()) + " "+ Utility.messageBD(this, "TheSalesRep", vars.getLanguage()) + " "+ReportRefundInvoiceCustomerDimensionalAnalysesData.selectSalesrep(this, strsalesrepId);
192     ReportRefundInvoiceCustomerDimensionalAnalysesData[] data = null;
193     String JavaDoc[] strShownArray = {"", "", "", "", "", ""};
194     if (strShown.startsWith("(")) strShown = strShown.substring(1, strShown.length()-1);
195     if (!strShown.equals("")) {
196       strShown = Replace.replace(strShown, "'", "");
197       strShown = Replace.replace(strShown, " ", "");
198       StringTokenizer st = new StringTokenizer(strShown, ",", false);
199       int intContador = 0;
200       while (st.hasMoreTokens()){
201         strShownArray[intContador] = st.nextToken();
202         intContador++;
203       }
204
205     }
206     String JavaDoc[] strTextShow = {"", "", "", "", "",""};
207     int intDiscard = 0;
208     int intAuxDiscard = -1;
209     for (int i = 0; i<6; i++){
210       if (strShownArray[i].equals("1")) {
211         strTextShow[i] = "C_BP_GROUP.NAME";
212         intDiscard++;
213       }
214       else if (strShownArray[i].equals("2")) {
215         strTextShow[i] = "AD_COLUMN_IDENTIFIER(to_char('C_Bpartner'), to_char( C_BPARTNER.C_BPARTNER_ID), to_char( 'es_ES'))";
216         intDiscard++;
217       }
218       else if (strShownArray[i].equals("3")) {
219         strTextShow[i] = "M_PRODUCT_CATEGORY.NAME";
220         intDiscard++;
221       }
222       else if (strShownArray[i].equals("4")) {
223         strTextShow[i] = "AD_COLUMN_IDENTIFIER(to_char('M_Product'), to_char( M_PRODUCT.M_PRODUCT_ID), to_char( 'es_ES'))";
224         intAuxDiscard = i;
225       }
226       else if (strShownArray[i].equals("5")) {
227         strTextShow[i] = "C_INVOICE.DOCUMENTNO";
228         intDiscard++;
229       }
230       else if (strShownArray[i].equals("6")) {
231         strTextShow[i] = "AD_USER.FIRSTNAME||' '||' '||AD_USER.LASTNAME";
232         intDiscard++;
233       }
234       else {
235         strTextShow[i] = "''";
236         discard[i] = "display:none;";
237       }
238     }
239     if (intDiscard != 0){
240       int k=1;
241       strOrderby = " ORDER BY NIVEL"+k+",";
242       while (k<intDiscard){
243         strOrderby = strOrderby+"NIVEL"+k+",";
244         k++;
245       }
246       if (k==1){
247         if (strOrder.equals("Normal")){
248           strOrderby = " ORDER BY NIVEL"+k;
249         } else if (strOrder.equals("Amountasc")){
250           strOrderby = " ORDER BY LINENETAMT ASC";
251         } else if (strOrder.equals("Amountdesc")){
252           strOrderby = " ORDER BY LINENETAMT DESC";
253         } else if (strOrder.equals("Ratioasc")){
254           strOrderby = " ORDER BY RATIO ASC";
255         } else if (strOrder.equals("Ratiodesc")){
256           strOrderby = " ORDER BY RATIO DESC";
257         }else{
258           strOrderby = "1";
259         }
260       } else{
261         if (strOrder.equals("Normal")){
262           strOrderby += "NIVEL"+k;
263         } else if (strOrder.equals("Amountasc")){
264           strOrderby += "LINENETAMT ASC";
265         } else if (strOrder.equals("Amountdesc")){
266           strOrderby += "LINENETAMT DESC";
267         } else if (strOrder.equals("Ratioasc")){
268           strOrderby += "RATIO ASC";
269         } else if (strOrder.equals("Ratiodesc")){
270           strOrderby += "RATIO DESC";
271         } else{
272           strOrderby = "1";
273         }
274       }
275
276     } else{
277       strOrderby = " ORDER BY 1";
278     }
279     String JavaDoc strHaving = "";
280     if (!strMayor.equals("") && !strMenor.equals("")) {strHaving = " HAVING SUM(LINENETAMT) > "+strMayor+" AND SUM(LINENETAMT) < "+strMenor;}
281     else if (!strMayor.equals("") && strMenor.equals("")) {strHaving = " HAVING SUM(LINENETAMT) > "+strMayor;}
282     else if (strMayor.equals("") && !strMenor.equals("")) {strHaving = " HAVING SUM(LINENETAMT) < "+strMenor;}
283     else{}
284     if (strHaving.equals("")){
285       if (!strRatioMayor.equals("") && !strRatioMenor.equals("")) {strHaving = " HAVING DIVIDE(SUM(REFUNDAMT), (SUM(LINENETAMT)+SUM(REFUNDAMT)))*100 > "+strRatioMayor+" AND DIVIDE(SUM(REFUNDAMT), (SUM(LINENETAMT)+SUM(REFUNDAMT)))*100 < "+strRatioMenor;}
286       else if (!strRatioMayor.equals("") && strRatioMenor.equals("")) {strHaving = " HAVING DIVIDE(SUM(REFUNDAMT), (SUM(LINENETAMT)+SUM(REFUNDAMT)))*100 > "+strRatioMayor;}
287       else if (strRatioMayor.equals("") && !strRatioMenor.equals("")) {strHaving = " HAVING DIVIDE(SUM(REFUNDAMT), (SUM(LINENETAMT)+SUM(REFUNDAMT)))*100 < "+strRatioMenor;}
288       else{}
289     } else {
290       if (!strRatioMayor.equals("") && !strRatioMenor.equals("")) {strHaving = " AND DIVIDE(SUM(REFUNDAMT), (SUM(LINENETAMT)+SUM(REFUNDAMT)))*100 > "+strRatioMayor+" AND DIVIDE(SUM(REFUNDAMT), (SUM(LINENETAMT)+SUM(REFUNDAMT)))*100 < "+strRatioMenor;}
291       else if (!strRatioMayor.equals("") && strRatioMenor.equals("")) {strHaving = " AND DIVIDE(SUM(REFUNDAMT), (SUM(LINENETAMT)+SUM(REFUNDAMT)))*100 > "+strRatioMayor;}
292       else if (strRatioMayor.equals("") && !strRatioMenor.equals("")) {strHaving = " AND DIVIDE(SUM(REFUNDAMT), (SUM(LINENETAMT)+SUM(REFUNDAMT)))*100 < "+strRatioMenor;}
293       else{}
294     }
295     strOrderby = strHaving + strOrderby;
296     if (log4j.isDebugEnabled()) log4j.debug("*********************"+strOrderby);
297     if (strComparative.equals("Y")){
298       data = ReportRefundInvoiceCustomerDimensionalAnalysesData.select(this, strTextShow[0], strTextShow[1], strTextShow[2], strTextShow[3], strTextShow[4], strTextShow[5], Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg), Utility.getContext(this, vars, "#User_Client", "ReportRefundInvoiceCustomerDimensionalAnalyses"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strsalesrepId, strDateFromRef, DateTimeData.nDaysAfter(this, strDateToRef,"1"), strOrderby);
299     } else {
300       data = ReportRefundInvoiceCustomerDimensionalAnalysesData.selectNoComparative(this, strTextShow[0], strTextShow[1], strTextShow[2], strTextShow[3], strTextShow[4], strTextShow[5], Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg), Utility.getContext(this, vars, "#User_Client", "ReportRefundInvoiceCustomerDimensionalAnalyses"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strsalesrepId, strOrderby);
301     }
302     //data = ReportRefundInvoiceCustomerDimensionalAnalysesData.select(this, strTextShow[0], strTextShow[1], strTextShow[2], strTextShow[3], strTextShow[4], strTextShow[5], vars.getClient(), strOrg, Utility.getContext(this, vars, "#User_Client", "ReportRefundInvoiceCustomerDimensionalAnalyses"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), strPartnerGroup, strcBpartnerId, strProductCategory, strmProductId, strsalesrepId, strDateFromRef, DateTimeData.nDaysAfter(this, strDateToRef,"1"));
303
if (data.length == 0 || data == null){
304       //discard1[0] = "selEliminar1";
305
if (log4j.isDebugEnabled()) log4j.debug("**************************There's There's no data");
306       data = ReportRefundInvoiceCustomerDimensionalAnalysesData.set();
307     } else {
308       if (log4j.isDebugEnabled()) log4j.debug("************************data"+data[0].nivel1);
309       int contador = intDiscard;
310       if (intAuxDiscard != -1) contador = intAuxDiscard;
311       int k = 1;
312       if (strComparative.equals("Y")){
313         for (int j = contador; j>0; j--){
314           discard1[k] = "fieldTotalQtyNivel"+String.valueOf(j);
315           discard1[k+10] = "fieldTotalRefundQtyNivel"+String.valueOf(j);
316           discard1[k+20] = "fieldUomsymbol"+String.valueOf(j);
317           discard1[k+5] = "fieldTotalRefQtyNivel"+String.valueOf(j);
318           discard1[k+15] = "fieldTotalRefRefundQtyNivel"+String.valueOf(j);
319           k++;
320         }
321       } else {
322         for (int j = contador; j>0; j--){
323           discard1[k] = "fieldNoncomparativeTotalQtyNivel"+String.valueOf(j);
324           discard1[k+10] = "fieldNoncomparativeTotalRefundQtyNivel"+String.valueOf(j);
325           discard1[k+20] = "fieldNoncomparativeUomsymbol"+String.valueOf(j);
326           k++;
327         }
328       }
329
330     }
331     xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportRefundInvoiceCustomerDimensionalAnalysesEdition", discard1).createXmlDocument();
332
333     xmlDocument.setParameter("eliminar2", discard[1]);
334     xmlDocument.setParameter("eliminar3", discard[2]);
335     xmlDocument.setParameter("eliminar4", discard[3]);
336     xmlDocument.setParameter("eliminar5", discard[4]);
337     xmlDocument.setParameter("eliminar6", discard[5]);
338     xmlDocument.setParameter("title", strTitle);
339     xmlDocument.setParameter("constante", "100");
340     if (strComparative.equals("Y")){
341       xmlDocument.setData("structure1", data);
342     } else {
343       xmlDocument.setData("structure2", data);
344     }
345     response.setContentType("text/html; charset=UTF-8");
346     PrintWriter out = response.getWriter();
347     out.println(xmlDocument.print());
348     out.close();
349   }
350
351   public String JavaDoc getServletInfo() {
352     return "Servlet ReportRefundInvoiceCustomerDimensionalAnalyses. This Servlet was made by Jon Alegría";
353   } // end of getServletInfo() method
354
}
355
356
Popular Tags