svn commit: r806276 - in /ofbiz/trunk/applications/accounting: 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: r806276 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/finaccount/ servicedef/ webapp/accounting/finaccounttrans/ widget/

apatel-2
Author: apatel
Date: Thu Aug 20 17:51:30 2009
New Revision: 806276

URL: http://svn.apache.org/viewvc?rev=806276&view=rev
Log:
Create Gl transaction while creating financial transaction. Gl transaction is posted when finaccount transaction is reconciled.

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml
    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
    ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/FinAccountTrans.ftl
    ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml

Modified: 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?rev=806276&r1=806275&r2=806276&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountGlPostServices.xml Thu Aug 20 17:51:30 2009
@@ -24,20 +24,14 @@
     <!-- 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 -->
-
         <now-timestamp field="nowTimestamp"/>
-
         <entity-one entity-name="FinAccountTrans" value-field="finAccountTrans"/>
         <set field="finAccountId" from-field="finAccountTrans.finAccountId"/>
         <entity-one entity-name="FinAccount" value-field="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="finAccount.postToGlAccountId">
             <set field="glAccountId" from-field="finAccount.postToGlAccountId"/>
-
             <else>
                 <entity-one entity-name="FinAccountTypeGlAccount" value-field="finAccountTypeGlAccount" auto-field-map="false">
                     <field-map field-name="organizationPartyId"/>
@@ -49,28 +43,17 @@
             </else>
         </if-not-empty>
 
-        <!-- set initial values for AcctgTrans -->
-        <set field="createAcctgTransAndEntriesMap.finAccountTransId" from-field="parameters.finAccountTransId"/>
-        <set field="createAcctgTransAndEntriesMap.transactionDate" from-field="nowTimestamp"/>
-        <set field="createAcctgTransAndEntriesMap.glFiscalTypeId" value="ACTUAL"/>
-        <set field="createAcctgTransAndEntriesMap.partyId" from-field="finAccount.ownerPartyId"/>
-
-        <!-- set initial values for Main AcctgTransEntry -->
-        <make-value value-field="mainAcctgTransEntry" entity-name="AcctgTransEntry"/>
-        <set field="mainAcctgTransEntry.glAccountId" from-field="glAccountId"/>
-        <set field="mainAcctgTransEntry.organizationPartyId" from-field="finAccount.organizationPartyId"/>
-        <set field="mainAcctgTransEntry.partyId" from-field="finAccount.ownerPartyId"/>
-        <set field="mainAcctgTransEntry.amount" from-field="finAccountTrans.amount"/>
-        <set field="mainAcctgTransEntry.acctgTransEntryTypeId" value="_NA_"/>
-        <set field="mainAcctgTransEntry.acctgTransEntrySeqId" value="01"/>
-
-        <!-- set initial values for Offset AcctgTransEntry -->
-        <make-value value-field="offsetAcctgTransEntry" entity-name="AcctgTransEntry"/>
-        <set field="offsetAcctgTransEntry.organizationPartyId" from-field="finAccount.organizationPartyId"/>
-        <set field="offsetAcctgTransEntry.partyId" from-field="finAccount.ownerPartyId"/>
-        <set field="offsetAcctgTransEntry.amount" from-field="finAccountTrans.amount"/>
-        <set field="offsetAcctgTransEntry.acctgTransEntryTypeId" value="_NA_"/>
-        <set field="offsetAcctgTransEntry.acctgTransEntrySeqId" value="02"/>
+        <!-- set values for AcctgTrans -->
+        <set field="quickCreateAcctgTransAndEntries.finAccountTransId" from-field="parameters.finAccountTransId"/>
+        <set field="quickCreateAcctgTransAndEntries.transactionDate" from-field="nowTimestamp"/>
+        <set field="quickCreateAcctgTransAndEntries.glFiscalTypeId" value="ACTUAL"/>
+        <set field="quickCreateAcctgTransAndEntries.partyId" from-field="finAccountTrans.partyId"/>
+        <set field="quickCreateAcctgTransAndEntries.isPosted" value="N"/>
+        
+        <!-- set values for AcctgTransEntry -->
+        <set field="quickCreateAcctgTransAndEntries.organizationPartyId" from-field="finAccount.organizationPartyId"/>
+        <set field="quickCreateAcctgTransAndEntries.amount" from-field="finAccountTrans.amount"/>
+        <set field="quickCreateAcctgTransAndEntries.acctgTransEntryTypeId" value="_NA_"/>
 
         <!-- Find the other side to post to/from -
             if payment directory to account do from Payment;
@@ -80,63 +63,56 @@
             <condition><if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="DEPOSIT"/></condition>
             <then>
                 <!-- TODO: somehow check to see if the deposit was not from a product, or didn't get into the general CUSTOMER CREDITS 213000 account -->
-
                 <!--
                     Handle the case where a product is purchased to deposit to account.
                     The Product should be setup so that funds go to the general CUSTOMER CREDITS account, 213000.
                     This will simply transfer from that account to the configured account above.
                 -->
-                <set field="offsetAcctgTransEntry.glAccountId" value="213000"/>
-
-                <set field="mainAcctgTransEntry.debitCreditFlag" value="D"/>
-                <set field="offsetAcctgTransEntry.debitCreditFlag" value="C"/>
-                <set field="createAcctgTransAndEntriesMap.acctgTransTypeId" value="RECEIPT"/>
+                <set field="quickCreateAcctgTransAndEntries.creditGlAccountId" from-field="parameters.glAccountId"/>
+                <set field="quickCreateAcctgTransAndEntries.debitGlAccountId" from-field="glAccountId"/>
+                <set field="quickCreateAcctgTransAndEntries.acctgTransTypeId" value="RECEIPT"/>
             </then>
             <else-if>
                 <condition><if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="WITHDRAWAL"/></condition>
                 <then>
                     <!-- TODO: somehow determine if this is an order placed against the account or some other type of withdrawal -->
-
                     <!-- TODO: handle order placed against (paid for with) the account -->
 
-                    <set field="mainAcctgTransEntry.debitCreditFlag" value="C"/>
-                    <set field="offsetAcctgTransEntry.debitCreditFlag" value="D"/>
-                    <set field="createAcctgTransAndEntriesMap.acctgTransTypeId" value="PAYMENT_ACCTG_TRANS"/>
+                    <set field="quickCreateAcctgTransAndEntries.debitGlAccountId" from-field="glAccountId"/>
+                    <set field="quickCreateAcctgTransAndEntries.creditGlAccountId" from-field="parameters.glAccountId"/>
+                    <set field="quickCreateAcctgTransAndEntries.acctgTransTypeId" value="PAYMENT_ACCTG_TRANS"/>
                 </then>
             </else-if>
             <else-if>
                 <condition><if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="ADJUSTMENT"/></condition>
                 <then>
-                    <!-- TODO: what to do for an adjustment? for now nothing, will error out below -->
-
                     <!-- if positive will go to one account for write-off, if negative will go to another account for a fee -->
-
                     <!-- these will reverse depending on positive/negative amount -->
-                    <set field="mainAcctgTransEntry.debitCreditFlag" value="D"/>
-                    <set field="offsetAcctgTransEntry.debitCreditFlag" value="C"/>
+                    <if-compare field="finAccountTrans.amount" operator="less" value="0">
+                        <set field="quickCreateAcctgTransAndEntries.debitGlAccountId" from-field="parameters.glAccountId"/>
+                        <set field="quickCreateAcctgTransAndEntries.creditGlAccountId" from-field="glAccountId"/>
+                        <set field="quickCreateAcctgTransAndEntries.acctgTransTypeId" value="OUTGOING_PAYMENT"/>
+                    <else>
+                        <set field="quickCreateAcctgTransAndEntries.creditGlAccountId" from-field="parameters.glAccountId"/>
+                        <set field="quickCreateAcctgTransAndEntries.debitGlAccountId" from-field="glAccountId"/>
+                        <set field="quickCreateAcctgTransAndEntries.acctgTransTypeId" value="INCOMING_PAYMENT"/>
+                    </else>
+                    </if-compare>
                 </then>
             </else-if>
         </if>
 
         <!-- Make sure we have the glAccountId, glAccountIdOffset, organizationPartyId -->
-        <if-empty field="mainAcctgTransEntry.glAccountId">
-            <add-error><fail-message message="Cannot post FinAccountTrans with ID [${parameters.finAccountTransId}] to GL, could not find Main glAccountId"/></add-error>
+        <if-empty field="quickCreateAcctgTransAndEntries.debitGlAccountId">
+            <add-error><fail-message message="Cannot post FinAccountTrans with ID [${parameters.finAccountTransId}] to GL, could not find Debit glAccountId"/></add-error>
         </if-empty>
-        <if-empty field="offsetAcctgTransEntry.glAccountId">
-            <add-error><fail-message message="Cannot post FinAccountTrans with ID [${parameters.finAccountTransId}] to GL, could not find Offset glAccountId"/></add-error>
+        <if-empty field="quickCreateAcctgTransAndEntries.creditGlAccountId">
+            <add-error><fail-message message="Cannot post FinAccountTrans with ID [${parameters.finAccountTransId}] to GL, could not find credit glAccountId"/></add-error>
         </if-empty>
         <if-empty field="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/>
-
-        <!-- Post the finAccountTrans.amount to/from the given GlAccounts -->
-        <set field="createAcctgTransAndEntriesMap.acctgTransEntries[]" from-field="mainAcctgTransEntry"/>
-        <set field="createAcctgTransAndEntriesMap.acctgTransEntries[]" from-field="offsetAcctgTransEntry"/>
-        <!-- TODO: un-comment this once ready for real use
-        <call-service service-name="createAcctgTransAndEntries" in-map-name="createAcctgTransAndEntriesMap" include-user-login="true">
-        </call-service>
-        -->
-        <!-- TODO: do anything with return values from service? -->
+        <call-service service-name="quickCreateAcctgTransAndEntries" in-map-name="quickCreateAcctgTransAndEntries" include-user-login="true"/>
     </simple-method>
 </simple-methods>

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=806276&r1=806275&r2=806276&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 Thu Aug 20 17:51:30 2009
@@ -687,37 +687,22 @@
     <simple-method method-name="reconcileAdjustmentFinAcctgTrans" short-description="Reconcile financial accounting transaction of type adjustment">
         <set field="finAccountTrans" from-field="parameters.finAccountTrans"/>
         <if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="ADJUSTMENT">
-            <get-related-one relation-name="FinAccount" value-field="parameters.finAccountTrans" to-value-field="finAccount"/>
-            <set-service-fields service-name="quickCreateAcctgTransAndEntries" map="parameters.finAccountTrans" to-map="quickCreateAcctgTransAndEntriesMap"/>
-            <set field="quickCreateAcctgTransAndEntriesMap.glFiscalTypeId" value="ACTUAL"/>
-            <set field="quickCreateAcctgTransAndEntriesMap.organizationPartyId" from-field="parameters.organizationPartyId"/>
-            <if-compare field="finAccountTrans.amount" operator="less" value="0">
-                <set field="quickCreateAcctgTransAndEntriesMap.acctgTransTypeId" value="INCOMING_PAYMENT"/>
-            <else>
-                <set field="quickCreateAcctgTransAndEntriesMap.acctgTransTypeId" value="OUTGOING_PAYMENT"/>
-            </else>
-            </if-compare>
-            <set field="quickCreateAcctgTransAndEntriesMap.isPosted" value="Y"/>
-            <if-compare field="parameters.debitCreditFlag" operator="equals" value="D">
-                <set field="quickCreateAcctgTransAndEntriesMap.debitGlAccountId" from-field="parameters.glAccountId"/>
-                <set field="quickCreateAcctgTransAndEntriesMap.creditGlAccountId" from-field="finAccount.postToGlAccountId"/>
-            <else>
-                <set field="quickCreateAcctgTransAndEntriesMap.debitGlAccountId" from-field="finAccount.postToGlAccountId"/>
-                <set field="quickCreateAcctgTransAndEntriesMap.creditGlAccountId" from-field="parameters.glAccountId"/>
-            </else>    
-            </if-compare>
-            <call-service service-name="quickCreateAcctgTransAndEntries" in-map-name="quickCreateAcctgTransAndEntriesMap">
-                <result-to-field result-name="acctgTransId"/>
-            </call-service>
-            <entity-and entity-name="AcctgTransEntry" list="acctgTransEntries">
-                <field-map field-name="acctgTransId"/>
+            <entity-and entity-name="AcctgTrans" list="acctgTransList">
+                <field-map field-name="finAccountTransId" from-field="finAccountTrans.finAccountTransId"/>
             </entity-and>
-            <iterate list="acctgTransEntries" entry="acctgTransEntry">
-                <set-service-fields service-name="createGlReconciliationEntry" map="acctgTransEntry" to-map="createGlReconciliationEntryMap"/>
-                <set field="createGlReconciliationEntryMap.glReconciliationId" from-field="finAccountTrans.glReconciliationId"/>
-                <set field="createGlReconciliationEntryMap.reconciledAmount" from-field="acctgTransEntry.amount"/>
-                <call-service service-name="createGlReconciliationEntry" in-map-name="createGlReconciliationEntryMap"/>
-            </iterate>
+            <if-not-empty field="acctgTransList">
+                <first-from-list list="acctgTransList" entry="acctgTrans"/>
+                <if-compare field="acctgTrans.isPosted" operator="equals" value="N">
+                    <set-service-fields service-name="postAcctgTrans" map="acctgTrans" to-map="postAcctgTransMap"/>
+                    <call-service service-name="postAcctgTrans" in-map-name="postAcctgTransMap"/>
+                </if-compare>
+                <get-related relation-name="AcctgTransEntry" list="acctgTransEntries" value-field="acctgTrans"/>
+                <iterate  list="acctgTransEntries" entry="acctgTransEntry">
+                    <set-service-fields service-name="updateAcctgTransEntry" map="acctgTransEntry" to-map="updateAcctgTransEntryMap"/>
+                    <set field="updateAcctgTransEntryMap.reconcileStatusId" value="AES_RECONCILED"/>
+                    <call-service service-name="updateAcctgTransEntry" in-map-name="updateAcctgTransEntryMap"/>
+                </iterate>
+            </if-not-empty>
         <else>
             <property-to-field property="AccountingNotAdjustmentFinAccountTrans" resource="AccountingUiLabels" field="errorMessage"/>
             <field-to-result field="errorMessage" result-name="errorMessage"/>
@@ -739,6 +724,16 @@
                 <field-to-list field="payment" list="payments"/>
             </else>
             </if-empty>
+            <if-empty field="payments">
+                <entity-and entity-name="AcctgTrans" list="acctgTransList">
+                    <field-map field-name="finAccountTransId" from-field="finAccountTrans.finAccountTransId"/>
+                </entity-and>
+                <first-from-list list="acctgTransList" entry="acctgTrans"/>
+                <if-compare field="acctgTrans.isPosted" operator="equals" value="N">
+                    <set-service-fields service-name="postAcctgTrans" map="acctgTrans" to-map="postAcctgTransMap"/>
+                    <call-service service-name="postAcctgTrans" in-map-name="postAcctgTransMap"/>
+                </if-compare>
+            </if-empty>
             <iterate list="payments" entry="payment">
                 <clear-field field="createAcctgTransAndEntriesMap"/>
                 <get-related relation-name="AcctgTrans" list="acctgTransList" value-field="payment"/>
@@ -812,6 +807,16 @@
                 <field-to-list field="payment" list="payments"/>
             </else>
             </if-empty>
+            <if-empty field="payments">
+                <entity-and entity-name="AcctgTrans" list="acctgTransList">
+                    <field-map field-name="finAccountTransId" from-field="finAccountTrans.finAccountTransId"/>
+                </entity-and>
+                <first-from-list list="acctgTransList" entry="acctgTrans"/>
+                <if-compare field="acctgTrans.isPosted" operator="equals" value="N">
+                    <set-service-fields service-name="postAcctgTrans" map="acctgTrans" to-map="postAcctgTransMap"/>
+                    <call-service service-name="postAcctgTrans" in-map-name="postAcctgTransMap"/>
+                </if-compare>
+            </if-empty>
             <iterate list="payments" entry="payment">
                 <clear-field field="createAcctgTransAndEntriesMap"/>
                 <get-related relation-name="AcctgTrans" list="acctgTransList" value-field="payment"/>

Modified: ofbiz/trunk/applications/accounting/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas.xml?rev=806276&r1=806275&r2=806276&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas.xml Thu Aug 20 17:51:30 2009
@@ -128,13 +128,11 @@
         <condition field-name="replenishPaymentId" operator="is-not-empty"/>
         <action service="finAccountReplenish" mode="sync" run-as-user="system"/>
     </eca>
-
-    <!--
+    
     <eca service="createFinAccountTrans" event="commit">
-        <condition-field field-name="statusId" operator="equals" value="FINACT_TRNS_APPROVED"/>
+        <condition field-name="glAccountId" operator="is-not-empty"/>
         <action service="postFinAccountTransToGl" mode="sync"/>
     </eca>
-    -->
 
     <!-- sample ECA rules for the sampleInvoiceAffiliateCommission service triggering
     <eca service="createPayment" event="commit">

Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?rev=806276&r1=806275&r2=806276&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Thu Aug 20 17:51:30 2009
@@ -80,11 +80,13 @@
         <auto-attributes mode="IN" optional="true" include="nonpk">
             <exclude field-name="performedByPartyId"/>
         </auto-attributes>
+        <attribute name="glAccountId" type="String" mode="IN" optional="true"/>
     </service>
     <service name="postFinAccountTransToGl" engine="simple"
         location="component://accounting/script/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"/>
+        <attribute name="glAccountId" type="String" mode="IN" optional="false"/>
     </service>
 
     <service name="createFinAccountRole" engine="simple" default-entity-name="FinAccountRole"
@@ -252,21 +254,16 @@
         <description>Reconcile Financial Accounting Financial Transactions</description>
         <attribute name="finAccountTrans" type="org.ofbiz.entity.GenericValue" mode="IN" optional="false"/>
         <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
-        <attribute name="glAccountId" type="String" mode="IN" optional="false"/>
-        <attribute name="debitCreditFlag" type="String" mode="IN" optional="false"/>
-        <attribute name="errorMessage" type="String" mode="OUT" optional="true"/>
     </service>
     <service name="reconcileDepositFinAcctgTrans" engine="simple"
             location="component://accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="reconcileDepositFinAcctgTrans">
         <description>Reconcile Financial Accounting Financial Transactions</description>
         <attribute name="finAccountTrans" type="org.ofbiz.entity.GenericValue" mode="IN" optional="false"/>
-        <attribute name="errorMessage" type="String" mode="OUT" optional="true"/>
     </service>
     <service name="reconcileWithdrawalFinAcctgTrans" engine="simple"
             location="component://accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="reconcileWithdrawalFinAcctgTrans">
         <description>Reconcile Financial Accounting Financial Transactions</description>
         <attribute name="finAccountTrans" type="org.ofbiz.entity.GenericValue" mode="IN" optional="false"/>
-        <attribute name="errorMessage" type="String" mode="OUT" optional="true"/>
     </service>
 
     <!-- service credit account w/ transaction -->

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/FinAccountTrans.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/FinAccountTrans.ftl?rev=806276&r1=806275&r2=806276&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/FinAccountTrans.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/finaccounttrans/FinAccountTrans.ftl Thu Aug 20 17:51:30 2009
@@ -242,25 +242,6 @@
                 <td><input id="finAccountTransId_${finAccountTrans_index}" name="_rowSubmit_o_${finAccountTrans_index}" type="checkbox" value="Y" onclick="javascript:getFinAccountTransRunningTotalAndBalances();"/></td>
               </#if>
             </#if>
-            <#if !grandTotal?exists>
-              <#if finAccountTrans.finAccountTransTypeId="ADJUSTMENT">
-          </tr>
-          <tr>  
-                <td>
-                  <select name="debitCreditFlag_o_${finAccountTrans_index}">
-                    <option value="D">${uiLabelMap.FormFieldTitle_debit}</option>
-                    <option value="C">${uiLabelMap.FormFieldTitle_credit}</option>
-                  </select>
-                </td>
-                <td>
-                  <select name="glAccountId_o_${finAccountTrans_index}" style="width: 50%">
-                    <#list glAccountOrgAndClassList as glAccountOrgAndClass>
-                      <option value="${glAccountOrgAndClass.glAccountId}">${glAccountOrgAndClass.accountCode} - ${glAccountOrgAndClass.accountName} [${glAccountOrgAndClass.glAccountId}]</option>
-                    </#list>
-                  </select>
-                </td>
-              </#if>
-            </#if>
           </tr>
           <#-- toggle the row color -->
           <#assign alt_row = !alt_row>

Modified: ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml?rev=806276&r1=806275&r2=806276&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Thu Aug 20 17:51:30 2009
@@ -131,7 +131,8 @@
         <field name="isRefundable">
             <drop-down no-current-selected-key="Y"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/></drop-down>
         </field>
-        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
+        <field name="submitButton" use-when="finAccountId==null" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit"><submit button-type="button"/></field>
+        <field name="submitButton" use-when="finAccountId!=null" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
         <field name="actualBalance"><display/></field>
         <field name="availableBalance"><display/></field>
     </form>
@@ -200,6 +201,14 @@
                 </entity-options>
             </drop-down>
         </field>
+        <field name="glAccountId" title="${uiLabelMap.AccountingGlAccount}">
+            <drop-down>
+                <entity-options entity-name="GlAccountOrganizationAndClass" description="${accountCode} - ${accountName} [${glAccountId}]" key-field-name="glAccountId">
+                    <entity-constraint name="organizationPartyId" operator="equals" env-name="defaultOrganizationPartyId"/>
+                    <entity-order-by field-name="glAccountId"/>
+                </entity-options>
+            </drop-down>
+        </field>
         <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>