From: <jwi...@ea...> - 2011-02-15 13:54:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "opentaps Open Source ERP CRM". The branch, master has been updated via 74cbbccdd8e22e05f53fc6efccb31745e3834963 (commit) via 3a79fdebe78703e23d289476bc130c9c790ecad7 (commit) from b42d626cb915165e4b14e758e9edcc8683f63ae7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 74cbbccdd8e22e05f53fc6efccb31745e3834963 Author: Jeremy Wickersheimer <jwi...@gm...> Date: Tue Feb 15 21:53:36 2011 +0800 Re-generated entities diff --git a/opentaps/opentaps-common/lib/opentaps-common-entities.jar b/opentaps/opentaps-common/lib/opentaps-common-entities.jar index 74d0b8e..6c1805a 100644 Binary files a/opentaps/opentaps-common/lib/opentaps-common-entities.jar and b/opentaps/opentaps-common/lib/opentaps-common-entities.jar differ diff --git a/opentaps/opentaps-common/lib/opentaps-common-services.jar b/opentaps/opentaps-common/lib/opentaps-common-services.jar index 01c140d..90a1466 100644 Binary files a/opentaps/opentaps-common/lib/opentaps-common-services.jar and b/opentaps/opentaps-common/lib/opentaps-common-services.jar differ commit 3a79fdebe78703e23d289476bc130c9c790ecad7 Author: Jeremy Wickersheimer <jwi...@gm...> Date: Tue Feb 15 21:23:57 2011 +0800 #1938 Change the application of billing account to invoice * removed the pay to invoice button and related screen/form * list pending invoices with input to apply amount * changed the service to use captureBillingAccountPayments (instead of ofbiz captureBillingAccountPayment) * added tag support to the service * added optional check so the service cannot capture more than the account balance, set this option to Y when applying to invoices from the above forms * added check so that the invoice application cannot exceed the invoice open amount diff --git a/opentaps/financials/config/FinancialsUiLabels.properties b/opentaps/financials/config/FinancialsUiLabels.properties index c44cfe0..649c5f4 100644 --- a/opentaps/financials/config/FinancialsUiLabels.properties +++ b/opentaps/financials/config/FinancialsUiLabels.properties @@ -66,6 +66,7 @@ FinancialsBalancesByCustomerTitle = \ with balances over 5% of total FinancialsBeginningCashBalance = Beginning Cash Balance FinancialsBeginningOn = Beginning On FinancialsBillingAccountAccountLimitTip = Maximum which can be charged to the credit account in the currency of the organization +FinancialsBillingAccountFullyUsed = This account has been fully used FinancialsBudgeting = Budgeting FinancialsBudgetVsActualExpensesDetails = Budget versus Actual Expenses Details FinancialsBudgetVsActualExpensesByGLAccount = Budget versus Actual Expenses by GL Account @@ -139,6 +140,7 @@ FinancialsCustomerBillingAccountID = Credit Account ID FinancialsCustomerBillingAccountOpenOrders = Credit Billing Account Open Orders FinancialsCustomerBillingAccountOpenOrdersTotal = Open Orders Total FinancialsCustomerBillingAccountTransactions = Credit Account Transactions +FinancialsCustomerBillingAccountApplyToInvoices = Apply Credit Account to Invoices FinancialsCustomerBillingAccounts = Customer Credit Accounts FinancialsCustomerCode = Customer Code FinancialsCustomerCreditAccount = Customer Credit Account diff --git a/opentaps/financials/servicedef/services_billingaccount.xml b/opentaps/financials/servicedef/services_billingaccount.xml index 8953b5e..94a5002 100644 --- a/opentaps/financials/servicedef/services_billingaccount.xml +++ b/opentaps/financials/servicedef/services_billingaccount.xml @@ -92,10 +92,12 @@ under the License. Note that this is the ofbiz "deprecated" captureBillingAccountPayment service, but because its replacement captureBillingAccountPayments broke billing account functionality as a real billing account, the original captureBillingAccountPayment service is brought back and maintained here. This name overrides the one defined in ofbiz accounting.</description> + <implements service="accountingTagsEntityInterface"/> <attribute name="invoiceId" type="String" mode="IN" optional="false"/> <attribute name="billingAccountId" type="String" mode="IN" optional="false"/> - <attribute name="captureAmount" type="Double" mode="INOUT" optional="false"/> + <attribute name="captureAmount" type="BigDecimal" mode="INOUT" optional="false"/> <attribute name="orderId" type="String" mode="IN" optional="true"/> + <attribute name="limitToAvailableBalance" type="String" mode="IN" optional="true"/> <attribute name="paymentId" type="String" mode="OUT" optional="false"/> <attribute name="paymentGatewayResponseId" type="String" mode="OUT" optional="true"/> </service> diff --git a/opentaps/financials/src/com/opensourcestrategies/financials/accounts/BillingAccountServices.java b/opentaps/financials/src/com/opensourcestrategies/financials/accounts/BillingAccountServices.java index 8739575..86490e6 100644 --- a/opentaps/financials/src/com/opensourcestrategies/financials/accounts/BillingAccountServices.java +++ b/opentaps/financials/src/com/opensourcestrategies/financials/accounts/BillingAccountServices.java @@ -39,12 +39,16 @@ /* This file has been modified by Open Source Strategies, Inc. */ package com.opensourcestrategies.financials.accounts; +import java.math.BigDecimal; import java.sql.Timestamp; +import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import org.ofbiz.accounting.payment.PaymentGatewayServices; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.Delegator; @@ -56,8 +60,16 @@ import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; import org.ofbiz.service.ServiceUtil; +import org.opentaps.common.util.UtilAccountingTags; import org.opentaps.common.util.UtilCommon; import org.opentaps.common.util.UtilMessage; +import org.opentaps.domain.DomainsDirectory; +import org.opentaps.domain.DomainsLoader; +import org.opentaps.domain.organization.AccountingTagConfigurationForOrganizationAndUsage; +import org.opentaps.domain.organization.Organization; +import org.opentaps.domain.organization.OrganizationRepositoryInterface; +import org.opentaps.foundation.infrastructure.Infrastructure; +import org.opentaps.foundation.infrastructure.User; /** * Billing accounts related services. @@ -171,19 +183,47 @@ public final class BillingAccountServices { public static Map<String, Object> captureBillingAccountPayment(DispatchContext dctx, Map<String, ?> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); + Locale locale = UtilCommon.getLocale(context); GenericValue userLogin = (GenericValue) context.get("userLogin"); String invoiceId = (String) context.get("invoiceId"); String billingAccountId = (String) context.get("billingAccountId"); - Double captureAmount = (Double) context.get("captureAmount"); + BigDecimal captureAmount = (BigDecimal) context.get("captureAmount"); + String limitToAvailableBalance = (String) context.get("limitToAvailableBalance"); String orderId = (String) context.get("orderId"); Map<String, Object> results = ServiceUtil.returnSuccess(); try { - // Note that the partyIdFrom of the Payment should be the partyIdTo of the invoice, since you're receiving a payment from the party you billed + // check the amount against the billing account balance if required + if ("Y".equalsIgnoreCase(limitToAvailableBalance)) { + BigDecimal balance = com.opensourcestrategies.financials.accounts.BillingAccountWorker.getBillingAccountAvailableBalance(delegator, billingAccountId); + if (balance.compareTo(captureAmount) < 0) { + return UtilMessage.createAndLogServiceError("Insufficient balance on billing account [" + billingAccountId + "], remaining balance is " + balance + " but tried to capture " + captureAmount, MODULE); + } + } + + // get the invoice GenericValue invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId)); + + DomainsLoader domainLoader = new DomainsLoader(new Infrastructure(dispatcher), new User(userLogin)); + DomainsDirectory domains = domainLoader.loadDomainsDirectory(); + OrganizationRepositoryInterface ori = domains.getOrganizationDomain().getOrganizationRepository(); + Organization organization = ori.getOrganizationById(invoice.getString("partyIdFrom")); + // note: tags are set on the Payment if !allocatePaymentTagsToApplications, else they are set on the PaymentApplication + // so tags are always required here, validate them + Map<String, String> tags = new HashMap<String, String>(); + UtilAccountingTags.putAllAccountingTags(context, tags); + List<AccountingTagConfigurationForOrganizationAndUsage> missings = ori.validateTagParameters(tags, organization.getPartyId(), UtilAccountingTags.RECEIPT_PAYMENT_TAG, UtilAccountingTags.ENTITY_TAG_PREFIX); + if (!missings.isEmpty()) { + return UtilMessage.createAndLogServiceError("OpentapsError_ServiceErrorRequiredTagNotFound", UtilMisc.toMap("tagName", missings.get(0).getDescription()), locale, MODULE); + } + + // Note that the partyIdFrom of the Payment should be the partyIdTo of the invoice, since you're receiving a payment from the party you billed Map<String, Object> paymentParams = UtilMisc.<String, Object>toMap("paymentTypeId", "CUSTOMER_PAYMENT", "paymentMethodTypeId", "EXT_BILLACT", "partyIdFrom", invoice.getString("partyId"), "partyIdTo", invoice.getString("partyIdFrom"), - "statusId", "PMNT_RECEIVED", "effectiveDate", UtilDateTime.nowTimestamp()); + "statusId", "PMNT_NOT_PAID", "effectiveDate", UtilDateTime.nowTimestamp()); + if (!organization.allocatePaymentTagsToApplications()) { + UtilAccountingTags.putAllAccountingTags(context, paymentParams); + } paymentParams.put("amount", captureAmount); paymentParams.put("currencyUomId", invoice.getString("currencyUomId")); paymentParams.put("userLogin", userLogin); @@ -193,22 +233,31 @@ public final class BillingAccountServices { } String paymentId = (String) tmpResult.get("paymentId"); - tmpResult = dispatcher.runSync("createPaymentApplication", UtilMisc.toMap("paymentId", paymentId, "invoiceId", invoiceId, "billingAccountId", billingAccountId, - "amountApplied", captureAmount, "userLogin", userLogin)); + Map<String, Object> input = UtilMisc.toMap("paymentId", paymentId, "invoiceId", invoiceId, "billingAccountId", billingAccountId, "amountApplied", captureAmount, "checkForOverApplication", Boolean.TRUE, "userLogin", userLogin); + if (organization.allocatePaymentTagsToApplications()) { + UtilAccountingTags.putAllAccountingTags(context, input); + } + tmpResult = dispatcher.runSync("createPaymentApplication", input); if (ServiceUtil.isError(tmpResult)) { return tmpResult; } if (paymentId == null) { - return ServiceUtil.returnError("No payment created for invoice [" + invoiceId + "] and billing account [" + billingAccountId + "]"); + return UtilMessage.createAndLogServiceError("No payment created for invoice [" + invoiceId + "] and billing account [" + billingAccountId + "]", MODULE); } results.put("paymentId", paymentId); results.put("captureAmount", captureAmount); - if (orderId != null && captureAmount.doubleValue() > 0) { + // now set the payment to received + tmpResult = dispatcher.runSync("setPaymentStatus", UtilMisc.toMap("paymentId", paymentId, "statusId", "PMNT_RECEIVED", "userLogin", userLogin)); + if (ServiceUtil.isError(tmpResult)) { + return tmpResult; + } + + if (orderId != null && captureAmount.signum() > 0) { // Create a paymentGatewayResponse, if necessary GenericValue order = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); if (order == null) { - return ServiceUtil.returnError("No paymentGatewayResponse created for invoice [" + invoiceId + "] and billing account [" + billingAccountId + "]: Order with ID [" + orderId + "] not found!"); + return UtilMessage.createAndLogServiceError("No paymentGatewayResponse created for invoice [" + invoiceId + "] and billing account [" + billingAccountId + "]: Order with ID [" + orderId + "] not found!", MODULE); } // See if there's an orderPaymentPreference - there should be only one OPP for EXT_BILLACT per order List<GenericValue> orderPaymentPreferences = delegator.findByAnd("OrderPaymentPreference", UtilMisc.toMap("orderId", orderId, "paymentMethodTypeId", "EXT_BILLACT")); @@ -244,10 +293,8 @@ public final class BillingAccountServices { } } } - } catch (GenericEntityException ex) { - return ServiceUtil.returnError(ex.getMessage()); - } catch (GenericServiceException ex) { - return ServiceUtil.returnError(ex.getMessage()); + } catch (GeneralException ex) { + return UtilMessage.createAndLogServiceError(ex, MODULE); } return results; diff --git a/opentaps/financials/webapp/financials/WEB-INF/actions/receivables/viewCustomerBillAcct.bsh b/opentaps/financials/webapp/financials/WEB-INF/actions/receivables/viewCustomerBillAcct.bsh index 4af7233..9158d04 100644 --- a/opentaps/financials/webapp/financials/WEB-INF/actions/receivables/viewCustomerBillAcct.bsh +++ b/opentaps/financials/webapp/financials/WEB-INF/actions/receivables/viewCustomerBillAcct.bsh @@ -16,17 +16,27 @@ * */ +import org.ofbiz.accounting.payment.BillingAccountWorker; import org.ofbiz.base.util.*; import org.ofbiz.entity.condition.*; import org.ofbiz.entity.util.EntityUtil; -import org.ofbiz.accounting.payment.BillingAccountWorker; - import org.ofbiz.party.party.PartyHelper; -import org.opentaps.common.util.UtilMessage; +import org.opentaps.common.util.UtilAccountingTags; import org.opentaps.common.util.UtilCommon; +import org.opentaps.common.util.UtilMessage; +import org.opentaps.domain.DomainsLoader; +import org.opentaps.domain.billing.invoice.Invoice; +import org.opentaps.domain.billing.invoice.InvoiceRepositoryInterface; +import org.opentaps.foundation.entity.Entity; +import org.opentaps.foundation.entity.EntityNotFoundException; +import org.opentaps.foundation.exception.FoundationException; +import org.opentaps.foundation.infrastructure.Infrastructure; +import org.opentaps.foundation.infrastructure.User; +import org.opentaps.foundation.repository.ofbiz.Repository; delegator = request.getAttribute("delegator"); +organizationPartyId = UtilCommon.getOrganizationPartyId(request); billingAccountId = parameters.get("billingAccountId"); context.put("billingAccountId", billingAccountId); // BillingAccountForms.xml#EditBillingAccount uses this to lookup addresses @@ -36,8 +46,10 @@ billingAccountMap = billingAccount.getAllFields(); // The data model supports multiple roles to a billing account, but in reality all the applications only one BILL_TO_CUSTOMER role is used billingAccountCustomer = EntityUtil.getFirst(EntityUtil.filterByDate(billingAccount.getRelatedByAnd("BillingAccountRole", UtilMisc.toMap("roleTypeId", "BILL_TO_CUSTOMER")))); +customerPartyId = null; if (UtilValidate.isNotEmpty(billingAccountCustomer)) { - billingAccountMap.put("customerPartyId", billingAccountCustomer.get("partyId")); + customerPartyId = billingAccountCustomer.get("partyId"); + billingAccountMap.put("customerPartyId", customerPartyId); billingAccountMap.put("customerName", PartyHelper.getPartyName(delegator, billingAccountCustomer.get("partyId"), false)); } @@ -52,13 +64,60 @@ context.put("billAcctPaymentAndApplications", billAcctPaymentAndApplications); context.put("billAcctOpenOrders", BillingAccountWorker.getBillingAccountOpenOrders(delegator, billingAccountId)); -// pay invoice flag toggle -payInvoiceEnabled = false; // if available balance > 0 -if (com.opensourcestrategies.financials.accounts.BillingAccountWorker.getBillingAccountAvailableBalance(delegator, billingAccountId).signum() == 1) { - payInvoiceEnabled = true; +balance = com.opensourcestrategies.financials.accounts.BillingAccountWorker.getBillingAccountAvailableBalance(delegator, billingAccountId); +hasBalance = false; +if (balance.signum() == 1) { + hasBalance = true; + dl = new DomainsLoader(new Infrastructure(dispatcher), new User(userLogin)); + billingDomain = dl.loadDomainsDirectory().getBillingDomain(); + invoiceRepository = billingDomain.getInvoiceRepository(); + // get a list of invoices this billing account can be applied to + if (UtilValidate.isNotEmpty(customerPartyId)) { + conditions = UtilMisc.toList(new EntityExpr("partyId", EntityOperator.EQUALS, customerPartyId), + new EntityExpr("partyIdFrom", EntityOperator.EQUALS, organizationPartyId), + new EntityExpr("statusId", EntityOperator.NOT_IN, UtilMisc.toList("INVOICE_CANCELLED","INVOICE_WRITEOFF","INVOICE_PAID", "INVOICE_VOIDED"))); + entityConditionList = new EntityConditionList(conditions, EntityOperator.AND); + List invoices = delegator.findByCondition("Invoice", entityConditionList, null, null); + List invoicesDomain = Repository.loadFromGeneric(Invoice.class, invoices, invoiceRepository); + + // now create a list of Maps which hold invoice information, the amountApplied, and the amount to be applied (ie, still open) + if (UtilValidate.isNotEmpty(invoicesDomain)) { + organizationRepository = dl.loadDomainsDirectory().getOrganizationDomain().getOrganizationRepository(); + organization = organizationRepository.getOrganizationById(organizationPartyId); + // get the tags + context.put("allocatePaymentTagsToApplications", organization.allocatePaymentTagsToApplications()); + context.put("tagTypes", UtilAccountingTags.getAccountingTagsForOrganization(organizationPartyId, UtilAccountingTags.RECEIPT_PAYMENT_TAG, delegator)); + + ArrayList invoicesList = new ArrayList(); // to pass back to the screeen list of unapplied invoices + for (Invoice invoice : invoicesDomain) { + outstandingAmount = invoice.getPendingOpenAmount(); + if (outstandingAmount != null && outstandingAmount.signum() != 0) { + // put in the map + Map invoiceMap = new HashMap(); + invoiceMap.put("invoiceId", invoice.getInvoiceId()); + invoiceMap.put("currencyUomId", invoice.getCurrencyUomId()); + invoiceMap.put("amount", invoice.getInvoiceTotal()); + invoiceMap.put("invoiceRefNum", invoice.getReferenceNumber()); + invoiceMap.put("description",invoice.getDescription()); + invoiceMap.put("invoiceDate", invoice.getInvoiceDate()); + invoiceMap.put("amountApplied", invoice.getAppliedAmount()); + invoiceMap.put("outstandingAmount", outstandingAmount); + if (balance.compareTo(outstandingAmount) < 0 ) { + invoiceMap.put("amountToApply", balance); + } else { + invoiceMap.put("amountToApply", outstandingAmount); + } + // used as default accounting tags + invoiceMap.put("firstItem", Entity.getFirst(invoice.getInvoiceItems())); + invoicesList.add(invoiceMap); + } + } + context.put("invoices", invoicesList); + } + } } -context.put("payInvoiceEnabled", payInvoiceEnabled); +context.put("hasBalance", hasBalance); //put to history -context{"history"} = UtilCommon.makeHistoryEntry(UtilMessage.expandLabel("FinancialsNavHistoryBillingAccount", locale, UtilMisc.toMap("billingAccountId", billingAccountId, "partyName", billingAccountMap.get("customerName"))), "viewCustomerBillAcct"); +context{"history"} = UtilCommon.makeHistoryEntry(UtilMessage.expandLabel("FinancialsNavHistoryBillingAccount", locale, UtilMisc.toMap("billingAccountId", billingAccountId, "partyName", billingAccountMap.get("customerName"))), "viewCustomerBillAcct", UtilMisc.toList("billingAccountId")); diff --git a/opentaps/financials/webapp/financials/WEB-INF/controller.xml b/opentaps/financials/webapp/financials/WEB-INF/controller.xml index 7554de1..5e7955d 100644 --- a/opentaps/financials/webapp/financials/WEB-INF/controller.xml +++ b/opentaps/financials/webapp/financials/WEB-INF/controller.xml @@ -295,17 +295,13 @@ <security https="true" auth="true"/> <response name="success" type="view" value="findCustomerBillAcct"/> </request-map> - <request-map uri="payInvoiceWithBillingAccountForm"> - <security https="true" auth="true"/> - <response name="success" type="view" value="payInvoiceWithBillingAccountForm"/> - </request-map> <request-map uri="payInvoiceWithBillingAccount"> <security https="true" auth="true"/> - <event type="service" invoke="captureBillingAccountPayment"/> + <event type="service" invoke="captureBillingAccountPayments"/> <response name="success" type="request-redirect" value="viewCustomerBillAcct"> <redirect-parameter name="billingAccountId"/> </response> - <response name="error" type="view" value="payInvoiceWithBillingAccountForm"/> + <response name="error" type="view" value="viewCustomerBillAcct"/> </request-map> <request-map uri="customerVendorStatement.pdf"> @@ -2038,7 +2034,6 @@ <view-map name="viewCustomerBillAcct" type="screen" page="component://financials/widget/financials/screens/receivables/BillingAccountScreens.xml#viewCustomerBillAcct"/> <view-map name="findCustomerBillAcct" type="screen" page="component://financials/widget/financials/screens/receivables/BillingAccountScreens.xml#findCustomerBillAcct"/> - <view-map name="payInvoiceWithBillingAccountForm" type="screen" page="component://financials/widget/financials/screens/receivables/BillingAccountScreens.xml#payInvoiceWithBillingAccountForm"/> <view-map name="CustomerVendorStatementPDF" type="screenfop" page="component://financials/widget/financials/screens/receivables/ReceivablesScreens.xml#CustomerVendorStatementPDF" content-type="application/pdf" encoding="none"/> <view-map name="CODReceipt" type="screen" page="component://financials/widget/financials/screens/receivables/ReceivablesScreens.xml#CODReceipt"/> diff --git a/opentaps/financials/webapp/financials/receivables/billingAccountApplyToInvoices.ftl b/opentaps/financials/webapp/financials/receivables/billingAccountApplyToInvoices.ftl new file mode 100644 index 0000000..423e64a --- /dev/null +++ b/opentaps/financials/webapp/financials/receivables/billingAccountApplyToInvoices.ftl @@ -0,0 +1,61 @@ +<#-- + * Copyright (c) Open Source Strategies, Inc. + * + * Opentaps is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Opentaps is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Opentaps. If not, see <http://www.gnu.org/licenses/>. + * +--> + +<@import location="component://opentaps-common/webapp/common/includes/lib/opentapsFormMacros.ftl"/> + +<#if invoices?has_content> + <table class="listTable" > + <tr class="boxtop"> + <td><span class="boxhead">${uiLabelMap.AccountingInvoice}</span></td> + <td><span class="boxhead">${uiLabelMap.FinancialsPaymentRef}</span></td> + <td><span class="boxhead">${uiLabelMap.CommonDescription}</span></td> + <td><span class="boxhead">${uiLabelMap.AccountingInvoiceDate}</span></td> + <td><span class="boxhead">${uiLabelMap.FinancialsAmountOutstanding}</span></td> + <td><span class="boxhead">${uiLabelMap.AccountingAmountApplied}</span></td> + <td><span class="boxhead">${uiLabelMap.CommonApply}</span></td> + </tr> + <#if invoices?has_content> + <#list invoices as row> + <form name="invoices_${row_index}" action="payInvoiceWithBillingAccount" method="POST" class="basic-form"> + <tr class="viewManyTR2"> + <@inputHidden name="billingAccountId" value=billingAccountId /> + <@inputHidden name="invoiceId" value=row.invoiceId?if_exists /> + <@inputHidden name="limitToAvailableBalance" value="Y" /> + <@displayLinkCell text=row.invoiceId href="viewInvoice?invoiceId=${row.invoiceId}"/> + <@displayCell text=row.invoiceRefNum/> + <@displayCell text=row.description/> + <@displayDateCell date=row.invoiceDate/> + <@displayCell text=row.outstandingAmount/> + <@inputTextCell name="captureAmount" default=row.amountToApply/> + <@inputButtonCell title=uiLabelMap.CommonApply/> + </tr> + <#if tagTypes?has_content && allocatePaymentTagsToApplications> + <#-- use the first invoice item tags as default for the application --> + <@accountingTagsInputCells tags=tagTypes prefix="acctgTagEnumId" tagColSpan="2" entity=row.firstItem! /> + </#if> + </form> + </#list> + </#if> + </table> +<#else> + <#if !hasBalance> + <div class="tabletext">${uiLabelMap.FinancialsBillingAccountFullyUsed}.</div> + <#else> + <div class="tabletext">${uiLabelMap.AccountingNoInvoicesFound}.</div> + </#if> +</#if> diff --git a/opentaps/financials/webapp/financials/receivables/viewBillingAccountMenu.ftl b/opentaps/financials/webapp/financials/receivables/viewBillingAccountMenu.ftl index a44ad30..8a1a311 100644 --- a/opentaps/financials/webapp/financials/receivables/viewBillingAccountMenu.ftl +++ b/opentaps/financials/webapp/financials/receivables/viewBillingAccountMenu.ftl @@ -19,5 +19,4 @@ <div class="subSectionHeader"> <div class="subSectionTitle">${uiLabelMap.FinancialsCustomerBillingAccount} ${uiLabelMap.OrderNbr}${billingAccount.billingAccountId}</div> - <div class="subMenuBar"><a class="subMenuButton" href="<@ofbizUrl>payInvoiceWithBillingAccountForm?billingAccountId=${billingAccount.billingAccountId}</@ofbizUrl>">${uiLabelMap.FinancialsPayInvoice}</a></div> </div> diff --git a/opentaps/financials/widget/financials/forms/receivables/BillingAccountForms.xml b/opentaps/financials/widget/financials/forms/receivables/BillingAccountForms.xml index d4b113f..15e3962 100644 --- a/opentaps/financials/widget/financials/forms/receivables/BillingAccountForms.xml +++ b/opentaps/financials/widget/financials/forms/receivables/BillingAccountForms.xml @@ -76,20 +76,6 @@ <field name="availableBalance"><display description="${groovy:com.opensourcestrategies.financials.accounts.BillingAccountWorker.getBillingAccountAvailableBalance(delegator, context.get("billingAccountId"))}" type="currency" currency="${accountCurrencyUomId}"/></field> </form> - <form name="payInvoiceWithBillingAccountForm" type="single" target="payInvoiceWithBillingAccount" - default-title-style="tableheadtext" default-tooltip-style="tabletext" default-widget-style="inputBox"> - - <field name="billingAccountId" title="${uiLabelMap.FinancialsCustomerBillingAccountID}" widget-style="tabletext"> - <display description="${parameters.billingAccountId}"/> - </field> - <field name="invoiceId" title="${uiLabelMap.AccountingInvoiceID}"><text/></field> - <field name="captureAmount" title="${uiLabelMap.CommonAmount}"> - <text size="10"/> - </field> - - <field name="submitButton" title="${uiLabelMap.FinancialsMakePayment}" widget-style="smallSubmit"><submit button-type="button"/></field> - </form> - <form name="EditBillingAccount" type="single" target="updateBillingAccount" title="" default-map-name="billingAccount" default-title-style="tableheadtext" > <alt-target use-when="billingAccount==null" target="createBillingAccount"/> diff --git a/opentaps/financials/widget/financials/screens/receivables/BillingAccountScreens.xml b/opentaps/financials/widget/financials/screens/receivables/BillingAccountScreens.xml index e77dbfb..8106fcb 100644 --- a/opentaps/financials/widget/financials/screens/receivables/BillingAccountScreens.xml +++ b/opentaps/financials/widget/financials/screens/receivables/BillingAccountScreens.xml @@ -73,8 +73,6 @@ <section> <actions> <set field="pageTitleLabel" value="FinancialsCustomerBillingAccount"/> - <set field="organizationPartyId" from-field="parameters.organizationPartyId"/> <!-- for the ftl --> - <script location="component://financials/webapp/financials/WEB-INF/actions/receivables/viewCustomerBillAcct.bsh"/> </actions> <widgets> @@ -102,6 +100,18 @@ </container> <container style="screenlet"> <container style="screenlet-header"> + <label style="boxhead" text="${uiLabelMap.FinancialsCustomerBillingAccountApplyToInvoices}"/> + </container> + <container style="screenlet-body"> + <platform-specific> + <html> + <html-template location="component://financials/webapp/financials/receivables/billingAccountApplyToInvoices.ftl"/> + </html> + </platform-specific> + </container> + </container> + <container style="screenlet"> + <container style="screenlet-header"> <label style="boxhead" text="${uiLabelMap.FinancialsCustomerBillingAccountOpenOrders}"/> </container> <container style="screenlet-body"> @@ -139,28 +149,5 @@ </section> </screen> - <screen name="payInvoiceWithBillingAccountForm"> - <section> - <actions> - <script location="component://financials/webapp/financials/WEB-INF/actions/receivables/viewCustomerBillAcct.bsh"/> - </actions> - <widgets> - <decorator-screen name="main-section-decorator" location="component://financials/widget/financials/screens/receivables/ReceivablesScreens.xml"> - <decorator-section name="section-body"> - <container style="screenlet"> - <container style="screenlet-header"> - <label style="boxhead" text="${uiLabelMap.FinancialsPayInvoice}"/> - </container> - <container style="screenlet-body"> - <include-form name="payInvoiceWithBillingAccountForm" location="component://financials/widget/financials/forms/receivables/BillingAccountForms.xml"/> - </container> - </container> - </decorator-section> - </decorator-screen> - </widgets> - </section> - </screen> - - </screens> ----------------------------------------------------------------------- Summary of changes: .../config/FinancialsUiLabels.properties | 2 + .../servicedef/services_billingaccount.xml | 4 +- .../accounts/BillingAccountServices.java | 71 +++++++++++++++--- .../actions/receivables/viewCustomerBillAcct.bsh | 79 +++++++++++++++++--- .../webapp/financials/WEB-INF/controller.xml | 9 +-- .../receivables/billingAccountApplyToInvoices.ftl | 61 +++++++++++++++ .../receivables/viewBillingAccountMenu.ftl | 1 - .../forms/receivables/BillingAccountForms.xml | 14 ---- .../screens/receivables/BillingAccountScreens.xml | 37 +++------ .../lib/opentaps-common-entities.jar | Bin 9427609 -> 9427609 bytes .../lib/opentaps-common-services.jar | Bin 20153153 -> 20154519 bytes 11 files changed, 208 insertions(+), 70 deletions(-) create mode 100644 opentaps/financials/webapp/financials/receivables/billingAccountApplyToInvoices.ftl hooks/post-receive -- opentaps Open Source ERP CRM |