svn commit: r806588 - in /ofbiz/trunk/applications/accounting: config/ script/org/ofbiz/accounting/finaccount/ servicedef/ webapp/accounting/finaccounttrans/ widget/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r806588 - in /ofbiz/trunk/applications/accounting: config/ script/org/ofbiz/accounting/finaccount/ servicedef/ webapp/accounting/finaccounttrans/ widget/

apatel-2
Author: apatel
Date: Fri Aug 21 15:08:50 2009
New Revision: 806588

URL: http://svn.apache.org/viewvc?rev=806588&view=rev
Log:
If reconciliation is started then user cannot add new financial account transaction. Adding a service to check if a GlReconcilation is ready for completion (isGlReconciliationReconciled).
Manual FinancialAccount Transaction now default to CREATED status.

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/GlReconciledFinAccountTrans.ftl
    ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml
    ofbiz/trunk/applications/accounting/widget/FinAccountScreens.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=806588&r1=806587&r2=806588&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Fri Aug 21 15:08:50 2009
@@ -4560,6 +4560,10 @@
         <value xml:lang="it">Istanza del prodotto</value>
         <value xml:lang="zh">产品标识实例</value>
     </property>
+    <property key="AccountingInvalidGlReconciliation">
+        <value xml:lang="en">GlReconciliation [${glReconciliationId}] is already reconciled</value>
+        <value xml:lang="hi_IN">GlReconciliation [${glReconciliationId}] पहले ही पुनर्मिलित है</value>
+    </property>
     <property key="AccountingInvalidGlReconciliationAssignment">
         <value xml:lang="en">Invalid Gl Reconciliation Assignement: You can not assign FinAccountTrans in Approved or Cancel Status. FinAccount Transaction need to be in Created status only.</value>
     </property>

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?rev=806588&r1=806587&r2=806588&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml Fri Aug 21 15:08:50 2009
@@ -685,6 +685,15 @@
         <set field="setFinAccountTransStatusMap.statusId" value="FINACT_TRNS_APPROVED"/>
         <call-service service-name="setFinAccountTransStatus" in-map-name="setFinAccountTransStatusMap"/>
         <if-not-empty field="finAccountTrans.glReconciliationId">
+            <set field="isGlReconciliationReconciledMap.glReconciliationId" from-field="finAccountTrans.glReconciliationId"/>
+            <call-service service-name="isGlReconciliationReconciled" in-map-name="isGlReconciliationReconciledMap">
+                <result-to-field result-name="isReconciled"/>
+            </call-service>
+            <if-compare field="isReconciled" operator="equals" value="true" type="Boolean">
+                <if-empty field="updateGlReconciliationMap.reconciledDate">
+                    <set field="updateGlReconciliationMap.reconciledDate" from-field="nowTimestamp"/>
+                </if-empty>
+            </if-compare>
             <call-service service-name="updateGlReconciliation" in-map-name="updateGlReconciliationMap"/>
         </if-not-empty>
     </simple-method>
@@ -926,41 +935,71 @@
 
     <simple-method method-name="assignGlRecToFinAccTrans" short-description="Assignment of Gl Reconciliation to Fin Account Trans">
         <entity-one entity-name="FinAccountTrans" value-field="finAccountTrans"/>
-        <if-compare field="finAccountTrans.statusId" operator="not-equals" value="FINACT_TRNS_CREATED">
-            <add-error><fail-property resource="AccountingUiLabels" property="AccountingInvalidGlReconciliationAssignment"/></add-error>
-            <check-errors/>
-        <else>
-            <set field="finAccountTrans.glReconciliationId" from-field="parameters.glReconciliationId"/>
-            <store-value value-field="finAccountTrans"/>
-        </else>
-        </if-compare>
-        <if-empty field="finAccountTrans.paymentId">
-            <entity-and entity-name="Payment" list="payments">
-                <field-map field-name="finAccountTransId" from-field="finAccountTrans.finAccountTransId"/>
-            </entity-and>
+        <set field="glReconciliationId" from-field="parameters.glReconciliationId"/>
+        <entity-one entity-name="GlReconciliation" value-field="glReconciliation"/>
+        <if-empty field="glReconciliation.reconciledBalance">
+            <if-compare field="finAccountTrans.statusId" operator="not-equals" value="FINACT_TRNS_CREATED">
+                <add-error><fail-property resource="AccountingUiLabels" property="AccountingInvalidGlReconciliationAssignment"/></add-error>
+                <check-errors/>
+            <else>
+                <set field="finAccountTrans.glReconciliationId" from-field="glReconciliationId"/>
+                <store-value value-field="finAccountTrans"/>
+            </else>
+            </if-compare>
+            <if-empty field="finAccountTrans.paymentId">
+                <entity-and entity-name="Payment" list="payments">
+                    <field-map field-name="finAccountTransId" from-field="finAccountTrans.finAccountTransId"/>
+                </entity-and>
+            <else>
+                <entity-one entity-name="Payment" value-field="payment">
+                    <field-map field-name="paymentId" from-field="finAccountTrans.paymentId"/>
+                </entity-one>
+                <field-to-list field="payment" list="payments"/>
+            </else>
+            </if-empty>
+            <iterate list="payments" entry="payment">
+                <if-compare field="${payment.statusId == 'PMNT_SENT' @or payment.statusId == 'PMNT_RECEIVED' @or payment.statusId == 'PMNT_CONFIRMED'}" operator="equals" value="false">
+                    <add-error><fail-property resource="AccountingUiLabels" property="AccountingPaymentsAssociateWithFinAccountHasInvalidStatusError"/></add-error>
+                    <check-errors/>
+                </if-compare>
+            </iterate>
         <else>
-            <entity-one entity-name="Payment" value-field="payment">
-                <field-map field-name="paymentId" from-field="finAccountTrans.paymentId"/>
-            </entity-one>
-            <field-to-list field="payment" list="payments"/>
+            <add-error><fail-property resource="AccountingUiLabels" property="AccountingInvalidGlReconciliation"/></add-error>
+            <check-errors/>
         </else>
         </if-empty>
-        <iterate list="payments" entry="payment">
-            <if-compare field="${payment.statusId == 'PMNT_SENT' @or payment.statusId == 'PMNT_RECEIVED' @or payment.statusId == 'PMNT_CONFIRMED'}" operator="equals" value="false">
-                <add-error><fail-property resource="AccountingUiLabels" property="AccountingPaymentsAssociateWithFinAccountHasInvalidStatusError"/></add-error>
-                <check-errors/>
-            </if-compare>
-        </iterate>
     </simple-method>
+
     <simple-method method-name="removeFinAccountTransFromReconciliation" short-description="Remove finAccountTrans from reconciliation">
         <entity-one entity-name="FinAccountTrans" value-field="finAccountTrans"/>
         <if-compare field="finAccountTrans.statusId" operator="equals" value="FINACT_TRNS_CREATED">
             <clear-field field="finAccountTrans.glReconciliationId"/>
             <store-value value-field="finAccountTrans"/>
         <else>
-            <add-error><fail-property resource="AccountingUiLabel" property="AccountingFinAccountTransInvalidStatusError"/></add-error>
+            <add-error><fail-property resource="AccountingUiLabels" property="AccountingFinAccountTransInvalidStatusError"/></add-error>
             <check-errors/>
         </else>
         </if-compare>
     </simple-method>
+
+    <simple-method method-name="isGlReconciliationReconciled" short-description="Check GlReconciliation is Reconciled or not">
+        <set field="glReconciliationId" from-field="parameters.glReconciliationId"/>
+        <entity-and entity-name="FinAccountTrans" list="finAccountTransList">
+            <field-map field-name="glReconciliationId"/>
+        </entity-and>
+        <set field="finAccountTransIds" value="${groovy:org.ofbiz.entity.util.EntityUtil.getFieldListFromEntityList(finAccountTransList, 'finAccountTransId', true);}" type="List"/>
+        <entity-condition entity-name="FinAccountTrans" list="finAccountTransactions">
+            <condition-list>
+                <condition-expr field-name="finAccountTransId" operator="in" from-field="finAccountTransIds"/>
+                <condition-expr field-name="statusId" value="FINACT_TRNS_CREATED"/>
+            </condition-list>
+        </entity-condition>
+        <if-not-empty field="finAccountTransactions">
+            <set field="isReconciled" value="false" type="Boolean"/>
+        <else>
+            <set field="isReconciled" value="true" type="Boolean"/>
+        </else>
+        </if-not-empty>
+        <field-to-result field="isReconciled"/>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?rev=806588&r1=806587&r2=806588&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Fri Aug 21 15:08:50 2009
@@ -497,9 +497,17 @@
         <attribute name="finAccountTransId" type="String" mode="IN" optional="false"/>
         <attribute name="glReconciliationId" type="String" mode="IN" optional="false"/>
     </service>
+
     <service name="removeFinAccountTransFromReconciliation" engine="simple"
             location="component://accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="removeFinAccountTransFromReconciliation">
         <description>Remove finaAccountTrans association with gl reconciliation</description>
         <attribute name="finAccountTransId" type="String" mode="IN" optional="false"/>
     </service>
+
+    <service name="isGlReconciliationReconciled" engine="simple"
+            location="component://accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="isGlReconciliationReconciled">
+        <description>Check GlReconciliation is Reconciled or not</description>
+        <attribute name="glReconciliationId" type="String" mode="IN" optional="false"/>
+        <attribute name="isReconciled" type="Boolean" mode="OUT" optional="false"/>
+    </service>
 </services>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/GlReconciledFinAccountTrans.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/GlReconciledFinAccountTrans.ftl?rev=806588&r1=806587&r2=806588&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/GlReconciledFinAccountTrans.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/GlReconciledFinAccountTrans.ftl Fri Aug 21 15:08:50 2009
@@ -95,7 +95,7 @@
             <th>${uiLabelMap.FormFieldTitle_paymentMethodTypeId}</th>
             <th>${uiLabelMap.CommonStatus}</th>
             <th>${uiLabelMap.CommonComments}</th>
-            <#if FinAccountTranstions?has_content>
+            <#if finAccountTransactions?has_content>
               <th>${uiLabelMap.AccountingRemoveFromGlReconciliation}</th>
             </#if>
           </tr>
@@ -155,7 +155,7 @@
     </div>
     <div class="right">
       <span class="label">${uiLabelMap.AccountingTotalCapital} </span><@ofbizCurrency amount=transactionTotalAmount.grandTotal isoCode=defaultOrganizationPartyCurrencyUomId/>
-      <#if !currentGlReconciliation.reconciledBalance?has_content>
+      <#if isReconciled == false>
         <input type="submit" value="${uiLabelMap.AccountingReconcile}"/>
       </#if>
     </div>
@@ -167,4 +167,4 @@
     <input name="finAccountId" type="hidden" value="${finAccountTrans.finAccountId}"/>
     <input name="glReconciliationId" type="hidden" value="${glReconciliationId}"/>
   </form>
-</#list>
\ No newline at end of file
+</#list>

Modified: ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml?rev=806588&r1=806587&r2=806588&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Fri Aug 21 15:08:50 2009
@@ -179,6 +179,9 @@
 
     <form name="AddFinAccountTrans" type="single" target="createFinAccountTrans"
         header-row-style="header-row" default-table-style="basic-table">
+        <actions>
+            <set field="statusId" value="FINACT_TRNS_CREATED"/>
+        </actions>
         <auto-fields-service service-name="createFinAccountTrans"/>
         <field name="finAccountId"><hidden/></field>
         <field name="finAccountTransId"><hidden/></field>

Modified: ofbiz/trunk/applications/accounting/widget/FinAccountScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountScreens.xml?rev=806588&r1=806587&r2=806588&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FinAccountScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FinAccountScreens.xml Fri Aug 21 15:08:50 2009
@@ -631,12 +631,14 @@
                 <service service-name="getFinAccountTransListAndTotals" result-map="transactionTotalAmount"/>
                 <set field="finAccountTransList" from-field="transactionTotalAmount.finAccountTransList" type="List"/>
                 <set field="finAccountTransIds" value="${groovy:org.ofbiz.entity.util.EntityUtil.getFieldListFromEntityList(finAccountTransList, 'finAccountTransId', true);}" type="List"/>
-                <entity-condition entity-name="FinAccountTrans" list="FinAccountTranstions">
+                <entity-condition entity-name="FinAccountTrans" list="finAccountTransactions">
                     <condition-list>
                         <condition-expr field-name="finAccountTransId" operator="in" from-field="finAccountTransIds"/>
                         <condition-expr field-name="statusId" value="FINACT_TRNS_CREATED"/>
                     </condition-list>
                 </entity-condition>
+                <service service-name="isGlReconciliationReconciled" result-map="reconciledMap"/>
+                <set field="isReconciled" from-field="reconciledMap.isReconciled"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonFinAccountDecorator" location="${parameters.finAccountDecoratorLocation}">