You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/12/12 00:11:51 UTC
svn commit: r889851 [3/17] - in /ofbiz/branches/addbirt: ./
applications/accounting/config/ applications/accounting/data/
applications/accounting/data/helpdata/ applications/accounting/entitydef/
applications/accounting/script/org/ofbiz/accounting/fina...
Modified: ofbiz/branches/addbirt/applications/accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml (original)
+++ ofbiz/branches/addbirt/applications/accounting/script/org/ofbiz/accounting/test/AutoPaymentTests.xml Fri Dec 11 23:11:39 2009
@@ -203,28 +203,31 @@
<!-- Post condition : thruDate for PaymentGroupMember should be Not Null
payment status should be changed to PMNT_VOID. -->
- <set field="paymentGroupId" value="9000"/>
+ <set field="paymentGroupId" value="9001"/>
<entity-one entity-name="UserLogin" value-field="userLogin">
<field-map field-name="userLoginId" value="system"/>
</entity-one>
<set field="cancelCheckRunPaymentsMap.userLogin" from-field="userLogin"/>
<set field="cancelCheckRunPaymentsMap.paymentGroupId" from-field="paymentGroupId"/>
<call-service service-name="cancelCheckRunPayments" in-map-name="cancelCheckRunPaymentsMap"/>
- <entity-and entity-name="PaymentGroupMember" list="paymentGroupMembers">
+ <entity-and entity-name="PmtGrpMembrPaymentAndFinAcctTrans" list="paymentGroupMemberAndTransList">
<field-map field-name="paymentGroupId"/>
</entity-and>
- <iterate list="paymentGroupMembers" entry="paymentGroupMember">
- <assert>
- <not>
- <if-empty field="paymentGroupMember.thruDate"/>
- </not>
- </assert>
- <check-errors/>
- <get-related-one value-field="paymentGroupMember" relation-name="Payment" to-value-field="payment"/>
- <assert>
- <if-compare field="payment.statusId" operator="equals" value="PMNT_VOID"/>
- </assert>
- </iterate>
+ <first-from-list list="paymentGroupMemberAndTransList" entry="paymentGroupMemberAndTrans"/>
+ <if-compare field="paymentGroupMemberAndTrans.finAccountTransStatusId" operator="not-equals" value="FINACT_TRNS_APPROVED">
+ <iterate list="paymentGroupMemberAndTransList" entry="paymentGroupMemberAndTrans">
+ <assert>
+ <not>
+ <if-empty field="paymentGroupMemberAndTrans.thruDate"/>
+ </not>
+ </assert>
+ <check-errors/>
+ <assert>
+ <if-compare field="paymentGroupMemberAndTrans.statusId" operator="equals" value="PMNT_VOID"/>
+ </assert>
+ <check-errors/>
+ </iterate>
+ </if-compare>
<log level="info" message="Test case for cancelCheckRunPayments ran successfully for paymentGroupId = ${paymentGroupId}"/>
</simple-method>
Modified: ofbiz/branches/addbirt/applications/accounting/servicedef/services_payment.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/servicedef/services_payment.xml?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/servicedef/services_payment.xml (original)
+++ ofbiz/branches/addbirt/applications/accounting/servicedef/services_payment.xml Fri Dec 11 23:11:39 2009
@@ -161,7 +161,6 @@
location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="cancelPaymentBatch" auth="true">
<description>cancel payment batch</description>
<attribute name="paymentGroupId" type="String" mode="IN" optional="false"/>
- <attribute name="glReconciliationId" type="String" mode="IN" optional="true"/>
</service>
<service name="createPaymentAndPaymentGroupForInvoices" engine="simple"
location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createPaymentAndPaymentGroupForInvoices" auth="true">
Modified: ofbiz/branches/addbirt/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
+++ ofbiz/branches/addbirt/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Fri Dec 11 23:11:39 2009
@@ -531,8 +531,17 @@
result.put("cvCode", reply.get("ccAuthReply_cvCode"));
result.put("avsCode", reply.get("ccAuthReply_avsCode"));
result.put("scoreCode", reply.get("ccAuthReply_authFactorCode"));
- result.put("captureRefNum", reply.get("requestID")); // maybe use something else here?
- result.put("captureCode", reply.get("ccCaptureReply_reconciliationID"));
+ result.put("captureRefNum", reply.get("requestID"));
+ if (UtilValidate.isNotEmpty(reply.get("ccCaptureReply_reconciliationID"))) {
+ if ("ACCEPT".equalsIgnoreCase(decision)) {
+ result.put("captureResult", Boolean.TRUE);
+ } else {
+ result.put("captureResult", Boolean.FALSE);
+ }
+ result.put("captureCode", reply.get("ccCaptureReply_reconciliationID"));
+ result.put("captureFlag", reply.get("ccCaptureReply_reasonCode"));
+ result.put("captureMessage", reply.get("decision"));
+ }
if (Debug.infoOn())
Debug.logInfo("CC [Cybersource] authorization result : " + result, module);
}
Modified: ofbiz/branches/addbirt/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java (original)
+++ ofbiz/branches/addbirt/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java Fri Dec 11 23:11:39 2009
@@ -212,19 +212,19 @@
}
} else if (status != null && "INVALID".equals(status)) {
Debug.logInfo("SagePay - Invalid authorisation request for order : " + vendorTxCode, module);
- result = SagePayUtil.buildCardAuthorisationPaymentResponse(Boolean.FALSE, null, null, new BigDecimal("0.00"), "INVALID", vendorTxCode, statusDetail);
+ result = SagePayUtil.buildCardAuthorisationPaymentResponse(Boolean.FALSE, null, null, BigDecimal.ZERO, "INVALID", vendorTxCode, statusDetail);
} else if (status != null && "MALFORMED".equals(status)) {
Debug.logInfo("SagePay - Malformed authorisation request for order : " + vendorTxCode, module);
- result = SagePayUtil.buildCardAuthorisationPaymentResponse(Boolean.FALSE, null, null, new BigDecimal("0.00"), "MALFORMED", vendorTxCode, statusDetail);
+ result = SagePayUtil.buildCardAuthorisationPaymentResponse(Boolean.FALSE, null, null, BigDecimal.ZERO, "MALFORMED", vendorTxCode, statusDetail);
} else if (status != null && "NOTAUTHED".equals(status)) {
Debug.logInfo("SagePay - NotAuthed authorisation request for order : " + vendorTxCode, module);
- result = SagePayUtil.buildCardAuthorisationPaymentResponse(Boolean.FALSE, null, securityKey, new BigDecimal("0.00"), vpsTxId, vendorTxCode, statusDetail);
+ result = SagePayUtil.buildCardAuthorisationPaymentResponse(Boolean.FALSE, null, securityKey, BigDecimal.ZERO, vpsTxId, vendorTxCode, statusDetail);
} else if (status != null && "REJECTED".equals(status)) {
Debug.logInfo("SagePay - Rejected authorisation request for order : " + vendorTxCode, module);
result = SagePayUtil.buildCardAuthorisationPaymentResponse(Boolean.FALSE, null, securityKey, new BigDecimal(amount), vpsTxId, vendorTxCode, statusDetail);
} else {
Debug.logInfo("SagePay - Invalid status " + status + " received for order : " + vendorTxCode, module);
- result = SagePayUtil.buildCardAuthorisationPaymentResponse(Boolean.FALSE, null, null, new BigDecimal("0.00"), "ERROR", vendorTxCode, statusDetail);
+ result = SagePayUtil.buildCardAuthorisationPaymentResponse(Boolean.FALSE, null, null, BigDecimal.ZERO, "ERROR", vendorTxCode, statusDetail);
}
} catch(GenericServiceException e) {
Debug.logError(e, "Error in calling SagePayPaymentAuthentication", module);
@@ -394,7 +394,7 @@
result = SagePayUtil.buildCardRefundPaymentResponse(Boolean.TRUE, txAuthNo, amount, vpsTxId, orderId, statusDetail);
} else {
Debug.logInfo("SagePay - Invalid status " + status + " received for order : " + orderId, module);
- result = SagePayUtil.buildCardRefundPaymentResponse(Boolean.FALSE, null, new BigDecimal("0.00"), status, orderId, statusDetail);
+ result = SagePayUtil.buildCardRefundPaymentResponse(Boolean.FALSE, null, BigDecimal.ZERO, status, orderId, statusDetail);
}
} catch(GenericServiceException e) {
@@ -437,13 +437,13 @@
result = SagePayUtil.buildCardVoidPaymentResponse(Boolean.TRUE, amount, "SUCCESS", orderId, statusDetail);
} else if (status != null && "MALFORMED".equals(status)) {
Debug.logInfo("SagePay - Malformed void request for order : " + orderId, module);
- result = SagePayUtil.buildCardVoidPaymentResponse(Boolean.FALSE, new BigDecimal("0.00"), "MALFORMED", orderId, statusDetail);
+ result = SagePayUtil.buildCardVoidPaymentResponse(Boolean.FALSE, BigDecimal.ZERO, "MALFORMED", orderId, statusDetail);
} else if (status != null && "INVALID".equals(status)){
Debug.logInfo("SagePay - Invalid void request for order : " + orderId, module);
- result = SagePayUtil.buildCardVoidPaymentResponse(Boolean.FALSE, new BigDecimal("0.00"), "INVALID", orderId, statusDetail);
+ result = SagePayUtil.buildCardVoidPaymentResponse(Boolean.FALSE, BigDecimal.ZERO, "INVALID", orderId, statusDetail);
} else if (status != null && "ERROR".equals(status)){
Debug.logInfo("SagePay - Error in void request for order : " + orderId, module);
- result = SagePayUtil.buildCardVoidPaymentResponse(Boolean.FALSE, new BigDecimal("0.00"), "ERROR", orderId, statusDetail);
+ result = SagePayUtil.buildCardVoidPaymentResponse(Boolean.FALSE, BigDecimal.ZERO, "ERROR", orderId, statusDetail);
}
} catch(GenericServiceException e) {
Modified: ofbiz/branches/addbirt/applications/accounting/testdef/invoicetests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/testdef/invoicetests.xml?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/testdef/invoicetests.xml (original)
+++ ofbiz/branches/addbirt/applications/accounting/testdef/invoicetests.xml Fri Dec 11 23:11:39 2009
@@ -17,7 +17,7 @@
under the License.
-->
-<test-suite suite-name="accountingtests"
+<test-suite suite-name="invoicetests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
<!-- Test case for Commission Run -->
Modified: ofbiz/branches/addbirt/applications/accounting/testdef/paymenttests.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/testdef/paymenttests.xml?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/testdef/paymenttests.xml (original)
+++ ofbiz/branches/addbirt/applications/accounting/testdef/paymenttests.xml Fri Dec 11 23:11:39 2009
@@ -17,7 +17,7 @@
under the License.
-->
-<test-suite suite-name="accountingtests"
+<test-suite suite-name="paymenttests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy Fri Dec 11 23:11:39 2009
@@ -17,109 +17,69 @@
* under the License.
*/
+import org.ofbiz.base.util.UtilMisc;
import java.math.BigDecimal;
-import java.sql.Timestamp;
-import org.ofbiz.entity.util.EntityUtil;
-period1FromDate = parameters.period1FromDate;
-period1ThruDate = parameters.period1ThruDate;
-period2FromDate = parameters.period2FromDate;
-period2ThruDate = parameters.period2ThruDate;
-
-if (period1FromDate && period1ThruDate && organizationPartyId && period2FromDate && period2ThruDate) {
- onlyIncludePeriodTypeIdList = [];
- onlyIncludePeriodTypeIdList.add("FISCAL_YEAR");
- glAccountIncomeList = [];
- glAccountExpenseList = [];
- periodExpenses = [];
- periodIncomes = [];
- period1IncomeStatement = getGlAccountTotals(onlyIncludePeriodTypeIdList, Timestamp.valueOf(period1FromDate), Timestamp.valueOf(period1ThruDate), organizationPartyId, parameters.glFiscalTypeId);
- period1Expenses = [];
- period1Incomes = [];
- if (period1IncomeStatement) {
- context.period1TotalNetIncome = period1IncomeStatement.totalNetIncome;
- glAccountTotalsMapForPeriod1 = period1IncomeStatement.glAccountTotalsMap;
- if (glAccountTotalsMapForPeriod1) {
- period1Expenses = glAccountTotalsMapForPeriod1.expenses;
- period1Incomes = glAccountTotalsMapForPeriod1.income;
- if (period1Incomes)
- periodIncomes.addAll(period1Incomes);
- if (period1Expenses)
- periodExpenses.addAll(period1Expenses);
- }
- }
- period2IncomeStatement = getGlAccountTotals(onlyIncludePeriodTypeIdList ,Timestamp.valueOf(period2FromDate) ,Timestamp.valueOf(period2ThruDate) ,organizationPartyId , parameters.glFiscalTypeId);
- period2Expenses = [];
- period2Incomes = [];
- if (period2IncomeStatement) {
- context.period2TotalNetIncome = period2IncomeStatement.totalNetIncome;
- glAccountTotalsMapForPeriod2 = period2IncomeStatement.glAccountTotalsMap;
- if (glAccountTotalsMapForPeriod2) {
- period2Expenses = glAccountTotalsMapForPeriod2.expenses;
- period2Incomes = glAccountTotalsMapForPeriod2.income;
- period2Expenses.each { period2Expense ->
- if (!((periodExpenses.glAccountId).contains(period2Expense.glAccountId)))
- periodExpenses.add(period2Expense);
- }
- period2Incomes.each { period2Income ->
- if (!((periodIncomes.glAccountId).contains(period2Income.glAccountId)))
- periodIncomes.add(period2Income);
- }
- }
+revenueAccountBalanceMap = [:];
+revenueAccountBalanceList = [];
+revenueAccountBalanceList1.each { accountBalance ->
+ revenueAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+}
+revenueAccountBalanceList2.each { accountBalance ->
+ Map assetAccount = (Map)revenueAccountBalanceMap.get(accountBalance.glAccountId);
+ if (!assetAccount) {
+ revenueAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ } else {
+ assetAccount.put("balance2", accountBalance.balance);
}
- periodExpenses.each { periodExpense ->
- period1TotalAmount = BigDecimal.ZERO;
- period2TotalAmount = BigDecimal.ZERO;
- if ((period1Expenses.glAccountId).contains(periodExpense.glAccountId)) {
- period1Expenses.each { period1Expense ->
- if(periodExpense.glAccountId.equals(period1Expense.glAccountId))
- period1TotalAmount = period1Expense.totalAmount;
- }
- }
- if ((period2Expenses.glAccountId).contains(periodExpense.glAccountId)) {
- period2Expenses.each { period2Expense ->
- if(periodExpense.glAccountId.equals(period2Expense.glAccountId))
- period2TotalAmount = period2Expense.totalAmount;
- }
- }
- glAccountExpenseList.add([glAccountId : periodExpense.glAccountId , period1TotalAmount : period1TotalAmount , period2TotalAmount : period2TotalAmount]);
- context.glAccountExpenseList = glAccountExpenseList;
+}
+revenueAccountBalanceList = UtilMisc.sortMaps(revenueAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
+context.revenueAccountBalanceList = revenueAccountBalanceList;
+
+expenseAccountBalanceMap = [:];
+expenseAccountBalanceList = [];
+expenseAccountBalanceList1.each { accountBalance ->
+ expenseAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+}
+expenseAccountBalanceList2.each { accountBalance ->
+ Map assetAccount = (Map)expenseAccountBalanceMap.get(accountBalance.glAccountId);
+ if (!assetAccount) {
+ expenseAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ } else {
+ assetAccount.put("balance2", accountBalance.balance);
}
- periodIncomes.each { periodIncome ->
- period1TotalAmount = BigDecimal.ZERO;
- period2TotalAmount = BigDecimal.ZERO;
- if ((period1Incomes.glAccountId).contains(periodIncome.glAccountId)) {
- period1Incomes.each { period1Income ->
- if(periodIncome.glAccountId.equals(period1Income.glAccountId))
- period1TotalAmount = period1Income.totalAmount;
- }
- }
- if ((period2Incomes.glAccountId).contains(periodIncome.glAccountId)) {
- period2Incomes.each { period2Income ->
- if(periodIncome.glAccountId.equals(period2Income.glAccountId))
- period2TotalAmount = period2Income.totalAmount;
- }
- }
- glAccountIncomeList.add([glAccountId : periodIncome.glAccountId , period1TotalAmount : period1TotalAmount , period2TotalAmount : period2TotalAmount]);
- context.glAccountIncomeList = glAccountIncomeList;
+}
+expenseAccountBalanceList = UtilMisc.sortMaps(expenseAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
+context.expenseAccountBalanceList = expenseAccountBalanceList;
+
+incomeAccountBalanceMap = [:];
+incomeAccountBalanceList = [];
+incomeAccountBalanceList1.each { accountBalance ->
+ incomeAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+}
+incomeAccountBalanceList2.each { accountBalance ->
+ Map assetAccount = (Map)incomeAccountBalanceMap.get(accountBalance.glAccountId);
+ if (!assetAccount) {
+ incomeAccountBalanceMap.put(accountBalance.glAccountId, UtilMisc.toMap("glAccountId", accountBalance.glAccountId, "accountCode", accountBalance.accountCode, "accountName", accountBalance.accountName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ } else {
+ assetAccount.put("balance2", accountBalance.balance);
}
}
+incomeAccountBalanceList = UtilMisc.sortMaps(incomeAccountBalanceMap.values().asList(), UtilMisc.toList("accountCode"));
+context.incomeAccountBalanceList = incomeAccountBalanceList;
-private Map getGlAccountTotals(List onlyIncludePeriodTypeIdList, Timestamp fromDate, Timestamp thruDate, String organizationPartyId, String glFiscalTypeId) {
- customTimePeriodResult = dispatcher.runSync("findCustomTimePeriods", [findDate : thruDate, organizationPartyId : organizationPartyId, onlyIncludePeriodTypeIdList : onlyIncludePeriodTypeIdList, userLogin : userLogin]);
- if (customTimePeriodResult) {
- customTimePeriod = EntityUtil.getFirst(customTimePeriodResult.customTimePeriodList);
- if (customTimePeriod) {
- customTimePeriodFromDate = new Timestamp((customTimePeriod.fromDate).getTime());
- customTimePeriodThruDate = new Timestamp((customTimePeriod.thruDate).getTime());
- if (customTimePeriodFromDate.compareTo(fromDate) > 0)
- fromDate = customTimePeriodFromDate;
- if (customTimePeriodThruDate.compareTo(thruDate) < 0)
- thruDate = customTimePeriodThruDate;
- context.financialYearFromDate = customTimePeriodFromDate;
- }
- prepareIncomeStatement = dispatcher.runSync("prepareIncomeStatement",
- [fromDate : fromDate, thruDate : thruDate, organizationPartyId : organizationPartyId, glFiscalTypeId : glFiscalTypeId, userLogin : userLogin]);
- return prepareIncomeStatement;
+balanceTotalMap = [:];
+balanceTotalList = [];
+balanceTotalList1.each { accountBalance ->
+ balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance1", accountBalance.balance, "balance2", BigDecimal.ZERO));
+}
+balanceTotalList2.each { accountBalance ->
+ Map assetAccount = (Map)balanceTotalMap.get(accountBalance.totalName);
+ if (!assetAccount) {
+ balanceTotalMap.put(accountBalance.totalName, UtilMisc.toMap("totalName", accountBalance.totalName, "balance2", accountBalance.balance, "balance1", BigDecimal.ZERO));
+ } else {
+ assetAccount.put("balance2", accountBalance.balance);
}
-}
\ No newline at end of file
+}
+balanceTotalList = balanceTotalMap.values().asList();
+context.balanceTotalList = balanceTotalList;
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy Fri Dec 11 23:11:39 2009
@@ -16,28 +16,68 @@
* specific language governing permissions and limitations
* under the License.
*/
-import org.ofbiz.accounting.util.UtilAccounting;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilValidate;
+
import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilNumber;
import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityUtil;
-if (organizationPartyId) {
+import javolution.util.FastList;
+import javolution.util.FastMap;
- customTimePeriods = delegator.findByAnd("CustomTimePeriod", [organizationPartyId : organizationPartyId, periodTypeId : "FISCAL_YEAR"]);
- if (UtilValidate.isNotEmpty(customTimePeriods)) {
- context.customTimePeriods = customTimePeriods;
- }
- onlyIncludePeriodTypeIdList = [];
- onlyIncludePeriodTypeIdList.add("FISCAL_YEAR");
- customTimePeriodResults = dispatcher.runSync("findCustomTimePeriods", [findDate : UtilDateTime.nowTimestamp(), organizationPartyId : organizationPartyId, onlyIncludePeriodTypeIdList : onlyIncludePeriodTypeIdList, userLogin : userLogin]);
- customTimePeriodList = customTimePeriodResults.customTimePeriodList;
- if (UtilValidate.isNotEmpty(customTimePeriodList)) {
- context.timePeriod = (EntityUtil.getFirst(customTimePeriodList)).customTimePeriodId;
+if (!fromDate) {
+ return;
+}
+if (!thruDate) {
+ thruDate = UtilDateTime.nowTimestamp();
+}
+if (!parameters.glFiscalTypeId) {
+ parameters.glFiscalTypeId = "ACTUAL";
+}
+
+// POSTED
+// Posted transactions totals and grand totals
+postedTotalDebit = BigDecimal.ZERO;
+postedTotalCredit = BigDecimal.ZERO;
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, parameters.glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List postedTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+if (postedTransactionTotals) {
+ glAccountCategories = delegator.findByAnd("GlAccountCategory", [glAccountCategoryTypeId : 'COST_CENTER'], ['glAccountCategoryId']);
+ context.glAccountCategories = glAccountCategories;
+ Map postedTransactionTotalsMap = [:]
+ postedTransactionTotals.each { postedTransactionTotal ->
+ Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId);
+ if (!accountMap) {
+ accountMap = UtilMisc.makeMapWritable(postedTransactionTotal);
+ accountMap.put("D", BigDecimal.ZERO);
+ accountMap.put("C", BigDecimal.ZERO);
+ }
+ UtilMisc.addToBigDecimalInMap(accountMap, postedTransactionTotal.debitCreditFlag, postedTransactionTotal.amount);
+ postedTransactionTotalsMap.put(postedTransactionTotal.glAccountId, accountMap);
+ BigDecimal debitAmount = (BigDecimal)accountMap.get("D");
+ BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+ BigDecimal balance = debitAmount.subtract(creditAmount);
+ accountMap.put("balance", balance);
+ glAccountCategories.each { glAccountCategory ->
+ glAccountCategoryMember = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("GlAccountCategoryMember", [glAccountCategoryId : glAccountCategory.glAccountCategoryId, glAccountId: postedTransactionTotal.glAccountId], ['glAccountCategoryId'])));
+ if (glAccountCategoryMember) {
+ BigDecimal glAccountCategorySharePercentage = glAccountCategoryMember.amountPercentage;
+ if (glAccountCategorySharePercentage && glAccountCategorySharePercentage != BigDecimal.ZERO ) {
+ glAccountCategoryShareFraction = glAccountCategorySharePercentage.divide(new BigDecimal("100.00"));
+ BigDecimal glAccountCategoryShare = balance.multiply(glAccountCategoryShareFraction);
+ accountMap.put(glAccountCategory.glAccountCategoryId,glAccountCategoryShare);
+ }
+ }
+ }
}
- resultFromPartyAcctgPref = dispatcher.runSync("getPartyAccountingPreferences", [organizationPartyId : organizationPartyId, userLogin : request.getAttribute("userLogin")]);
- partyAcctgPreference = resultFromPartyAcctgPref.partyAccountingPreference;
- context.currencyUomId = partyAcctgPreference.baseCurrencyUomId;
- context.glAccountCategories = delegator.findList("GlAccountCategory", EntityCondition.makeCondition([glAccountCategoryTypeId : "COST_CENTER"]), null, ["glAccountCategoryId"], null, false);
+ context.glAcctBalancesByCostCenter = postedTransactionTotalsMap.values().asList()
}
+
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy Fri Dec 11 23:11:39 2009
@@ -76,7 +76,6 @@
isPosted = parameters.isPosted;
while (customTimePeriodEndDate <= currentTimePeriod.thruDate) {
-
if ("ALL".equals(isPosted)) {
isPosted = "";
}
@@ -97,7 +96,7 @@
glAcctgTrialBalanceList.add(acctgTransEntriesAndTransTotal);
- calendarTimePeriodStartDate.roll(Calendar.MONTH, 1);
+ calendarTimePeriodStartDate.add(Calendar.MONTH, 1);
Timestamp retStampStartDate = new Timestamp(calendarTimePeriodStartDate.getTimeInMillis());
retStampStartDate.setNanos(0);
customTimePeriodStartDate = retStampStartDate;
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy Fri Dec 11 23:11:39 2009
@@ -18,141 +18,320 @@
*/
import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilNumber;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityOperator;
-import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.accounting.util.UtilAccounting;
+
import javolution.util.FastList;
-import javolution.util.FastMap;
-debitTotal = BigDecimal.ZERO;
-creditTotal = BigDecimal.ZERO;
-openingBalanceCredit = BigDecimal.ZERO;
-openingBalanceDebit = BigDecimal.ZERO;
-
-decimals = UtilNumber.getBigDecimalScale("ledger.decimals");
-rounding = UtilNumber.getBigDecimalRoundingMode("ledger.rounding");
-exprs = [EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds)];
-if (fromDate) {
- exprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-} else return;
+import java.sql.Date;
+if (!fromDate) {
+ return;
+}
if (!thruDate) {
thruDate = UtilDateTime.nowTimestamp();
}
-exprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+if (!glFiscalTypeId) {
+ return;
+}
+
+// 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 = dispatcher.runSync("findLastClosedDate", UtilMisc.toMap("organizationPartyId", organizationPartyId, "findDate", new Date(fromDate.getTime()),"userLogin", userLogin));
+Timestamp lastClosedDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
+GenericValue lastClosedTimePeriod = null;
+if (lastClosedDate) {
+ lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod;
+}
+
+// POSTED
+// Posted transactions totals and grand totals
+postedTotals = [];
+postedTotalDebit = BigDecimal.ZERO;
+postedTotalCredit = BigDecimal.ZERO;
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List postedTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+if (postedTransactionTotals) {
+ Map postedTransactionTotalsMap = [:]
+ postedTransactionTotals.each { postedTransactionTotal ->
+ Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId);
+ if (!accountMap) {
+ GenericValue glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", postedTransactionTotal.glAccountId), true);
+ if (glAccount) {
+ boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
+ // Get the opening balances at the end of the last closed time period
+ if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
+ if (lastClosedTimePeriod) {
+ List timePeriodAndExprs = FastList.newInstance();
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, postedTransactionTotal.glAccountId));
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
+ lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
+ if (lastTimePeriodHistory) {
+ accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
+ }
+ }
+ }
+ }
+ if (!accountMap) {
+ accountMap = UtilMisc.makeMapWritable(postedTransactionTotal);
+ accountMap.put("openingD", BigDecimal.ZERO);
+ accountMap.put("openingC", BigDecimal.ZERO);
+ accountMap.put("D", BigDecimal.ZERO);
+ accountMap.put("C", BigDecimal.ZERO);
+ accountMap.put("balance", BigDecimal.ZERO);
+ }
+ //
+ List mainAndExprs = FastList.newInstance();
+ mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+ mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
+ mainAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, postedTransactionTotal.glAccountId));
+ mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+ mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
+ transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(mainAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+ transactionTotals.each { transactionTotal ->
+ UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
+ }
+ }
+ UtilMisc.addToBigDecimalInMap(accountMap, postedTransactionTotal.debitCreditFlag, postedTransactionTotal.amount);
+ postedTransactionTotalsMap.put(postedTransactionTotal.glAccountId, accountMap);
+ }
+ postedTotals = postedTransactionTotalsMap.values().asList();
+}
+// Posted grand total for Debits
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List postedDebitTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+if (postedDebitTransactionTotals) {
+ postedDebitTransactionTotal = EntityUtil.getFirst(postedDebitTransactionTotals);
+ if (postedDebitTransactionTotal && postedDebitTransactionTotal.amount) {
+ postedTotalDebit = postedDebitTransactionTotal.amount;
+ }
+}
+// Posted grand total for Credits
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List postedCreditTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+if (postedCreditTransactionTotals) {
+ postedCreditTransactionTotal = EntityUtil.getFirst(postedCreditTransactionTotals);
+ if (postedCreditTransactionTotal && postedCreditTransactionTotal.amount) {
+ postedTotalCredit = postedCreditTransactionTotal.amount;
+ }
+}
+postedTotals.add(["D":postedTotalDebit, "C":postedTotalCredit]);
+context.postedTransactionTotals = postedTotals;
-exprList = FastList.newInstance();
-orExprs = new ArrayList();
-orExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
-orExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
-orCond = EntityCondition.makeCondition(orExprs, EntityOperator.OR);
-
-exprList.add(orCond);
-exprList.addAll(exprs);
-
-fieldsToSelect = ["glAccountId", "debitCreditFlag", "totalAmount", "isPosted"] as Set;
-orderBy = ["glAccountId"];
-
-postedTransTotalList = FastList.newInstance();
-unpostedTransTotalList = FastList.newInstance();
-postedAndUnpostedTransTotalList = FastList.newInstance();
-tempValueMap = [:];
-tempValueMap.isPosted = "";
-tempValueMap.glAccountId = "000";
-tempValueMap.debitCreditFlag = "X";
-tempValueMap.totalAmount = 0.00;
-
-allTrans = delegator.findList("GlAccOrgAndAcctgTransAndEntry", EntityCondition.makeCondition(exprList, EntityOperator.AND), fieldsToSelect, orderBy, null, false);
-if (allTrans) {
- //PostedTransaction Section
- allPostedTrans = EntityUtil.filterByCondition(allTrans, EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
- if (allPostedTrans)
- getPostedTrans(0, (allPostedTrans.get(0)).glAccountId);
-
- //UnPostedTransaction Section
- allUnPostedTrans = EntityUtil.filterByCondition(allTrans, EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
- if (allUnPostedTrans)
- getUnpostedTrans(0, (allUnPostedTrans.get(0)).glAccountId);
-
- //PostedAndUnPostedTransaction Section
- getPostedAndUnpostedTrans(0, (allTrans.get(0)).glAccountId);
-}
-
-private void addTransToList(List transectionList, String prevGlAccountId, Map value) {
- if (!prevGlAccountId.equals(value.glAccountId)) {
- if (parameters.selectedMonth){
- resultMap = dispatcher.runSync("calculateGlAccountTrialBalance",
- [fromDate : financialYearFromDate, thruDate : fromDate , glAccountId : prevGlAccountId, isPosted : value.isPosted, userLogin : userLogin]);
-
- openingBalanceCredit = resultMap.openingBalanceCredit;
- openingBalanceDebit = resultMap.openingBalanceDebit;
+// UNPOSTED
+// Unposted transactions totals and grand totals
+unpostedTotals = [];
+unpostedTotalDebit = BigDecimal.ZERO;
+unpostedTotalCredit = BigDecimal.ZERO;
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List unpostedTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+if (unpostedTransactionTotals) {
+ Map unpostedTransactionTotalsMap = [:]
+ unpostedTransactionTotals.each { unpostedTransactionTotal ->
+ Map accountMap = (Map)unpostedTransactionTotalsMap.get(unpostedTransactionTotal.glAccountId);
+ if (!accountMap) {
+ GenericValue glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", unpostedTransactionTotal.glAccountId), true);
+ if (glAccount) {
+ boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
+ // Get the opening balances at the end of the last closed time period
+ if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
+ if (lastClosedTimePeriod) {
+ List timePeriodAndExprs = FastList.newInstance();
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, unpostedTransactionTotal.glAccountId));
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
+ lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
+ if (lastTimePeriodHistory) {
+ accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
+ }
+ }
+ }
+ }
+ if (!accountMap) {
+ accountMap = UtilMisc.makeMapWritable(unpostedTransactionTotal);
+ accountMap.put("openingD", BigDecimal.ZERO);
+ accountMap.put("openingC", BigDecimal.ZERO);
+ accountMap.put("D", BigDecimal.ZERO);
+ accountMap.put("C", BigDecimal.ZERO);
+ accountMap.put("balance", BigDecimal.ZERO);
+ }
+ //
+ List mainAndExprs = FastList.newInstance();
+ mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+ mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
+ mainAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, unpostedTransactionTotal.glAccountId));
+ mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+ mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
+ transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(mainAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+ transactionTotals.each { transactionTotal ->
+ UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
+ }
}
- postedAndUnpostedMap = FastMap.newInstance();
- postedAndUnpostedMap.glAccountId = prevGlAccountId;
- postedAndUnpostedMap.credit = creditTotal.setScale(decimals, rounding);
- postedAndUnpostedMap.debit = debitTotal.setScale(decimals, rounding);
- postedAndUnpostedMap.openingBalanceCredit = openingBalanceCredit.setScale(decimals, rounding);
- postedAndUnpostedMap.openingBalanceDebit = openingBalanceDebit.setScale(decimals, rounding);
- transectionList.add(postedAndUnpostedMap);
- debitTotal = BigDecimal.ZERO;
- creditTotal = BigDecimal.ZERO;
- }
- if ("C".equals(value.debitCreditFlag))
- creditTotal += value.getBigDecimal("totalAmount");
- if ("D".equals(value.debitCreditFlag))
- debitTotal += value.getBigDecimal("totalAmount");
-}
-
-private void getPostedTrans(int index, String prevGlAccountId) {
- if (index < allPostedTrans.size())
- value = allPostedTrans.get(index);
- else {
- tempValueMap.isPosted = "Y";
- value = tempValueMap;
- }
- if("Y".equals(value.isPosted)) {
- addTransToList(postedTransTotalList, prevGlAccountId, value);
- }
- if (index < allPostedTrans.size()) {
- index++;
- getPostedTrans(index, value.glAccountId);
- }
- else return;
-}
-
-private void getUnpostedTrans(int index, String prevGlAccountId) {
- if (index != allUnPostedTrans.size())
- value = allUnPostedTrans.get(index);
- else {
- tempValueMap.isPosted = "N";
- value = tempValueMap;
- }
-
- if("N".equals(value.isPosted)) {
- addTransToList(unpostedTransTotalList, prevGlAccountId, value);
- }
- if (index < allUnPostedTrans.size()) {
- index++;
- getUnpostedTrans(index, value.glAccountId);
- }
- else return;
-}
-
-private void getPostedAndUnpostedTrans(int index, String prevGlAccountId) {
- if (index != allTrans.size())
- value = allTrans.get(index);
- value.isPosted = "";
- addTransToList(postedAndUnpostedTransTotalList, prevGlAccountId, value);
- if (index < allTrans.size()) {
- index++;
- getPostedAndUnpostedTrans(index, value.glAccountId);
- }
- else return;
-}
-context.postedTransTotalList = postedTransTotalList;
-context.unpostedTransTotalList = unpostedTransTotalList;
-context.postedAndUnpostedTransTotalList = postedAndUnpostedTransTotalList;
\ No newline at end of file
+ UtilMisc.addToBigDecimalInMap(accountMap, unpostedTransactionTotal.debitCreditFlag, unpostedTransactionTotal.amount);
+ unpostedTransactionTotalsMap.put(unpostedTransactionTotal.glAccountId, accountMap);
+ }
+ unpostedTotals = unpostedTransactionTotalsMap.values().asList();
+}
+// Unposted grand total for Debits
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List unpostedDebitTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+if (unpostedDebitTransactionTotals) {
+ unpostedDebitTransactionTotal = EntityUtil.getFirst(unpostedDebitTransactionTotals);
+ if (unpostedDebitTransactionTotal && unpostedDebitTransactionTotal.amount) {
+ unpostedTotalDebit = unpostedDebitTransactionTotal.amount;
+ }
+}
+// Unposted grand total for Credits
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List unpostedCreditTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+if (unpostedCreditTransactionTotals) {
+ unpostedCreditTransactionTotal = EntityUtil.getFirst(unpostedCreditTransactionTotals);
+ if (unpostedCreditTransactionTotal && unpostedCreditTransactionTotal.amount) {
+ unpostedTotalCredit = unpostedCreditTransactionTotal.amount;
+ }
+}
+unpostedTotals.add(["D":unpostedTotalDebit, "C":unpostedTotalCredit]);
+context.unpostedTransactionTotals = unpostedTotals;
+
+// POSTED AND UNPOSTED
+// Posted and unposted transactions totals and grand totals
+allTotals = [];
+allTotalDebit = BigDecimal.ZERO;
+allTotalCredit = BigDecimal.ZERO;
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List allTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+if (allTransactionTotals) {
+ Map allTransactionTotalsMap = [:]
+ allTransactionTotals.each { allTransactionTotal ->
+ Map accountMap = (Map)allTransactionTotalsMap.get(allTransactionTotal.glAccountId);
+ if (!accountMap) {
+ GenericValue glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", allTransactionTotal.glAccountId), true);
+ if (glAccount) {
+ boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
+ // Get the opening balances at the end of the last closed time period
+ if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
+ if (lastClosedTimePeriod) {
+ List timePeriodAndExprs = FastList.newInstance();
+ timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
+ timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, allTransactionTotal.glAccountId));
+ timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
+ lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
+ if (lastTimePeriodHistory) {
+ accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
+ }
+ }
+ }
+ }
+ if (!accountMap) {
+ accountMap = UtilMisc.makeMapWritable(allTransactionTotal);
+ accountMap.put("openingD", BigDecimal.ZERO);
+ accountMap.put("openingC", BigDecimal.ZERO);
+ accountMap.put("D", BigDecimal.ZERO);
+ accountMap.put("C", BigDecimal.ZERO);
+ accountMap.put("balance", BigDecimal.ZERO);
+ }
+ //
+ List mainAndExprs = FastList.newInstance();
+ mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+ mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N"));
+ mainAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, allTransactionTotal.glAccountId));
+ mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+ mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
+ mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
+ transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(mainAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+ transactionTotals.each { transactionTotal ->
+ UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
+ }
+ }
+ UtilMisc.addToBigDecimalInMap(accountMap, allTransactionTotal.debitCreditFlag, allTransactionTotal.amount);
+ allTransactionTotalsMap.put(allTransactionTotal.glAccountId, accountMap);
+ }
+ allTotals = allTransactionTotalsMap.values().asList();
+}
+// Posted and unposted grand total for Debits
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List allDebitTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+if (allDebitTransactionTotals) {
+ allDebitTransactionTotal = EntityUtil.getFirst(allDebitTransactionTotals);
+ if (allDebitTransactionTotal && allDebitTransactionTotal.amount) {
+ allTotalDebit = allDebitTransactionTotal.amount;
+ }
+}
+// Posted and unposted grand total for Credits
+andExprs = FastList.newInstance();
+andExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
+andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
+andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
+andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
+List allCreditTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+if (allCreditTransactionTotals) {
+ allCreditTransactionTotal = EntityUtil.getFirst(allCreditTransactionTotals);
+ if (allCreditTransactionTotal && allCreditTransactionTotal.amount) {
+ allTotalCredit = allCreditTransactionTotal.amount;
+ }
+}
+allTotals.add(["D":allTotalDebit, "C":allTotalCredit]);
+context.allTransactionTotals = allTotals;
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/WEB-INF/controller.xml Fri Dec 11 23:11:39 2009
@@ -440,14 +440,14 @@
<security https="true" auth="true"/>
<event type="service" invoke="cancelPaymentBatch"/>
<response name="success" type="view" value="PaymentGroupOverview"/>
- <response name="error" type="view" value="PaymentGroupOverview"/>
+ <response name="error" type="view" value="FindPaymentGroup"/>
</request-map>
<request-map uri="cancelCheckRunPayments">
<security https="true" auth="true"/>
<event type="service" invoke="cancelCheckRunPayments"/>
<response name="success" type="view" value="PaymentGroupOverview"/>
- <response name="error" type="view" value="PaymentGroupOverview"/>
+ <response name="error" type="view" value="FindPaymentGroup"/>
</request-map>
<request-map uri="DepositSlip.pdf">
@@ -2219,26 +2219,10 @@
<response name="success" type="view" value="ComparativeIncomeStatement"/>
<response name="error" type="view" value="ComparativeIncomeStatement"/>
</request-map>
- <request-map uri="prepareIncomeStatement">
- <security https="true" auth="true"/>
- <event type="service" invoke="prepareIncomeStatement"/>
- <response name="success" type="view" value="IncomeStatement"/>
- <response name="error" type="view" value="IncomeStatement"/>
- </request-map>
<request-map uri="BalanceSheet"><security https="true" auth="true"/><response name="success" type="view" value="BalanceSheet"/></request-map>
- <request-map uri="prepareBalanceSheet">
- <security https="true" auth="true"/>
- <event type="service" invoke="prepareBalanceSheet"/>
- <response name="success" type="view" value="BalanceSheet"/>
- <response name="error" type="view" value="BalanceSheet"/>
- </request-map>
<request-map uri="ComparativeBalanceSheet"><security https="true" auth="true"/><response name="success" type="view" value="ComparativeBalanceSheet"/></request-map>
- <request-map uri="prepareComparativeBalanceSheet">
- <security https="true" auth="true"/>
- <event type="service" invoke="prepareComparativeBalanceSheet"/>
- <response name="success" type="view" value="ComparativeBalanceSheet"/>
- <response name="error" type="view" value="ComparativeBalanceSheet"/>
- </request-map>
+ <request-map uri="ComparativeBalanceSheet.pdf"><security https="true" auth="true"/><response name="success" type="view" value="ComparativeBalanceSheetPdf"/></request-map>
+ <request-map uri="ComparativeBalanceSheet.csv"><security https="true" auth="true"/><response name="success" type="view" value="ComparativeBalanceSheetCsv"/></request-map>
<request-map uri="TransactionTotals"><security https="true" auth="true"/><response name="success" type="view" value="TransactionTotals"/></request-map>
<request-map uri="FindPaymentsForDepositOrWithdraw">
<security https="true" auth="true"/>
@@ -2284,7 +2268,16 @@
<response name="success" type="view" value="InventoryValuationCsv"/>
<response name="error" type="view" value="InventoryValuation"/>
</request-map>
-
+ <request-map uri="CashFlowStatement"><security https="true" auth="true"/><response name="success" type="view" value="CashFlowStatement"/></request-map>
+ <request-map uri="CashFlowStatementListPdf.pdf">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="CashFlowStatementListPdf"/>
+ </request-map>
+ <request-map uri="CashFlowStatementListCsv.csv">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="CashFlowStatementListCsv"/>
+ </request-map>
+
<!-- ================ Depreciation Calculation Report requests ================ -->
<request-map uri="showFixedAssetDepreciation">
<security https="true" auth="true"/>
@@ -2398,15 +2391,6 @@
<response name="success" type="view" value="CommissionRun"/>
</request-map>
- <request-map uri="MonthlyTrialBalance">
- <security auth="true" https="true"/>
- <response name="success" type="view" value="MonthlyTrialBalance"/>
- </request-map>
- <request-map uri="MonthlyTrialBalance.pdf">
- <security auth="true" https="true"/>
- <response name="success" type="view" value="MonthlyTrialBalancePdf"/>
- </request-map>
-
<!--Add Tax Settings -->
<request-map uri="addtax">
<security auth="true" https="true"/>
@@ -2462,23 +2446,6 @@
<response name="success" type="view" value="CostCenters"/>
</request-map>
- <request-map uri="CostCenterReport">
- <security https="true" auth="true"/>
- <response name="success" type="view" value="CostCenterReport"/>
- </request-map>
-
- <request-map uri="getGlAcctgOrgWithPostedBalanceSplit">
- <security https="true" auth="true"/>
- <event type="service" invoke="getGlAcctgOrgWithPostedBalanceSplit"/>
- <response name="success" type="view" value="CostCenterReport"/>
- <response name="error" type="view" value="CostCenterReport"/>
- </request-map>
-
- <request-map uri="CostCentersReport.pdf">
- <security auth="true" https="true"/>
- <response name="success" type="view" value="CostCentersReportPdf"/>
- </request-map>
-
<request-map uri="createUpdateCostCenter">
<security auth="true" https="true"/>
<event type="jsonservice-multi" invoke="createUpdateCostCenter"/>
@@ -2500,6 +2467,15 @@
<event type="groovy" path="component://accounting/webapp/accounting/WEB-INF/actions/payment/" invoke="PaymentReport.groovy"/>
<response name="success" type="view" value="ViewPaymentReportPdf"/>
</request-map>
+
+ <request-map uri="GlAccountBalanceByCostCenter">
+ <security https="true" auth="true"/>
+ <response name="success" type="view" value="GlAccountBalanceByCostCenter"/>
+ </request-map>
+ <request-map uri="GlAccountBalanceByCostCenter.pdf">
+ <security auth="true" https="true"/>
+ <response name="success" type="view" value="GlAccountBalanceByCostCenterPdf"/>
+ </request-map>
<!-- end of request mappings -->
<!-- View Mappings -->
@@ -2752,10 +2728,14 @@
<view-map name="IncomeStatementListPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#IncomeStatementListPdf" content-type="application/pdf" encoding="none"/>
<view-map name="IncomeStatementListCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#IncomeStatementListCsv" content-type="text/csv" encoding="none"/>
<view-map name="ComparativeIncomeStatement" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeIncomeStatement"/>
+ <view-map name="ComparativeIncomeStatementsPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeIncomeStatementsPdf" content-type="application/pdf" encoding="none"/>
+ <view-map name="ComparativeIncomeStatementsCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeIncomeStatementsCsv" content-type="text/csv" encoding="none"/>
<view-map name="BalanceSheet" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#BalanceSheet"/>
<view-map name="BalanceSheetCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#BalanceSheetCsv" content-type="text/csv" encoding="none"/>
<view-map name="BalanceSheetPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#BalanceSheetPdf" content-type="application/pdf" encoding="none"/>
<view-map name="ComparativeBalanceSheet" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeBalanceSheet"/>
+ <view-map name="ComparativeBalanceSheetPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeBalanceSheetPdf" content-type="application/pdf" encoding="none"/>
+ <view-map name="ComparativeBalanceSheetCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeBalanceSheetCsv" content-type="text/csv" encoding="none"/>
<view-map name="TransactionTotals" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#TransactionTotals"/>
<view-map name="TransactionTotalsPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#TransactionTotalsPdf" content-type="application/pdf" encoding="none"/>
<view-map name="TransactionTotalsCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#TransactionTotalsCsv" content-type="text/csv" encoding="none"/>
@@ -2765,6 +2745,9 @@
<view-map name="InventoryValuation" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#InventoryValuation"/>
<view-map name="InventoryValuationPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#InventoryValuationPdf" content-type="application/pdf" encoding="none"/>
<view-map name="InventoryValuationCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#InventoryValuationCsv" content-type="text/csv" encoding="none"/>
+ <view-map name="CashFlowStatement" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CashFlowStatement"/>
+ <view-map name="CashFlowStatementListPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CashFlowStatementListPdf" content-type="application/pdf" encoding="none"/>
+ <view-map name="CashFlowStatementListCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CashFlowStatementListCsv" content-type="text/csv" encoding="none"/>
<!-- Assignment Mappings -->
<view-map name="EditPartyFixedAssetAssignments" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditPartyFixedAssetAssignments"/>
@@ -2792,16 +2775,12 @@
<view-map name="GlAccountTrialBalance" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#GlAccountTrialBalance"/>
<view-map name="GlAccountTrialBalanceReportPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#GlAccountTrialBalanceReportPdf" content-type="application/pdf" encoding="none"/>
<view-map name="CommissionRun" type="screen" page="component://accounting/widget/ap/InvoiceScreens.xml#CommissionRun"/>
- <view-map name="MonthlyTrialBalance" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#MonthlyTrialBalance"/>
- <view-map name="MonthlyTrialBalancePdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#MonthlyTrialBalancePdf" content-type="application/pdf"/>
<view-map name="EditGlAccountCategory" type="screen" page="component://accounting/widget/GlSetupScreens.xml#EditGlAccountCategory"/>
<view-map name="FindGlAccountCategory" type="screen" page="component://accounting/widget/GlSetupScreens.xml#FindGlAccountCategory"/>
<view-map name="EditGlAccountCategoryMember" type="screen" page="component://accounting/widget/GlSetupScreens.xml#EditGlAccountCategoryMember"/>
<view-map name="CostCenters" type="screen" page="component://accounting/widget/GlobalGlAccountsScreens.xml#CostCenters"/>
- <view-map name="CostCenterReport" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CostCenterReport"/>
- <view-map name="CostCentersReportPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CostCentersReportPdf" content-type="application/pdf" encoding="none"/>
- <view-map name="ComparativeIncomeStatementsPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeIncomeStatementsPdf" content-type="application/pdf" encoding="none"/>
- <view-map name="ComparativeIncomeStatementsCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeIncomeStatementsCsv" content-type="text/csv" encoding="none"/>
+ <view-map name="GlAccountBalanceByCostCenter" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#GlAccountBalanceByCostCenter"/>
+ <view-map name="GlAccountBalanceByCostCenterPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#GlAccountBalanceByCostCenterPdf" content-type="application/pdf" encoding="none"/>
<view-map name="ViewPaymentReportHtml" type="birt" page="component://accounting/webapp/accounting/payment/report/PaymentReport.rptdesign" content-type="text/html"/>
<view-map name="ViewPaymentReportPdf" type="birt" page="component://accounting/webapp/accounting/payment/report/PaymentReport.rptdesign" content-type="application/pdf"/>
<!-- end of view mappings -->
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/finaccounttrans/FinAccountTrans.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/finaccounttrans/FinAccountTrans.ftl?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/finaccounttrans/FinAccountTrans.ftl (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/finaccounttrans/FinAccountTrans.ftl Fri Dec 11 23:11:39 2009
@@ -202,15 +202,9 @@
<#if payment?has_content>
<#assign paymentGroupMembers = Static["org.ofbiz.entity.util.EntityUtil"].filterByDate(payment.getRelated("PaymentGroupMember")?if_exists) />
<#assign fromParty = payment.getRelatedOne("FromParty")?if_exists />
- <#assign fromPartyName = fromParty.getRelatedOne("Person")?if_exists />
- <#if !(fromPartyName?has_content)>
- <#assign fromPartyName = fromParty.getRelatedOne("PartyGroup")?if_exists />
- </#if>
+ <#assign fromPartyName = delegator.findOne("PartyNameView", {"partyId" : fromParty.partyId}, true) />
<#assign toParty = payment.getRelatedOne("ToParty")?if_exists />
- <#assign toPartyName = toParty.getRelatedOne("Person")?if_exists />
- <#if !(toPartyName?has_content)>
- <#assign toPartyName = toParty.getRelatedOne("PartyGroup")?if_exists />
- </#if>
+ <#assign toPartyName = delegator.findOne("PartyNameView", {"partyId" : toParty.partyId}, true) />
<#if paymentGroupMembers?has_content>
<#assign paymentGroupMember = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(paymentGroupMembers) />
</#if>
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/images/costCenters.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/images/costCenters.js?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/images/costCenters.js (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/images/costCenters.js Fri Dec 11 23:11:39 2009
@@ -16,9 +16,47 @@
* specific language governing permissions and limitations
* under the License.
*/
+
Event.observe(window, 'load', function() {
Event.observe($('costCentersSubmit'), 'click', processCostCenterData);
+ // Find all text boxes in form and add a method to list on for on change.
+ var categoryShareInputs = $('costCenters').getInputs('text');
+ categoryShareInputs.each(function (element) {
+ Event.observe(element, 'change', function(){
+ var textIdSplit = element.id.split('|');
+ var tableRowId = 'row_' + textIdSplit[0];
+ var tableRow = $(tableRowId);
+ // get all text inputs
+ var rowInputs = $(tableRowId).select('input[type="text"]');
+ var totalPercentage = 0;
+ rowInputs.each(function (inputElement) {
+ var inputElementIdSplit = inputElement.id.split("|");
+ if (inputElement.value) {
+ totalPercentage = totalPercentage + parseFloat(inputElement.value)
+ }
+ });
+ if (totalPercentage == 100 || totalPercentage == 0 ) {
+ if ( $(tableRowId).hasClassName('alternate-rowWarn')){
+ $(tableRowId).removeClassName('alternate-rowWarn');
+ }
+ if ($$('tr.alternate-rowWarn').size() == 0) {
+ $('costCentersSubmit').removeClassName('buttontextdisabled')
+ $('costCentersSubmit').disabled = false;
+ }
+
+ } else {
+ if ( !$(tableRowId).hasClassName('alternate-rowWarn')){
+ $(tableRowId).addClassName('alternate-rowWarn');
+ }
+ if (!$('costCentersSubmit').hasClassName('buttontextdisabled')) {
+ $('costCentersSubmit').addClassName('buttontextdisabled')
+ $('costCentersSubmit').disabled = true;
+ }
+ }
+ });
+ });
});
+
function processCostCenterData() {
new Ajax.Request($('costCenters').action, {
asynchronous: false,
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/ledger/CostCenters.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/ledger/CostCenters.ftl?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/ledger/CostCenters.ftl (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/ledger/CostCenters.ftl Fri Dec 11 23:11:39 2009
@@ -32,23 +32,25 @@
</#list>
</tr>
+ <#assign alt_row = false>
<#list glAcctgAndAmountPercentageList as glAcctgAndAmountPercentage>
<input type="hidden" id="glAccountId_${glAcctgAndAmountPercentage.glAccountId}" name="glAccountId_o_${glAcctgAndAmountPercentage_index}" value="${glAcctgAndAmountPercentage.glAccountId!}"/>
- <tr>
+ <tr id="row_${glAcctgAndAmountPercentage.glAccountId}" <#if alt_row> class="alternate-row"</#if>>
<td>${glAcctgAndAmountPercentage.glAccountId}</td>
<td>${glAcctgAndAmountPercentage.accountCode!}</td>
<td>${glAcctgAndAmountPercentage.accountName!}</td>
<#list glAccountCategories as glAccountCategory>
<td>
<#if (glAcctgAndAmountPercentage[glAccountCategory.glAccountCategoryId!])??>
- <input type="text" name="amp_${glAccountCategory.glAccountCategoryId!}_o_${glAcctgAndAmountPercentage_index}" value="${(glAcctgAndAmountPercentage[glAccountCategory.glAccountCategoryId!])!}"/>
+ <input type="text" id="${glAcctgAndAmountPercentage.glAccountId}|${glAccountCategory.glAccountCategoryId}" name="amp_${glAccountCategory.glAccountCategoryId!}_o_${glAcctgAndAmountPercentage_index}" value="${(glAcctgAndAmountPercentage[glAccountCategory.glAccountCategoryId!])!}"/>
<#else>
- <input type="text" name="amp_${glAccountCategory.glAccountCategoryId!}_o_${glAcctgAndAmountPercentage_index}" value=""/>
+ <input type="text" id="${glAcctgAndAmountPercentage.glAccountId}|${glAccountCategory.glAccountCategoryId}" name="amp_${glAccountCategory.glAccountCategoryId!}_o_${glAcctgAndAmountPercentage_index}" value=""/>
</#if>
</td>
</#list>
<input name="_rowSubmit_o_${glAcctgAndAmountPercentage_index}" type="hidden" value="Y"/>
</tr>
+ <#assign alt_row = !alt_row>
</#list>
</table>
<div align="right"><input type="button" id="costCentersSubmit" value="${uiLabelMap.CommonSubmit}"/></div>
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/reports/CostCentersReport.fo.ftl Fri Dec 11 23:11:39 2009
@@ -17,7 +17,7 @@
under the License.
-->
<#escape x as x?xml>
- <#if glAcctgOrgAndCostCenterList?has_content && glAccountCategories?has_content>
+ <#if glAcctBalancesByCostCenter?has_content && glAccountCategories?has_content>
<fo:table border="1pt solid" border-width=".1mm" width="19cm">
<fo:table-header>
<fo:table-cell border="1pt solid" border-width=".1mm">
@@ -39,24 +39,24 @@
</#list>
</fo:table-header>
<fo:table-body>
- <#list glAcctgOrgAndCostCenterList as glAcctgOrgAndCostCenter>
+ <#list glAcctBalancesByCostCenter as glAcctBalanceByCostCenter>
<#if glAcctgOrgAndCostCenter?has_content>
<fo:table-row>
<fo:table-cell border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${glAcctgOrgAndCostCenter.glAccountId?if_exists}</fo:block>
+ <fo:block text-align="center">${glAcctBalanceByCostCenter.glAccountId?if_exists}</fo:block>
</fo:table-cell>
<fo:table-cell border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${glAcctgOrgAndCostCenter.accountCode?if_exists}</fo:block>
+ <fo:block text-align="center">${glAcctBalanceByCostCenter.accountCode?if_exists}</fo:block>
</fo:table-cell>
<fo:table-cell border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${glAcctgOrgAndCostCenter.accountName?if_exists}</fo:block>
+ <fo:block text-align="center">${glAcctBalanceByCostCenter.accountName?if_exists}</fo:block>
</fo:table-cell>
<fo:table-cell border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${glAcctgOrgAndCostCenter.postedBalance?if_exists!}</fo:block>
+ <fo:block text-align="center">${glAcctBalanceByCostCenter.balance?if_exists!}</fo:block>
</fo:table-cell>
<#list glAccountCategories as glAccountCategory>
<fo:table-cell border="1pt solid" border-width=".1mm">
- <fo:block text-align="center">${(glAcctgOrgAndCostCenter[glAccountCategory.glAccountCategoryId?if_exists]?if_exists)}</fo:block>
+ <fo:block text-align="center">${(glAcctBalanceByCostCenter[glAccountCategory.glAccountCategoryId?if_exists]?if_exists)}</fo:block>
</fo:table-cell>
</#list>
</fo:table-row>
Modified: ofbiz/branches/addbirt/applications/accounting/webapp/accounting/reports/CostCentersReport.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/applications/accounting/webapp/accounting/reports/CostCentersReport.ftl?rev=889851&r1=889850&r2=889851&view=diff
==============================================================================
--- ofbiz/branches/addbirt/applications/accounting/webapp/accounting/reports/CostCentersReport.ftl (original)
+++ ofbiz/branches/addbirt/applications/accounting/webapp/accounting/reports/CostCentersReport.ftl Fri Dec 11 23:11:39 2009
@@ -17,14 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
-<#if glAcctgOrgAndCostCenterList?has_content && glAccountCategories?has_content>
- <form name="costCentersReportPdfForm" method="post" action="<@o...@ofbizUrl>">
- <input type="hidden" name="organizationPartyId" value="${parameters.organizationPartyId}"/>
- <input type="hidden" name="fromDate" value="${parameters.fromDate}"/>
- <input type="hidden" name="thruDate" value="${parameters.thruDate}"/>
- <input type="hidden" name="timePeriod" value="${parameters.timePeriod}"/>
- <a href="javascript:document.costCentersReportPdfForm.submit();" class="buttontext">${uiLabelMap.AccountingExportAsPdf}</a>
- </form>
+<#if glAcctBalancesByCostCenter?has_content && glAccountCategories?has_content>
<table class="basic-table hover-bar" cellspacing="0">
<tr class="header-row">
<th>${uiLabelMap.FormFieldTitle_glAccountId}</th>
@@ -35,18 +28,18 @@
<th>${glAccountCategory.description!} - (${currencyUomId})</th>
</#list>
</tr>
- <#list glAcctgOrgAndCostCenterList as glAcctgOrgAndCostCenter>
- <#if glAcctgOrgAndCostCenter?has_content>
- <tr>
- <td>${glAcctgOrgAndCostCenter.glAccountId?if_exists}</td>
- <td>${glAcctgOrgAndCostCenter.accountCode?if_exists}</td>
- <td>${glAcctgOrgAndCostCenter.accountName?if_exists}</td>
- <td>${glAcctgOrgAndCostCenter.postedBalance?if_exists}</td>
+ <#assign alt_row = false>
+ <#list glAcctBalancesByCostCenter as glAcctBalanceByCostCenter>
+ <tr <#if alt_row> class="alternate-row"</#if>>
+ <td>${glAcctBalanceByCostCenter.glAccountId?if_exists}</td>
+ <td>${glAcctBalanceByCostCenter.accountCode?if_exists}</td>
+ <td>${glAcctBalanceByCostCenter.accountName?if_exists}</td>
+ <td>${glAcctBalanceByCostCenter.balance?if_exists}</td>
<#list glAccountCategories as glAccountCategory>
- <td>${(glAcctgOrgAndCostCenter[glAccountCategory.glAccountCategoryId?if_exists]?if_exists)}</td>
+ <td>${(glAcctBalanceByCostCenter[glAccountCategory.glAccountCategoryId?if_exists]?if_exists)}</td>
</#list>
+ <#assign alt_row = !alt_row>
</tr>
- </#if>
</#list>
</table>
<#else>