Author: arunpatidar
Date: Fri Jul 1 14:06:51 2016 New Revision: 1750940 URL: http://svn.apache.org/viewvc?rev=1750940&view=rev Log: Applied patch from jira issue - OFBIZ-7515 - Balance Sheet PDF export fails. Thanks Rohit Koushal for your contribution. Modified: ofbiz/trunk/applications/accounting/groovyScripts/reports/BalanceSheet.groovy ofbiz/trunk/specialpurpose/birt/groovyScripts/accounting/BalanceSheetParameters.groovy ofbiz/trunk/specialpurpose/birt/webapp/accounting/reports/BalanceSheet.rptdesign Modified: ofbiz/trunk/applications/accounting/groovyScripts/reports/BalanceSheet.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/groovyScripts/reports/BalanceSheet.groovy?rev=1750940&r1=1750939&r2=1750940&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/groovyScripts/reports/BalanceSheet.groovy (original) +++ ofbiz/trunk/applications/accounting/groovyScripts/reports/BalanceSheet.groovy Fri Jul 1 14:06:51 2016 @@ -37,10 +37,16 @@ if (!thruDate) { if (!glFiscalTypeId) { return; } - +organizationPartyId =null +if(context.organizationPartyId) { + organizationPartyId = context.organizationPartyId; +} else { + organizationPartyId = parameters.get('ApplicationDecorator|organizationPartyId') +} // Setup the divisions for which the report is executed -List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, parameters.get('ApplicationDecorator|organizationPartyId'), 'GROUP_ROLLUP'); -partyIds.add(parameters.get('ApplicationDecorator|organizationPartyId')); +List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP'); +partyIds.add(organizationPartyId); + // Get the group of account classes that will be used to position accounts in the proper section of the financial statement GenericValue assetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ASSET").cache(true).queryOne(); @@ -63,7 +69,7 @@ GenericValue accumAmortizationGlAccountC List accumAmortizationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumAmortizationGlAccountClass); // Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period -Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": parameters.get('ApplicationDecorator|organizationPartyId'), "findDate": thruDate,"userLogin": userLogin]); +Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": organizationPartyId, "findDate": thruDate,"userLogin": userLogin]); Timestamp fromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate; if (!fromDate) { return; @@ -407,9 +413,9 @@ transactionTotals.each { transactionTota transactionTotalsMap.put(transactionTotal.glAccountId, accountMap); } // Add the "retained earnings" account -Map netIncomeResult = runService('prepareIncomeStatement', ["organizationPartyId": parameters.get('ApplicationDecorator|organizationPartyId'), "glFiscalTypeId": glFiscalTypeId, "fromDate": fromDate, "thruDate": thruDate, "userLogin": userLogin]); +Map netIncomeResult = runService('prepareIncomeStatement', ["organizationPartyId": organizationPartyId, "glFiscalTypeId": glFiscalTypeId, "fromDate": fromDate, "thruDate": thruDate, "userLogin": userLogin]); BigDecimal netIncome = (BigDecimal)netIncomeResult.totalNetIncome; -GenericValue retainedEarningsAccount = from("GlAccountTypeDefault").where("glAccountTypeId", "RETAINED_EARNINGS", "organizationPartyId", parameters.get('ApplicationDecorator|organizationPartyId')).cache(true).queryOne(); +GenericValue retainedEarningsAccount = from("GlAccountTypeDefault").where("glAccountTypeId", "RETAINED_EARNINGS", "organizationPartyId", organizationPartyId).cache(true).queryOne(); if (retainedEarningsAccount) { GenericValue retainedEarningsGlAccount = retainedEarningsAccount.getRelatedOne("GlAccount", false); transactionTotalsMap.put(retainedEarningsGlAccount.glAccountId, UtilMisc.toMap("glAccountId", retainedEarningsGlAccount.glAccountId,"accountName", retainedEarningsGlAccount.accountName, "accountCode", retainedEarningsGlAccount.accountCode, "balance", netIncome)); Modified: ofbiz/trunk/specialpurpose/birt/groovyScripts/accounting/BalanceSheetParameters.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/groovyScripts/accounting/BalanceSheetParameters.groovy?rev=1750940&r1=1750939&r2=1750940&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/birt/groovyScripts/accounting/BalanceSheetParameters.groovy (original) +++ ofbiz/trunk/specialpurpose/birt/groovyScripts/accounting/BalanceSheetParameters.groovy Fri Jul 1 14:06:51 2016 @@ -17,6 +17,9 @@ * under the License. */ +import java.sql.Timestamp; +import org.ofbiz.base.util.Debug; + def module = "BalanceSheetParameters.groovy"; try { @@ -30,6 +33,7 @@ try { birtParameters.glFiscalTypeId = parameters.glFiscalTypeId; birtParameters.organizationPartyId = parameters.organizationPartyId; birtParameters.userLoginId = userLogin.userLoginId; + birtParameters.locale = locale; request.setAttribute("birtParameters", birtParameters); } catch (e) { Debug.logError(e, module); Modified: ofbiz/trunk/specialpurpose/birt/webapp/accounting/reports/BalanceSheet.rptdesign URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/accounting/reports/BalanceSheet.rptdesign?rev=1750940&r1=1750939&r2=1750940&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/birt/webapp/accounting/reports/BalanceSheet.rptdesign (original) +++ ofbiz/trunk/specialpurpose/birt/webapp/accounting/reports/BalanceSheet.rptdesign Fri Jul 1 14:06:51 2016 @@ -23,6 +23,7 @@ under the License. <method name="initialize"><![CDATA[ importPackage(Packages.org.ofbiz.base.util) importPackage(Packages.org.ofbiz.entity.util) +importPackage(Packages.java.util) module = "BalanceSheet.rptdesign"; dateFormatter = new java.text.SimpleDateFormat("dd MMMMM yyyy"); @@ -54,20 +55,27 @@ if (params["fromDate"].value) { fromDate = params["fromDate"].value; } -if (!params["thruDate"].value) { +if (params["thruDate"].value) { thruDate = params["thruDate"].value; } else { thruDate = UtilDateTime.nowTimestamp(); } -if (!params["glFiscalTypeId"].value) { +if (params["glFiscalTypeId"].value) { glFiscalTypeId = params["glFiscalTypeId"].value; } else { glFiscalTypeId = "ACTUAL"; } +if (params["locale"].value) { + locale = params["glFiscalTypeId"].value; +} else { + locale = "ACTUAL"; +} + // call BalanceSheet.groovy script context = new HashMap(); +context.put("parameters", new HashMap()); context.put("organizationPartyId", organizationPartyId); context.put("fromDate", fromDate); context.put("thruDate", thruDate); @@ -75,7 +83,8 @@ context.put("glFiscalTypeId", glFiscalTy context.put("delegator", delegator); context.put("dispatcher", dispatcher); context.put("userLogin", userLogin); -GroovyUtil.runScriptAtLocation("component://accounting/groovyScripts/reports/BalanceSheet.groovy", context); +context.put("locale", params["locale"].value); +GroovyUtil.runScriptAtLocation("component://accounting/groovyScripts/reports/BalanceSheet.groovy", null, context); // prepare data source lists assetAccountBalanceList = context.get("assetAccountBalanceList"); |
Free forum by Nabble | Edit this page |