You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2007/03/27 05:44:31 UTC
svn commit: r522728 - in /ofbiz/trunk/applications/accounting:
script/org/ofbiz/accounting/finaccount/ servicedef/
Author: jonesde
Date: Mon Mar 26 20:44:30 2007
New Revision: 522728
URL: http://svn.apache.org/viewvc?view=rev&rev=522728
Log:
To help with integrating efforts and to get the FinAccount balance field maintenance services in places committing all of this; note that the GL posting service is NOT yet complete, but is benign right now and shouldn't interfere with anything (ie it doesn't change anything in the database yet)
Added:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml (with props)
ofbiz/trunk/applications/accounting/servicedef/eecas.xml (with props)
Modified:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
ofbiz/trunk/applications/accounting/servicedef/secas.xml
ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
Added: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml?view=auto&rev=522728
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml (added)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml Mon Mar 26 20:44:30 2007
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/simple-methods.xsd">
+
+ <!-- FinAccountTrans Services -->
+ <simple-method method-name="postFinAccountTransToGl" short-description="Post a Financial Account Transaction to the General Ledger">
+ <!-- NOTE: this is not yet complete -->
+ <!-- NOTE: this will behave differently depending on how the FinAccount is used, see comments on different GlAccounts for trans entries below -->
+
+ <entity-one entity-name="FinAccountTrans" value-name="finAccountTrans"/>
+ <set field="finAccountId" from-field="finAccountTrans.finAccountId"/>
+ <entity-one entity-name="FinAccount" value-name="finAccount"/>
+
+ <set field="organizationPartyId" from-field="finAccount.organizationPartyId"/>
+
+ <!-- Figure out which GlAccount to post to using finAccount.postToGlAccountId or if not specified then use FinAccountTypeGlAccount -->
+ <if-not-empty field-name="finAccount.postToGlAccountId">
+ <set field="glAccountId" from-field="finAccount.postToGlAccountId"/>
+
+ <else>
+ <entity-one entity-name="FinAccountTypeGlAccount" value-name="finAccountTypeGlAccount" auto-field-map="false">
+ <field-map field-name="organizationPartyId"/>
+ <field-map field-name="finAccountTypeId" env-name="finAccount.finAccountTypeId"/>
+ </entity-one>
+ <if-not-empty field-name="finAccountTypeGlAccount">
+ <set field="glAccountId" from-field="finAccountTypeGlAccount.glAccountId"/>
+ </if-not-empty>
+ </else>
+ </if-not-empty>
+
+ <!-- Make sure we have the organizationPartyId and the glAccountId -->
+ <if-empty field-name="glAccountId">
+ <add-error><fail-message message="Cannot post FinAccountTrans with ID [${parameters.finAccountTransId}] to GL, could not find glAccountId"/></add-error>
+ </if-empty>
+ <if-empty field-name="organizationPartyId">
+ <add-error><fail-message message="Cannot post FinAccountTrans with ID [${parameters.finAccountTransId}] to GL, could not find organizationPartyId"/></add-error>
+ </if-empty>
+ <check-errors/>
+
+ <!-- TODO: Find the other side to post to/from -
+ if payment directory to account do from Payment;
+ if from account refill product purchase pull from special account where those funds wait;
+ if purchase on account, balance like bank acount received or something -->
+
+ <!-- TODO: Post the finAccountTrans.amount to the given GlAccount -->
+
+ </simple-method>
+</simple-methods>
Propchange: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml?view=diff&rev=522728&r1=522727&r2=522728
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml Mon Mar 26 20:44:30 2007
@@ -113,4 +113,62 @@
</if-empty>
<store-value value-name="finAccountAuth"/>
</simple-method>
+
+ <!-- Some methods to maintain FinAccount.actualBalance and FinAccount.availableBalance -->
+ <simple-method method-name="updateFinAccountBalancesFromTrans" short-description="">
+ <if-not-empty field-name="parameters.finAccountId">
+ <set field="finAccountId" from-field="parameters.finAccountId"/>
+ <else>
+ <entity-one entity-name="FinAccountTrans" value-name="mainFinAccountTrans"/>
+ <set field="finAccountId" from-field="mainFinAccountTrans.finAccountId"/>
+ </else>
+ </if-not-empty>
+
+ <call-simple-method method-name="inlineUpdateFinAccountActualAndAvailableBalance"/>
+ </simple-method>
+ <simple-method method-name="updateFinAccountBalancesFromAuth" short-description="">
+ <if-not-empty field-name="parameters.finAccountId">
+ <set field="finAccountId" from-field="parameters.finAccountId"/>
+ <else>
+ <entity-one entity-name="FinAccountAuth" value-name="mainFinAccountAuth"/>
+ <set field="finAccountId" from-field="mainFinAccountAuth.finAccountId"/>
+ </else>
+ </if-not-empty>
+
+ <call-simple-method method-name="inlineUpdateFinAccountActualAndAvailableBalance"/>
+ </simple-method>
+ <simple-method method-name="inlineUpdateFinAccountActualAndAvailableBalance" short-description="">
+ <!-- NOTE: finAccountId should always be in place -->
+ <!-- Get all of the records for the account from the database and sum everything up again, make sure we don't have any errors propagated over time -->
+
+ <entity-condition entity-name="FinAccountTrans" list-name="finAccountTransList">
+ <condition-expr field-name="finAccountId" env-name="finAccountId"/>
+ </entity-condition>
+ <iterate entry-name="finAccountTrans" list-name="finAccountTransList">
+ <calculate field-name="actualBalanceSum" type="BigDecimal">
+ <calcop operator="add" field-name="actualBalanceSum">
+ <calcop operator="get" field-name="finAccountTrans.amount"/>
+ </calcop>
+ </calculate>
+ </iterate>
+
+ <!-- start with the actual balance, and subtract off FinAccountAuth.amount -->
+ <set field="availableBalanceSum" from-field="actualBalanceSum"/>
+ <entity-condition entity-name="FinAccountAuth" list-name="finAccountAuthList">
+ <condition-expr field-name="finAccountId" env-name="finAccountId"/>
+ </entity-condition>
+ <iterate entry-name="finAccountAuth" list-name="finAccountAuthList">
+ <calculate field-name="availableBalanceSum" type="BigDecimal">
+ <calcop operator="add" field-name="availableBalanceSum">
+ <calcop operator="negative" field-name="finAccountAuth.amount"/>
+ </calcop>
+ </calculate>
+ </iterate>
+
+ <!-- Okay, now just store the results -->
+ <entity-one entity-name="FinAccount" value-name="finAccount"/>
+ <set field="finAccount.actualBalance" from-field="actualBalanceSum"/>
+ <set field="finAccount.availableBalance" from-field="availableBalanceSum"/>
+ <store-value value-name="finAccount"/>
+ </simple-method>
</simple-methods>
Added: ofbiz/trunk/applications/accounting/servicedef/eecas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/eecas.xml?view=auto&rev=522728
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/eecas.xml (added)
+++ ofbiz/trunk/applications/accounting/servicedef/eecas.xml Mon Mar 26 20:44:30 2007
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<entity-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/entity-eca.xsd">
+
+ <!-- To maintain FinAccount.actualBalance and FinAccount.availableBalance -->
+ <eca entity="FinAccountTrans" operation="create-store" event="return">
+ <action service="updateFinAccountBalancesFromTrans" mode="sync"/>
+ </eca>
+ <!-- To maintain FinAccount.availableBalance -->
+ <eca entity="FinAccountAuth" operation="create-store" event="return">
+ <action service="updateFinAccountBalancesFromAuth" mode="sync"/>
+ </eca>
+</entity-eca>
Propchange: ofbiz/trunk/applications/accounting/servicedef/eecas.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/accounting/servicedef/eecas.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/accounting/servicedef/eecas.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: ofbiz/trunk/applications/accounting/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas.xml?view=diff&rev=522728&r1=522727&r2=522728
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas.xml Mon Mar 26 20:44:30 2007
@@ -110,4 +110,9 @@
<action service="sampleInvoiceAffiliateCommission" mode="sync"/>
</eca>
-->
+
+ <!-- FinAccountTrans SECAs -->
+ <eca service="createFinAccountTrans" event="commit">
+ <action service="postFinAccountTransToGl" mode="sync"/>
+ </eca>
</service-eca>
Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?view=diff&rev=522728&r1=522727&r2=522728
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Mon Mar 26 20:44:30 2007
@@ -42,14 +42,29 @@
<description>Delete a Financial Account</description>
<auto-attributes mode="IN" optional="false" include="pk"/>
</service>
-
+ <service name="updateFinAccountBalancesFromTrans" engine="simple"
+ location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="updateFinAccountActualBalanceFromTrans">
+ <description>Update FinAccount.actualBalance and FinAccount.availableBalance based on a new FinAccountTrans; meant to be called as an EECA as it is for data maintenance</description>
+ <attribute name="finAccountTransId" type="String" mode="IN" optional="false"/>
+ </service>
+ <service name="updateFinAccountBalancesFromAuth" engine="simple"
+ location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="updateFinAccountBalancesFromAuth">
+ <description>Update FinAccount.availableBalance based on a new FinAccountAuth; meant to be called as an EECA as it is for data maintenance</description>
+ <attribute name="finAccountAuthId" type="String" mode="IN" optional="false"/>
+ </service>
+
<service name="createFinAccountTrans" engine="simple" default-entity-name="FinAccountTrans"
location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="createFinAccountTrans">
<description>Create a new Financial Account Transaction. Will use current timestamp for entryDate and trasanctionDate if none is provided.</description>
<auto-attributes mode="IN" optional="true" include="nonpk"/>
<auto-attributes mode="OUT" optional="false" include="pk"/>
</service>
-
+ <service name="postFinAccountTransToGl" engine="simple"
+ location="org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml" invoke="postFinAccountTransToGl">
+ <description>Post a Financial Account Transaction to the General Ledger; meant to be called as an SECA</description>
+ <attribute name="finAccountTransId" type="String" mode="IN" optional="false"/>
+ </service>
+
<service name="createFinAccountRole" engine="simple" default-entity-name="FinAccountRole"
location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="createFinAccountRole">
<description>Create a new Financial Account Role</description>
@@ -57,31 +72,29 @@
<auto-attributes mode="IN" optional="false" include="pk"/>
<override name="fromDate" optional="true"/>
</service>
-
<service name="updateFinAccountRole" engine="simple" default-entity-name="FinAccountRole"
location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="updateFinAccountRole">
<description>Update a Financial Account Role</description>
<auto-attributes mode="IN" optional="true" include="nonpk"/>
<auto-attributes mode="IN" optional="false" include="pk"/>
</service>
-
<service name="deleteFinAccountRole" engine="simple" default-entity-name="FinAccountRole"
location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="deleteFinAccountRole">
<description>Remove a Financial Account Role</description>
<auto-attributes mode="IN" optional="false" include="pk"/>
</service>
- <service name="createFinAccountAuth" engine="simple" default-entity-name="FinAccountAuth"
+ <service name="createFinAccountAuth" engine="simple" default-entity-name="FinAccountAuth"
location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="createFinAccountAuth">
<description>Lower level service for creating authorization against a fin account. Will use current time for authorizationDate and thruDate if not supplied.</description>
<auto-attributes mode="IN" optional="true" include="nonpk"/>
<auto-attributes mode="OUT" optional="false" include="pk"/>
</service>
- <service name="expireFinAccountAuth" engine="simple" default-entity-name="FinAccountAuth"
+ <service name="expireFinAccountAuth" engine="simple" default-entity-name="FinAccountAuth"
location="org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="expireFinAccountAuth">
<description>Expires a fin account authorization. Will use current time if no time is supplied in parameter</description>
- <attribute type="String" mode="IN" name="finAccountAuthId" optional="false"/>
- <attribute type="Timestamp" mode="IN" name="expireDateTime" optional="true"/>
+ <attribute name="finAccountAuthId" type="String" mode="IN" optional="false"/>
+ <attribute name="expireDateTime" type="Timestamp" mode="IN" optional="true"/>
</service>
<!-- these services use the product store's fin account settings -->