details: https://code.openbravo.com/erp/devel/pi/rev/e368bb414b7e changeset: 29857:e368bb414b7e user: Sanjota <sanjota.nelagi <at> promantia.com> date: Mon Jul 11 22:13:15 2016 +0200 summary: Fixes issue 33460 : New field for comparing ref year in Balance sheet & PL rep.
New field "Compare To" created to have reference year as optional Code reference from org.openbravo.report.improved.balancesheet module. details: https://code.openbravo.com/erp/devel/pi/rev/7fa430ed866b changeset: 29858:7fa430ed866b user: Víctor Martínez Romanos <victor.martinez <at> openbravo.com> date: Tue Aug 09 09:50:55 2016 +0200 summary: Fixed issue 33460: code review improvements Avoid NullPointerException in non-compartive mode In JasperReport: * Band height for details restored to 15, so we have the same number of lines as before the change * Period N-1 label only shown in comparative mode details: https://code.openbravo.com/erp/devel/pi/rev/1e59b5f3ed0a changeset: 29859:1e59b5f3ed0a user: Víctor Martínez Romanos <victor.martinez <at> openbravo.com> date: Tue Aug 09 11:24:49 2016 +0200 summary: Fixed issue 33460: fixed dbcons diffstat: src-db/database/sourcedata/AD_TEXTINTERFACES.xml | 33 ++- src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.html | 18 +- src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java | 89 +++++--- src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.xml | 1 + src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.jrxml | 102 ++++++--- src/org/openbravo/erpCommon/businessUtility/AccountTree_data.xsql | 6 +- 6 files changed, 166 insertions(+), 83 deletions(-) diffs (truncated from 560 to 300 lines): diff -r 16c58ee3abf0 -r 1e59b5f3ed0a src-db/database/sourcedata/AD_TEXTINTERFACES.xml --- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml Thu Aug 11 16:37:05 2016 +0000 +++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml Tue Aug 09 11:24:49 2016 +0200 @@ -13930,6 +13930,17 @@ <!--3970C02EB23F4983A349D2726F5F4BF6--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> <!--3970C02EB23F4983A349D2726F5F4BF6--></AD_TEXTINTERFACES> +<!--39A0FA8EF38721A1E0530100007FB0C3--><AD_TEXTINTERFACES> +<!--39A0FA8EF38721A1E0530100007FB0C3--> <AD_TEXTINTERFACES_ID><![CDATA[39A0FA8EF38721A1E0530100007FB0C3]]></AD_TEXTINTERFACES_ID> +<!--39A0FA8EF38721A1E0530100007FB0C3--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--39A0FA8EF38721A1E0530100007FB0C3--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--39A0FA8EF38721A1E0530100007FB0C3--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--39A0FA8EF38721A1E0530100007FB0C3--> <TEXT><![CDATA[Period N-1:]]></TEXT> +<!--39A0FA8EF38721A1E0530100007FB0C3--> <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.jrxml]]></FILENAME> +<!--39A0FA8EF38721A1E0530100007FB0C3--> <ISUSED><![CDATA[Y]]></ISUSED> +<!--39A0FA8EF38721A1E0530100007FB0C3--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> +<!--39A0FA8EF38721A1E0530100007FB0C3--></AD_TEXTINTERFACES> + <!--39F1C6FF551B4210BE3EC6F1904DE43B--><AD_TEXTINTERFACES> <!--39F1C6FF551B4210BE3EC6F1904DE43B--> <AD_TEXTINTERFACES_ID><![CDATA[39F1C6FF551B4210BE3EC6F1904DE43B]]></AD_TEXTINTERFACES_ID> <!--39F1C6FF551B4210BE3EC6F1904DE43B--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> @@ -14249,17 +14260,6 @@ <!--48AF9E125D2143669AFAAA89D52473D3--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> <!--48AF9E125D2143669AFAAA89D52473D3--></AD_TEXTINTERFACES> -<!--48B16F0CEB9E47D4BF0963C89D22504D--><AD_TEXTINTERFACES> -<!--48B16F0CEB9E47D4BF0963C89D22504D--> <AD_TEXTINTERFACES_ID><![CDATA[48B16F0CEB9E47D4BF0963C89D22504D]]></AD_TEXTINTERFACES_ID> -<!--48B16F0CEB9E47D4BF0963C89D22504D--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> -<!--48B16F0CEB9E47D4BF0963C89D22504D--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> -<!--48B16F0CEB9E47D4BF0963C89D22504D--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> -<!--48B16F0CEB9E47D4BF0963C89D22504D--> <TEXT><![CDATA[Period N-1]]></TEXT> -<!--48B16F0CEB9E47D4BF0963C89D22504D--> <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.jrxml]]></FILENAME> -<!--48B16F0CEB9E47D4BF0963C89D22504D--> <ISUSED><![CDATA[Y]]></ISUSED> -<!--48B16F0CEB9E47D4BF0963C89D22504D--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> -<!--48B16F0CEB9E47D4BF0963C89D22504D--></AD_TEXTINTERFACES> - <!--4A2CBA2EA7EF4F01843340C1921843F1--><AD_TEXTINTERFACES> <!--4A2CBA2EA7EF4F01843340C1921843F1--> <AD_TEXTINTERFACES_ID><![CDATA[4A2CBA2EA7EF4F01843340C1921843F1]]></AD_TEXTINTERFACES_ID> <!--4A2CBA2EA7EF4F01843340C1921843F1--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> @@ -14414,6 +14414,17 @@ <!--4D6F7EFED00711DDBE8C001D09C4A2FE--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> <!--4D6F7EFED00711DDBE8C001D09C4A2FE--></AD_TEXTINTERFACES> +<!--4DE64DE174C34EA2AC63A7522575A600--><AD_TEXTINTERFACES> +<!--4DE64DE174C34EA2AC63A7522575A600--> <AD_TEXTINTERFACES_ID><![CDATA[4DE64DE174C34EA2AC63A7522575A600]]></AD_TEXTINTERFACES_ID> +<!--4DE64DE174C34EA2AC63A7522575A600--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--4DE64DE174C34EA2AC63A7522575A600--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--4DE64DE174C34EA2AC63A7522575A600--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--4DE64DE174C34EA2AC63A7522575A600--> <TEXT><![CDATA[Compare To]]></TEXT> +<!--4DE64DE174C34EA2AC63A7522575A600--> <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.html]]></FILENAME> +<!--4DE64DE174C34EA2AC63A7522575A600--> <ISUSED><![CDATA[Y]]></ISUSED> +<!--4DE64DE174C34EA2AC63A7522575A600--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> +<!--4DE64DE174C34EA2AC63A7522575A600--></AD_TEXTINTERFACES> + <!--4E80DAAC37BB49D09A8EF2737160FEF5--><AD_TEXTINTERFACES> <!--4E80DAAC37BB49D09A8EF2737160FEF5--> <AD_TEXTINTERFACES_ID><![CDATA[4E80DAAC37BB49D09A8EF2737160FEF5]]></AD_TEXTINTERFACES_ID> <!--4E80DAAC37BB49D09A8EF2737160FEF5--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff -r 16c58ee3abf0 -r 1e59b5f3ed0a src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.html --- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.html Thu Aug 11 16:37:05 2016 +0000 +++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.html Tue Aug 09 11:24:49 2016 +0200 @@ -85,7 +85,7 @@ setWindowElementFocus(frm.inpAgno); showJSMessage(7); return false; - } else if (frm.inpAgnoRef.value == null || frm.inpAgnoRef.value == "") { + } else if (frm.inpCompareTo.checked && (frm.inpAgnoRef.value == null || frm.inpAgnoRef.value == "")) { setWindowElementFocus(frm.inpAgnoRef); showJSMessage(7); return false; @@ -171,6 +171,13 @@ } } +function onClickCompare() { + if(document.frmMain.inpCompareTo.checked) + displayLogicElement('trReferenceDetails', true); + else + displayLogicElement('trReferenceDetails', false); +} + function onloadFunctions() { } </script> @@ -490,8 +497,15 @@ </TABLE> </TD> </tr> + + <!-- Improved Balance Sheet --> + <tr> + <td class="TitleCell"><span class="LabelText">Compare To</span></td> + <td class="Radio_Check_ContentCell"><input name="inpCompareTo" type="checkbox" id="fieldCompareTo" value="Y" onclick="onClickCompare();"></input></td> + </tr> + <!-- Improved Balance Sheet --> - <tr> + <tr id="trReferenceDetails"> <td class="TitleCell"><span class="LabelText">Reference Year</span></td> <td class="Combo_ContentCell"> <SELECT name="inpAgnoRef" id="paramAgnoRef" class="ComboKey Combo_OneCell_width" onchange="displayLogic(); return true;"> <OPTION value=""></OPTION> diff -r 16c58ee3abf0 -r 1e59b5f3ed0a src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java --- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java Thu Aug 11 16:37:05 2016 +0000 +++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java Tue Aug 09 11:24:49 2016 +0200 @@ -94,14 +94,19 @@ "GeneralAccountingReports|conImporte", "N"); String strConCodigo = vars.getGlobalVariable("inpConCodigo", "GeneralAccountingReports|conCodigo", "N"); + /* Improved Balance Sheet */ + String strCompareTo = vars.getGlobalVariable("inpCompareTo", + "GeneralAccountingReports|compareTo", "Y"); + String strLevel = vars.getGlobalVariable("inpLevel", "GeneralAccountingReports|level", ""); printPageDataSheet(response, vars, "", "", strDateFrom, strDateTo, strPageNo, strDateFromRef, strDateToRef, strAsDateTo, strAsDateToRef, strElementValue, strConImporte, "", strLevel, - strConCodigo, ""); + strConCodigo, "", strCompareTo); } else if (vars.commandIn("FIND")) { String strcAcctSchemaId = vars.getStringParameter("inpcAcctSchemaId", ""); String strAgno = vars.getRequiredGlobalVariable("inpAgno", "GeneralAccountingReports|agno"); - String strAgnoRef = vars.getRequiredGlobalVariable("inpAgnoRef", + /* Improved Balance Sheet */ + String strAgnoRef = vars.getRequestGlobalVariable("inpAgnoRef", "GeneralAccountingReports|agnoRef"); String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom", "GeneralAccountingReports|dateFrom"); @@ -123,12 +128,15 @@ "GeneralAccountingReports|conImporte"); String strConCodigo = vars.getRequestGlobalVariable("inpConCodigo", "GeneralAccountingReports|conCodigo"); + /* Improved Balance Sheet */ + String strCompareTo = vars.getRequestGlobalVariable("inpCompareTo", + "GeneralAccountingReports|compareTo"); String strOrg = vars.getRequestGlobalVariable("inpOrganizacion", "GeneralAccountingReports|organizacion"); String strLevel = vars.getRequestGlobalVariable("inpLevel", "GeneralAccountingReports|level"); printPagePDF(request, response, vars, strAgno, strAgnoRef, strDateFrom, strDateTo, strDateFromRef, strDateToRef, strAsDateTo, strAsDateToRef, strElementValue, - strConImporte, strOrg, strLevel, strConCodigo, strcAcctSchemaId, strPageNo); + strConImporte, strOrg, strLevel, strConCodigo, strcAcctSchemaId, strPageNo, strCompareTo); } else if (vars.commandIn("LEDGER")) { String strOrg = vars.getStringParameter("inpOrganizacion"); if (StringUtils.isEmpty(strOrg)) { @@ -150,8 +158,8 @@ VariablesSecureApp vars, String strYearId, String strYearRefId, String strDateFrom, String strDateTo, String strDateFromRef, String strDateToRef, String strAsDateTo, String strAsDateToRef, String strElementValue, String strConImporte, String strOrg, - String strLevel, String strConCodigo, String strcAcctSchemaId, String strPageNo) - throws IOException, ServletException { + String strLevel, String strConCodigo, String strcAcctSchemaId, String strPageNo, + String strCompareTo) throws IOException, ServletException { String localStrElementValue = strElementValue; String localStrDateToRef = strDateToRef; String localStrDateFrom = strDateFrom; @@ -201,7 +209,13 @@ Year year = OBDal.getInstance().get(Year.class, strYearId); Year yearRef = OBDal.getInstance().get(Year.class, strYearRefId); HashMap<String, Date> startingEndingDate = getStartingEndingDate(year); - HashMap<String, Date> startingEndingDateRef = getStartingEndingDate(yearRef); + /* Improved Balance Sheet */ + String yrRef = ""; + HashMap<String, Date> startingEndingDateRef = null; + if (strCompareTo.equals("Y")) { + yrRef = yearRef.getFiscalYear(); + startingEndingDateRef = getStartingEndingDate(yearRef); + } // Years to be included as no closing is present String strYearsToClose = ""; String strYearsToCloseRef = ""; @@ -219,13 +233,16 @@ strCalculateOpening = "Y"; strYearsToClose = "," + strYearsToClose; } - yearsInfo = getYearsToClose(startingEndingDateRef.get("startingDate"), strOrg, - yearRef.getCalendar(), strcAcctSchemaId, true); - strYearsToCloseRef = yearsInfo[0]; - openingEntryOwnerRef = yearsInfo[1]; - if (strYearsToCloseRef.length() > 0) { - strCalculateOpening = "Y"; - strYearsToCloseRef = "," + strYearsToCloseRef; + /* Improved Balance Sheet */ + if (strCompareTo.equals("Y")) { + yearsInfo = getYearsToClose(startingEndingDateRef.get("startingDate"), strOrg, + yearRef.getCalendar(), strcAcctSchemaId, true); + strYearsToCloseRef = yearsInfo[0]; + openingEntryOwnerRef = yearsInfo[1]; + if (strYearsToCloseRef.length() > 0) { + strCalculateOpening = "Y"; + strYearsToCloseRef = "," + strYearsToCloseRef; + } } } // Income summary amount is calculated and included in the balance sheet data @@ -246,9 +263,9 @@ Utility.getContext(this, vars, "#User_Client", "GeneralAccountingReports"), localStrDateFrom, DateTimeData.nDaysAfter(this, localStrDateTo, "1"), strcAcctSchemaId, Tree.getMembers(this, strTreeOrg, strOrg), - "'" + year.getFiscalYear() + "'" + strYearsToClose, openingEntryOwner, + "'" + year.getFiscalYear() + "'" + strYearsToClose, openingEntryOwner, strCompareTo, localStrDateFromRef, DateTimeData.nDaysAfter(this, localStrDateToRef, "1"), "'" - + yearRef.getFiscalYear() + "'" + strYearsToCloseRef, openingEntryOwnerRef); + + yrRef + "'" + strYearsToCloseRef, openingEntryOwnerRef); { if (log4j.isDebugEnabled()) log4j.debug("*********** strIncomeSummaryAccount: " + strIncomeSummaryAccount); @@ -257,12 +274,16 @@ + "'" + strYearsToClose, strTreeOrg, strOrg, strcAcctSchemaId); if (log4j.isDebugEnabled()) log4j.debug("*********** strISyear: " + strISyear); - String strISyearRef = processIncomeSummary(localStrDateFromRef, - DateTimeData.nDaysAfter(this, localStrDateToRef, "1"), - "'" + yearRef.getFiscalYear() + "'" + strYearsToCloseRef, strTreeOrg, strOrg, - strcAcctSchemaId); - if (log4j.isDebugEnabled()) - log4j.debug("*********** strISyearRef: " + strISyearRef); + /* Improved Balance Sheet */ + String strISyearRef = "0"; + if (strCompareTo.equals("Y")) { + strISyearRef = processIncomeSummary(localStrDateFromRef, + DateTimeData.nDaysAfter(this, localStrDateToRef, "1"), + "'" + yearRef.getFiscalYear() + "'" + strYearsToCloseRef, strTreeOrg, strOrg, + strcAcctSchemaId); + if (log4j.isDebugEnabled()) + log4j.debug("*********** strISyearRef: " + strISyearRef); + } accounts = appendRecords(accounts, strIncomeSummaryAccount, strISyear, strISyearRef); } @@ -282,12 +303,12 @@ parameters.put("group", strGroups); parameters.put("agno", year.getFiscalYear()); - parameters.put("agno2", yearRef.getFiscalYear()); + parameters.put("agno2", yrRef); parameters.put("column", year.getFiscalYear()); - parameters.put("columnRef", yearRef.getFiscalYear()); + parameters.put("columnRef", yrRef); parameters.put("org", OrganizationData.selectOrgName(this, strOrg)); parameters.put("column1", year.getFiscalYear()); - parameters.put("columnRef1", yearRef.getFiscalYear()); + parameters.put("columnRef1", yrRef); parameters.put("companyName", GeneralAccountingReportsData.companyName(this, vars.getClient())); parameters.put("date", DateTimeData.today(this)); @@ -295,15 +316,18 @@ localStrDateFrom = OBDateUtils.formatDate(startingEndingDate.get("startingDate")); if (localStrDateTo.equals("")) localStrDateTo = OBDateUtils.formatDate(startingEndingDate.get("endingDate")); - if (localStrDateFromRef.equals("")) - localStrDateFromRef = OBDateUtils.formatDate(startingEndingDateRef.get("startingDate")); - if (localStrDateToRef.equals("")) - localStrDateToRef = OBDateUtils.formatDate(startingEndingDateRef.get("endingDate")); + /* Improved Balance Sheet */ + if (strCompareTo.equals("Y")) { + if (localStrDateFromRef.equals("")) + localStrDateFromRef = OBDateUtils.formatDate(startingEndingDateRef.get("startingDate")); + if (localStrDateToRef.equals("")) + localStrDateToRef = OBDateUtils.formatDate(startingEndingDateRef.get("endingDate")); + } parameters.put("period", localStrDateFrom + " - " + localStrDateTo); parameters.put("periodRef", localStrDateFromRef + " - " + localStrDateToRef); parameters.put("agnoInitial", year.getFiscalYear()); - parameters.put("agnoRef", yearRef.getFiscalYear()); - + parameters.put("agnoRef", yrRef); + parameters.put("compareTo", (strCompareTo.equals("Y") ? "Y" : "N")); parameters.put( "principalTitle", strCalculateOpening.equals("Y") ? GeneralAccountingReportsData.rptTitle(this, @@ -486,7 +510,8 @@ String strAgno, String strAgnoRef, String strDateFrom, String strDateTo, String strPageNo, String strDateFromRef, String strDateToRef, String strAsDateTo, String strAsDateToRef, String strElementValue, String strConImporte, String strOrg, String strLevel, - String strConCodigo, String strcAcctSchemaId) throws IOException, ServletException { + String strConCodigo, String strcAcctSchemaId, String strCompareTo) throws IOException, + ServletException { if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet"); XmlDocument xmlDocument = xmlEngine.readXmlTemplate( @@ -549,6 +574,8 @@ xmlDocument.setParameter("asDateToRefsaveFormat", vars.getSessionValue("#AD_SqlDateFormat")); xmlDocument.setParameter("conImporte", strConImporte); xmlDocument.setParameter("conCodigo", strConCodigo); + /* Improved Balance Sheet */ + xmlDocument.setParameter("compareTo", strCompareTo); xmlDocument.setParameter("C_Org_ID", strOrg); xmlDocument.setParameter("C_ElementValue_ID", strElementValue); xmlDocument.setParameter("level", strLevel); diff -r 16c58ee3abf0 -r 1e59b5f3ed0a src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.xml --- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.xml Thu Aug 11 16:37:05 2016 +0000 +++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.xml Tue Aug 09 11:24:49 2016 +0200 @@ -46,6 +46,7 @@ <PARAMETER id="fieldCheck" name="check" default="Y"/> <PARAMETER id="fieldConImporte" name="conImporte" boolean="checked" withId="fieldCheck"/> <PARAMETER id="fieldConCodigo" name="conCodigo" boolean="checked" withId="fieldCheck"/> + <PARAMETER id="fieldCompareTo" name="compareTo" boolean="checked" withId="fieldCheck"/> <PARAMETER id="fieldC_ElementValue_ID" name="C_ElementValue_ID"/> <PARAMETER id="fieldC_Org_ID" name="C_Org_ID"/> <PARAMETER id="paramLevel" name="level"/> diff -r 16c58ee3abf0 -r 1e59b5f3ed0a src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.jrxml --- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.jrxml Thu Aug 11 16:37:05 2016 +0000 ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohodev2dev _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits