Spotted an error in my wording it should be:

>From my understanding of the flow of OFBiz you need to create the
Purchase Order, approve it and then once the goods have been received in
full the Purchase Invoice is generated which then kicks in the
Agreements which you set during the creation of the Purchase *Order* and
finally the Purchase Invoice is shown to the Accounts Payable team for
payment.


On 05/05/2010 11:00, Sam Hamilton wrote:
> Hi Scott,
> 
> We will ring a supplier and get a quote for a product, agree the terms
> e.g. pay first then they send the goods or 30 days credit or pay on
> delivery of goods. Then create a Purchase Order and then wire them the
> payment, the goods will then be delivered to our warehouse where we
> receive against the PO.
> 
> Sometimes the supplier can send too much or too little goods at which
> point either our purchasing department chases them for more products or
> we then send an additional wire for the extra cash or we get credit from
> the supplier to use against the next order.
> 
> From my understanding of the flow of OFBiz you need to create the
> Purchase Order, approve it and then once the goods have been received in
> full the Purchase Invoice is generated which then kicks in the
> Agreements which you set during the creation of the Purchase Invoice and
> finally the Purchase Invoice is shown to the Accounts Payable team for
> payment.
> 
> Yes I agree that this seems the wrong way round but this is how the
> business is done here and I can't change that - China can seem very
> inefficient at times.
> 
> Perhaps a On/Off switch for this code could be made - then it suits all
> companies? How best to make this work for everyone?
> 
> Cheers
> Sam
> 
> 
> 
> On 05/05/2010 10:34, Scott Gray wrote:
>> Surely they invoice you beforehand though?
>>
>> The payment should be created based on that.
>>
>> Regards
>> Scott
>>
>> On 5/05/2010, at 2:28 PM, Sam Hamilton wrote:
>>
>>> Hi Guys,
>>>
>>> Its for suppliers who need the payment of the invoice before the goods
>>> will be shipped e.g. they don't give credit.
>>>
>>> Sam
>>>
>>>
>>> On 05/05/2010 10:24, BJ Freeman wrote:
>>>> more for my understanding, I believe an invoice for a PO is internal not
>>>> sent to the supplier, if I remember a previous thread on the ml.
>>>> and that it is used to reconcile against the invoice received from the
>>>> supplier.
>>>> I did something similar.
>>>>
>>>> ========================
>>>>
>>>> BJ Freeman
>>>> http://bjfreeman.elance.com
>>>> Strategic Power Office with Supplier Automation 
>>>> <http://www.businessesnetwork.com/automation/viewforum.php?f=93>
>>>> Specialtymarket.com <http://www.specialtymarket.com/>
>>>>
>>>> Systems Integrator-- Glad to Assist
>>>>
>>>> Chat  Y! messenger: bjfr33man
>>>> Linkedin
>>>> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>>>>
>>>>
>>>> Scott Gray sent the following on 5/4/2010 6:56 PM:
>>>>> Hi Hans,
>>>>>
>>>>> Wouldn't you do this when an order is received (i.e. an invoice created) 
>>>>> rather than when the order is placed?
>>>>>
>>>>> Typically payment due dates are based on the invoice date not the order 
>>>>> date.
>>>>>
>>>>> Regards
>>>>> Scott
>>>>>
>>>>> HotWax Media
>>>>> http://www.hotwaxmedia.com
>>>>>
>>>>> On 5/05/2010, at 1:43 PM, hans...@apache.org wrote:
>>>>>
>>>>>> Author: hansbak
>>>>>> Date: Wed May  5 01:43:45 2010
>>>>>> New Revision: 941132
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=941132&view=rev
>>>>>> Log:
>>>>>> Create a payment with the status 'not-paid' when a purchase order is 
>>>>>> approved setting the payment date according agreements
>>>>>>
>>>>>> Modified:
>>>>>>   
>>>>>> ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
>>>>>>   ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
>>>>>>   ofbiz/trunk/applications/order/servicedef/secas.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=941132&r1=941131&r2=941132&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 May  5 01:43:45 2010
>>>>>> @@ -746,4 +746,72 @@ under the License.
>>>>>>            <clear-field field="setPaymentStatusMap"/>
>>>>>>        </iterate>
>>>>>>    </simple-method>
>>>>>> -</simple-methods>
>>>>>> +
>>>>>> +    <simple-method method-name="createPaymentFromOrder" 
>>>>>> short-description="Service auto create Payment from Order">
>>>>>> +        <entity-one value-field="orderHeader" 
>>>>>> entity-name="OrderHeader"/>
>>>>>> +        <entity-and list="orderRoleToList" entity-name="OrderRole">
>>>>>> +            <field-map field-name="orderId" 
>>>>>> from-field="orderHeader.orderId"/>
>>>>>> +            <field-map field-name="roleTypeId" 
>>>>>> value="BILL_FROM_VENDOR"/>
>>>>>> +        </entity-and>
>>>>>> +        <first-from-list entry="orderRoleTo" list="orderRoleToList"/>
>>>>>> +        <entity-and list="orderRoleFromList" entity-name="OrderRole">
>>>>>> +            <field-map field-name="orderId" 
>>>>>> from-field="orderHeader.orderId"/>
>>>>>> +            <field-map field-name="roleTypeId" 
>>>>>> value="BILL_TO_CUSTOMER"/>
>>>>>> +        </entity-and>
>>>>>> +        <first-from-list entry="orderRoleFrom" 
>>>>>> list="orderRoleFromList"/>
>>>>>> +        <if-compare operator="equals" value="PURCHASE_ORDER" 
>>>>>> field="orderHeader.orderTypeId">
>>>>>> +            <entity-and list="agreementList" entity-name="Agreement" 
>>>>>> filter-by-date="true">
>>>>>> +                <field-map field-name="partyIdFrom" 
>>>>>> from-field="orderRoleFrom.partyId"/>
>>>>>> +                <field-map field-name="partyIdTo" 
>>>>>> from-field="orderRoleTo.partyId"/>
>>>>>> +                <field-map field-name="agreementTypeId" 
>>>>>> value="PURCHASE_AGREEMENT"/>
>>>>>> +            </entity-and>
>>>>>> +            <set field="parameters.paymentTypeId" 
>>>>>> value="VENDOR_PAYMENT"/>
>>>>>> +            <else>
>>>>>> +               <entity-and list="agreementList" entity-name="Agreement" 
>>>>>> filter-by-date="true">
>>>>>> +                    <field-map field-name="partyIdFrom" 
>>>>>> from-field="orderRoleFrom.partyId"/>
>>>>>> +                    <field-map field-name="partyIdTo" 
>>>>>> from-field="orderRoleTo.partyId"/>
>>>>>> +                    <field-map field-name="agreementTypeId" 
>>>>>> value="SALES_AGREEMENT"/>
>>>>>> +                </entity-and>
>>>>>> +                <set field="parameters.paymentTypeId" 
>>>>>> value="CUSTOMER_PAYMENT"/>
>>>>>> +            </else>
>>>>>> +        </if-compare>
>>>>>> +        <first-from-list entry="agreement" list="agreementList"/>
>>>>>> +        <if-not-empty field="agreement">
>>>>>> +            <entity-and list="orderTermList" entity-name="OrderTerm">
>>>>>> +                <field-map field-name="orderId" 
>>>>>> from-field="orderHeader.orderId"/>
>>>>>> +                <field-map field-name="termTypeId" 
>>>>>> value="FIN_PAYMENT_TERM"/>
>>>>>> +            </entity-and>
>>>>>> +            <first-from-list entry="orderTerm" list="orderTermList"/>
>>>>>> +            <if-not-empty field="orderTerm.termDays">
>>>>>> +                <set field="days" from-field="orderTerm.termDays" 
>>>>>> type="Integer"/>
>>>>>> +                <now-timestamp field="start"/>
>>>>>> +                <call-class-method 
>>>>>> class-name="org.ofbiz.base.util.UtilDateTime" 
>>>>>> method-name="addDaysToTimestamp" ret-field="parameters.effectiveDate">
>>>>>> +                    <field field="start" type="java.sql.Timestamp"/>
>>>>>> +                    <field field="days" type="int"/>
>>>>>> +                </call-class-method>
>>>>>> +            </if-not-empty>
>>>>>> +        </if-not-empty>
>>>>>> +        <if-empty field="parameters.effectiveDate">
>>>>>> +            <now-timestamp field="parameters.effectiveDate"/>
>>>>>> +        </if-empty>
>>>>>> +        <set field="parameters.partyIdFrom" 
>>>>>> from-field="orderRoleFrom.partyId"/>
>>>>>> +        <set field="parameters.partyIdTo" 
>>>>>> from-field="orderRoleTo.partyId"/>
>>>>>> +        <set field="parameters.amount" 
>>>>>> from-field="orderHeader.grandTotal"/>
>>>>>> +        <set field="parameters.currencyUomId" 
>>>>>> from-field="orderHeader.currencyUom"/>
>>>>>> +        <set field="parameters.paymentMethodTypeId" 
>>>>>> value="COMPANY_ACCOUNT"/>
>>>>>> +        <set field="parameters.statusId" value="PMNT_NOT_PAID"/>
>>>>>> +        <set-service-fields service-name="createPayment" 
>>>>>> to-map="createPayment" map="parameters"/>
>>>>>> +        <call-service service-name="createPayment" 
>>>>>> in-map-name="createPayment">
>>>>>> +            <result-to-field result-name="paymentId" 
>>>>>> field="parameters.paymentId"/>
>>>>>> +        </call-service>
>>>>>> +        <set field="parameters.orderId" 
>>>>>> from-field="orderHeader.orderId"/>
>>>>>> +        <set field="parameters.maxAmount" 
>>>>>> from-field="orderHeader.grandTotal"/>
>>>>>> +        <set-service-fields service-name="createOrderPaymentPreference" 
>>>>>> to-map="newOrderPaymentPreference" map="parameters"/>
>>>>>> +        <call-service service-name="createOrderPaymentPreference" 
>>>>>> in-map-name="newOrderPaymentPreference">
>>>>>> +            <result-to-field result-name="orderPaymentPreferenceId" 
>>>>>> field="parameters.paymentPreferenceId"/>
>>>>>> +        </call-service>
>>>>>> +        <set-service-fields service-name="updatePayment" 
>>>>>> to-map="updatePayment" map="parameters"/>
>>>>>> +        <call-service service-name="updatePayment" 
>>>>>> in-map-name="updatePayment"/>
>>>>>> +        <field-to-result field="parameters.paymentId" 
>>>>>> result-name="paymentId"/>
>>>>>> +    </simple-method>
>>>>>> +</simple-methods>
>>>>>> \ No newline at end of file
>>>>>>
>>>>>> Modified: 
>>>>>> ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
>>>>>> URL: 
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_payment.xml?rev=941132&r1=941131&r2=941132&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml 
>>>>>> (original)
>>>>>> +++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml 
>>>>>> Wed May  5 01:43:45 2010
>>>>>> @@ -233,4 +233,11 @@ under the License.
>>>>>>        <attribute name="statusId" type="String" mode="IN" 
>>>>>> optional="false"/>
>>>>>>        <attribute name="errorMessage" type="String" optional="true" 
>>>>>> mode="OUT"/>
>>>>>>    </service>
>>>>>> +
>>>>>> +    <service name="createPaymentFromOrder" engine="simple"
>>>>>> +        
>>>>>> location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml"
>>>>>>  invoke="createPaymentFromOrder" auth="true">
>>>>>> +        <description>create Payment from Order</description>
>>>>>> +        <attribute name="orderId" type="String" mode="IN" 
>>>>>> optional="false"/>
>>>>>> +        <attribute name="paymentId" type="String" mode="OUT" 
>>>>>> optional="false"/>
>>>>>> +    </service>
>>>>>> </services>
>>>>>>
>>>>>> Modified: ofbiz/trunk/applications/order/servicedef/secas.xml
>>>>>> URL: 
>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=941132&r1=941131&r2=941132&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/order/servicedef/secas.xml (original)
>>>>>> +++ ofbiz/trunk/applications/order/servicedef/secas.xml Wed May  5 
>>>>>> 01:43:45 2010
>>>>>> @@ -93,6 +93,12 @@ under the License.
>>>>>>        <action service="resetGrandTotal" mode="sync"/>
>>>>>>        <action service="sendOrderCompleteNotification" mode="async" 
>>>>>> persist="true"/>
>>>>>>    </eca>
>>>>>> +    <eca service="changeOrderStatus" event="commit" 
>>>>>> run-on-error="false">
>>>>>> +        <condition field-name="orderTypeId" operator="equals" 
>>>>>> value="PURCHASE_ORDER"/>
>>>>>> +        <condition field-name="statusId" operator="equals" 
>>>>>> value="ORDER_APPROVED"/>
>>>>>> +        <condition-field field-name="statusId" operator="not-equals" 
>>>>>> to-field-name="oldStatusId"/>
>>>>>> +        <action service="createPaymentFromOrder" mode="sync" 
>>>>>> persist="true"/>
>>>>>> +    </eca>
>>>>>>
>>>>>>    <!-- DISABLED FOR NOW
>>>>>>    <eca service="changeOrderStatus" event="commit" run-on-error="false">
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
> 

Reply via email to