Author: ashish
Date: Fri Jul 10 11:28:21 2009 New Revision: 792888 URL: http://svn.apache.org/viewvc?rev=792888&view=rev Log: Applied patch from jira issue OFBIZ-2706 - Create a screen under AP -> Invoice, which will search for a PURCHASE_INVOICE between dates. Following thing is covered in this patch: -- Patch for issue checks functionality for AP Invoices. Thanks Chirag, Sumit, Rishi & Anil for the 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/ap/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=792888&r1=792887&r2=792888&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Fri Jul 10 11:28:21 2009 @@ -5335,6 +5335,9 @@ <property key="AccountingNoAcctgTransFound"> <value xml:lang="en">No Accounting Transactions Found.</value> </property> + <property key="AccountingNoInvoicesReadyOrOutstandingAmountZero"> + <value xml:lang="en">Either no selected invoices in ready state or selected invoices outstanding amount equals to zero.</value> + </property> <property key="AccountingNoRecordFound"> <value xml:lang="en">No Record Found.</value> </property> 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=792888&r1=792887&r2=792888&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 Fri Jul 10 11:28:21 2009 @@ -469,4 +469,114 @@ <call-service service-name="deletePaymentGroupMember" in-map-name="deletePaymentGroupMemberMap"/> </iterate> </simple-method> + + <simple-method method-name="createPaymentAndPaymentGroupForInvoices" short-description="Creates Payments, PaymentApplications and PaymentGroup for the same"> + <now-timestamp field="nowTimestamp"/> + <set field="invoices" type="List"/> + <iterate list="parameters.invoiceIds" entry="invoiceId"> + <entity-one entity-name="Invoice" value-field="invoice" auto-field-map="true"/> + <clear-field field="invoices"/> + <set field="invoices" from-field="partyInvoices.${invoice.partyIdFrom}"/> + <field-to-list field="invoice" list="invoices"/> + <set field="partyInvoices.${invoice.partyIdFrom}" from-field="invoices"/> + </iterate> + <clear-field field="invoices"/> + <iterate-map map="partyInvoices" key="partyId" value="invoices"> + <set-service-fields service-name="createPaymentAndApplicationForParty" map="parameters" to-map="createPaymentAndApplicationForPartyMap"/> + <set field="createPaymentAndApplicationForPartyMap.partyId" from-field="partyId"/> + <set field="createPaymentAndApplicationForPartyMap.invoices" from-field="invoices"/> + <if-not-empty field="parameters.checkStartNumber"> + <calculate field="parameters.checkStartNumber" type="Long"> + <calcop operator="add"> + <calcop operator="get" field="parameters.checkStartNumber"/> + <number value="1"/> + </calcop> + </calculate> + </if-not-empty> + <call-service service-name="createPaymentAndApplicationForParty" in-map-name="createPaymentAndApplicationForPartyMap"> + <result-to-field result-name="paymentId" field="paymentId"/> + </call-service> + <field-to-list field="paymentId" list="paymentIds"/> + </iterate-map> + <if-not-empty field="paymentIds"> + <set field="createPaymentGroupAndMemberMap.paymentIds" from-field="paymentIds"/> + <set field="createPaymentGroupAndMemberMap.paymentGroupTypeId" value="CHECK_RUN"/> + <set field="createPaymentGroupAndMemberMap.fromDate" from-field="nowTimestamp"/> + <set field="createPaymentGroupAndMemberMap.paymentGroupName" value="Check Run for ${nowTimestamp}"/> + <call-service service-name="createPaymentGroupAndMember" in-map-name="createPaymentGroupAndMemberMap"> + <result-to-field result-name="paymentGroupId"/> + <result-to-result result-name="paymentGroupId"/> + </call-service> + </if-not-empty> + <if-empty field="paymentGroupId"> + <property-to-field property="AccountingNoInvoicesReadyOrOutstandingAmountZero" resource="AccountingUiLabels" field="errorMessage"/> + <field-to-result field="errorMessage" result-name="errorMessage"/> + </if-empty> + </simple-method> + + <simple-method method-name="createPaymentAndApplicationForParty" short-description="create Payment and PaymentApplications for multiple invoices for one party"> + <set field="paymentAmount" type="BigDecimal" value="0"/> + <iterate list="parameters.invoices" entry="invoice"> + <if-compare field="invoice.statusId" operator="equals" value="INVOICE_READY" type="String"> + <set-service-fields service-name="getInvoicePaymentInfoList" map="invoice" to-map="getInvoicePaymentInfoListCtx"/> + <call-service service-name="getInvoicePaymentInfoList" in-map-name="getInvoicePaymentInfoListCtx"> + <result-to-field result-name="invoicePaymentInfoList"/> + </call-service> + <first-from-list list="invoicePaymentInfoList" entry="invoicePaymentInfo"/> + <calculate field="paymentAmount"> + <calcop operator="add" field="paymentAmount"> + <calcop operator="get" field="invoicePaymentInfo.outstandingAmount"/> + </calcop> + </calculate> + </if-compare> + </iterate> + <if-compare field="paymentAmount" operator="greater" type="BigDecimal" value="0"> + <set-service-fields service-name="getPartyAccountingPreferences" map="parameters" to-map="getPartyAccountingPreferencesMap"/> + <call-service service-name="getPartyAccountingPreferences" in-map-name="getPartyAccountingPreferencesMap"> + <result-to-field result-name="partyAccountingPreference" field="partyAcctgPreference"/> + </call-service> + <set field="createPaymentMap.paymentTypeId" value="VENDOR_PAYMENT"/> + <set field="createPaymentMap.partyIdFrom" from-field="parameters.organizationPartyId"/> + <set field="createPaymentMap.currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/> + <set field="createPaymentMap.partyIdTo" from-field="parameters.partyId"/> + <set field="createPaymentMap.statusId" value="PMNT_SENT"/> + <set field="createPaymentMap.amount" type="BigDecimal" from-field="paymentAmount"/> + <set field="createPaymentMap.paymentMethodTypeId" from-field="parameters.paymentMethodTypeId"/> + <set field="createPaymentMap.paymentRefNum" type="String" from-field="parameters.checkStartNumber"/> + <call-service service-name="createPayment" in-map-name="createPaymentMap"> + <result-to-field result-name="paymentId"/> + <result-to-result result-name="paymentId"/> + </call-service> + <iterate list="parameters.invoices" entry="invoice"> + <if-compare field="invoice.statusId" operator="equals" value="INVOICE_READY"> + <set-service-fields service-name="getInvoicePaymentInfoList" map="invoice" to-map="getInvoicePaymentInfoListCtx"/> + <call-service service-name="getInvoicePaymentInfoList" in-map-name="getInvoicePaymentInfoListCtx"> + <result-to-field result-name="invoicePaymentInfoList" field="invoicePaymentInfoList"/> + </call-service> + <first-from-list list="invoicePaymentInfoList" entry="invoicePaymentInfo"/> + <if-compare field="invoicePaymentInfo.outstandingAmount" operator="greater" value="0"> + <set field="createPaymentApplicationMap.paymentId" from-field="paymentId"/> + <set field="createPaymentApplicationMap.amountApplied" from-field="invoicePaymentInfo.outstandingAmount"/> + <set field="createPaymentApplicationMap.invoiceId" from-field="invoice.invoiceId"/> + <call-service service-name="createPaymentApplication" in-map-name="createPaymentApplicationMap"/> + </if-compare> + </if-compare> + <clear-field field="createPaymentApplicationMap"/> + </iterate> + </if-compare> + </simple-method> + + <simple-method method-name="createPaymentGroupAndMember" short-description="creates PaymentGroup and PaymentGroupMembers"> + <set-service-fields service-name="createPaymentGroup" map="parameters" to-map="createPaymentGroupMap"/> + <call-service service-name="createPaymentGroup" in-map-name="createPaymentGroupMap"> + <result-to-field result-name="paymentGroupId"/> + <result-to-result result-name="paymentGroupId"/> + </call-service> + <set field="createPaymentGroupMemberMap.paymentGroupId" from-field="paymentGroupId"/> + <set field="createPaymentGroupMemberMap.fromDate" from-field="parameters.fromDate"/> + <iterate list="parameters.paymentIds" entry="paymentId"> + <set field="createPaymentGroupMemberMap.paymentId" from-field="paymentId"/> + <call-service service-name="createPaymentGroupMember" in-map-name="createPaymentGroupMemberMap"/> + </iterate> + </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=792888&r1=792887&r2=792888&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Fri Jul 10 11:28:21 2009 @@ -166,4 +166,32 @@ <description>cancel payment batch</description> <attribute name="paymentGroupId" type="String" mode="IN" optional="false"/> </service> + <service name="createPaymentAndPaymentGroupForInvoices" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createPaymentAndPaymentGroupForInvoices" auth="true"> + <description>Creates Payments, Payment Application and Payment Group for the same</description> + <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/> + <attribute name="checkStartNumber" type="Long" mode="IN" optional="true"/> + <attribute name="invoiceIds" type="List" mode="IN" optional="false"/> + <attribute name="paymentMethodTypeId" type="String" mode="IN" optional="false"/> + <attribute name="paymentGroupId" type="String" mode="OUT" optional="true"/> + <attribute name="errorMessage" type="String" optional="true" mode="OUT"/> + </service> + <service name="createPaymentAndApplicationForParty" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createPaymentAndApplicationForParty" auth="true"> + <description>create Payment and PaymentApplications for multiple invoices for one party</description> + <attribute name="organizationPartyId" type="String" mode="IN" optional="true"/> + <attribute name="partyId" type="String" mode="IN" optional="false"/> + <attribute name="invoices" type="List" mode="IN" optional="false"/> + <attribute name="paymentMethodTypeId" type="String" mode="IN" optional="false"/> + <attribute name="checkStartNumber" type="Long" mode="IN" optional="true"/> + <attribute name="paymentId" type="String" mode="OUT" optional="true"/> + </service> + <service name="createPaymentGroupAndMember" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createPaymentGroupAndMember" auth="true"> + <attribute name="paymentIds" type="List" mode="IN" optional="false"/> + <attribute name="paymentGroupTypeId" type="String" mode="IN" optional="false"/> + <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/> + <attribute name="paymentGroupName" type="String" mode="IN" optional="true"/> + <attribute name="paymentGroupId" type="String" mode="OUT" optional="false"/> + </service> </services> Modified: ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/controller.xml?rev=792888&r1=792887&r2=792888&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/controller.xml Fri Jul 10 11:28:21 2009 @@ -48,6 +48,12 @@ <response name="success" type="none"/> <response name="error" type="none"/> </request-map> + <request-map uri="processMassCheckRun"> + <security https="true" auth="true"/> + <event type="service" invoke="createPaymentAndPaymentGroupForInvoices"/> + <response name="success" type="request" value="FindPurchaseInvoices"/> + <response name="error" type="view" value="FindPurchaseInvoices"/> + </request-map> <!-- ================ Vendor requests ================ --> <request-map uri="findVendors"> Modified: ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl?rev=792888&r1=792887&r2=792888&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl (original) +++ ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl Fri Jul 10 11:28:21 2009 @@ -55,6 +55,24 @@ $('showInvoiceRunningTotal').update(""); } } + +function setServiceName(selection) { + document.listPurchaseInvoices.action = '<@ofbizUrl>'+selection.value+'</@ofbizUrl>'; + showIssueChecks(selection); +} + +function runAction() { + var form = document.listPurchaseInvoices; + var invoices = form.elements.length; + for (var i = 0; i < invoices; i++) { + var element = form.elements[i]; + if (element.name == "invoiceIds") { + element.disabled = false; + } + } + form.submit(); +} + function showIssueChecks(selection) { if (selection.value == 'processMassCheckRun') { Effect.BlindDown('issueChecks',{duration: 0.0}); @@ -73,19 +91,19 @@ <form name="listPurchaseInvoices" id="listPurchaseInvoices" method="post" action="javascript:void();"> <div align="right"> <!-- May add some more options in future like cancel selected invoices--> - <select name="serviceName" id="serviceName" onchange="javascript:showIssueChecks(this);"> + <select name="serviceName" id="serviceName" onchange="javascript:setServiceName(this);"> <option value=""/> <option value="processMassCheckRun">${uiLabelMap.AccountingIssueCheck}</option> </select> - <a href="#" id="runAction" class="buttontext">${uiLabelMap.OrderRunAction}</a><#--call the runAction--> + <a href="javascript:runAction();" id="runAction" class="buttontext">${uiLabelMap.OrderRunAction}</a> </div> <input type="hidden" name="organizationPartyId" value="${organizationPartyId}"/> <div id="issueChecks" style="display: none;" align="right"> <span class="label">${uiLabelMap.AccountingVendorPaymentMethod}</span> - <select name="vendorPaymentMethod"> + <select name="paymentMethodTypeId"> <option value=""></option> <#if paymentMethodType?has_content> - <option value="paymentMethodType.paymentMethodTypeId">${paymentMethodType.description}</option> + <option value="${paymentMethodType.paymentMethodTypeId}">${paymentMethodType.description}</option> </#if> </select> <span class="label">${uiLabelMap.AccountingBankAccount}</span> @@ -98,7 +116,7 @@ </#if> </select> <span class="label">${uiLabelMap.AccountingCheckNumber}</span> - <input type="text" name="checkNumber"/> + <input type="text" name="checkStartNumber"/> </div> <table class="basic-table hover-bar" cellspacing="0"> <#-- Header Begins --> |
Free forum by Nabble | Edit this page |