Author: apatel
Date: Wed Aug 19 16:41:29 2009 New Revision: 805875 URL: http://svn.apache.org/viewvc?rev=805875&view=rev Log: Enhancement to screen for editing cost center shares. Added: ofbiz/trunk/applications/accounting/webapp/accounting/images/ ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js (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/ledger/CostCenters.ftl ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=805875&r1=805874&r2=805875&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Wed Aug 19 16:41:29 2009 @@ -10952,6 +10952,10 @@ <value xml:lang="it">Non applicata</value> <value xml:lang="zh">æªä½¿ç¨</value> </property> + <property key="FormFieldTitle_notValidTotal"> + <value xml:lang="en">Not valid total</value> + <value xml:lang="hi_IN">à¤à¥à¤² वà¥à¤§ नहà¥à¤ हà¥</value> + </property> <property key="FormFieldTitle_notifyUrl"> <value xml:lang="en">Notify Url</value> <value xml:lang="hi_IN">सà¥à¤à¤¿à¤¤ यà¥à¤à¤°à¤à¤²(Url)</value> @@ -12182,6 +12186,10 @@ <value xml:lang="it">Nome utente</value> <value xml:lang="zh">ç¨æ·å</value> </property> + <property key="FormFieldTitle_validTotal"> + <value xml:lang="en">Valid total</value> + <value xml:lang="hi_IN">à¤à¥à¤² वà¥à¤§ हà¥</value> + </property> <property key="FormFieldTitle_vendor"> <value xml:lang="en">Vendor</value> <value xml:lang="hi_IN">विà¤à¥à¤°à¥à¤¤à¤¾</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=805875&r1=805874&r2=805875&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 Wed Aug 19 16:41:29 2009 @@ -2422,28 +2422,24 @@ <set field="glAccountCategoryId" from-field="parameters.glAccountCategoryId"/> <set field="amountPercentage" from-field="parameters.amountPercentage" type="BigDecimal"/> - <set field="totalAmountPercentage" type="BigDecimal" value="0"/> - - <entity-and entity-name="GlAccountCategoryMember" list="glAccountCategoryMembers" filter-by-date="true"> + <set-service-fields service-name="calculateCostCenterTotal" map="parameters" to-map="calculateCostCenterTotalMap"/> + <call-service service-name="calculateCostCenterTotal" in-map-name="calculateCostCenterTotalMap"/> + <check-errors/> + <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> - <if-not-empty field="glAccountCategoryMembers"> - <iterate list="glAccountCategoryMembers" entry="glAccountCategoryMember"> - <if-compare-field field="glAccountCategoryMember.glAccountCategoryId" operator="not-equals" to-field="glAccountCategoryId"> - <set field="totalAmountPercentage" value="${totalAmountPercentage + glAccountCategoryMember.amountPercentage}" type="BigDecimal"/> - </if-compare-field> - </iterate> - </if-not-empty> - <if-not-empty field="amountPercentage"> - <set field="totalAmountPercentage" value="${totalAmountPercentage + amountPercentage}" type="BigDecimal"/> - <if-compare field="totalAmountPercentage" operator="less-equals" value="100" 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> - <filter-list-by-date list="glAccountCategoryMemberList"/> - <first-from-list list="glAccountCategoryMemberList" entry="glAccountCategoryMember"/> - <if-compare field="glAccountCategoryMember.amountPercentage" operator="not-equals" value="" type="BigDecimal"> + <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}]"/> + <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"/> @@ -2455,15 +2451,14 @@ <call-service service-name="createGlAccountCategoryMember" in-map-name="createGlAccountCategoryMemberMap"/> <log level="info" message="GlAccountCategoryMember created for [${glAccountCategoryId}] and [${glAccountId}]"/> </else> - </if-compare> - <set field="amountPercentage" value="0" type="BigDecimal"/> - <set field="totalAmountPercentage" value="0" type="BigDecimal"/> + </if-compare-field> <else> - <add-error><fail-property resource="AccountingUiLabels" property="AccountingTotalAmountPercentageIsGreaterThenOneHundred"/></add-error> - <check-errors/> + <now-timestamp field="glAccountCategoryMember.thruDate"/> + <store-value value-field="glAccountCategoryMember"/> </else> </if-compare> - </if-not-empty> + </else> + </if-empty> </simple-method> <simple-method method-name="updateGlAccountCategoryMember" short-description="Update GL Account Category Member"> @@ -2477,7 +2472,7 @@ <set field="newLookedUpValue.amountPercentage" from-field="parameters.amountPercentage" type="BigDecimal"/> <now-timestamp field="newLookedUpValue.fromDate"/> <create-value value-field="newLookedUpValue"/> - <log level="info" message="GlAccountCategoryMember updated for [${glAccountCategoryId}] and [${glAccountId}]"/> + <log level="info" message="GlAccountCategoryMember updated for [${parameters.glAccountCategoryId}] and [${parameters.glAccountId}]"/> </if-compare-field> </if-not-empty> </simple-method> @@ -2638,4 +2633,36 @@ <property-to-field resource="arithmetic" property="ledger.rounding" field="roundingMode" default="HalfUp"/> <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-methods> Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=805875&r1=805874&r2=805875&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Wed Aug 19 16:41:29 2009 @@ -675,4 +675,12 @@ <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> + </services> 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=805875&r1=805874&r2=805875&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Wed Aug 19 16:41:29 2009 @@ -2418,9 +2418,9 @@ <request-map uri="createGlAcctCatMemFromCostCenters"> <security https="true" auth="true"/> - <event type="service-multi" invoke="createGlAcctCatMemFromCostCenters"/> - <response name="success" type="view" value="CostCenters"/> - <response name="error" type="view" value="CostCenters"/> + <event type="jsonservice" invoke="createGlAcctCatMemFromCostCenters"/> + <response name="success" type="none"/> + <response name="error" type="none"/> </request-map> <request-map uri="CostCenterReport"> Added: 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=805875&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js (added) +++ ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js Wed Aug 19 16:41:29 2009 @@ -0,0 +1,39 @@ +/* + * 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. + */ + +function changeAmountPercentage(elementId) { + idArray = elementId.split('_'); + var data = null; + new Ajax.Request('createGlAcctCatMemFromCostCenters', { + asynchronous: false, + onSuccess: function(transport) { + data = transport.responseText.evalJSON(true); + }, + parameters: {amountPercentage : $F(elementId), glAccountId : idArray[1], glAccountCategoryId : idArray[2]} + }); + 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}); + } +} + + Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/images/costCenters.js ------------------------------------------------------------------------------ svn:mime-type = text/plain 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=805875&r1=805874&r2=805875&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl Wed Aug 19 16:41:29 2009 @@ -19,8 +19,7 @@ --> <#if glAcctgAndAmountPercentageList?has_content && glAccountCategories?has_content> - <form name="costCenters" id="costCenters" method="post" action="<@ofbizUrl>createGlAcctCatMemFromCostCenters</@ofbizUrl>"> - <input type="hidden" name="_useRowSubmit" value="Y"> + <form name="costCenters" id="costCenters" method="post"> <table class="basic-table hover-bar" cellspacing="0"> <tr class="header-row"> <th>${uiLabelMap.FormFieldTitle_glAccountId}</th> @@ -30,30 +29,31 @@ <th>${glAccountCategory.description!}</th> </#list> </tr> - + <#list glAcctgAndAmountPercentageList as glAcctgAndAmountPercentage> <tr> - <#assign glAccountOrganizationIndex = glAcctgAndAmountPercentage_index + 1/> <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_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${glAcctgAndAmountPercentage.glAccountId!}"/> - <input type="hidden" id="glAccountCategoryId_${glAccountCategory.glAccountCategoryId}_${glAcctgAndAmountPercentage.glAccountId}" name="glAccountCategoryId_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${(glAccountCategory.glAccountCategoryId!)}"/> - + <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="amountPercentage_${glAccountCategory.glAccountCategoryId}_${glAcctgAndAmountPercentage.glAccountId}" name="amountPercentage_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${(glAcctgAndAmountPercentage[glAccountCategory.glAccountCategoryId!])!}"/> + <input type="text" id="${id}" name="${id}" value="${(glAcctgAndAmountPercentage[glAccountCategory.glAccountCategoryId!])!}" onchange="javascript:changeAmountPercentage(id);"/> <#else> - <input type="text" id="amountPercentage_${glAccountCategory.glAccountCategoryId}_${glAcctgAndAmountPercentage.glAccountId}" name="amountPercentage_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value=""/> + <input type="text" id="${id}" name="${id}" value="" onchange="javascript:changeAmountPercentage(id);"/> </#if> - <input name="_rowSubmit_o_${glAccountOrganizationIndex}${glAccountCategory_index}" type="hidden" value="Y"/> </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> </tr> </#list> </table> - <div align="right"><input type="submit" id="costCentersSubmit" value="${uiLabelMap.CommonSubmit}"/></div> </form> <#else> <label>${uiLabelMap.AccountingNoRecordFound}</label> Modified: ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml?rev=805875&r1=805874&r2=805875&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml Wed Aug 19 16:41:29 2009 @@ -468,6 +468,7 @@ <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/> <set field="titleProperty" value="FormFieldTitle_costCenters"/> <set field="tabButtonItem" value="CostCenters"/> + <set field="layoutSettings.javaScripts[+0]" value="/accounting/images/costCenters.js" global="true"/> </actions> <widgets> <decorator-screen name="GlobalGLSettingsDecorator" location="${parameters.mainDecoratorLocation}"> |
Free forum by Nabble | Edit this page |