Author: jacopoc
Date: Fri Jan 25 01:49:59 2008
New Revision: 615161

URL: http://svn.apache.org/viewvc?rev=615161&view=rev
Log:
Implemented mapping logic for party specific gl account type/gl account id.
Still not tested.

Modified:
    
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml

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=615161&r1=615160&r2=615161&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
 Fri Jan 25 01:49:59 2008
@@ -320,6 +320,7 @@
                         <set 
field="getGlAccountFromAccountTypeInMap.glAccountTypeId" 
from-field="acctgTransEntry.glAccountTypeId"/>
                         <set 
field="getGlAccountFromAccountTypeInMap.debitCreditFlag" 
from-field="acctgTransEntry.debitCreditFlag"/>
                         <set 
field="getGlAccountFromAccountTypeInMap.productId" 
from-field="acctgTransEntry.productId"/>
+                        <set field="getGlAccountFromAccountTypeInMap.partyId" 
from-field="parameters.partyId"/>
                         <set 
field="getGlAccountFromAccountTypeInMap.invoiceId" 
from-field="parameters.invoiceId"/>
                         <set 
field="getGlAccountFromAccountTypeInMap.paymentId" 
from-field="parameters.paymentId"/>
                         <call-service 
service-name="getGlAccountFromAccountType" 
in-map-name="getGlAccountFromAccountTypeInMap">
@@ -402,6 +403,61 @@
             </if-not-empty>
             <return/>
         </if-compare>
+        <!-- for invoices and payments, check first if there is a party 
specific account mapping defined for the account type -->
+        <if>
+            <condition>
+                <and>
+                    <or>
+                        <and>
+                            <if-compare 
field-name="parameters.acctgTransTypeId" operator="equals" 
value="OUTGOING_PAYMENT"/>
+                            <if-compare 
field-name="parameters.debitCreditFlag" operator="equals" value="C"/>
+                        </and>
+                        <and>
+                            <if-compare 
field-name="parameters.acctgTransTypeId" operator="equals" 
value="INCOMING_PAYMENT"/>
+                            <if-compare 
field-name="parameters.debitCreditFlag" operator="equals" value="D"/>
+                        </and>
+                        <and>
+                            <if-compare 
field-name="parameters.acctgTransTypeId" operator="equals" 
value="PURCHASE_INVOICE"/>
+                            <if-compare 
field-name="parameters.debitCreditFlag" operator="equals" value="D"/>
+                        </and>
+                        <and>
+                            <if-compare 
field-name="parameters.acctgTransTypeId" operator="equals" 
value="SALES_INVOICE"/>
+                            <if-compare 
field-name="parameters.debitCreditFlag" operator="equals" value="C"/>
+                        </and>
+                    </or>
+                    <not><if-empty 
field-name="parameters.glAccountTypeId"/></not>
+                    <not><if-empty field-name="parameters.partyId"/></not>
+                </and>
+            </condition>
+            <then>
+                <if>
+                    <condition>
+                        <or>
+                            <if-compare 
field-name="parameters.acctgTransTypeId" operator="equals" 
value="OUTGOING_PAYMENT"/>
+                            <if-compare 
field-name="parameters.acctgTransTypeId" operator="equals" 
value="PURCHASE_INVOICE"/>
+                        </or>
+                    </condition>
+                    <then>
+                        <set field="roleTypeId" value="BILL_FROM_VENDOR"/>
+                    </then>
+                    <else>
+                        <set field="roleTypeId" value="BILL_TO_CUSTOMER"/>
+                    </else>
+                </if>
+                <entity-one entity-name="PartyGlAccount" 
value-name="partyGlAccount">
+                    <field-map field-name="organizationPartyId" 
env-name="parameters.organizationPartyId"/>
+                    <field-map field-name="partyId" 
env-name="parameters.partyId"/>
+                    <field-map field-name="roleTypeId" env-name="roleTypeId"/>
+                    <field-map field-name="glAccountTypeId" 
env-name="parameters.glAccountTypeId"/>
+                </entity-one>
+                <if-not-empty field-name="partyGlAccount.glAccountId">
+                    <field-to-result field-name="partyGlAccount.glAccountId" 
result-name="glAccountId"/>
+                    <return/>
+                </if-not-empty>
+                <return/>
+            </then>
+        </if>
+
         <if>
             <condition>
                 <and>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=615161&r1=615160&r2=615161&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml 
(original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Fri Jan 
25 01:49:59 2008
@@ -331,6 +331,7 @@
         <attribute name="glAccountTypeId" type="String" mode="IN" 
optional="true"/>
         <attribute name="acctgTransTypeId" type="String" mode="IN" 
optional="true"/>
         <attribute name="debitCreditFlag" type="String" mode="IN" 
optional="true"/>
+        <attribute name="partyId" type="String" mode="IN" optional="true"/>
         <attribute name="productId" type="String" mode="IN" optional="true"/>
         <attribute name="paymentId" type="String" mode="IN" optional="true"/>
         <attribute name="invoiceId" type="String" mode="IN" optional="true"/>


Reply via email to