details: https://code.openbravo.com/erp/devel/pi/rev/4425f34e62c7
changeset: 25770:4425f34e62c7
user: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date: Tue Jan 27 20:28:05 2015 +0100
summary: Fixes bug 28421: No of rows exceed when export journal entries
report to excel
Modified ReportGeneralLedgerJournal class to chek if data is empty or if it
contains more than 65532 rows
diffstat:
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java | 113
+++++----
1 files changed, 64 insertions(+), 49 deletions(-)
diffs (143 lines):
diff -r b71f486b4915 -r 4425f34e62c7
src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java
Wed Jan 28 17:29:42 2015 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.java
Tue Jan 27 20:28:05 2015 +0100
@@ -306,7 +306,7 @@
}
// vars.setSessionValue("ReportGeneralLedgerJournal.initRecordNumber",
"0");
setHistoryCommand(request, "DEFAULT");
- printPagePDF(response, vars, strDateFrom, strDateTo, strDocument,
strOrg, strTable,
+ printPagePDF(request, response, vars, strDateFrom, strDateTo,
strDocument, strOrg, strTable,
strRecord, strFactAcctGroupId, strcAcctSchemaId, strShowClosing,
strShowReg,
strShowOpening, strPageNo, strEntryNo,
"Y".equals(strShowDescription) ? "Y" : "",
strShowRegular, strShowDivideUp);
@@ -638,12 +638,12 @@
return data;
}
- private void printPagePDF(HttpServletResponse response, VariablesSecureApp
vars,
- String strDateFrom, String strDateTo, String strDocument, String strOrg,
String strTable,
- String strRecord, String strFactAcctGroupId, String strcAcctSchemaId,
String strShowClosing,
- String strShowReg, String strShowOpening, String strPageNo, String
strEntryNo,
- String strShowDescription, String strShowRegular, String
strShowDivideUp) throws IOException,
- ServletException {
+ private void printPagePDF(HttpServletRequest request, HttpServletResponse
response,
+ VariablesSecureApp vars, String strDateFrom, String strDateTo, String
strDocument,
+ String strOrg, String strTable, String strRecord, String
strFactAcctGroupId,
+ String strcAcctSchemaId, String strShowClosing, String strShowReg,
String strShowOpening,
+ String strPageNo, String strEntryNo, String strShowDescription, String
strShowRegular,
+ String strShowDivideUp) throws IOException, ServletException {
ReportGeneralLedgerJournalData[] data = null;
@@ -670,54 +670,69 @@
Utility.getContext(this, vars, "#AccessibleOrgTree",
"ReportGeneralLedger"), strTable,
strRecord, strcAcctSchemaId, vars.getLanguage());
- String strSubtitle = (Utility.messageBD(this, "LegalEntity",
vars.getLanguage()) + ": ")
- + ReportGeneralLedgerJournalData.selectCompany(this, vars.getClient())
+ "\n";
- ;
+ if (data == null || data.length == 0) {
+ advisePopUp(request, response, "WARNING",
+ Utility.messageBD(this, "ProcessStatus-W", vars.getLanguage()),
+ Utility.messageBD(this, "NoDataFound", vars.getLanguage()));
+ }
- SimpleDateFormat javaSDF = new SimpleDateFormat(vars.getJavaDateFormat());
- SimpleDateFormat sqlSDF = new
SimpleDateFormat(vars.getSqlDateFormat().replace('Y', 'y')
- .replace('D', 'd'));
+ else if (vars.commandIn("XLS") && data.length > 65532) {
+ advisePopUp(request, response, "ERROR",
+ Utility.messageBD(this, "ProcessStatus-E", vars.getLanguage()),
+ Utility.messageBD(this, "numberOfRowsExceeded", vars.getLanguage()));
+ }
- if (!("0".equals(strOrg)))
- strSubtitle += (Utility.messageBD(this, "OBUIAPP_Organization",
vars.getLanguage()) + ": ")
- + ReportGeneralLedgerJournalData.selectOrg(this, strOrg) + "\n";
+ else {
- if (!"".equals(strDateFrom) || !"".equals(strDateTo))
- try {
- strSubtitle += (Utility.messageBD(this, "From", vars.getLanguage()) +
": ")
- + ((!"".equals(strDateFrom)) ?
javaSDF.format(sqlSDF.parse(strDateFrom)) : "") + " "
- + (Utility.messageBD(this, "OBUIAPP_To", vars.getLanguage()) + ":
")
- + ((!"".equals(strDateTo)) ?
javaSDF.format(sqlSDF.parse(strDateTo)) : "") + "\n";
- } catch (ParseException e) {
- log4j.error("Error when parsing dates", e);
+ String strSubtitle = (Utility.messageBD(this, "LegalEntity",
vars.getLanguage()) + ": ")
+ + ReportGeneralLedgerJournalData.selectCompany(this,
vars.getClient()) + "\n";
+ ;
+
+ SimpleDateFormat javaSDF = new
SimpleDateFormat(vars.getJavaDateFormat());
+ SimpleDateFormat sqlSDF = new
SimpleDateFormat(vars.getSqlDateFormat().replace('Y', 'y')
+ .replace('D', 'd'));
+
+ if (!("0".equals(strOrg)))
+ strSubtitle += (Utility.messageBD(this, "OBUIAPP_Organization",
vars.getLanguage()) + ": ")
+ + ReportGeneralLedgerJournalData.selectOrg(this, strOrg) + "\n";
+
+ if (!"".equals(strDateFrom) || !"".equals(strDateTo))
+ try {
+ strSubtitle += (Utility.messageBD(this, "From", vars.getLanguage())
+ ": ")
+ + ((!"".equals(strDateFrom)) ?
javaSDF.format(sqlSDF.parse(strDateFrom)) : "") + " "
+ + (Utility.messageBD(this, "OBUIAPP_To", vars.getLanguage()) +
": ")
+ + ((!"".equals(strDateTo)) ?
javaSDF.format(sqlSDF.parse(strDateTo)) : "") + "\n";
+ } catch (ParseException e) {
+ log4j.error("Error when parsing dates", e);
+ }
+
+ if (!"".equals(strcAcctSchemaId)) {
+ AcctSchema financialMgmtAcctSchema =
OBDal.getInstance().get(AcctSchema.class,
+ strcAcctSchemaId);
+ strSubtitle += Utility.messageBD(this, "generalLedger",
vars.getLanguage()) + ": "
+ + financialMgmtAcctSchema.getName();
}
- if (!"".equals(strcAcctSchemaId)) {
- AcctSchema financialMgmtAcctSchema =
OBDal.getInstance().get(AcctSchema.class,
- strcAcctSchemaId);
- strSubtitle += Utility.messageBD(this, "generalLedger",
vars.getLanguage()) + ": "
- + financialMgmtAcctSchema.getName();
+ String strOutput;
+ String strReportName;
+ if (vars.commandIn("PDF")) {
+ strOutput = "pdf";
+ strReportName =
"@basedesign@/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.jrxml";
+ } else {
+ strOutput = "xls";
+ strReportName =
"@basedesign@/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournalExcel.jrxml";
+ }
+
+ HashMap<String, Object> parameters = new HashMap<String, Object>();
+ parameters.put("ShowDescription", strShowDescription);
+ parameters.put("Subtitle", strSubtitle);
+ parameters.put("PageNo", strPageNo);
+ parameters.put("InitialEntryNumber", strEntryNo);
+ parameters.put("TaxID",
ReportGeneralLedgerJournalData.selectOrgTaxID(this, strOrg));
+ parameters.put("strDateFormat", vars.getJavaDateFormat());
+ renderJR(vars, response, strReportName, "JournalEntriesReport",
strOutput, parameters, data,
+ null);
}
-
- String strOutput;
- String strReportName;
- if (vars.commandIn("PDF")) {
- strOutput = "pdf";
- strReportName =
"@basedesign@/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.jrxml";
- } else {
- strOutput = "xls";
- strReportName =
"@basedesign@/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournalExcel.jrxml";
- }
-
- HashMap<String, Object> parameters = new HashMap<String, Object>();
- parameters.put("ShowDescription", strShowDescription);
- parameters.put("Subtitle", strSubtitle);
- parameters.put("PageNo", strPageNo);
- parameters.put("InitialEntryNumber", strEntryNo);
- parameters.put("TaxID",
ReportGeneralLedgerJournalData.selectOrgTaxID(this, strOrg));
- parameters.put("strDateFormat", vars.getJavaDateFormat());
- renderJR(vars, response, strReportName, "JournalEntriesReport", strOutput,
parameters, data,
- null);
}
private String getFamily(String strTree, String strChild) throws
IOException, ServletException {
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits