Author: ashish
Date: Sun Jul 12 14:36:17 2009 New Revision: 793358 URL: http://svn.apache.org/viewvc?rev=793358&view=rev Log: Applied patch from jira issue OFBIZ-2717 - Add a new "Deposit/Withdraw" screen to the FinAccount subscreens This patch includes: -- Implemented basic search form and list form. -- Written groovy for data fetching. -- Implemented running total functionality. Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy (with props) ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl (with props) Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml ofbiz/trunk/applications/accounting/widget/FinAccountScreens.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=793358&r1=793357&r2=793358&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Sun Jul 12 14:36:17 2009 @@ -2291,9 +2291,18 @@ <value xml:lang="ru">ÐÑибка безопаÑноÑÑи: Ð´Ð»Ñ Ð·Ð°Ð¿ÑÑка deleteFixedAssetMaintOrder Ñ Ð²Ð°Ñ Ð´Ð¾Ð»Ð¶Ð½Ñ Ð±ÑÑÑ Ð¿Ñава ACCOUNTING_DELETE, ACCOUNTING_ADMIN или огÑаниÑеннÑе ACCOUNTING_ROLE_UPDATE</value> <value xml:lang="th">Security Error: à¸à¸§à¸²à¸¡à¸à¸´à¸à¸à¸¥à¸²à¸! à¹à¸à¸à¸²à¸£ deleteFixedAssetMaintOrder à¸à¸¸à¸à¸à¹à¸à¸à¸¡à¸µ ACCOUNTING_DELETE หรืภACCOUNTING_ADMIN permission, หรืภlimited ACCOUNTING_ROLE_UPDATE à¸à¹à¸à¸</value> </property> + <property key="AccountingDeposit"> + <value xml:lang="en">Deposit</value> + </property> <property key="AccountingDepositSlip"> <value xml:lang="en">Deposit Slip</value> </property> + <property key="AccountingDepositWithdraw"> + <value xml:lang="en">Deposit/Withdraw</value> + </property> + <property key="AccountingDepositOrWithdrawPayments"> + <value xml:lang="en">Deposit Or Withdraw Payments</value> + </property> <property key="AccountingDescr"> <value xml:lang="ar">ÙصÙ</value> <value xml:lang="de">Beschreibung</value> @@ -3790,6 +3799,9 @@ <value xml:lang="nl">Algemene configuratie boekhouding</value> <value xml:lang="th">à¸à¸²à¸£à¸à¸³à¸«à¸à¸à¸à¸±à¸à¸à¸µà¹à¸¢à¸à¸à¸£à¸°à¹à¸ à¸à¸à¸±à¹à¸§à¹à¸</value> </property> + <property key="AccountingGroupInOneTransaction"> + <value xml:lang="en">Group in one Transaction</value> + </property> <property key="AccountingHideFields"> <value xml:lang="ar">إخÙاء اÙØÙÙÙ</value> <value xml:lang="en">Hide Fields</value> Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy?rev=793358&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy (added) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy Sun Jul 12 14:36:17 2009 @@ -0,0 +1,62 @@ +/* + * 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. + */ +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityOperator; + +List exprListForParameters = []; +if (paymentMethodTypeId) { + partyCond = EntityCondition.makeCondition([EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, organizationPartyId), + EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId)], EntityOperator.OR); + statusCond = EntityCondition.makeCondition([EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"), + EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_SENT")], EntityOperator.OR); + + exprListForParameters.add(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, paymentMethodTypeId)); + if (fromDate) { + exprListForParameters.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate)); + } + if (thruDate) { + exprListForParameters.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate)); + } + if (partyIdFrom) { + exprListForParameters.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyIdFrom)); + } + exprListForParameters.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.EQUALS, null)); + paramCond = EntityCondition.makeCondition(exprListForParameters, EntityOperator.AND); + combinedPaymentCond = EntityCondition.makeCondition([partyCond, statusCond, paramCond], EntityOperator.AND); + payments = delegator.findList("Payment", combinedPaymentCond, null, null, null, false); + paymentListWithCreditCard = []; + paymentListWithoutCreditCard = []; + payments.each { payment -> + if (cardType && payment.paymentMethodId) { + creditCard = delegator.findOne("CreditCard", [paymentMethodId : payment.paymentMethodId], false); + if (creditCard.cardType == cardType) { + paymentListWithCreditCard.add(payment); + } + } else if (UtilValidate.isEmpty(cardType)) { + paymentListWithoutCreditCard.add(payment); + } + } + if (paymentListWithCreditCard) { + context.paymentList = paymentListWithCreditCard; + } else { + context.paymentList = paymentListWithoutCreditCard; + } +} \ No newline at end of file Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy ------------------------------------------------------------------------------ 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=793358&r1=793357&r2=793358&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Sun Jul 12 14:36:17 2009 @@ -2062,6 +2062,24 @@ <response name="error" type="view" value="ComparativeBalanceSheet"/> </request-map> <request-map uri="TransactionTotals"><security https="true" auth="true"/><response name="success" type="view" value="TransactionTotals"/></request-map> + <request-map uri="FindPaymentsForDepositOrWithdraw"> + <security https="true" auth="true"/> + <response name="success" type="view" value="PaymentsDepositWithdraw"/> + </request-map> + <request-map uri="ListPaymentsForDepositOrWithdraw"> + <security https="true" auth="true"/> + <response name="success" type="view" value="PaymentsDepositWithdraw"/> + <response name="error" type="view" value="PaymentsDepositWithdraw"/> + </request-map> + <request-map uri="getPaymentRunningTotal"> + <event type="jsonservice" invoke="getPaymentRunningTotal"/> + <response name="success" type="none"/> + <response name="error" type="none"/> + </request-map> + <request-map uri="LookupCustomerName"> + <security auth="true" https="true"/> + <response name="success" type="view" value="LookupCustomerName"/> + </request-map> <!-- ================ Depreciation Calculation Report requests ================ --> @@ -2399,6 +2417,8 @@ <view-map name="BalanceSheet" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#BalanceSheet"/> <view-map name="ComparativeBalanceSheet" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeBalanceSheet"/> <view-map name="TransactionTotals" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#TransactionTotals"/> + <view-map name="PaymentsDepositWithdraw" type="screen" page="component://accounting/widget/FinAccountScreens.xml#PaymentsDepositWithdraw"/> + <view-map name="LookupCustomerName" type="screen" page="component://party/widget/partymgr/LookupScreens.xml#LookupCustomerName"/> <!-- Assignment Mappings --> <view-map name="EditPartyFixedAssetAssignments" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditPartyFixedAssetAssignments"/> Added: ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl?rev=793358&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl (added) +++ ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl Sun Jul 12 14:36:17 2009 @@ -0,0 +1,123 @@ +<#-- +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. +--> + +<script language="JavaScript" type="text/javascript"> +<!-- // +function togglePaymentId(master) { + var form = document.depositWithdrawPaymentsForm; + var payments = form.elements.length; + for (var i = 0; i < payments; i++) { + var element = form.elements[i]; + if (element.name == "paymentIds") { + element.checked = master.checked; + } + } + getPaymentRunningTotal(master); +} +function getPaymentRunningTotal(e) { + var form = document.depositWithdrawPaymentsForm; + var payments = form.elements.length; + var isSingle = true; + var isAllSelected = true; + for (var i = 0; i < payments; i++) { + var element = form.elements[i]; + if (element.name == "paymentIds") { + if (element.checked) { + isSingle = false; + } else { + isAllSelected = false; + } + } + } + if (!($(e).checked)) { + $('checkAllPayments').checked = false; + } else if (isAllSelected) { + $('checkAllPayments').checked = true; + } + if (!isSingle) { + new Ajax.Request('getPaymentRunningTotal', { + asynchronous: false, + onSuccess: function(transport) { + var data = transport.responseText.evalJSON(true); + $('showPaymentRunningTotal').update(data.paymentRunningTotal); + }, parameters: $('depositWithdrawPaymentsForm').serialize(), requestHeaders: {Accept: 'application/json'} + }); + } else { + $('showPaymentRunningTotal').update(""); + } +} +// --> + +</script> +<div class="screenlet"> + <div class="screenlet-body"> + <form id="depositWithdrawPaymentsForm" name="depositWithdrawPaymentsForm" method="post" action="<@ofbizUrl></@ofbizUrl>"> + <#if paymentList?has_content> + <input type="hidden" name='organizationPartyId' value="${organizationPartyId?if_exists}"> + <div> + <span class="label">${uiLabelMap.AccountingRunningTotal} :</span> + <span class="label" id="showPaymentRunningTotal"></span> + </div> + <table class="basic-table"> + <tr class="header-row"> + <td>${uiLabelMap.FormFieldTitle_paymentId}</td> + <td>${uiLabelMap.AccountingPaymentType}</td> + <td>${uiLabelMap.Party}</td> + <td>${uiLabelMap.CommonAmount}</td> + <td>${uiLabelMap.CommonDate}</td> + <td align="right"> + ${uiLabelMap.CommonSelectAll} + <input type="checkbox" id="checkAllPayments" name="checkAllPayments" onchange="javascript:togglePaymentId(this);"/> + </td> + </tr> + <#list paymentList as payment> + <#if payment.paymentTypeId?has_content> + <#assign paymentType = delegator.findOne("PaymentType", {"paymentTypeId" : payment.paymentTypeId}, false)/> + </#if> + <tr> + <td><a href="<@ofbizUrl>paymentOverview?paymentId=${payment.paymentId}</@ofbizUrl>">${payment.paymentId}</a></td> + <td> + ${paymentType.description?if_exists} + </td> + <td> + <#assign partyName = (delegator.findOne("PartyNameView", {"partyId" : payment.partyIdFrom}, false))!> + <#if partyName.partyTypeId == "PERSON"> + ${(partyName.firstName)!} ${(partyName.lastName)!} + <#elseif (partyName.partyTypeId)! == "PARTY_GROUP"> + ${(partyName.groupName)!} + </#if> + </td> + <td><@ofbizCurrency amount=payment.amount isoCode=payment.currencyUomId/></td> + <td>${payment.effectiveDate?if_exists}</td> + <td align="right"> + ${uiLabelMap.AccountingDeposit} + <input type="checkbox" id="paymentId_${payment_index}" name="paymentIds" value="${payment.paymentId}" onclick="javascript:getPaymentRunningTotal('paymentId_${payment_index}');"/> + </td> + </tr> + </#list> + </table> + <div align="right"> + ${uiLabelMap.AccountingGroupInOneTransaction} + <input type="checkbox" name="groupInOneTransaction" value="Y"/> + <a href="javascript:document.depositWithdrawPaymentsForm.submit();" class="buttontext">${uiLabelMap.AccountingDepositWithdraw}</a> + </div> + </#if> + </form> + </div> +</div> \ No newline at end of file Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml?rev=793358&r1=793357&r2=793358&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml Sun Jul 12 14:36:17 2009 @@ -41,21 +41,12 @@ <security https="true" auth="true"/> <response name="success" type="view" value="BatchPayments"/> </request-map> - <request-map uri="LookupCustomerName"> - <security auth="true" https="true"/> - <response name="success" type="view" value="LookupCustomerName"/> - </request-map> <request-map uri="createPaymentBatch"> <security https="true" auth="true"/> <event type="service" invoke="createPaymentGroupAndMember"/> <response name="success" type="view" value="PaymentGroupOverview"/> <response name="error" type="view" value="BatchPayments"/> </request-map> - <request-map uri="getPaymentRunningTotal"> - <event type="jsonservice" invoke="getPaymentRunningTotal"/> - <response name="success" type="none"/> - <response name="error" type="none"/> - </request-map> <!-- end of request mappings --> <!-- View Mappings --> @@ -63,6 +54,5 @@ <view-map name="ListReports" type="screen" page="component://accounting/widget/ar/InvoiceScreens.xml#ListReports"/> <view-map name="FindPayments" type="screen" page="component://accounting/widget/ar/ArPaymentScreens.xml#FindPayments"/> <view-map name="BatchPayments" type="screen" page="component://accounting/widget/ar/ArPaymentScreens.xml#BatchPayments"/> - <view-map name="LookupCustomerName" type="screen" page="component://party/widget/partymgr/LookupScreens.xml#LookupCustomerName"/> <!-- end of view mappings --> </site-conf> \ No newline at end of file Modified: ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml?rev=793358&r1=793357&r2=793358&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Sun Jul 12 14:36:17 2009 @@ -220,4 +220,8 @@ <field name="thruDate"><date-time/></field> <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field> </form> + <form name="PaymentsDepositWithdraw" type="single" target="ListPaymentsForDepositOrWithdraw" extends="FindBatchPayments" extends-resource="component://accounting/widget/ar/forms/ArPaymentForms.xml"> + <field name="finAccountId"><hidden/></field> + <field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit"><submit button-type="button"/></field> + </form> </forms> \ No newline at end of file Modified: ofbiz/trunk/applications/accounting/widget/FinAccountScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountScreens.xml?rev=793358&r1=793357&r2=793358&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/FinAccountScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/FinAccountScreens.xml Sun Jul 12 14:36:17 2009 @@ -27,6 +27,7 @@ <section> <actions> <set field="headerItem" value="FindFinAccount"/> + <entity-one value-field="finAccount" entity-name="FinAccount"/> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> @@ -196,4 +197,40 @@ </widgets> </section> </screen> + <screen name="PaymentsDepositWithdraw"> + <section> + <actions> + <set field="titleProperty" value="AccountingDepositOrWithdrawPayments"/> + <set field="tabButtonItem" value="depositWithdraw"/> + <set field="finAccountId" from-field="parameters.finAccountId"/> + <set field="paymentMethodTypeId" from-field="parameters.paymentMethodTypeId"/> + <set field="cardType" from-field="parameters.cardType"/> + <set field="fromDate" type="Timestamp" from-field="parameters.fromDate"/> + <set field="thruDate" type="Timestamp" from-field="parameters.thruDate"/> + <set field="partyIdFrom" from-field="parameters.partyIdFrom"/> + <set field="organizationPartyId" from-field="parameters.organizationPartyId"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy"/> + </actions> + <widgets> + <decorator-screen name="CommonFinAccountDecorator" location="${parameters.finAccountDecoratorLocation}"> + <decorator-section name="body"> + <section> + <widgets> + <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml"> + <decorator-section name="search-options"> + <include-form name="PaymentsDepositWithdraw" location="component://accounting/widget/FinAccountForms.xml"/> + </decorator-section> + <decorator-section name="search-results"> + <platform-specific> + <html><html-template location="component://accounting/webapp/accounting/payment/depositWithdrawPayments.ftl"/></html> + </platform-specific> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </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=793358&r1=793357&r2=793358&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/Menus.xml (original) +++ ofbiz/trunk/applications/accounting/widget/Menus.xml Sun Jul 12 14:36:17 2009 @@ -636,6 +636,15 @@ <parameter param-name="finAccountId"/> </link> </menu-item> + <menu-item name="depositWithdraw" title="${uiLabelMap.AccountingDepositWithdraw}"> + <condition> + <if-compare field="finAccount.finAccountTypeId" operator="equals" value="BANK_ACCOUNT"/> + </condition> + <link target="FindPaymentsForDepositOrWithdraw"> + <parameter param-name="finAccountId"/> + <parameter param-name="organizationPartyId" from-field="finAccount.ownerPartyId"/> + </link> + </menu-item> </menu> <menu name="PartyTopTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml" |
Free forum by Nabble | Edit this page |