Author: apatel
Date: Sat Aug 1 14:44:59 2009 New Revision: 799876 URL: http://svn.apache.org/viewvc?rev=799876&view=rev Log: Initial version of screen to manage cost center share for organization glaccounts. More enhancements to come soon. Brajesh, Thanks for putting up business requirements and helping with investments. Added: ofbiz/trunk/applications/accounting/webapp/accounting/ledger/ ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl (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/widget/GlobalGlAccountsScreens.xml ofbiz/trunk/applications/accounting/widget/Menus.xml Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=799876&r1=799875&r2=799876&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Sat Aug 1 14:44:59 2009 @@ -7631,6 +7631,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> + </property> <property key="AccountingTotalOfTheCurrentMonth"> <value xml:lang="en">Total of the current month</value> </property> @@ -8787,6 +8790,9 @@ <value xml:lang="th">à¸à¸±à¸à¸£à¸²</value> <value xml:lang="zh">æ¯ç</value> </property> + <property key="FormFieldTitle_costCenters"> + <value xml:lang="en">Cost Centers</value> + </property> <property key="FormFieldTitle_credit"> <value xml:lang="en">Credit</value> <value xml:lang="fr">Crédit</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=799876&r1=799875&r2=799876&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 Sat Aug 1 14:44:59 2009 @@ -2423,4 +2423,54 @@ <field-map field-name="glAccountTypeId" from-field="parameters.glAccountTypeId"/> </entity-one> </simple-method> + + <simple-method method-name="createGlAcctCatMemFromCostCenters" short-description="Create GlAccountCategroyMember from CostCenters"> + <set field="glAccountId" from-field="parameters.glAccountId"/> + <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"> + <field-map field-name="glAccountId" from-field="glAccountId"/> + </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="glAccountCategoryMembers" use-cache="true"> + <field-map field-name="glAccountId" from-field="glAccountId"/> + <field-map field-name="glAccountCategoryId" from-field="glAccountCategoryId"/> + </entity-and> + <first-from-list list="glAccountCategoryMembers" entry="glAccountCategoryMember"/> + <if-compare field="glAccountCategoryMember.amountPercentage" operator="not-equals" value="" type="BigDecimal"> + <if-compare-field field="glAccountCategoryMember.amountPercentage" operator="not-equals" to-field="amountPercentage" type="BigDecimal"> + <set-service-fields service-name="updateGlAccountCategoryMember" map="glAccountCategoryMember" to-map="updateGlAccountCategoryMemberMap"/> + <set field="updateGlAccountCategoryMemberMap.amountPercentage" from-field="amountPercentage" type="BigDecimal"/> + <call-service service-name="updateGlAccountCategoryMember" in-map-name="updateGlAccountCategoryMemberMap"/> + <log level="info" message="GlAccountCategoryMember updated for [${glAccountCategoryId}] and [${glAccountId}]"/> + </if-compare-field> + <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> + <else> + <add-error><fail-property resource="AccountingUiLabels" property="AccountingTotalAmountPercentageIsGreaterThenOneHundred"/></add-error> + <check-errors/> + </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=799876&r1=799875&r2=799876&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Sat Aug 1 14:44:59 2009 @@ -636,4 +636,11 @@ <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> + <service name="createGlAcctCatMemFromCostCenters" default-entity-name="GlAccountCategoryMember" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createGlAcctCatMemFromCostCenters" auth="true"> + <description>Create GlAccountCategoryMember from CostCenters</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=799876&r1=799875&r2=799876&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Sat Aug 1 14:44:59 2009 @@ -2319,6 +2319,19 @@ <event type="service" invoke="deleteGlAccountCategoryMember"/> <response name="success" type="view" value="EditGlAccountCategoryMember"/> </request-map> + + <request-map uri="CostCenters"> + <security https="true" auth="true"/> + <response name="success" type="view" value="CostCenters"/> + </request-map> + + <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"/> + </request-map> + <!-- end of request mappings --> <!-- View Mappings --> @@ -2602,5 +2615,6 @@ <view-map name="EditGlAccountCategory" type="screen" page="component://accounting/widget/GlSetupScreens.xml#EditGlAccountCategory"/> <view-map name="FindGlAccountCategory" type="screen" page="component://accounting/widget/GlSetupScreens.xml#FindGlAccountCategory"/> <view-map name="EditGlAccountCategoryMember" type="screen" page="component://accounting/widget/GlSetupScreens.xml#EditGlAccountCategoryMember"/> + <view-map name="CostCenters" type="screen" page="component://accounting/widget/GlobalGlAccountsScreens.xml#CostCenters"/> <!-- end of view mappings --> </site-conf> Added: 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=799876&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl (added) +++ ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl Sat Aug 1 14:44:59 2009 @@ -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. +--> +<#if glAccountOrganizations?has_content && glAccountCategories?has_content> + + <form name="costCenters" id="costCenters" method="post" action="<@ofbizUrl>createGlAcctCatMemFromCostCenters</@ofbizUrl>"> + <input type="hidden" name="_useRowSubmit" value="Y"> + <table class="basic-table hover-bar" cellspacing="0"> + <tr class="header-row"> + <th>${uiLabelMap.FormFieldTitle_glAccountId}</th> + <th>${uiLabelMap.FormFieldTitle_accountCode}</th> + <th>${uiLabelMap.FormFieldTitle_accountName}</th> + <#list glAccountCategories as glAccountCategory> + <th>${glAccountCategory.description!}</th> + </#list> + </tr> + + <#list glAccountOrganizations as glAccountOrganization> + <tr> + <#assign glAccountOrganizationIndex = glAccountOrganization_index + 1/> + <td>${glAccountOrganization.glAccountId}</td> + <#assign glAccount = delegator.findOne("GlAccount", {"glAccountId" : glAccountOrganization.glAccountId}, true)/> + <td>${glAccount.accountCode}</td> + <td>${glAccount.accountName}</td> + <#list glAccountCategories as glAccountCategory> + + <#assign glAccountCategoryMember = null/> + <td> + <input type="hidden" id="glAccountId_${glAccountOrganization.glAccountId}" name="glAccountId_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${glAccountOrganization.glAccountId!}"/> + <input type="hidden" id="glAccountCategoryId_${glAccountCategory.glAccountCategoryId}_${glAccountOrganization.glAccountId}" name="glAccountCategoryId_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${(glAccountCategory.glAccountCategoryId!)}"/> + + <#assign glAccountCategoryMembers = delegator.findByAnd("GlAccountCategoryMember", {"glAccountId" : glAccountOrganization.glAccountId, "glAccountCategoryId" : glAccountCategory.glAccountCategoryId})/> + <#if glAccountCategoryMembers?has_content> + <#assign glAccountCategoryMember = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(glAccountCategoryMembers)/> + </#if> + <#if glAccountCategoryMember != null> + <input type="text" id="amountPercentage_${glAccountCategory.glAccountCategoryId}_${glAccountOrganization.glAccountId}" name="amountPercentage_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${(glAccountCategoryMember.amountPercentage!)}"/> + <#else> + <input type="text" id="amountPercentage_${glAccountCategory.glAccountCategoryId}_${glAccountOrganization.glAccountId}" name="amountPercentage_o_${glAccountOrganizationIndex}${glAccountCategory_index}" value="${(glAccountCategoryMember.amountPercentage!)}"/> + </#if> + <input name="_rowSubmit_o_${glAccountOrganizationIndex}${glAccountCategory_index}" type="hidden" value="Y"/> + </td> + </#list> + </tr> + </#list> + </table> + <div align="right"><input type="submit" id="costCentersSubmit" value="${uiLabelMap.CommonSubmit}"/></div> + </form> +<#else> + <label>${uiLabelMap.AccountingNoRecordFound}</label> +</#if> Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/ledger/CostCenters.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml?rev=799876&r1=799875&r2=799876&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsScreens.xml Sat Aug 1 14:44:59 2009 @@ -460,4 +460,35 @@ </widgets> </section> </screen> + + <screen name="CostCenters"> + <section> + <actions> + <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> + <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/> + <set field="titleProperty" value="FormFieldTitle_costCenters"/> + <set field="tabButtonItem" value="CostCenters"/> + <entity-condition entity-name="GlAccountOrganization" list="glAccountOrganizations" distinct="true"> + <order-by field-name="glAccountId"/> + </entity-condition> + <entity-condition entity-name="GlAccountCategory" list="glAccountCategories"> + <condition-expr field-name="glAccountCategoryTypeId" operator="equals" value="COST_CENTER"/> + </entity-condition> + </actions> + <widgets> + <decorator-screen name="GlobalGLSettingsDecorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <screenlet title="${uiLabelMap.FormFieldTitle_costCenters}"> + <platform-specific> + <html> + <html-template location="component://accounting/webapp/accounting/ledger/CostCenters.ftl"/> + </html> + </platform-specific> + </screenlet> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + </screens> \ No newline at end of file Modified: ofbiz/trunk/applications/accounting/widget/Menus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/Menus.xml?rev=799876&r1=799875&r2=799876&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/Menus.xml (original) +++ ofbiz/trunk/applications/accounting/widget/Menus.xml Sat Aug 1 14:44:59 2009 @@ -905,6 +905,9 @@ <menu-item name="FindGlAccountCategory" title="${uiLabelMap.FormFieldTitle_glAccountCategory}"> <link target="FindGlAccountCategory"/> </menu-item> + <menu-item name="CostCenters" title="${uiLabelMap.FormFieldTitle_costCenters}"> + <link target="CostCenters"/> + </menu-item> </menu> <menu name="AgreementTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml"> |
Free forum by Nabble | Edit this page |