Author: jacopoc
Date: Sun Dec 20 11:44:03 2009
New Revision: 892585
URL: http://svn.apache.org/viewvc?rev=892585&view=rev
Log:
Improved and completed implementation of automatic gl postings for payment and
applications and added new demo accounts and mappings to show the new feature
available:
it is now possible to generate separate gl transactions for payments and for
payment applications.
Based on initial suggestions from Scott Gray and Anil Patel.
Minor fixes:
- removed a duplicated gl account type (PREPAID_EXPENSES)
- fixed a typo in a description of an account of the demo chart of accounts
Modified:
ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml
ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?rev=892585&r1=892584&r2=892585&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Sun Dec 20
11:44:03 2009
@@ -335,7 +335,6 @@
<GlAccountType description="Customer Gift Certificate Balances"
glAccountTypeId="CUSTOMER_GC_DEPOSIT" hasTable="N"
parentTypeId="CURRENT_LIABILITY"/>
<GlAccountType description="Uninvoiced Shipment Receipts"
glAccountTypeId="UNINVOICED_SHIP_RCPT" hasTable="N"
parentTypeId="CURRENT_LIABILITY"/>
<GlAccountType description="Purchase Price Variance"
glAccountTypeId="PURCHASE_PRICE_VAR" hasTable="N" parentTypeId="OTHER_EXPENSE"/>
- <GlAccountType description="Prepaid Expenses"
glAccountTypeId="PREPAID_EXPENSES" hasTable="N" parentTypeId="CURRENT_ASSET"/>
<GlAccountType description="Income" glAccountTypeId="INCOME" hasTable="N"
parentTypeId=""/>
<GlAccountType description="Other Income" glAccountTypeId="OTHER_INCOME"
hasTable="N" parentTypeId="INCOME"/>
@@ -346,6 +345,8 @@
<GlAccountType description="Receivable from Inventory Transferred Out"
glAccountTypeId="INVENTORY_XFER_OUT" hasTable="N" parentTypeId="CURRENT_ASSET"/>
<GlAccountType description="Payable from Inventory Transferred In"
glAccountTypeId="INVENTORY_XFER_IN" hasTable="N"
parentTypeId="CURRENT_LIABILITY"/>
+ <GlAccountType description="Accounts Payable - Unapplied Payments"
glAccountTypeId="ACCPAYABLE_UNAPPLIED" hasTable="N"
parentTypeId="ACCOUNTS_PAYABLE"/>
+ <GlAccountType description="Accounts Receivable - Unapplied Payments"
glAccountTypeId="ACCREC_UNAPPLIED" hasTable="N"
parentTypeId="ACCOUNTS_RECEIVABLE"/>
<GlAccountType description="Commission Expense"
glAccountTypeId="COMMISSION_EXPENSE" hasTable="N"
parentTypeId="OPERATING_EXPENSE"/>
<GlAccountType description="Commissions Payables"
glAccountTypeId="COMMISSIONS_PAYABLE" hasTable="N"
parentTypeId="CURRENT_LIABILITY"/>
Modified:
ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml?rev=892585&r1=892584&r2=892585&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml
(original)
+++ ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml Sun
Dec 20 11:44:03 2009
@@ -128,12 +128,16 @@
accountName="LOANS RECEIVABLE - OWNERS" description=""
postedBalance="0.0"/>
<GlAccount parentGlAccountId="124000" glAccountId="124300"
accountCode="124300"
glAccountClassId="CURRENT_ASSET" glAccountTypeId="CURRENT_ASSET"
glResourceTypeId="MONEY"
- accountName="LOANS RECEIVABLE -OTHERS" description="" postedBalance="0.0"/>
+ accountName="LOANS RECEIVABLE - OTHERS" description=""
postedBalance="0.0"/>
<GlAccount parentGlAccountId="120000" glAccountId="125000"
accountCode="125000"
glAccountClassId="CURRENT_ASSET" glAccountTypeId="INVENTORY_XFER_OUT"
glResourceTypeId="MONEY"
accountName="RECEIVABLE FROM INVENTORY TRANSFERRED OUT" description=""
postedBalance="0.0"/>
+ <GlAccount parentGlAccountId="120000" glAccountId="126000"
accountCode="126000"
+ glAccountClassId="CURRENT_ASSET" glAccountTypeId="ACCREC_UNAPPLIED"
glResourceTypeId="MONEY"
+ accountName="ACCOUNTS RECEIVABLE - UNAPPLIED PAYMENTS" description=""
postedBalance="0.0"/>
+
<GlAccount parentGlAccountId="120000" glAccountId="129000"
accountCode="129000"
glAccountClassId="CURRENT_ASSET" glAccountTypeId="CURRENT_ASSET"
glResourceTypeId="MONEY"
accountName="A/R MISCELLANEOUS" description="" postedBalance="0.0"/>
@@ -332,6 +336,10 @@
glAccountClassId="CURRENT_LIABILITY" glAccountTypeId="INVENTORY_XFER_IN"
glResourceTypeId="MONEY"
accountName="PAYABLE FOR INVENTORY TRANSFERRED IN" description=""
postedBalance="0.0"/>
+ <GlAccount parentGlAccountId="210000" glAccountId="216000"
accountCode="216000"
+ glAccountClassId="CURRENT_LIABILITY"
glAccountTypeId="ACCPAYABLE_UNAPPLIED" glResourceTypeId="MONEY"
+ accountName="ACCOUNTS PAYABLE - UNAPPLIED PAYMENTS" description=""
postedBalance="0.0"/>
+
<GlAccount parentGlAccountId="200000" glAccountId="220000"
accountCode="220000"
glAccountClassId="CURRENT_LIABILITY" glAccountTypeId="CURRENT_LIABILITY"
glResourceTypeId="MONEY"
accountName="ACCRUED EXPENSES" description="" postedBalance="0.0"/>
Modified: ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml?rev=892585&r1=892584&r2=892585&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml Sun Dec 20
11:44:03 2009
@@ -228,6 +228,7 @@
<GlAccountOrganization organizationPartyId="Company" glAccountId="122200"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="122300"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="122500"
fromDate="2001-01-01 00:00:00.0"/>
+ <GlAccountOrganization organizationPartyId="Company" glAccountId="126000"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="140000"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="141000"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="142000"
fromDate="2001-01-01 00:00:00.0"/>
@@ -241,6 +242,7 @@
<GlAccountOrganization organizationPartyId="Company" glAccountId="213500"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="214000"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="215000"
fromDate="2001-01-01 00:00:00.0"/>
+ <GlAccountOrganization organizationPartyId="Company" glAccountId="216000"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="221100"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="224000"
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountOrganization organizationPartyId="Company" glAccountId="224100"
fromDate="2001-01-01 00:00:00.0"/>
@@ -287,6 +289,7 @@
<!-- Default mapping between account types and account ids -->
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="ACCOUNTS_RECEIVABLE" glAccountId="120000"/>
+ <GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="ACCREC_UNAPPLIED" glAccountId="126000"/>
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="INTRSTINC_RECEIVABLE" glAccountId="121800"/>
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="INVENTORY_XFER_OUT" glAccountId="125000"/>
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="INVENTORY_ACCOUNT" glAccountId="140000"/>
@@ -298,6 +301,7 @@
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="CUSTOMER_DEPOSIT" glAccountId="213300"/>
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="UNINVOICED_SHIP_RCPT" glAccountId="214000"/>
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="INVENTORY_XFER_IN" glAccountId="215000"/>
+ <GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="ACCPAYABLE_UNAPPLIED" glAccountId="216000"/>
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="COMMISSIONS_PAYABLE" glAccountId="221100"/>
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="RETAINED_EARNINGS" glAccountId="336000"/>
<GlAccountTypeDefault organizationPartyId="Company"
glAccountTypeId="SALES_ACCOUNT" glAccountId="400000"/>
@@ -315,10 +319,10 @@
<!-- mappings for payments -->
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="CUSTOMER_REFUND" glAccountTypeId="CUSTOMER_CREDIT"/>
<!-- NOTE: do not change this -->
- <PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="VENDOR_PAYMENT" glAccountTypeId="ACCOUNTS_PAYABLE"/>
+ <PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="VENDOR_PAYMENT" glAccountTypeId="ACCPAYABLE_UNAPPLIED"/>
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="VENDOR_PREPAY" glAccountTypeId="PREPAID_EXPENSES"/>
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="COMMISSION_PAYMENT" glAccountTypeId="COMMISSIONS_PAYABLE"/>
- <PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="PAY_CHECK" glAccountTypeId="ACCOUNTS_PAYABLE"/>
+ <PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="PAY_CHECK" glAccountTypeId="ACCPAYABLE_UNAPPLIED"/>
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="GC_WITHDRAWAL" glAccountTypeId="CUSTOMER_CREDIT"/>
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="SALES_TAX_PAYMENT" glAccountTypeId="TAX_ACCOUNT"/>
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="PAYROL_PAYMENT" glAccountTypeId="OPERATING_EXPENSE"/>
@@ -326,7 +330,7 @@
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="INCOME_TAX_PAYMENT" glAccountTypeId="TAX_ACCOUNT"/>
<!-- NOTE: do not change this -->
- <PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="CUSTOMER_PAYMENT" glAccountTypeId="ACCOUNTS_RECEIVABLE"/>
+ <PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="CUSTOMER_PAYMENT" glAccountTypeId="ACCREC_UNAPPLIED"/>
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="CUSTOMER_DEPOSIT" glAccountTypeId="CUSTOMER_DEPOSIT"/>
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="INTEREST_RECEIPT" glAccountTypeId="INTRSTINC_RECEIVABLE"/>
<PaymentGlAccountTypeMap organizationPartyId="Company"
paymentTypeId="GC_DEPOSIT" glAccountTypeId="CUSTOMER_DEPOSIT"/>
Modified:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=892585&r1=892584&r2=892585&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
(original)
+++
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
Sun Dec 20 11:44:03 2009
@@ -1913,11 +1913,10 @@
<field-map field-name="organizationPartyId"/>
</entity-one>
<set field="creditGlAccountTypeId"
from-field="paymentGlAccountTypeMap.glAccountTypeId"/>
-
+ <!-- This is now delegated to the
createAcctgTransAndEntriesForPaymentApplication calls at the bottom of this
service
<get-related value-field="payment"
relation-name="PaymentApplication" list="paymentApplications"/>
<iterate list="paymentApplications" entry="paymentApplication">
- <!-- credit -->
<make-value entity-name="AcctgTransEntry"
value-field="creditEntry"/>
<set field="creditEntry.debitCreditFlag" value="C"/>
<set field="creditEntry.origAmount"
from-field="paymentApplication.amountApplied"/>
@@ -1935,7 +1934,7 @@
</calculate>
<set field="acctgTransEntries[]" from-field="creditEntry"
type="Object"/>
</iterate>
-
+ -->
<calculate field="diffAmount" decimal-scale="${ledgerDecimals}"
rounding-mode="${roundingMode}">
<calcop operator="subtract">
<calcop operator="get" field="payment.amount"/>
@@ -1966,6 +1965,15 @@
<result-to-field result-name="acctgTransId"/>
</call-service>
<field-to-result field="acctgTransId" result-name="acctgTransId"/>
+ <!-- Now create accounting transactions for the payment
applications -->
+ <get-related value-field="payment"
relation-name="PaymentApplication" list="paymentApplications"/>
+ <iterate list="paymentApplications" entry="paymentApplication">
+ <set
field="createAcctgTransAndEntriesForPaymentApplicationInMap.paymentApplicationId"
from-field="paymentApplication.paymentApplicationId"/>
+ <call-service
service-name="createAcctgTransAndEntriesForPaymentApplication"
in-map-name="createAcctgTransAndEntriesForPaymentApplicationInMap">
+ <result-to-field result-name="acctgTransId"/>
+ </call-service>
+ <log level="info" message="Accounting transaction
${acctgTransId} created for payment application
${paymentApplication.paymentApplicationId}"/>
+ </iterate>
</if-compare>
</simple-method>
@@ -2238,12 +2246,11 @@
<set field="creditEntry.partyId" from-field="payment.partyIdTo"/>
<set field="creditEntry.roleTypeId" value="BILL_FROM_VENDOR"/>
<set field="acctgTransEntries[]" from-field="creditEntry"
type="Object"/>
-
+ <!-- This is now delegated to the
createAcctgTransAndEntriesForPaymentApplication calls at the bottom of this
service
<entity-and entity-name="PaymentApplication"
list="paymentApplications">
<field-map field-name="paymentId"
from-field="payment.paymentId"/>
</entity-and>
<iterate list="paymentApplications" entry="paymentApplication">
- <!-- Debit -->
<make-value entity-name="AcctgTransEntry"
value-field="debitEntry"/>
<set field="debitEntry.debitCreditFlag" value="D"/>
<set field="debitEntry.origAmount"
from-field="paymentApplication.amountApplied"/>
@@ -2271,6 +2278,7 @@
</calculate>
<set field="acctgTransEntries[]" from-field="debitEntry"
type="Object"/>
</iterate>
+ -->
<calculate field="amount" decimal-scale="${ledgerDecimals}"
rounding-mode="${roundingMode}">
<calcop operator="subtract">
<calcop operator="get" field="payment.amount"/>
@@ -2298,6 +2306,17 @@
<result-to-field result-name="acctgTransId"/>
</call-service>
<field-to-result field="acctgTransId" result-name="acctgTransId"/>
+ <!-- Now create accounting transactions for the payment
applications -->
+ <entity-and entity-name="PaymentApplication"
list="paymentApplications">
+ <field-map field-name="paymentId"
from-field="payment.paymentId"/>
+ </entity-and>
+ <iterate list="paymentApplications" entry="paymentApplication">
+ <set
field="createAcctgTransAndEntriesForPaymentApplicationInMap.paymentApplicationId"
from-field="paymentApplication.paymentApplicationId"/>
+ <call-service
service-name="createAcctgTransAndEntriesForPaymentApplication"
in-map-name="createAcctgTransAndEntriesForPaymentApplicationInMap">
+ <result-to-field result-name="acctgTransId"/>
+ </call-service>
+ <log level="info" message="Accounting transaction
${acctgTransId} created for payment application
${paymentApplication.paymentApplicationId}"/>
+ </iterate>
</if-compare>
</simple-method>
@@ -2411,6 +2430,19 @@
<set field="debitEntry.origAmount"
from-field="paymentApplication.amountApplied"/>
<set field="debitEntry.origCurrencyUomId"
from-field="payment.currencyUomId"/>
<set field="debitEntry.glAccountTypeId" value="ACCOUNTS_PAYABLE"/>
+ <if-not-empty field="paymentApplication.overrideGlAccountId">
+ <set field="debitEntry.glAccountId"
from-field="paymentApplication.overrideGlAccountId"/>
+ <else>
+ <if-not-empty field="paymentApplication.taxAuthGeoId">
+ <entity-one entity-name="TaxAuthorityGlAccount"
value-field="taxAuthorityGlAccount">
+ <field-map field-name="organizationPartyId"
from-field="organizationPartyId"/>
+ <field-map field-name="taxAuthGeoId"
from-field="paymentApplication.taxAuthGeoId"/>
+ <field-map field-name="taxAuthPartyId"
from-field="partyId"/>
+ </entity-one>
+ <set field="debitEntry.glAccountId"
from-field="taxAuthorityGlAccount.glAccountId"/>
+ </if-not-empty>
+ </else>
+ </if-not-empty>
</else>
</if-compare>
<set field="acctgTransEntries[]" from-field="debitEntry"
type="Object"/>