| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| 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. |
| --> |
| |
| <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods-v2.xsd"> |
| |
| <simple-method method-name="testInvoiceWorkerGetInvoiceTotal" login-required="false" |
| short-description="Tests InvoiceWorker.getInvoiceTotal(GenericValue) for all demo invoices"> |
| <set field="invoiceId" value="demo10000"/> |
| <set field="amount" value="323.54" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="demo10001"/> |
| <set field="amount" value="36.43" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="demo10002"/> |
| <set field="amount" value="56.99" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="demo11000"/> |
| <set field="amount" value="20" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="demo11001"/> |
| <set field="amount" value="543.23" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="demo1200"/> |
| <set field="amount" value="511.23" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8000"/> |
| <set field="amount" value="60" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8001"/> |
| <set field="amount" value="10" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8002"/> |
| <set field="amount" value="36.43" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8003"/> |
| <set field="amount" value="46.43" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8004"/> |
| <set field="amount" value="33.99" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8100"/> |
| <set field="amount" value="1320" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8005"/> |
| <set field="amount" value="33.99" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8006"/> |
| <set field="amount" value="46.43" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8007"/> |
| <set field="amount" value="36.43" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8008"/> |
| <set field="amount" value="48" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8009"/> |
| <set field="amount" value="127.09" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <set field="invoiceId" value="8010"/> |
| <set field="amount" value="179.97" type="BigDecimal"/> |
| <call-simple-method method-name="assertInvoiceTotal"/> |
| |
| <check-errors/> |
| </simple-method> |
| <simple-method method-name="assertInvoiceTotal" login-required="false" |
| short-description="Inline method to assist testInvoiceWorkerGetInvoiceTotal"> |
| <entity-one value-field="invoice" entity-name="Invoice"> |
| <field-map field-name="invoiceId"/> |
| </entity-one> |
| <call-class-method method-name="getInvoiceTotal" class-name="org.ofbiz.accounting.invoice.InvoiceWorker" ret-field="invoiceTotal"> |
| <field field="invoice" type="GenericValue"/> |
| </call-class-method> |
| <assert><if-compare-field field="invoiceTotal" operator="equals" to-field="amount" type="BigDecimal"/></assert> |
| </simple-method> |
| |
| <!-- Test case for Commission Run --> |
| <simple-method method-name="testCommissionRun" short-description="Test case for Commission Run" login-required="false"> |
| |
| <!-- Precondition : For Creating Commission invoice following data should be there : |
| 1 ) Sales invoices with paid status.(invoiceId = "8100") |
| 2 ) Sales Representative with agreement to Company on product (DemoCustAgent and DemoRepAll). --> |
| <!-- Postcondition : |
| 1 ) Two commission will be creating for the parties DemoCustAgent and DemoRepAll (like 10000 and 10001 invoiceId). |
| 2 ) Its amountTotal will be same as commission cost of associated products. --> |
| |
| <set field="invoiceId" value="8100"/> |
| <set field="invoiceIds[]" from-field="invoiceId"/> |
| <set field="partyIds[]" value="DemoRepAll"/> |
| <set field="partyIds[]" value="DemoCustAgent"/> |
| <set field="partyIds[]" value="DemoRepStore"/> |
| <set field="invoiceTotal" type="BigDecimal" value="0"/> |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="system"/> |
| </entity-one> |
| <entity-and entity-name="InvoiceItem" list="invoiceItems"> |
| <field-map field-name="invoiceId" from-field="invoiceId"/> |
| </entity-and> |
| <iterate list="invoiceItems" entry="invoiceItem"> |
| <if-compare field="invoiceItem.productId" operator="equals" value="WG-9943-B3"> |
| <set field="invoiceTotal" value="${invoiceTotal + (invoiceItem.quantity * (invoiceItem.amount * 3 / 100 + 1))}" type="BigDecimal"/> |
| </if-compare> |
| </iterate> |
| <set field="createCommissionInvoicesMap.invoiceIds" from-field="invoiceIds"/> |
| <set field="createCommissionInvoicesMap.partyIds" from-field="partyIds"/> |
| <set field="createCommissionInvoicesMap.userLogin" from-field="userLogin"/> |
| <call-service service-name="createCommissionInvoices" in-map-name="createCommissionInvoicesMap"> |
| <result-to-field result-name="invoicesCreated"/> |
| </call-service> |
| <assert> |
| <not><if-empty field="invoicesCreated"/></not> |
| </assert> |
| <check-errors/> |
| <iterate list="invoicesCreated" entry="invoice"> |
| <call-class-method method-name="getInvoiceTotal" ret-field="amountTotal" class-name="org.ofbiz.accounting.invoice.InvoiceWorker"> |
| <field field="delegator" type="org.ofbiz.entity.Delegator"/> |
| <field field="invoice.commissionInvoiceId" type="String"/> |
| </call-class-method> |
| <assert> |
| <or> |
| <if-compare-field field="amountTotal" operator="equals" to-field="invoiceTotal"/> |
| </or> |
| </assert> |
| <check-errors/> |
| </iterate> |
| <log level="info" message="Commission Invoice ${invoicesCreated} is created successfully for ${partyIds}"/> |
| </simple-method> |
| |
| <!--Test case to verify GL postings for Cancel Invoice process--> |
| <simple-method method-name="testGlPostingOnCancelInvoice" short-description="Test case to verify GL postings for Cancel Invoice functionality" login-required="false"> |
| <!-- Precondition : |
| * Invoice is in ready status so accounting transaction is already posted to the GL |
| * GL Accounts associated with Invoice :8008 are ACCOUNTS PAYABLE and UNINVOICED ITEM RECEIPTS |
| * Credit in account 210000 - ACCOUNTS PAYABLE ;debitTotal $303.41 ; creditTotal:$1651.7 ; debitCreditDifference : $ -1348.42 |
| * Debit in account 214000 - UNINVOICED ITEM RECEIPTS;debitTotal :$408 ; creditTotal:$48 ; debitCreditDifference : $360 |
| --> |
| |
| <!-- Post condition : After Cancel Invoice process reverse accounting transactions are automatically posted to the GL. |
| * ACCOUNTS PAYABLE 210000 - debitTotal $351.41 ; creditTotal:$1651.7 ; debitCreditDifference : $ -1300 |
| * UNINVOICED ITEM RECEIPTS 214000 - debitTotal :$408 ; creditTotal:$96 ; debitCreditDifference : $312 |
| --> |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="system"/> |
| </entity-one> |
| |
| <now-timestamp field="nowTimestamp"/> |
| <set field="findCustomTimePeriodsMap.userLogin" from-field="userLogin"/> |
| <set field="findCustomTimePeriodsMap.findDate" from-field="nowTimestamp" type="Timestamp"/> |
| <set field="findCustomTimePeriodsMap.organizationPartyId" value="Company"/> |
| <call-service service-name="findCustomTimePeriods" in-map-name="findCustomTimePeriodsMap"> |
| <result-to-field result-name="customTimePeriodList"/> |
| </call-service> |
| <first-from-list list="customTimePeriodList" entry="customTimePeriod"/> |
| |
| <set field="getAcctgTransEntriesAndTransTotalMap.userLogin" from-field="userLogin"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.organizationPartyId" value="Company"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.customTimePeriodStartDate" from-field="customTimePeriod.fromDate" type="Timestamp"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.customTimePeriodEndDate" from-field="customTimePeriod.thruDate" type="Timestamp"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="210000"/> |
| <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap"> |
| <result-to-field result-name="debitTotal" field="payableDebitTotal"/> |
| <result-to-field result-name="creditTotal" field="payableCreditTotal"/> |
| <result-to-field result-name="debitCreditDifference" field="payableDebitCreditDifference"/> |
| </call-service> |
| <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="214000"/> |
| <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap"> |
| <result-to-field result-name="debitTotal" field="uninvoicedDebitTotal"/> |
| <result-to-field result-name="creditTotal" field="uninvoicedCreditTotal"/> |
| <result-to-field result-name="debitCreditDifference" field="uninvoicedDebitCreditDifference"/> |
| </call-service> |
| <log level="info" message="BEFORE RUNNING CANCEL INVOICE : ACCOUNTS PAYABLE ;debitTotal :${payableDebitTotal} ; creditTotal:${payableCreditTotal} ; debitCreditDifference : ${payableDebitCreditDifference}"/> |
| <log level="info" message="BEFORE RUNNING CANCEL INVOICE :UNINVOICED RECEIPTS;debitTotal :${uninvoicedDebitTotal} ; creditTotal:${uninvoicedCreditTotal} ; debitCreditDifference : ${uninvoicedDebitCreditDifference}"/> |
| <set field="invoiceId" value="8008"/> |
| <set field="cancelInvoiceMap.userLogin" from-field="userLogin"/> |
| <set field="cancelInvoiceMap.invoiceId" from-field="invoiceId"/> |
| <call-service service-name="cancelInvoice" in-map-name="cancelInvoiceMap"/> |
| |
| <set field="totalPayableDebitAmount" value="${payableDebitTotal + 48}" type="BigDecimal"/> |
| <set field="totalPayableDebitCreditDifference" value="${payableDebitCreditDifference + 48}" type="BigDecimal"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="210000"/> |
| <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap"> |
| <result-to-field result-name="debitTotal" field="payableDebitTotal"/> |
| <result-to-field result-name="creditTotal" field="payableCreditTotal"/> |
| <result-to-field result-name="debitCreditDifference" field="payableDebitCreditDifference"/> |
| </call-service> |
| <assert> |
| <if-compare-field field="totalPayableDebitAmount" operator="equals" to-field="payableDebitTotal" type="BigDecimal"/> |
| <if-compare-field field="totalPayableDebitCreditDifference" operator="equals" to-field="payableDebitCreditDifference" type="BigDecimal"/> |
| </assert> |
| <check-errors/> |
| <set field="totalUnInvoicedCreditAmount" value="${uninvoicedCreditTotal + 48}" type="BigDecimal"/> |
| <set field="totalUnInvoicedDebitCreditDifference" value="${uninvoicedDebitCreditDifference - 48}" type="BigDecimal"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="214000"/> |
| <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap"> |
| <result-to-field result-name="debitTotal" field="uninvoicedDebitTotal"/> |
| <result-to-field result-name="creditTotal" field="uninvoicedCreditTotal"/> |
| <result-to-field result-name="debitCreditDifference" field="uninvoicedDebitCreditDifference"/> |
| </call-service> |
| <assert> |
| <if-compare-field field="totalUnInvoicedCreditAmount" operator="equals" to-field="uninvoicedCreditTotal" type="BigDecimal"/> |
| <if-compare-field field="totalUnInvoicedDebitCreditDifference" operator="equals" to-field="uninvoicedDebitCreditDifference" type="BigDecimal"/> |
| </assert> |
| <check-errors/> |
| <log level="info" message="AFTER RUNNING CANCEL INVOICE : ACCOUNTS PAYABLE ;debitTotal :${payableDebitTotal} ; creditTotal:${payableCreditTotal} ; debitCreditDifference : ${payableDebitCreditDifference}"/> |
| <log level="info" message="AFTER RUNNING CANCEL INVOICE : UNINVOICED RECEIPTS ;debitTotal :${uninvoicedDebitTotal} ; creditTotal:${uninvoicedCreditTotal} ; debitCreditDifference : ${uninvoicedDebitCreditDifference}"/> |
| </simple-method> |
| |
| <!--Test case to verify GL postings for Cancel Check Run process--> |
| <simple-method method-name="testGlPostingOnCancelCheckRun" short-description="Test case to verify GL postings for Cancel Check Run functionality" login-required="false"> |
| <!-- Precondition : |
| * Two invoices are associated with PaymentGroupId 9000 which are 8001 and 8002 |
| * Invoices are in ready status so accounting transactions are already posted to the GL |
| * GL Accounts associated with Invoices are ACCOUNTS PAYABLE (210000) and GENERAL CHECKING ACCOUNT (111100) |
| --> |
| |
| <!-- Post condition : After Cancel Check Run process accounting transactions are automatically posted to the GL. |
| * ACCOUNTS PAYABLE 210000 - debitTotal increased of $82.86 ; creditTotal increased of $165.72 ; debitCreditDifference decreased of $82.86 |
| * GENERAL CHECKING ACCOUNT 111100 - debitTotal increased of $82.86 ; debitCreditDifference increased of $82.86 |
| --> |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="system"/> |
| </entity-one> |
| |
| <now-timestamp field="nowTimestamp"/> |
| <set field="findCustomTimePeriodsMap.userLogin" from-field="userLogin"/> |
| <set field="findCustomTimePeriodsMap.findDate" from-field="nowTimestamp" type="Timestamp"/> |
| <set field="findCustomTimePeriodsMap.organizationPartyId" value="Company"/> |
| <call-service service-name="findCustomTimePeriods" in-map-name="findCustomTimePeriodsMap"> |
| <result-to-field result-name="customTimePeriodList"/> |
| </call-service> |
| <first-from-list list="customTimePeriodList" entry="customTimePeriod"/> |
| |
| <set field="getAcctgTransEntriesAndTransTotalMap.userLogin" from-field="userLogin"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.organizationPartyId" value="Company"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.customTimePeriodStartDate" from-field="customTimePeriod.fromDate" type="Timestamp"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.customTimePeriodEndDate" from-field="customTimePeriod.thruDate" type="Timestamp"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="210000"/> |
| <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap"> |
| <result-to-field result-name="debitTotal" field="payableDebitTotal"/> |
| <result-to-field result-name="creditTotal" field="payableCreditTotal"/> |
| <result-to-field result-name="debitCreditDifference" field="payableDebitCreditDifference"/> |
| </call-service> |
| |
| <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="111100"/> |
| <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap"> |
| <result-to-field result-name="debitTotal" field="undepositedDebitTotal"/> |
| <result-to-field result-name="creditTotal" field="undepositedCreditTotal"/> |
| <result-to-field result-name="debitCreditDifference" field="undepositedDebitCreditDifference"/> |
| </call-service> |
| |
| <log level="info" message="BEFORE RUNNING CANCEL CHECK RUN : ACCOUNTS PAYABLE ;debitTotal :${payableDebitTotal} ; creditTotal:${payableCreditTotal} ; debitCreditDifference : ${payableDebitCreditDifference}"/> |
| <log level="info" message="BEFORE RUNNING CANCEL CHECK RUN : UNDEPOSITED RECEIPTS ;debitTotal :${undepositedDebitTotal} ; creditTotal:${undepositedCreditTotal} ; debitCreditDifference : ${undepositedDebitCreditDifference}"/> |
| |
| <set field="paymentGroupId" value="9000"/> |
| <set field="cancelCheckRunPaymentsMap.userLogin" from-field="userLogin"/> |
| <set field="cancelCheckRunPaymentsMap.paymentGroupId" from-field="paymentGroupId"/> |
| <call-service service-name="cancelCheckRunPayments" in-map-name="cancelCheckRunPaymentsMap"/> |
| <entity-and entity-name="PmtGrpMembrPaymentAndFinAcctTrans" list="paymentGroupMemberAndTransList"> |
| <field-map field-name="paymentGroupId"/> |
| </entity-and> |
| <first-from-list list="paymentGroupMemberAndTransList" entry="paymentGroupMemberAndTrans"/> |
| <if-compare field="paymentGroupMemberAndTrans.finAccountTransStatusId" operator="not-equals" value="FINACT_TRNS_APPROVED"> |
| |
| <set field="totalPayableDebitAmount" value="${payableDebitTotal + 82.86}" type="BigDecimal"/> |
| <set field="totalPayableCreditAmount" value="${payableCreditTotal + 165.72}" type="BigDecimal"/> |
| <set field="totalPayableDebitCreditDifference" value="${payableDebitCreditDifference - 82.86}" type="BigDecimal"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="210000"/> |
| <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap"> |
| <result-to-field result-name="debitTotal" field="payableDebitTotal"/> |
| <result-to-field result-name="creditTotal" field="payableCreditTotal"/> |
| <result-to-field result-name="debitCreditDifference" field="payableDebitCreditDifference"/> |
| </call-service> |
| |
| <assert> |
| <if-compare-field field="totalPayableDebitAmount" operator="equals" to-field="payableDebitTotal" type="BigDecimal"/> |
| <if-compare-field field="totalPayableCreditAmount" operator="equals" to-field="payableCreditTotal" type="BigDecimal"/> |
| <if-compare-field field="totalPayableDebitCreditDifference" operator="equals" to-field="payableDebitCreditDifference" type="BigDecimal"/> |
| </assert> |
| <check-errors/> |
| <set field="totalUndepositedDebitAmount" value="${undepositedDebitTotal + 82.86}" type="BigDecimal"/> |
| <set field="totalUndepositedDebitCreditDifference" value="${undepositedDebitCreditDifference + 82.86}" type="BigDecimal"/> |
| <set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="111100"/> |
| <call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap"> |
| <result-to-field result-name="debitTotal" field="undepositedDebitTotal"/> |
| <result-to-field result-name="creditTotal" field="undepositedCreditTotal"/> |
| <result-to-field result-name="debitCreditDifference" field="undepositedDebitCreditDifference"/> |
| </call-service> |
| <assert> |
| <if-compare-field field="totalUndepositedDebitAmount" operator="equals" to-field="undepositedDebitTotal" type="BigDecimal"/> |
| <if-compare-field field="totalUndepositedDebitCreditDifference" operator="equals" to-field="undepositedDebitCreditDifference" type="BigDecimal"/> |
| </assert> |
| <check-errors/> |
| |
| </if-compare> |
| <log level="info" message="AFTER RUNNING CANCEL CHECK RUN: ACCOUNTS PAYABLE ;debitTotal :${payableDebitTotal} ; creditTotal:${payableCreditTotal} ; debitCreditDifference : ${payableDebitCreditDifference}"/> |
| <log level="info" message="AFTER RUNNING CANCEL CHECK RUN : UNDEPOSITED RECEIPTS ;debitTotal :${undepositedDebitTotal} ; creditTotal:${undepositedCreditTotal} ; debitCreditDifference : ${undepositedDebitCreditDifference}"/> |
| </simple-method> |
| |
| </simple-methods> |