svn commit: r816517 - in /ofbiz/trunk/applications/accounting: config/ script/org/ofbiz/accounting/ledger/ servicedef/ src/org/ofbiz/accounting/ledger/ webapp/accounting/WEB-INF/ webapp/accounting/images/ webapp/accounting/ledger/

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

svn commit: r816517 - in /ofbiz/trunk/applications/accounting: config/ script/org/ofbiz/accounting/ledger/ servicedef/ src/org/ofbiz/accounting/ledger/ webapp/accounting/WEB-INF/ webapp/accounting/images/ webapp/accounting/ledger/

ashish-18
Author: ashish
Date: Fri Sep 18 08:09:02 2009
New Revision: 816517

URL: http://svn.apache.org/viewvc?rev=816517&view=rev
Log:
Applied patch from jira issue OFBIZ-2783 - Cost Centers: implement new accounting screen to associate gl accounts to "cost centers"
Thanks Brajesh, Rishi, Anil.
Special thanks to Jacopo for providing wonderful notes for the implementation.

Added:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ledger/
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ledger/GeneralLedgerServices.java   (with props)
Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js
    ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=816517&r1=816516&r2=816517&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Fri Sep 18 08:09:02 2009
@@ -8574,9 +8574,9 @@
         <value xml:lang="th">รหัสประเภทช่วงระยะเวลา</value>
         <value xml:lang="zh">条件类型标识</value>
     </property>
-    <property key="AccountingTotalAmountPercentageIsGreaterThenOneHundred">
-        <value xml:lang="en">Total amountPercentage is greater then 100.</value>
-        <value xml:lang="hi_IN">कुल amountPercentage 100 से भी ज्यादा है</value>
+    <property key="AccountingTotalAmountPercentageIsNotEqualOneHundred">
+        <value xml:lang="en">Total amountPercentage is not equal 100.</value>
+        <value xml:lang="hi_IN">कुल amountPercentage बराबर 100 नहीं है</value>
     </property>
     <property key="AccountingTotalCommissionAmount">
         <value xml:lang="en">Total Commission Amount</value>

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=816517&r1=816516&r2=816517&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 Sep 18 08:09:02 2009
@@ -2439,44 +2439,40 @@
         <set field="glAccountId" from-field="parameters.glAccountId"/>
         <set field="glAccountCategoryId" from-field="parameters.glAccountCategoryId"/>
         <set field="amountPercentage" from-field="parameters.amountPercentage" type="BigDecimal"/>
-
-        <set-service-fields service-name="calculateCostCenterTotal" map="parameters" to-map="calculateCostCenterTotalMap"/>
-        <call-service service-name="calculateCostCenterTotal" in-map-name="calculateCostCenterTotalMap"/>
-        <check-errors/>
+        <set field="totalAmountPercentage" from-field="parameters.totalAmountPercentage" type="BigDecimal"/>
         <entity-and entity-name="GlAccountCategoryMember" list="glAccountCategoryMemberList" filter-by-date="true">
             <field-map field-name="glAccountId" from-field="glAccountId"/>
             <field-map field-name="glAccountCategoryId" from-field="glAccountCategoryId"/>
         </entity-and>
         <first-from-list list="glAccountCategoryMemberList" entry="glAccountCategoryMember"/>
-        <if-empty field="glAccountCategoryMember">
-            <set field="createGlAccountCategoryMemberMap.amountPercentage" from-field="amountPercentage" type="BigDecimal"/>
-            <set field="createGlAccountCategoryMemberMap.glAccountCategoryId" from-field="glAccountCategoryId"/>
-            <set field="createGlAccountCategoryMemberMap.glAccountId" from-field="glAccountId"/>
-            <now-timestamp field="createGlAccountCategoryMemberMap.fromDate"/>
-            <call-service service-name="createGlAccountCategoryMember" in-map-name="createGlAccountCategoryMemberMap"/>
-            <log level="info" message="GlAccountCategoryMember created for [${glAccountCategoryId}] and [${glAccountId}]"/>
+        <if-compare field="totalAmountPercentage" operator="equals" value="100" type="BigDecimal">
+            <if-empty field="glAccountCategoryMember">
+                <set field="createGlAccountCategoryMemberMap.amountPercentage" from-field="amountPercentage" type="BigDecimal"/>
+                <set field="createGlAccountCategoryMemberMap.glAccountCategoryId" from-field="glAccountCategoryId"/>
+                <set field="createGlAccountCategoryMemberMap.glAccountId" from-field="glAccountId"/>
+                <now-timestamp field="createGlAccountCategoryMemberMap.fromDate"/>
+                <call-service service-name="createGlAccountCategoryMember" in-map-name="createGlAccountCategoryMemberMap"/>
+                <log level="info" message="GlAccountCategoryMember created for [${glAccountCategoryId}] and [${glAccountId}]"/>
+            <else>
+                <set-service-fields service-name="updateGlAccountCategoryMember" to-map="updateGlAccountCategoryMemberMap" map="glAccountCategoryMember"/>
+                <set field="updateGlAccountCategoryMemberMap.amountPercentage" from-field="amountPercentage" type="BigDecimal"/>
+                <call-service service-name="updateGlAccountCategoryMember" in-map-name="updateGlAccountCategoryMemberMap"/>
+            </else>
+            </if-empty>
         <else>
-           <if-compare field="amountPercentage" operator="not-equals" value="0" type="BigDecimal">
-                <if-compare-field field="glAccountCategoryMember.amountPercentage" operator="not-equals" to-field="nullfield">
-                    <set-service-fields service-name="updateGlAccountCategoryMember" to-map="updateGlAccountCategoryMemberMap" map="glAccountCategoryMember"/>
-                    <set field="updateGlAccountCategoryMemberMap.amountPercentage" from-field="amountPercentage" type="BigDecimal"/>
-                    <call-service service-name="updateGlAccountCategoryMember" in-map-name="updateGlAccountCategoryMemberMap"/>
-                <else>
-                    <set field="createGlAccountCategoryMemberMap.amountPercentage" from-field="amountPercentage" type="BigDecimal"/>
-                    <set field="createGlAccountCategoryMemberMap.glAccountCategoryId" from-field="glAccountCategoryId"/>
-                    <set field="createGlAccountCategoryMemberMap.glAccountId" from-field="glAccountId"/>
-                    <now-timestamp field="createGlAccountCategoryMemberMap.fromDate"/>
-                    <call-service service-name="createGlAccountCategoryMember" in-map-name="createGlAccountCategoryMemberMap"/>
-                    <log level="info" message="GlAccountCategoryMember created for [${glAccountCategoryId}] and [${glAccountId}]"/>
-                </else>
-                </if-compare-field>
+           <if-compare field="totalAmountPercentage" operator="equals" value="0" type="BigDecimal">
+                <if-not-empty field="glAccountCategoryMember">
+                    <now-timestamp field="glAccountCategoryMember.thruDate"/>
+                    <store-value value-field="glAccountCategoryMember"/>
+                    <log level="info" message="GlAccountCategoryMember expired for [${glAccountCategoryId}] and [${glAccountId}]"/>
+                </if-not-empty>
             <else>
-                <now-timestamp field="glAccountCategoryMember.thruDate"/>
-                <store-value value-field="glAccountCategoryMember"/>
+                <add-error><fail-property resource="AccountingUiLabels" property="AccountingTotalAmountPercentageIsNotEqualOneHundred"/></add-error>
+                <check-errors/>
             </else>
             </if-compare>
         </else>
-        </if-empty>
+        </if-compare>
     </simple-method>
 
     <simple-method method-name="updateGlAccountCategoryMember" short-description="Update GL Account Category Member">
@@ -2652,38 +2648,6 @@
         <log level="info" message="Got settings from arithmetic.properties: ledgerDecimals=${ledgerDecimals}, roundingMode=${roundingMode}"/>
     </simple-method>
 
-    <simple-method method-name="calculateCostCenterTotal" short-description="Calculate cost center total">
-        <set field="amountPercentage" from-field="parameters.amountPercentage" type="BigDecimal"/>
-        <if-not-empty field="amountPercentage">
-            <if-compare field="amountPercentage" operator="greater" value="100" type="BigDecimal">
-                <add-error><fail-property resource="AccountingUiLabels" property="AccountingTotalAmountPercentageIsGreaterThenOneHundred"/></add-error>
-                <check-errors/>
-            <else>
-                <entity-condition entity-name="GlAccountCategoryMember" list="glAccountCategoryMembers" filter-by-date="true">
-                    <condition-list>
-                        <condition-expr field-name="glAccountId" from-field="parameters.glAccountId"/>
-                    </condition-list>
-                    <order-by field-name="glAccountCategoryId DESC"/>
-                </entity-condition>
-                <set field="totalAmountPercentage" value="0" type="BigDecimal"/>
-                <iterate list="glAccountCategoryMembers" entry="glAccountCategoryMember">
-                    <if-compare-field field="glAccountCategoryMember.glAccountCategoryId" operator="not-equals" to-field="parameters.glAccountCategoryId">
-                        <set field="totalAmountPercentage" value="${groovy:totalAmountPercentage.add(glAccountCategoryMember.amountPercentage)}" type="BigDecimal"/>
-                    </if-compare-field>
-                </iterate>
-                <first-from-list list="glAccountCategoryMembers" entry="glAccountCategoryMember"/>
-                <set field="totalAmountPercentage" value="${groovy:totalAmountPercentage.add(amountPercentage)}" type="BigDecimal"/>
-                <if-compare field="totalAmountPercentage" operator="not-equals" value="100" type="BigDecimal">
-                    <if-compare-field field="glAccountCategoryMember.glAccountCategoryId" operator="equals" to-field="parameters.glAccountCategoryId">
-                        <add-error><fail-property resource="AccountingUiLabels" property="AccountingTotalAmountPercentageIsGreaterThenOneHundred"/></add-error>
-                        <check-errors/>
-                    </if-compare-field>
-                </if-compare>
-            </else>
-            </if-compare>
-        </if-not-empty>
-    </simple-method>
-
     <simple-method method-name="setGlReconciliationStatus" short-description="Set Gl Reconciliation status">
         <entity-one entity-name="GlReconciliation" value-field="glReconciliation"/>
         <field-to-result field="glReconciliation.statusId" result-name="oldStatusId"/>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=816517&r1=816516&r2=816517&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Fri Sep 18 08:09:02 2009
@@ -644,6 +644,7 @@
         <attribute name="glAccountId" mode="IN" type="String"/>
         <attribute name="glAccountCategoryId" mode="IN" type="String"/>
         <attribute name="amountPercentage" mode="IN" type="BigDecimal" optional="true"/>
+        <attribute name="totalAmountPercentage" mode="IN" type="BigDecimal" optional="true"/>
     </service>
 
     <service name="getGlAcctgOrgWithPostedBalanceSplit" engine="simple"
@@ -676,14 +677,6 @@
         <attribute name="inventoryValuationList" type="List" mode="OUT" optional="true"/>
     </service>
 
-    <service name="calculateCostCenterTotal" engine="simple" auth="true"
-            location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="calculateCostCenterTotal">
-        <description>Calculate Cost Center total with respect to the glAccountId</description>
-        <attribute name="glAccountId" mode="IN" type="String"/>
-        <attribute name="glAccountCategoryId" mode="IN" type="String"/>
-        <attribute name="amountPercentage" mode="IN" type="BigDecimal" optional="true"/>
-    </service>
-
     <service name="setGlReconciliationStatus" engine="simple"
             location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="setGlReconciliationStatus">
         <description>Set Gl Reconciliation status</description>
@@ -691,4 +684,11 @@
         <attribute name="statusId" type="String" mode="IN" optional="false"/>
         <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/>
     </service>
+
+    <service name="createUpdateCostCenter" engine="java" auth="true" invoke="createUpdateCostCenter"
+        location="org.ofbiz.accounting.ledger.GeneralLedgerServices">
+        <description>Create Update CostCenters</description>
+        <attribute name="glAccountId" mode="IN" type="String"/>
+        <attribute name="amountPercentageMap" type="Map" string-map-prefix="amp_" mode="IN" optional="true"/>
+    </service>
 </services>

Added: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ledger/GeneralLedgerServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ledger/GeneralLedgerServices.java?rev=816517&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ledger/GeneralLedgerServices.java (added)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ledger/GeneralLedgerServices.java Fri Sep 18 08:09:02 2009
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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.
+ *******************************************************************************/
+package org.ofbiz.accounting.ledger;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceUtil;
+
+public class GeneralLedgerServices {
+
+    public static final String module = GeneralLedgerServices.class.getName();
+
+    private static BigDecimal ZERO = BigDecimal.ZERO;
+
+    public static Map<String, Object> createUpdateCostCenter(DispatchContext dctx, Map<String, ? extends Object> context) {
+        LocalDispatcher dispatcher = dctx.getDispatcher();
+        BigDecimal totalAmountPercentage = ZERO;
+        Map<String, Object> createGlAcctCatMemFromCostCentersMap = null;
+        String glAccountId = (String) context.get("glAccountId");
+        GenericValue userLogin = (GenericValue) context.get("userLogin");
+        Map<String, String> amountPercentageMap = UtilGenerics.checkMap(context.get("amountPercentageMap"));
+        totalAmountPercentage = GeneralLedgerServices.calculateCostCenterTotal(amountPercentageMap);
+        for (String rowKey : amountPercentageMap.keySet()) {
+            String rowValue = amountPercentageMap.get(rowKey);
+            if (UtilValidate.isNotEmpty(rowValue)) {
+                createGlAcctCatMemFromCostCentersMap = UtilMisc.toMap("glAccountId", glAccountId,
+                        "glAccountCategoryId", rowKey, "amountPercentage", new BigDecimal(rowValue),
+                        "userLogin", userLogin, "totalAmountPercentage", totalAmountPercentage);
+            } else {
+                createGlAcctCatMemFromCostCentersMap = UtilMisc.toMap("glAccountId", glAccountId,
+                        "glAccountCategoryId", rowKey, "amountPercentage", new BigDecimal(0),
+                        "userLogin", userLogin, "totalAmountPercentage", totalAmountPercentage);
+            }
+            try {
+                dispatcher.runSync("createGlAcctCatMemFromCostCenters", createGlAcctCatMemFromCostCentersMap);
+            } catch (GenericServiceException e) {
+                Debug.logError(e, module);
+                return ServiceUtil.returnError(e.getMessage());
+            }
+        }
+        return ServiceUtil.returnSuccess();
+    }
+
+    public static BigDecimal calculateCostCenterTotal(Map<String, String> amountPercentageMap) {
+        BigDecimal totalAmountPercentage = ZERO;
+        for (String rowKey : amountPercentageMap.keySet()) {
+            if (UtilValidate.isNotEmpty(amountPercentageMap.get(rowKey))) {
+                BigDecimal rowValue = new BigDecimal(amountPercentageMap.get(rowKey));
+                if (rowValue != null)
+                    totalAmountPercentage = totalAmountPercentage.add(rowValue);
+            }
+        }
+        return totalAmountPercentage;
+    }
+}
\ No newline at end of file

Propchange: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ledger/GeneralLedgerServices.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ledger/GeneralLedgerServices.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/ledger/GeneralLedgerServices.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=816517&r1=816516&r2=816517&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Fri Sep 18 08:09:02 2009
@@ -2434,13 +2434,6 @@
         <response name="success" type="view" value="CostCenters"/>
     </request-map>
 
-    <request-map uri="createGlAcctCatMemFromCostCenters">
-        <security https="true" auth="true"/>
-        <event type="jsonservice" invoke="createGlAcctCatMemFromCostCenters"/>
-        <response name="success" type="none"/>
-        <response name="error" type="none"/>
-    </request-map>
-
     <request-map uri="CostCenterReport">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="CostCenterReport"/>
@@ -2458,6 +2451,12 @@
         <response name="success" type="view" value="CostCentersReportPdf"/>
     </request-map>
 
+    <request-map uri="createUpdateCostCenter">
+        <security auth="true" https="true"/>
+        <event type="jsonservice-multi"  invoke="createUpdateCostCenter"/>
+        <response name="success" type="none"/>
+        <response name="error" type="none"/>
+    </request-map>
     <!-- end of request mappings -->
 
     <!-- View Mappings -->

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js?rev=816517&r1=816516&r2=816517&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js Fri Sep 18 08:09:02 2009
@@ -16,24 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-function changeAmountPercentage(elementId) {
-    idArray = elementId.split('_');
-    var data = null;
-    new Ajax.Request('createGlAcctCatMemFromCostCenters', {
+Event.observe(window, 'load', function() {
+    Event.observe($('costCentersSubmit'), 'click', processCostCenterData);
+});
+function processCostCenterData() {
+    new Ajax.Request($('costCenters').action, {
         asynchronous: false,
         onSuccess: function(transport) {
-            data = transport.responseText.evalJSON(true);
-        },
-        parameters: {amountPercentage : $F(elementId), glAccountId : idArray[1], glAccountCategoryId : idArray[2]}
+            if (transport.responseText == "") {
+                Effect.Appear('errorMessage', {duration: 0.0});
+            }
+        }, parameters: $('costCenters').serialize(), requestHeaders: {Accept: 'application/json'}
     });
-    if (data._ERROR_MESSAGE_LIST_ != undefined) {
-        Effect.Appear('notValidTotal_'+idArray[1], {duration: 0.0});
-        Effect.Fade('notValidTotal_'+idArray[1], {duration: 5.0});
-    } else {
-        Effect.Appear('validTotal_'+idArray[1], {duration: 0.0});
-        Effect.Fade('validTotal_'+idArray[1], {duration: 5.0});
-    }
 }
-
-

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl?rev=816517&r1=816516&r2=816517&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl Fri Sep 18 08:09:02 2009
@@ -19,7 +19,9 @@
 -->
 <#if glAcctgAndAmountPercentageList?has_content && glAccountCategories?has_content>
 
-  <form name="costCenters" id="costCenters" method="post">
+  <form id="costCenters" method="post" action="<@ofbizUrl>createUpdateCostCenter</@ofbizUrl>">
+    <div id="errorMessage" class="errorMessage" style="display : none">${uiLabelMap.AccountingTotalAmountPercentageIsNotEqualOneHundred}</div>
+    <input type="hidden" name="_useRowSubmit" value="Y">
     <table class="basic-table hover-bar" cellspacing="0">
       <tr class="header-row">
         <th>${uiLabelMap.FormFieldTitle_glAccountId}</th>
@@ -31,29 +33,25 @@
       </tr>
 
       <#list glAcctgAndAmountPercentageList as glAcctgAndAmountPercentage>
+        <input type="hidden" id="glAccountId_${glAcctgAndAmountPercentage.glAccountId}" name="glAccountId_o_${glAcctgAndAmountPercentage_index}" value="${glAcctgAndAmountPercentage.glAccountId!}"/>
         <tr>
           <td>${glAcctgAndAmountPercentage.glAccountId}</td>
           <td>${glAcctgAndAmountPercentage.accountCode!}</td>
           <td>${glAcctgAndAmountPercentage.accountName!}</td>
           <#list glAccountCategories as glAccountCategory>
             <td>
-              <input type="hidden" id="glAccountId_${glAcctgAndAmountPercentage.glAccountId}" name="glAccountId_${glAcctgAndAmountPercentage.glAccountId!}" value="${glAcctgAndAmountPercentage.glAccountId!}"/>
-              <input type="hidden" id="glAccountCategoryId_${glAccountCategory.glAccountCategoryId!}_${glAcctgAndAmountPercentage.glAccountId!}" name="glAccountCategoryId_${glAccountCategory.glAccountCategoryId!}_${glAcctgAndAmountPercentage.glAccountId!}" value="${(glAccountCategory.glAccountCategoryId!)}"/>
-              <#assign id = "amountPercentage_" + glAcctgAndAmountPercentage.glAccountId + "_" + glAccountCategory.glAccountCategoryId/>
               <#if (glAcctgAndAmountPercentage[glAccountCategory.glAccountCategoryId!])??>
-                <input type="text" id="${id}" name="${id}" value="${(glAcctgAndAmountPercentage[glAccountCategory.glAccountCategoryId!])!}" onchange="javascript:changeAmountPercentage(id);"/>
+                <input type="text" name="amp_${glAccountCategory.glAccountCategoryId!}_o_${glAcctgAndAmountPercentage_index}" value="${(glAcctgAndAmountPercentage[glAccountCategory.glAccountCategoryId!])!}"/>
               <#else>
-                <input type="text" id="${id}" name="${id}" value="" onchange="javascript:changeAmountPercentage(id);"/>
+                <input type="text" name="amp_${glAccountCategory.glAccountCategoryId!}_o_${glAcctgAndAmountPercentage_index}" value=""/>
               </#if>
             </td>
           </#list>
-          <td>
-            <span id="notValidTotal_${glAcctgAndAmountPercentage.glAccountId}" style="display:none">${uiLabelMap.FormFieldTitle_notValidTotal}</span>
-            <span id="validTotal_${glAcctgAndAmountPercentage.glAccountId}" style="display:none">${uiLabelMap.FormFieldTitle_validTotal}</span>
-          </td>
+          <input name="_rowSubmit_o_${glAcctgAndAmountPercentage_index}" type="hidden" value="Y"/>
         </tr>
       </#list>
     </table>
+    <div align="right"><input type="button" id="costCentersSubmit" value="${uiLabelMap.CommonSubmit}"/></div>
   </form>
 <#else>
   <label>${uiLabelMap.AccountingNoRecordFound}</label>