Author: jacopoc
Date: Wed Sep 12 07:11:50 2007 New Revision: 574962 URL: http://svn.apache.org/viewvc?rev=574962&view=rev Log: Implemented service to create a payment and fully apply it in one step. Added ability to the billing account payment screen to quickly create and associated a payment to the billing account. Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml ofbiz/trunk/applications/accounting/servicedef/services_payment.xml ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml 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=574962&r1=574961&r2=574962&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 Wed Sep 12 07:11:50 2007 @@ -219,5 +219,21 @@ <set field="param.statusId" value="PMNT_SENT"/> <call-service service-name="setPaymentStatus" in-map-name="param"/> </simple-method> - + + <simple-method method-name="createPaymentAndApplication" short-description="Create a payment and a payment application for the full amount"> + <set-service-fields service-name="createPayment" map-name="parameters" to-map-name="createPaymentInMap"/> + <call-service service-name="createPayment" in-map-name="createPaymentInMap"> + <result-to-field field-name="paymentId" result-name="paymentId"/> + </call-service> + <check-errors/> + <set-service-fields service-name="createPaymentApplication" map-name="parameters" to-map-name="createPaymentAppInMap"/> + <set field="createPaymentAppInMap.paymentId" from-field="paymentId"/> + <set field="createPaymentAppInMap.amountApplied" from-field="parameters.amount"/> + <call-service service-name="createPaymentApplication" in-map-name="createPaymentAppInMap"> + <result-to-field field-name="paymentApplicationId" result-name="paymentApplicationId"/> + </call-service> + <check-errors/> + <field-to-result field-name="paymentId" result-name="paymentId"/> + <field-to-result field-name="paymentApplicationId" result-name="paymentApplicationId"/> + </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=574962&r1=574961&r2=574962&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Wed Sep 12 07:11:50 2007 @@ -106,4 +106,22 @@ <auto-attributes mode="IN" include="pk" optional="false"/> <auto-attributes mode="OUT" include="nonpk" optional="true"/> </service> + + <service name="createPaymentAndApplication" engine="simple" + location="org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createPaymentAndApplication" auth="true"> + <description>Create a payment and a payment application for the full amount</description> + <auto-attributes entity-name="Payment" include="nonpk" mode="IN" optional="true"/> + <auto-attributes entity-name="Payment" include="pk" mode="INOUT" optional="true"/> + <override name="paymentTypeId" optional="false"/> + <override name="partyIdFrom" optional="false"/> + <override name="partyIdTo" optional="false"/> + <override name="statusId" optional="false"/> + <override name="amount" optional="false"/> + <attribute name="invoiceId" type="String" mode="IN" optional="true"/> + <attribute name="invoiceItemSeqId" type="String" mode="IN" optional="true"/> + <attribute name="billingAccountId" type="String" mode="IN" optional="true"/> + <attribute name="overrideGlAccountId" type="String" mode="IN" optional="true"/> + <attribute name="taxAuthGeoId" type="String" mode="IN" optional="true"/> + <attribute name="paymentApplicationId" type="String" mode="OUT" optional="false"/> + </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=574962&r1=574961&r2=574962&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Wed Sep 12 07:11:50 2007 @@ -194,6 +194,11 @@ <security https="true" auth="true"/> <response name="success" type="view" value="BillingAccountPayments"/> </request-map> + <request-map uri="createPaymentAndAssociateToBillingAccount"> + <security https="true" auth="true"/> + <event type="service" invoke="createPaymentAndApplication"/> + <response name="success" type="view" value="BillingAccountPayments"/> + </request-map> <!-- invoice requests --> <request-map uri="findInvoices"> Modified: ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml?rev=574962&r1=574961&r2=574962&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/BillingAccountForms.xml Wed Sep 12 07:11:50 2007 @@ -228,5 +228,39 @@ <display type="currency" currency="${currencyUomId}"/> </field> </form> + <form name="CreateIncomingBillingAccountPayment" type="single" target="createPaymentAndAssociateToBillingAccount" title=""> + <actions> + <set field="partyIdFrom" from-field="billToCustomer.partyId"/> + </actions> + <field name="billingAccountId"><hidden/></field> + <field name="currencyUomId"><hidden value="${billingAccount.accountCurrencyUomId}"/></field> + <field name="statusId"><hidden value="PMNT_NOT_PAID"/></field> + <field name="partyIdFrom" position="1"><lookup target-form-name="LookupPartyName"/></field> + <field position="2" name="organizationPartyId" parameter-name="partyIdTo"> + <drop-down allow-empty="false"> + <entity-options description="${partyId}" entity-name="PartyAcctgPreference" key-field-name="partyId"> + <entity-order-by field-name="partyId"/> + </entity-options> + </drop-down> + </field> + <field position="1" name="paymentTypeId"> + <drop-down allow-empty="false" no-current-selected-key="CUSTOMER_DEPOSIT"> + <entity-options description="${description}" entity-name="PaymentType"> + <entity-order-by field-name="description"/> + </entity-options> + </drop-down> + </field> + <field position="1" name="paymentMethodTypeId"> + <drop-down allow-empty="false"> + <entity-options entity-name="PaymentMethodType" description="${description}"> + <entity-order-by field-name="description"/> + </entity-options> + </drop-down> + </field> + <field name="amount" position="1"><text/></field> + <field position="1" name="createButton"> + <submit button-type="button"/> + </field> + </form> </forms> Modified: ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml?rev=574962&r1=574961&r2=574962&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/BillingAccountScreens.xml Wed Sep 12 07:11:50 2007 @@ -202,11 +202,20 @@ <set field="billingAccountId" from-field="parameters.billingAccountId"/> <entity-one entity-name="BillingAccount" value-name="billingAccount"/> + <entity-condition entity-name="BillingAccountAndRole" list-name="billToCustomers" filter-by-date="true"> + <condition-list> + <condition-expr field-name="billingAccountId" env-name="billingAccountId"/> + <condition-expr field-name="roleTypeId" value="BILL_TO_CUSTOMER"/> + </condition-list> + </entity-condition> + <set field="billToCustomer" from-field="billToCustomers[0]"/> </actions> <widgets> <decorator-screen name="CommonBillingAccountDecorator"> <decorator-section name="body"> <include-form name="ListBillingAccountPayments" location="component://accounting/widget/BillingAccountForms.xml"/> + <label style="head1">${uiLabelMap.AccountingCreatePayment}</label> + <include-form name="CreateIncomingBillingAccountPayment" location="component://accounting/widget/BillingAccountForms.xml"/> </decorator-section> </decorator-screen> </widgets> |
Hi Jacopo,
This services is very handy - it helps a lot to clarify the way of using billing accounts. The only problem that I encountered is that if the payment that is applied to the billing account with the new service is then captured to different invoices then ListBillingAccountPayments form lists payment applications and shows only the full amount of the payment in every line(not the applied amount). I think that this is little confusing. Maybe it will be good idea to display also the applied amount. E.g 10000 Billing Account CI1 2007-09-12 17:34:01.821 $400.00 10000 Billing Account CI3 2007-09-12 17:34:01.821 $400.00 This is one payment with amount 400$ it is applied to two invoices - 200$ to CI1 and 200 to CI2 Regards, Rashko Rejmer |
Free forum by Nabble | Edit this page |