Author: ashish
Date: Mon Jul 6 15:16:40 2009 New Revision: 791510 URL: http://svn.apache.org/viewvc?rev=791510&view=rev Log: Applied patch from jira issue OFBIZ-2699 - Create Payment Batches for Ar Payment Following thing is covered in this patch: – Written a service to create a batch for selected payments from list of payment. Thanks Awdesh & Rishi for your contribution. Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml ofbiz/trunk/applications/accounting/servicedef/services_payment.xml ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/webapp/ar/payment/batchPayments.ftl Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=791510&r1=791509&r2=791510&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Mon Jul 6 15:16:40 2009 @@ -1826,6 +1826,9 @@ <value xml:lang="th">สรà¹à¸²à¸à¸ªà¸±à¸à¸à¸²</value> <value xml:lang="zh">æ°å»ºæå®</value> </property> + <property key="AccountingCreateBatch"> + <value xml:lang="en">Create Batch</value> + </property> <property key="AccountingCreateBillingAccount"> <value xml:lang="ar">استØداث Øساب ÙÙترة</value> <value xml:lang="de">Rechnungskonto erstellen</value> @@ -5988,6 +5991,9 @@ <value xml:lang="th">à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸£à¸à¸³à¸£à¸°à¹à¸à¸´à¸</value> <value xml:lang="zh">æ¯ä»ä¿¡æ¯</value> </property> + <property key="AccountingPaymentIsAlreadyBatched"> + <value xml:lang="en">PaymentId ${paymentId} Is Already Batched</value> + </property> <property key="AccountingPaymentLessRequested"> <value xml:lang="en">Payment [${paymentId}] has ${paymentApplyAvailable?currency(${isoCode})} to apply but ${amountApplied?currency(${isoCode})} is requested</value> <value xml:lang="es">Pago [${paymentId}] tiene ${paymentApplyAvailable?currency(${isoCode})} para aplicar pero ${amountApplied?currency(${isoCode})} es requerido</value> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=791510&r1=791509&r2=791510&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Mon Jul 6 15:16:40 2009 @@ -428,4 +428,31 @@ </iterate> </simple-method> + <simple-method method-name="createPaymentBatch" short-description="create a batch of payments"> + <now-timestamp field="nowTimestamp"/> + <set field="paymentId" from-field="parameters.paymentId"/> + <entity-and entity-name="PaymentGroupMember" list="paymentGroupMembers"> + <field-map field-name="paymentId"/> + </entity-and> + <if-not-empty field="paymentGroupMembers"> + <add-error><fail-property resource="AccountingUiLabels" property="AccountingPaymentIsAlreadyBatched"/></add-error> + <check-errors/> + </if-not-empty> + <set field="paymentGroupId" from-field="parameters.paymentGroupId"/> + <set field="paymentGroupName" from-field="parameters.paymentGroupName"/> + <if-empty field="paymentGroupId"> + <if-not-empty field="paymentGroupName"> + <set field="createPaymentGroupCtx.paymentGroupName" from-field="paymentGroupName"/> + <set field="createPaymentGroupCtx.paymentGroupTypeId" value="BATCH_PAYMENT"/> + <call-service service-name="createPaymentGroup" in-map-name="createPaymentGroupCtx"> + <result-to-field result-name="paymentGroupId"/> + </call-service> + </if-not-empty> + </if-empty> + <set field="createPaymentGroupMemberCtx.paymentId" from-field="paymentId"/> + <set field="createPaymentGroupMemberCtx.paymentGroupId" from-field="paymentGroupId"/> + <set field="createPaymentGroupMemberCtx.fromDate" from-field="nowTimestamp"/> + <call-service service-name="createPaymentGroupMember" in-map-name="createPaymentGroupMemberCtx"/> + <field-to-result field="paymentGroupId"/> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/accounting/servicedef/services_payment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_payment.xml?rev=791510&r1=791509&r2=791510&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Mon Jul 6 15:16:40 2009 @@ -148,4 +148,11 @@ INVOICE_READY if status is INVOICE_PAID, and reverses related AcctgTrans by calling copyAcctgTransAndEntries service</description> <attribute name="paymentId" mode="IN" optional="false" type="String"/> </service> + <service name="createPaymentBatch" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createPaymentBatch" auth="true"> + <description>Create a batch for payment</description> + <attribute name="paymentId" type="String" mode="IN" optional="false"/> + <attribute name="paymentGroupName" type="String" mode="IN" optional="false"/> + <attribute name="paymentGroupId" type="String" mode="INOUT" optional="true"/> + </service> </services> Modified: ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy?rev=791510&r1=791509&r2=791510&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy Mon Jul 6 15:16:40 2009 @@ -17,7 +17,9 @@ * under the License. */ -import org.ofbiz.entity.condition.*; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityOperator; List paymentCond = []; if (paymentMethodTypeId) { @@ -39,14 +41,11 @@ paymentGroupMember = delegator.findList("PaymentGroupMember", EntityCondition.makeCondition([paymentId : payment.paymentId]), null, null, null, false); if (!paymentGroupMember) { if (cardType && payment.paymentMethodId) { - - creditCard = delegator.findOne("CreditCard", [paymentMethodId : payment.paymentMethodId], false); - if (creditCard.cardType == cardType) { - paymentListWithCreditCard.add(payment); - } - - } - else { + creditCard = delegator.findOne("CreditCard", [paymentMethodId : payment.paymentMethodId], false); + if (creditCard.cardType == cardType) { + paymentListWithCreditCard.add(payment); + } + } else if (UtilValidate.isEmpty(cardType)) { paymentListWithoutCreditCard.add(payment); } } 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=791510&r1=791509&r2=791510&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/controller.xml Mon Jul 6 15:16:40 2009 @@ -45,6 +45,12 @@ <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-multi" invoke="createPaymentBatch"/> + <response name="success" type="view" value="BatchPayments"/> + <response name="error" type="view" value="BatchPayments"/> + </request-map> <!-- end of request mappings --> <!-- View Mappings --> Modified: ofbiz/trunk/applications/accounting/webapp/ar/payment/batchPayments.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ar/payment/batchPayments.ftl?rev=791510&r1=791509&r2=791510&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/ar/payment/batchPayments.ftl (original) +++ ofbiz/trunk/applications/accounting/webapp/ar/payment/batchPayments.ftl Mon Jul 6 15:16:40 2009 @@ -18,16 +18,27 @@ --> <div class="screenlet"> <div class="screenlet-body"> - <form name='batchPaymentForm'> - <table class="basic-table"> - <tr class="header-row"> - <td>${uiLabelMap.FormFieldTitle_paymentId}</td> - <td>${uiLabelMap.Party}</td> - <td>${uiLabelMap.CommonAmount}</td> - <td>${uiLabelMap.CommonDate}</td> - </tr> - <#if paymentList?has_content> + <form method="post" action="<@ofbizUrl>createPaymentBatch</@ofbizUrl>" name='paymentBatchForm'> + <input type="hidden" name="_useRowSubmit" value="Y"> + <#if paymentList?has_content> + <div> + <span class="label">${uiLabelMap.AccountingPayment} ${uiLabelMap.PartyPartyGroupName}</span> + <input type="text" size='25' name='paymentGroupName'> + <input type="hidden" name='organizationPartyId' value="${organizationPartyId?if_exists}"> + </div> + <table class="basic-table"> + <tr class="header-row"> + <td>${uiLabelMap.FormFieldTitle_paymentId}</td> + <td>${uiLabelMap.Party}</td> + <td>${uiLabelMap.CommonAmount}</td> + <td>${uiLabelMap.CommonDate}</td> + <td align="right"> + ${uiLabelMap.ProductSelectAll} + <input id="selectAll" type="checkbox" name="selectAll" value="Y" onclick="javascript:toggleAll(this, 'paymentBatchForm');"/> + </td> + </tr> <#list paymentList as payment> + <input type="hidden" name="paymentId_o_${payment_index}" value="${payment.paymentId}"/> <tr> <td><a href="<@ofbizUrl>paymentOverview?paymentId=${payment.paymentId}</@ofbizUrl>">${payment.paymentId}</a></td> <td> @@ -38,12 +49,20 @@ ${(partyName.groupName)!} </#if> </td> - <td>${payment.amount?if_exists}</td> + <td><@ofbizCurrency amount=payment.amount isoCode=payment.currencyUomId/></td> <td>${payment.effectiveDate?if_exists}</td> + <td align="right"> + <input type="checkbox" name="_rowSubmit_o_${payment_index}" value="Y" onclick="javascript:checkToggle(this, 'paymentBatchForm');"> + </td> </tr> </#list> - </#if> - </table> + <tr> + <td align="right"> + <a href="javascript:document.paymentBatchForm.submit();" class="buttontext">${uiLabelMap.AccountingCreateBatch}</a> + </td> + </tr> + </table> + </#if> </form> </div> </div> \ No newline at end of file |
Free forum by Nabble | Edit this page |