gilPts commented on code in PR #588:
URL: https://github.com/apache/ofbiz-framework/pull/588#discussion_r1100146762
##########
applications/accounting/groovyScripts/reports/BalanceSheet.groovy:
##########
@@ -209,24 +204,15 @@ enum RootClass {DEBIT, CREDIT}
* This controls how the balance of the account is calculated:
* Debit account balance = totalDebits - totalCredits
* Credit account balance = totalCredits - totalDebits
- * @param Specify whether the opening account balances should be negated,
having the effect of switching the credits
- * to debits, and vice-versa.
+ * @param negateBalances Specify whether balances should be negated after they
have been calculated according to the
+ * debit/credit flag of any accounts for which transaction entries are found.
*/
def calculateBalances = { Map<String, AccountBalance> openingBalances,
Collection<String> accountClassIds,
RootClass rootClass,
- boolean negateOpeningBalances = false ->
-
- Map<String, AccountBalance> accountBalancesByGlAccountId =
openingBalances.collectEntries {
- glAccountId, accountBalance ->
- [glAccountId, new AccountBalance(
- glAccountId: glAccountId,
- accountCode: accountBalance.accountCode,
- accountName: accountBalance.accountName,
- balance: negateOpeningBalances ?
accountBalance.balance.negate() : accountBalance.balance,
- D: accountBalance.D,
- C: accountBalance.C,)]
- }
+ boolean negateBalances = false ->
+
+ def accountBalancesByGlAccountId = [:] as Map<String, AccountBalance> <<
openingBalances
Review Comment:
Another way of writing it :)
https://groovy-lang.org/groovy-dev-kit.html#_spread_operator
```suggestion
Map<String, AccountBalance> accountBalancesByGlAccountId =
[*:openingBalances]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]