1 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.erpCommon.businessUtility.Tree; 24 import org.openbravo.erpCommon.businessUtility.TreeData; 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 javax.servlet.*; 30 import javax.servlet.http.*; 31 import org.openbravo.erpCommon.ad_combos.OrganizationComboData; 32 33 import org.openbravo.erpCommon.utility.DateTimeData; 34 35 36 37 38 public class ReportTaxInvoice extends HttpSecureAppServlet { 39 40 public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException { 41 VariablesSecureApp vars = new VariablesSecureApp(request); 42 43 if (vars.commandIn("DEFAULT")) { 44 String strDateFrom = vars.getGlobalVariable("inpDateFrom", "ReportTaxInvoice|DateFrom", ""); 45 String strDateTo = vars.getGlobalVariable("inpDateTo", "ReportTaxInvoice|DateTo", ""); 46 String strOrg = vars.getGlobalVariable("inpOrg", "ReportTaxInvoice|Org", "0"); 47 String strDetail = vars.getStringParameter("inpDetalle", "-1"); 48 String strSales = vars.getStringParameter("inpSales", "S"); 49 printPageDataSheet(response, vars, strDateFrom, strDateTo, strOrg, strDetail, strSales); 50 } else if (vars.commandIn("FIND")) { 51 String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom", "ReportTaxInvoice|DateFrom"); 52 String strDateTo = vars.getRequestGlobalVariable("inpDateTo", "ReportTaxInvoice|DateTo"); 53 String strOrg = vars.getRequestGlobalVariable("inpOrg", "ReportTaxInvoice|Org"); 54 if (strOrg.equals("")) strOrg = "0"; 55 String strDetail = vars.getStringParameter("inpDetalle"); 56 String strSales = vars.getStringParameter("inpSales"); 57 printPageDataHtml(response, vars, strDateFrom, strDateTo, strOrg, strDetail, strSales); 58 } else if (vars.commandIn("RELATION_XLS")) { 59 String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom", "ReportTaxInvoice|DateFrom"); 60 String strDateTo = vars.getRequestGlobalVariable("inpDateTo", "ReportTaxInvoice|DateTo"); 61 String strOrg = vars.getRequestGlobalVariable("inpOrg", "ReportTaxInvoice|Org"); 62 if (strOrg.equals("")) strOrg = "0"; 63 String strDetail = vars.getStringParameter("inpDetalle"); 64 String strSales = vars.getStringParameter("inpSales"); 65 printPageDataExcel(response, vars, strDateFrom, strDateTo, strOrg, strDetail, strSales); 66 } else pageError(response); 67 } 68 69 void printPageDataHtml(HttpServletResponse response, VariablesSecureApp vars, String strDateFrom, String strDateTo, String strOrg, String strDetail, String strSales) 70 throws IOException, ServletException { 71 if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet"); 72 response.setContentType("text/html; charset=UTF-8"); 73 PrintWriter out = response.getWriter(); 74 XmlDocument xmlDocument=null; 75 ReportTaxInvoiceData[] dataSale=null; 76 ReportTaxInvoiceData[] data2Sale=null; 77 ReportTaxInvoiceData[] dataPurchase=null; 78 ReportTaxInvoiceData[] data2Purchase=null; 79 String strSalesAux; 80 String strTitle = "FACTURAS CON EL EXTRANJERO"; 81 String strSale = ""; 82 String strPurchase = ""; 83 String discard[] = {"discard", "discard", "discard", "discard"}; 84 if (log4j.isDebugEnabled()) log4j.debug("****** strSales: " + strSales + " fecha desde: " + strDateFrom + " fecha hasta: " + strDateTo + " detalle: " + strDetail); 85 87 if (strDateFrom.equals("") && strDateTo.equals("") && strDetail.equals("-1")) { 88 printPageDataSheet(response, vars, strDateFrom, strDateTo, strOrg, strDetail, strSales); 89 } else if (!strDetail.equals("-1")){ 90 if (log4j.isDebugEnabled()) log4j.debug("****** not datailed"); 91 discard[0] = "selEliminarSale"; 92 discard[1] = "selEliminar1Sale"; 93 discard[2] = "selEliminarPurchase"; 94 discard[3] = "selEliminar1Purchase"; 95 if (strSales.equals("S")) { 96 dataSale = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 97 data2Sale = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 98 strSale = Utility.messageBD(this, "Sale", vars.getLanguage()); 99 } else if (strSales.equals("P")) { 100 dataPurchase = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 101 data2Purchase = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 102 strPurchase = Utility.messageBD(this, "Purchase", vars.getLanguage()); 103 } else { 104 dataSale = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 105 data2Sale = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 106 dataPurchase = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 107 data2Purchase = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 108 strSale = Utility.messageBD(this, "Sale", vars.getLanguage()); 109 strPurchase = Utility.messageBD(this, "Purchase", vars.getLanguage()); 110 } 111 } else { 112 if (log4j.isDebugEnabled()) log4j.debug("****** detailed"); 113 if (strSales.equals("S")) { 114 dataSale = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 115 data2Sale = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 116 strSale = Utility.messageBD(this, "Sale", vars.getLanguage()); 117 } else if (strSales.equals("P")) { 118 dataPurchase = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 119 data2Purchase = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 120 strPurchase = Utility.messageBD(this, "Purchase", vars.getLanguage()); 121 } else { 122 dataSale = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 123 data2Sale = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 124 dataPurchase = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 125 data2Purchase = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 126 strSale = Utility.messageBD(this, "Sale", vars.getLanguage()); 127 strPurchase = Utility.messageBD(this, "Purchase", vars.getLanguage()); 128 } 129 } 130 if (log4j.isDebugEnabled()) log4j.debug("****** strSale: " + strSale + " strPurchase: " + strPurchase); 131 if (log4j.isDebugEnabled()) log4j.debug("****** check nulls"); 132 if (dataSale == null || dataSale.length == 0){ 133 discard [0] = "sectionTaxSale"; 134 dataSale = ReportTaxInvoiceData.set(); 135 } 136 if (data2Sale == null || data2Sale.length == 0){ 137 discard [1] = "sectionTaxForeignSale"; 138 strTitle = ""; 139 data2Sale = ReportTaxInvoiceData.set(); 140 } 141 if (dataPurchase == null || dataPurchase.length == 0){ 142 discard [2] = "sectionTaxPurchase"; 143 dataPurchase = ReportTaxInvoiceData.set(); 144 } 145 if (data2Purchase == null || data2Purchase.length == 0){ 146 discard [3] = "sectionTaxForeignPurchase"; 147 strTitle = ""; 148 data2Purchase = ReportTaxInvoiceData.set(); 149 } 150 if (log4j.isDebugEnabled()) log4j.debug("****** xmlDocument"); 151 xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportTaxInvoiceEdit", discard).createXmlDocument(); 152 153 154 155 156 if (log4j.isDebugEnabled()) log4j.debug("****** setData dataSale"); 157 xmlDocument.setData("structure1Sale", dataSale); 158 if (log4j.isDebugEnabled()) log4j.debug("****** setData data2Sale"); 159 xmlDocument.setData("structure2Sale", data2Sale); 160 if (log4j.isDebugEnabled()) log4j.debug("****** setData dataPurchase"); 161 xmlDocument.setData("structure1Purchase", dataPurchase); 162 if (log4j.isDebugEnabled()) log4j.debug("****** setData data2Purchase"); 163 xmlDocument.setData("structure2Purchase", data2Purchase); 164 165 xmlDocument.setParameter("titleSale", strTitle); 166 xmlDocument.setParameter("titlePurchase", strTitle); 167 xmlDocument.setParameter("sale", strSale); 168 xmlDocument.setParameter("purchase", strPurchase); 169 out.println(xmlDocument.print()); 170 out.close(); 171 } 172 173 void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars, String strDateFrom, String strDateTo, String strOrg, String strDetail, String strSales) 174 throws IOException, ServletException { 175 if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet"); 176 response.setContentType("text/html; charset=UTF-8"); 177 PrintWriter out = response.getWriter(); 178 XmlDocument xmlDocument=null; 179 180 String strSalesAux; 181 String strTitle = "FACTURAS CON EL EXTRANJERO"; 182 String strSale = ""; 183 String strPurchase = ""; 184 String discard[] = {"discard", "discard", "discard", "discard"}; 185 if (log4j.isDebugEnabled()) log4j.debug("****** strSales: " + strSales + " fecha desde: " + strDateFrom + " fecha hasta: " + strDateTo + " detalle: " + strDetail); 186 187 188 189 if (log4j.isDebugEnabled()) log4j.debug("****** xmlDocument"); 190 xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportTaxInvoice", discard).createXmlDocument(); 191 192 ToolBar toolbar = new ToolBar(this, vars.getLanguage(), "ReportTaxInvoice", false, "", "", "",false, "ad_reports", strReplaceWith, false, true); 193 toolbar.prepareSimpleExcelToolBarTemplate("submitCommandForm('RELATION_XLS', false, null, 'ReportTaxInvoice_Excel.xls', 'EXCEL');return false;"); 194 xmlDocument.setParameter("toolbar", toolbar.toString()); 195 196 try { 197 KeyMap key = new KeyMap(this, vars, "ReportTaxInvoice.html"); 198 xmlDocument.setParameter("keyMap", key.getReportKeyMaps()); 199 } catch (Exception ex) { 200 throw new ServletException(ex); 201 } 202 try { 203 WindowTabs tabs = new WindowTabs(this, vars, "org.openbravo.erpCommon.ad_reports.ReportTaxInvoice"); 204 xmlDocument.setParameter("parentTabContainer", tabs.parentTabs()); 205 xmlDocument.setParameter("mainTabContainer", tabs.mainTabs()); 206 xmlDocument.setParameter("childTabContainer", tabs.childTabs()); 207 xmlDocument.setParameter("theme", vars.getTheme()); 208 NavigationBar nav = new NavigationBar(this, vars.getLanguage(), "ReportTaxInvoice.html", classInfo.id, classInfo.type, strReplaceWith, tabs.breadcrumb()); 209 xmlDocument.setParameter("navigationBar", nav.toString()); 210 LeftTabsBar lBar = new LeftTabsBar(this, vars.getLanguage(), "ReportTaxInvoice.html", strReplaceWith); 211 xmlDocument.setParameter("leftTabs", lBar.manualTemplate()); 212 } catch (Exception ex) { 213 throw new ServletException(ex); 214 } 215 { 216 OBError myMessage = vars.getMessage("ReportTaxInvoice"); 217 vars.removeMessage("ReportTaxInvoice"); 218 if (myMessage!=null) { 219 xmlDocument.setParameter("messageType", myMessage.getType()); 220 xmlDocument.setParameter("messageTitle", myMessage.getTitle()); 221 xmlDocument.setParameter("messageMessage", myMessage.getMessage()); 222 } 223 } 224 225 xmlDocument.setParameter("calendar", vars.getLanguage().substring(0,2)); 226 xmlDocument.setParameter("direction", "var baseDirection = \"" + strReplaceWith + "/\";\n"); 227 xmlDocument.setParameter("paramLanguage", "LNG_POR_DEFECTO=\"" + vars.getLanguage() + "\";"); 228 xmlDocument.setParameter("dateFrom", strDateFrom); 229 xmlDocument.setParameter("dateFromdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat")); 230 xmlDocument.setParameter("dateFromsaveFormat", vars.getSessionValue("#AD_SqlDateFormat")); 231 xmlDocument.setParameter("dateTo", strDateTo); 232 xmlDocument.setParameter("dateTodisplayFormat", vars.getSessionValue("#AD_SqlDateFormat")); 233 xmlDocument.setParameter("dateTosaveFormat", vars.getSessionValue("#AD_SqlDateFormat")); 234 xmlDocument.setParameter("detalle", strDetail); 235 xmlDocument.setParameter("psale", strSales); 236 xmlDocument.setParameter("ppurchase", strSales); 237 xmlDocument.setParameter("pboth", strSales); 238 xmlDocument.setParameter("adOrgId", strOrg); 239 xmlDocument.setParameter("titleSale", strTitle); 240 xmlDocument.setParameter("titlePurchase", strTitle); 241 xmlDocument.setParameter("sale", strSale); 242 xmlDocument.setParameter("purchase", strPurchase); 243 if (log4j.isDebugEnabled()) log4j.debug("****** setData reportAD_ORGID"); 244 246 xmlDocument.setData("reportAD_ORGID", "liststructure", OrganizationComboData.selectCombo(this, vars.getRole())); 247 248 out.println(xmlDocument.print()); 249 out.close(); 250 } 251 252 410 411 412 void printPageDataExcel(HttpServletResponse response, VariablesSecureApp vars, String strDateFrom, String strDateTo, String strOrg, String strDetail, String strSales) 413 throws IOException, ServletException { 414 if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet"); 415 response.setContentType("application/xls"); 416 PrintWriter out = response.getWriter(); 417 XmlDocument xmlDocument=null; 418 ReportTaxInvoiceData[] dataSale=null; 419 ReportTaxInvoiceData[] data2Sale=null; 420 ReportTaxInvoiceData[] dataPurchase=null; 421 ReportTaxInvoiceData[] data2Purchase=null; 422 String strSalesAux; 423 String strTitle = "FACTURAS CON EL EXTRANJERO"; 424 String strSale = ""; 425 String strPurchase = ""; 426 String discard[] = {"discard", "discard", "discard", "discard"}; 427 if (log4j.isDebugEnabled()) log4j.debug("****** strSales: " + strSales + " fecha desde: " + strDateFrom + " fecha hasta: " + strDateTo + " detalle: " + strDetail); 428 430 if (strDateFrom.equals("") && strDateTo.equals("")) { 431 if (log4j.isDebugEnabled()) log4j.debug("****** all null"); 432 discard[0] = "sectionDetailSale"; 433 discard[1] = "sectionDetail1Sale"; 434 discard[2] = "sectionDetailPurchase"; 435 discard[3] = "sectionDetail1Purchase"; 436 strTitle = ""; 437 dataSale = ReportTaxInvoiceData.set(); 438 data2Sale = ReportTaxInvoiceData.set(); 439 dataPurchase = ReportTaxInvoiceData.set(); 440 data2Purchase = ReportTaxInvoiceData.set(); 441 } else { 442 if (log4j.isDebugEnabled()) log4j.debug("****** detailed"); 443 if (strSales.equals("S")) { 444 dataSale = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 445 data2Sale = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 446 strSale = Utility.messageBD(this, "Sale", vars.getLanguage()); 447 } else if (strSales.equals("P")) { 448 dataPurchase = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 449 data2Purchase = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 450 strPurchase = Utility.messageBD(this, "Purchase", vars.getLanguage()); 451 } else { 452 dataSale = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 453 data2Sale = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "Y", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 454 dataPurchase = ReportTaxInvoiceData.select(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 455 data2Purchase = ReportTaxInvoiceData.selectForeign(this, Utility.getContext(this, vars, "C_Country_Id", "ReportTaxInvoice"), Utility.getContext(this, vars, "#User_Client", "ReportTaxInvoice"), strDateFrom, DateTimeData.nDaysAfter(this, strDateTo,"1"), "N", Tree.getMembers(this, TreeData.getTreeOrg(this, vars.getClient()), strOrg)); 456 strSale = Utility.messageBD(this, "Sale", vars.getLanguage()); 457 strPurchase = Utility.messageBD(this, "Purchase", vars.getLanguage()); 458 } 459 } 460 if (log4j.isDebugEnabled()) log4j.debug("****** strSale: " + strSale + " strPurchase: " + strPurchase); 461 if (log4j.isDebugEnabled()) log4j.debug("****** check nulls"); 462 if (dataSale == null || dataSale.length == 0){ 463 discard [0] = "sectionDetailSale"; 464 dataSale = ReportTaxInvoiceData.set(); 465 } 466 if (data2Sale == null || data2Sale.length == 0){ 467 discard [1] = "sectionDetail1Sale"; 468 strTitle = ""; 469 data2Sale = ReportTaxInvoiceData.set(); 470 } 471 if (dataPurchase == null || dataPurchase.length == 0){ 472 discard [2] = "sectionDetailPurchase"; 473 dataPurchase = ReportTaxInvoiceData.set(); 474 } 475 if (data2Purchase == null || data2Purchase.length == 0){ 476 discard [3] = "sectionDetail1Purchase"; 477 strTitle = ""; 478 data2Purchase = ReportTaxInvoiceData.set(); 479 } 480 if (log4j.isDebugEnabled()) log4j.debug("****** xmlDocument"); 481 xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_reports/ReportTaxInvoice_Excel", discard).createXmlDocument(); 482 483 xmlDocument.setData("structure1Sale", dataSale); 484 xmlDocument.setData("structure2Sale", data2Sale); 485 xmlDocument.setData("structure1Purchase", dataPurchase); 486 xmlDocument.setData("structure2Purchase", data2Purchase); 487 out.println(xmlDocument.print()); 488 out.close(); 489 } 490 491 public String getServletInfo() { 492 return "Servlet ReportTaxInvoice. This Servlet was made by Jon Alegria"; 493 } } 495 | Popular Tags |