Author: apatel
Date: Thu Sep 23 21:10:55 2010 New Revision: 1000627 URL: http://svn.apache.org/viewvc?rev=1000627&view=rev Log: Applied fix from trunk for revision: 1000621 === Modified: ofbiz/branches/release10.04/ (props changed) ofbiz/branches/release10.04/applications/accounting/data/AccountingTypeData.xml ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml ofbiz/branches/release10.04/applications/accounting/servicedef/secas_ledger.xml ofbiz/branches/release10.04/applications/accounting/servicedef/services_invoice.xml ofbiz/branches/release10.04/applications/accounting/servicedef/services_ledger.xml Propchange: ofbiz/branches/release10.04/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 23 21:10:55 2010 @@ -1,3 +1,3 @@ /ofbiz/branches/addbirt:831210-885099,885686-886087 /ofbiz/branches/multitenant20100310:921280-927264 -/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,940851,941007,941047,941109,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168,943271-943272,944614,944621,944623,944647,944669,944797,944895,945010,945018,945026,945118,945573,945578,945580,945582,945610,945619,945848,945852,945857,946061,946066,946073,946075,946080,946309,946313,946320,946322,946596,947004-947005,947392,947424,947679,947988,948017,948694,949174,949710,949844,950866,950870,950893,951005,951062,951098,951251,951367,951381,951672,952232,952249,952270,953294,953671,954135,954583,954733,954956,955568,956022,956206,956340,957160,958343,958514,958521,958752,958758,958769,958953,959456,960143,960491,960997,963610,964558,965470,965916,966525,966785,967098,978806,978893,978939,979104,980641-980642,980935,981051,981104,981123,981288,983920,983930,985163,985473,985718,985856,985902,987841,989166,990127,990339,990539,991 485,993344,993387,995384,995686,996069,996078-996079,996563,997418-997420,997423-997425,997431,997440,997526,997990,998061,998412 +/ofbiz/trunk:939988,939990,939999,940025,940053,940234,940248,940309,940401,940410,940425,940779,940815,940849,940851,941007,941047,941109,941177,941199,941261,941440,941600,941999,942084,942406,942414,942671,942883-942884,943168,943271-943272,944614,944621,944623,944647,944669,944797,944895,945010,945018,945026,945118,945573,945578,945580,945582,945610,945619,945848,945852,945857,946061,946066,946073,946075,946080,946309,946313,946320,946322,946596,947004-947005,947392,947424,947679,947988,948017,948694,949174,949710,949844,950866,950870,950893,951005,951062,951098,951251,951367,951381,951672,952232,952249,952270,953294,953671,954135,954583,954733,954956,955568,956022,956206,956340,957160,958343,958514,958521,958752,958758,958769,958953,959456,960143,960491,960997,963610,964558,965470,965916,966525,966785,967098,978806,978893,978939,979104,980641-980642,980935,981051,981104,981123,981288,983920,983930,985163,985473,985718,985856,985902,987841,989166,990127,990339,990539,991 485,993344,993387,995384,995686,996069,996078-996079,996563,997418-997420,997423-997425,997431,997440,997526,997990,998061,998412,1000621 Modified: ofbiz/branches/release10.04/applications/accounting/data/AccountingTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/accounting/data/AccountingTypeData.xml?rev=1000627&r1=1000626&r2=1000627&view=diff ============================================================================== --- ofbiz/branches/release10.04/applications/accounting/data/AccountingTypeData.xml (original) +++ ofbiz/branches/release10.04/applications/accounting/data/AccountingTypeData.xml Thu Sep 23 21:10:55 2010 @@ -45,6 +45,7 @@ under the License. <AcctgTransType acctgTransTypeId="SALES_INVOICE" description="Sales Invoice" hasTable="N" parentTypeId="OBLIGATION_ACCTG_TRA"/><!-- FIXME: replace with "SALES" --> <AcctgTransType acctgTransTypeId="PURCHASE_INVOICE" description="Purchase Invoice" hasTable="N" parentTypeId="OBLIGATION_ACCTG_TRA"/><!-- FIXME: replace with "SALES" --> + <AcctgTransType acctgTransTypeId="CUST_RTN_INVOICE" description="Customer Return" hasTable="N" parentTypeId="OBLIGATION_ACCTG_TRA"/><!-- FIXME: replace with "SALES" --> <AcctgTransType acctgTransTypeId="SALES_SHIPMENT" description="Sales Shipment" hasTable="N" parentTypeId="EXTERNAL_ACCTG_TRANS"/> <AcctgTransType acctgTransTypeId="SHIPMENT_RECEIPT" description="Shipment Receipt" hasTable="N" parentTypeId="EXTERNAL_ACCTG_TRANS"/> <AcctgTransType acctgTransTypeId="MANUFACTURING" description="Manufacturing" hasTable="N" parentTypeId=""/> Modified: ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=1000627&r1=1000626&r2=1000627&view=diff ============================================================================== --- ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml (original) +++ ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Thu Sep 23 21:10:55 2010 @@ -431,6 +431,7 @@ under the License. <simple-method method-name="setInvoiceStatus" short-description="Set The Invoice Status"> <entity-one entity-name="Invoice" value-field="invoice"/> <field-to-result field="invoice.statusId" result-name="oldStatusId"/> + <field-to-result field="invoice.invoiceTypeId" result-name="invoiceTypeId"/> <if-compare-field field="invoice.statusId" to-field="parameters.statusId" operator="not-equals"> <entity-one entity-name="StatusValidChange" value-field="statusChange" auto-field-map="false"> <field-map field-name="statusId" from-field="invoice.statusId"/> Modified: ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=1000627&r1=1000626&r2=1000627&view=diff ============================================================================== --- ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original) +++ ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Thu Sep 23 21:10:55 2010 @@ -579,6 +579,10 @@ under the License. <if-compare field="parameters.debitCreditFlag" operator="equals" value="D"/> </and> <and> + <if-compare field="parameters.acctgTransTypeId" operator="equals" value="CUST_RTN_INVOICE"/> + <if-compare field="parameters.debitCreditFlag" operator="equals" value="D"/> + </and> + <and> <if-compare field="parameters.acctgTransTypeId" operator="equals" value="SALES_INVOICE"/> <if-compare field="parameters.debitCreditFlag" operator="equals" value="C"/> </and> @@ -594,11 +598,16 @@ under the License. <set field="parameters.glAccountTypeId" value="UNINVOICED_SHIP_RCPT"/> <call-simple-method method-name="getGlAccountTypeDefaultInline"/> <set field="glAccountTypeDefault" from-field="lookedUpValue"/> - <else> + </if-compare> + <if-compare field="parameters.acctgTransTypeId" operator="equals" value="CUST_RTN_INVOICE"> + <set field="parameters.glAccountTypeId" value="SALES_RETURNS"/> + <call-simple-method method-name="getGlAccountTypeDefaultInline"/> + <set field="glAccountTypeDefault" from-field="lookedUpValue"/> + </if-compare> + <if-compare field="parameters.acctgTransTypeId" operator="equals" value="SALES_INVOICE"> <set field="parameters.glAccountTypeId" value="SALES_ACCOUNT"/> <call-simple-method method-name="getGlAccountTypeDefaultInline"/> <set field="glAccountTypeDefault" from-field="lookedUpValue"/> - </else> </if-compare> <if-not-empty field="glAccountTypeDefault.glAccountId"> <field-to-result field="glAccountTypeDefault.glAccountId" result-name="glAccountId"/> @@ -1877,6 +1886,130 @@ under the License. </if-compare> </simple-method> + <simple-method method-name="createAcctgTransForCustomerReturnInvoice" short-description="Create an accounting transaction for a Customer Return Invoice"> + <!-- retrieve ledger rounding properties --> + <call-simple-method method-name="getGlArithmeticSettingsInline"/> + + <entity-one entity-name="Invoice" value-field="invoice"/> + <get-related-one value-field="invoice" relation-name="InvoiceType" to-value-field="invoiceType"/> + <!-- Check invoiceTypeId. This service works only for CustomerReturns --> + <if-compare field="invoiceType.invoiceTypeId" operator="equals" value="CUST_RTN_INVOICE"> + <set field="totalAmountFromInvoice" type="BigDecimal" value="0"/> + <set field="transPartyRoleTypeId" value="BILL_TO_CUSTOMER"/> + <set field="acctgTransTypeId" value="CUST_RTN_INVOICE"/> + <entity-condition entity-name="InvoiceItem" list="invoiceItems" use-cache="true"> + <condition-list> + <condition-expr field-name="invoiceItemTypeId" operator="not-equals" value="PINV_SALES_TAX"/> + <condition-expr field-name="invoiceItemTypeId" operator="not-equals" value="PITM_SALES_TAX"/> + <condition-expr field-name="invoiceId" operator="equals" from-field="parameters.invoiceId"/> + </condition-list> + </entity-condition> + + <iterate list="invoiceItems" entry="invoiceItem"> + <set field="amountFromOrder" type="BigDecimal" value="0"/> + <set field="amountFromInvoice" type="BigDecimal" value="0"/> + <if-empty field="invoiceItem.quantity"> + <set field="invoiceItem.quantity" value="1"/> + </if-empty> + <!-- This InvoiceItem amount. --> + <calculate field="amountFromInvoice" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}"> + <calcop operator="multiply"> + <calcop operator="get" field="invoiceItem.quantity"/> + <calcop operator="get" field="invoiceItem.amount"/> + </calcop> + </calculate> + <!-- Keep building Invoice Total for use in credit entry --> + <calculate field="totalAmountFromInvoice" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}"> + <calcop operator="add"> + <calcop operator="get" field="totalAmountFromInvoice"/> + <calcop operator="get" field="amountFromInvoice"/> + </calcop> + </calculate> + <!-- Debit --> + <make-value entity-name="AcctgTransEntry" value-field="debitEntry"/> + <set field="debitEntry.debitCreditFlag" value="D"/> + <set field="debitEntry.organizationPartyId" from-field="invoice.partyId"/> + <set field="debitEntry.partyId" from-field="invoice.partyIdFrom"/> + <set field="debitEntry.roleTypeId" from-field="transPartyRoleTypeId"/> + <set field="debitEntry.productId" from-field="invoiceItem.productId"/> + <set field="debitEntry.glAccountTypeId" from-field="invoiceItem.invoiceItemTypeId"/> + <set field="debitEntry.glAccountId" from-field="invoiceItem.overrideGlAccountId"/> + <set field="debitEntry.origAmount" from-field="amountFromInvoice"/> + <set field="debitEntry.origCurrencyUomId" from-field="invoice.currencyUomId"/> + <set field="acctgTransEntries[]" from-field="debitEntry" type="Object"/> + </iterate> + <!-- debit entry for SALES_TAX--> + <call-class-method method-name="getInvoiceTaxAuthPartyAndGeos" class-name="org.ofbiz.accounting.invoice.InvoiceWorker" + ret-field="taxAuthPartyAndGeos"> + <field field="invoice" type="org.ofbiz.entity.GenericValue"/> + </call-class-method> + <iterate-map key="taxAuthPartyId" value="taxAuthGeoIds" map="taxAuthPartyAndGeos"> + <iterate entry="taxAuthGeoId" list="taxAuthGeoIds"> + <clear-field field="debitEntry"/> + <make-value entity-name="AcctgTransEntry" value-field="debitEntry"/> + <set field="debitEntry.debitCreditFlag" value="D"/> + <set field="debitEntry.organizationPartyId" from-field="invoice.partyIdFrom"/> + <call-class-method method-name="getInvoiceTaxTotalForTaxAuthPartyAndGeo" class-name="org.ofbiz.accounting.invoice.InvoiceWorker" + ret-field="taxAmount"> + <field field="invoice" type="GenericValue"/> + <field field="taxAuthPartyId" type="String"/> + <field field="taxAuthGeoId" type="String"/> + </call-class-method> + <set field="debitEntry.origAmount" from-field="taxAmount"/> + <set field="debitEntry.origCurrencyUomId" from-field="invoice.currencyUomId"/> + <set field="debitEntry.partyId" from-field="taxAuthPartyId"/> + <set field="debitEntry.roleTypeId" value="TAX_AUTHORITY"/> + <set field="acctgTransEntries[]" from-field="debitEntry" type="Object"/> + </iterate> + </iterate-map> + <!-- Another entry for tax not attributed to a taxAuthPartyId --> + <clear-field field="debitEntry"/> + <make-value entity-name="AcctgTransEntry" value-field="debitEntry"/> + <set field="debitEntry.debitCreditFlag" value="D"/> + <set field="debitEntry.organizationPartyId" from-field="invoice.partyIdFrom"/> + <call-class-method method-name="getInvoiceUnattributedTaxTotal" class-name="org.ofbiz.accounting.invoice.InvoiceWorker" + ret-field="taxAmount"> + <field field="invoice" type="GenericValue"/> + </call-class-method> + <set field="debitEntry.origAmount" from-field="taxAmount"/> + <set field="debitEntry.origCurrencyUomId" from-field="invoice.currencyUomId"/> + <set field="acctgTransEntries[]" from-field="debitEntry" type="Object"/> + + <!-- Credit --> + <make-value entity-name="AcctgTransEntry" value-field="creditEntry"/> + <set field="creditEntry.debitCreditFlag" value="C"/> + <set field="creditEntry.organizationPartyId" from-field="invoice.partyId"/> + <set field="creditEntry.glAccountTypeId" value="ACCOUNTS_PAYABLE"/> + <calculate field="totalAmountFromInvoice" type="BigDecimal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}"> + <calcop operator="add"> + <calcop operator="get" field="totalAmountFromInvoice"/> + <calcop operator="get" field="invoiceTaxTotal"/> + </calcop> + </calculate> + <set field="creditEntry.origAmount" from-field="totalAmountFromInvoice"/> + <set field="creditEntry.origCurrencyUomId" from-field="invoice.currencyUomId"/> + <set field="creditEntry.partyId" from-field="invoice.partyIdFrom"/> + <set field="creditEntry.roleTypeId" from-field="transPartyRoleTypeId"/> + <set field="acctgTransEntries[]" from-field="creditEntry" type="Object"/> + + <!-- Set header fields (AcctgTrans) --> + <set field="createAcctgTransAndEntriesInMap.glFiscalTypeId" value="ACTUAL"/> + <set field="createAcctgTransAndEntriesInMap.acctgTransTypeId" from-field="acctgTransTypeId"/> + <set field="createAcctgTransAndEntriesInMap.invoiceId" from-field="invoice.invoiceId"/> + <set field="createAcctgTransAndEntriesInMap.partyId" from-field="invoice.partyIdFrom"/> + <set field="createAcctgTransAndEntriesInMap.roleTypeId" value="BILL_FROM_VENDOR"/> + <set field="createAcctgTransAndEntriesInMap.acctgTransEntries" from-field="acctgTransEntries"/> + <call-service service-name="createAcctgTransAndEntries" in-map-name="createAcctgTransAndEntriesInMap"> + <result-to-field result-name="acctgTransId"/> + </call-service> + <field-to-result field="acctgTransId" result-name="acctgTransId"/> + <else> + <!-- This invoice is not a Customer Return. Return error --> + <add-error><fail-message message="Bad invoiceTypeId [${invoiceType.invoiceTypeId}]. Service createAcctgTransForCustomerReturnInvoice for type CUST_RTN_INVOICE."/></add-error> + </else> + </if-compare> + </simple-method> + <!-- Service for the automatic creation of accounting transaction for Purchase Invoice --> <simple-method method-name="createAcctgTransForPurchaseInvoice" short-description="Create an accounting transaction for a purchase invoice"> <!-- retrieve ledger rounding properties --> Modified: ofbiz/branches/release10.04/applications/accounting/servicedef/secas_ledger.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/accounting/servicedef/secas_ledger.xml?rev=1000627&r1=1000626&r2=1000627&view=diff ============================================================================== --- ofbiz/branches/release10.04/applications/accounting/servicedef/secas_ledger.xml (original) +++ ofbiz/branches/release10.04/applications/accounting/servicedef/secas_ledger.xml Thu Sep 23 21:10:55 2010 @@ -86,6 +86,7 @@ under the License. <!-- accounting transactions for Purchase (AP) and Sales Invoices (AR) --> <eca service="setInvoiceStatus" event="commit"> <condition field-name="invoiceId" operator="is-not-empty"/> + <condition field-name="invoiceTypeId" operator="not-equals" value="CUST_RTN_INVOICE"/> <condition field-name="statusId" operator="equals" value="INVOICE_READY"/> <condition field-name="oldStatusId" operator="not-equals" value="INVOICE_READY"/> <condition field-name="oldStatusId" operator="not-equals" value="INVOICE_PAID"/> @@ -94,6 +95,14 @@ under the License. </eca> <eca service="setInvoiceStatus" event="commit"> <condition field-name="invoiceId" operator="is-not-empty"/> + <condition field-name="invoiceTypeId" operator="equals" value="CUST_RTN_INVOICE"/> + <condition field-name="statusId" operator="equals" value="INVOICE_READY"/> + <condition field-name="oldStatusId" operator="not-equals" value="INVOICE_READY"/> + <condition field-name="oldStatusId" operator="not-equals" value="INVOICE_PAID"/> + <action service="createAcctgTransForCustomerReturnInvoice" mode="sync"/> + </eca> + <eca service="setInvoiceStatus" event="commit"> + <condition field-name="invoiceId" operator="is-not-empty"/> <condition field-name="statusId" operator="equals" value="INVOICE_CANCELLED"/> <action service="cancelInvoice" mode="sync"/> </eca> Modified: ofbiz/branches/release10.04/applications/accounting/servicedef/services_invoice.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/accounting/servicedef/services_invoice.xml?rev=1000627&r1=1000626&r2=1000627&view=diff ============================================================================== --- ofbiz/branches/release10.04/applications/accounting/servicedef/services_invoice.xml (original) +++ ofbiz/branches/release10.04/applications/accounting/servicedef/services_invoice.xml Thu Sep 23 21:10:55 2010 @@ -78,6 +78,7 @@ under the License. <attribute name="statusId" type="String" mode="IN" optional="false"/> <attribute name="statusDate" type="Timestamp" mode="IN" optional="true"/> <attribute name="paidDate" type="Timestamp" mode="IN" optional="true"/> <!-- only relevant for changes to PAID --> + <attribute name="invoiceTypeId" type="String" mode="OUT" optional="true"/> <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/> </service> <service name="copyInvoiceToTemplate" engine="simple" Modified: ofbiz/branches/release10.04/applications/accounting/servicedef/services_ledger.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/accounting/servicedef/services_ledger.xml?rev=1000627&r1=1000626&r2=1000627&view=diff ============================================================================== --- ofbiz/branches/release10.04/applications/accounting/servicedef/services_ledger.xml (original) +++ ofbiz/branches/release10.04/applications/accounting/servicedef/services_ledger.xml Thu Sep 23 21:10:55 2010 @@ -453,6 +453,14 @@ under the License. <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/> </service> + <!-- An automatic GL Posting for Customer Return Invoice--> + <service name="createAcctgTransForCustomerReturnInvoice" engine="simple" auth="true" + location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForCustomerReturnInvoice"> + <description>Create an accounting transaction for a Customer Return invoice</description> + <attribute name="invoiceId" type="String" mode="IN" optional="false"/> + <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/> + </service> + <!-- An automatic GL Posting for Purchase Invoice--> <service name="createAcctgTransForPurchaseInvoice" engine="simple" auth="true" location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForPurchaseInvoice"> |
Free forum by Nabble | Edit this page |