You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2006/09/23 14:29:55 UTC
svn commit: r449224 - in /incubator/ofbiz/trunk/applications/accounting:
script/org/ofbiz/accounting/invoice/ servicedef/
Author: jonesde
Date: Sat Sep 23 05:29:54 2006
New Revision: 449224
URL: http://svn.apache.org/viewvc?view=rev&rev=449224
Log:
Basics in place for sample customer affiliate commission service, with commented out ECA rule to trigger; just need to implement the invoice creation now
Added:
incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/SampleCommissionServices.xml (with props)
Modified:
incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
incubator/ofbiz/trunk/applications/accounting/servicedef/secas.xml
incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml
incubator/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
Modified: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?view=diff&rev=449224&r1=449223&r2=449224
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Sat Sep 23 05:29:54 2006
@@ -16,7 +16,7 @@
-->
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="../../../../../../../framework/minilang/dtd/simple-methods.xsd">
+ xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/simple-methods.xsd">
<simple-method method-name="getNextInvoiceId" short-description="Get Next invoiceId">
<!-- try to find PartyAcctgPreference for parameters.partyId, see if we need any special invoice number sequencing -->
Added: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/SampleCommissionServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/SampleCommissionServices.xml?view=auto&rev=449224
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/SampleCommissionServices.xml (added)
+++ incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/SampleCommissionServices.xml Sat Sep 23 05:29:54 2006
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright 2001-2006 The Apache Software Foundation
+
+Licensed 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://www.ofbiz.org/dtds/simple-methods.xsd">
+
+ <simple-method method-name="sampleCalculateAffiliateCommission" short-description="Sample Calculate Affiliate Commission">
+ <entity-one entity-name="Payment" value-name="payment"/>
+
+ <!-- find affiliate or commission partner for payment.partyIdFrom; will be relationship from CUSTOMER to AFFILIATE, type SALES_AFFILIATE -->
+ <entity-and entity-name="PartyRelationship" list-name="affiliatePartyRelationshipList" filter-by-date="true">
+ <field-map field-name="partyIdFrom" env-name="payment.partyIdFrom"/>
+ <field-map field-name="roleTypeIdFrom" value="CUSTOMER"/>
+ <field-map field-name="partyRelationshipTypeId" value="SALES_AFFILIATE"/><!-- this constraint could be optional if not being set in company data -->
+ </entity-and>
+
+ <iterate entry-name="affiliatePartyRelationship" list-name="affiliatePartyRelationshipList">
+ <!-- calculate a commission for each commission partner, identified by affiliatePartyRelationship.partyIdTo -->
+ <if>
+ <condition><if-compare field-name="affiliatePartyRelationship.roleTypeIdTo" operator="equals" value="AFFILIATE"/></condition>
+ <then>
+ <!-- calculate a simple commission with a base amount + a percentage of the payment -->
+ <calculate field-name="commissionAmount" type="Double">
+ <calcop operator="add">
+ <number value="10.0"/><!-- base amount -->
+ <calcop operator="multiply">
+ <calcop operator="get" field-name="payment.amount"/>
+ <number value="0.15"/><!-- commission percentage -->
+ </calcop>
+ </calcop>
+ </calculate>
+
+ <set field="commissionPartyId" from-field="affiliatePartyRelationship.partyIdTo"/>
+ </then>
+ <else-if>
+ <!-- NOTE: this is just an example of another type of commission partner associated with a customer, doesn't really exist -->
+ <condition><if-compare field-name="affiliatePartyRelationship.roleTypeIdTo" operator="equals" value="TIERED_COMMISSION"/></condition>
+ <then></then>
+ </else-if>
+ </if>
+ </iterate>
+ </simple-method>
+
+ <simple-method method-name="createCommissionInvoiceInline" short-description="Create Commission Invoice Inline">
+ <!-- should have in the context: payment, commissionAmount, commissionPartyId -->
+ <!-- this will create an invoice on behalf of the commission party, ie from the commissionPartyId to the company (payment.partyIdTo) -->
+ </simple-method>
+</simple-methods>
Propchange: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/SampleCommissionServices.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/SampleCommissionServices.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: incubator/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/SampleCommissionServices.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/ofbiz/trunk/applications/accounting/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/servicedef/secas.xml?view=diff&rev=449224&r1=449223&r2=449224
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/servicedef/secas.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/servicedef/secas.xml Sat Sep 23 05:29:54 2006
@@ -91,4 +91,16 @@
<condition field-name="processResult" operator="not-equals" value="ERROR"/>
<action service="sendOrderPayRetryNotification" mode="async" persist="true"/>
</eca>
+
+ <!-- sample ECA rules for the sampleInvoiceAffiliateCommission service triggering
+ <eca service="createPayment" event="commit">
+ <condition field-name="statusId" operator="equals" value="PMNT_RECEIVED"/>
+ <action service="sampleInvoiceAffiliateCommission" mode="sync"/>
+ </eca>
+ <eca service="setPaymentStatus" event="commit">
+ <condition field-name="statusId" operator="equals" value="PMNT_RECEIVED"/>
+ <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
+ <action service="sampleInvoiceAffiliateCommission" mode="sync"/>
+ </eca>
+ -->
</service-eca>
Modified: incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml?view=diff&rev=449224&r1=449223&r2=449224
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/servicedef/services_agreement.xml Sat Sep 23 05:29:54 2006
@@ -124,16 +124,6 @@
<attribute name="quantity" type="BigDecimal" mode="IN" optional="true"/>
<attribute name="commissions" type="List" mode="OUT" optional="false"/>
</service>
- <service name="sampleInvoiceAffiliateCommission" engine="simple"
- location="org/ofbiz/accounting/agreement/AgreementServices.xml" invoke="sampleCalculateAffiliateCommission" auth="true">
- <description>
- A sample/example service to calculate an affiliate commission (direct relationship to customer) and create
- and invoice for it on behalf of the affiliate, ie an invoice from the affiliate to the company that can
- then be paid by the company to balance it.
- </description>
- <attribute name="paymentId" type="String" mode="IN" optional="false"/>
- <attribute name="invoiceId" type="String" mode="OUT" optional="false"/>
- </service>
<!-- AgreementProductAppl -->
<service name="createAgreementProductAppl" default-entity-name="AgreementProductAppl" engine="simple"
location="org/ofbiz/accounting/agreement/AgreementServices.xml" invoke="createAgreementProductAppl" auth="true">
Modified: incubator/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml?view=diff&rev=449224&r1=449223&r2=449224
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml (original)
+++ incubator/ofbiz/trunk/applications/accounting/servicedef/services_invoice.xml Sat Sep 23 05:29:54 2006
@@ -185,6 +185,16 @@
<attribute name="amountApplied" type="Double" mode="IN" optional="false"/>
<attribute name="invoicesCreated" type="List" mode="OUT" optional="true"/>
</service>
+ <service name="sampleInvoiceAffiliateCommission" engine="simple"
+ location="org/ofbiz/accounting/invoice/SampleCommissionServices.xml.xml" invoke="sampleCalculateAffiliateCommission" auth="true">
+ <description>
+ A sample/example service to calculate an affiliate commission (direct relationship to customer) and create
+ and invoice for it on behalf of the affiliate, ie an invoice from the affiliate to the company that can
+ then be paid by the company to balance it.
+ </description>
+ <attribute name="paymentId" type="String" mode="IN" optional="false"/>
+ <attribute name="invoiceId" type="String" mode="OUT" optional="false"/>
+ </service>
<service name="readyInvoices" engine="java"
location="org.ofbiz.accounting.invoice.InvoiceServices" invoke="readyInvoices">
<description>