[jira] Created: (OFBIZ-1482) Implement an automatic GL posting service for sales invoices

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-1482) Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
Implement an automatic GL posting service for sales invoices
------------------------------------------------------------

                 Key: OFBIZ-1482
                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
             Project: OFBiz
          Issue Type: Sub-task
          Components: accounting
    Affects Versions: SVN trunk
            Reporter: Jacopo Cappellato


Name of the service: "createAcctgTransForSalesInvoice" or similar
Service definition:
    <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
        location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
        <description>Create an accounting transaction for a sales invoice</description>
        <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
        <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
    </service>

The eca rule will be:

<eca service="setInvoiceStatus" event="commit">
    <condition field-name="invoiceId" operator="is-not-empty"/>
    <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="createAcctgTransForSalesInvoice" mode="sync"/>
</eca>

This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
a) acctgTransTypeId="SALES_INVOICE"
b) partyId = invoice.partyId
c) roleTypeId = "BILL_TO_CUSTOMER"
d) invoiceId = invoice.invoiceId
e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
e1) one element for each of the InvoiceItems; here is the content of each of these elements:
-- debitCreditFlag = C
-- organizationPartyId = invoice.partyIdFrom
-- productId = invoiceItem.productId
-- glAccountTypeId = invoiceItem.invoiceItemTypeId
-- glAccountId = invoiceItem.overrideGlAccountId
-- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
-- origCurrencyUomId = invoice.currencyUomId
-- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
f) one element for the invoice total (the sum of all the items' amount*quantity):
-- debitCreditFlag = D
-- organizationPartyId = invoice.partyIdFrom
-- glAccountTypeId = ACCOUNTS_RECEIVABLE
-- origAmount = the sum of all the items' amount*quantity
-- origCurrencyUomId = invoice.currencyUomId
-- partyId = invoice.partyId
-- roleTypeId = "BILL_TO_CUSTOMER"

Some more details about the logic:

1) get the Invoice record
2) if Invoice.invoiceTypeId != SALES_INVOICE return
3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
4) call the createAcctgTransAndEntries service

Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-1482) Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shubham Goyal updated OFBIZ-1482:
---------------------------------

    Attachment: GLPostingServiceForSalesInvoice.patch

An automatic GL posting service for sales invoices.

> Implement an automatic GL posting service for sales invoices
> ------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>         Attachments: GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1482) Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12548229 ]

Jacopo Cappellato commented on OFBIZ-1482:
------------------------------------------

Wow... I've just quickly reviewed this patch (not time at the moment) but it seems pretty good.
One funny thing that I've immediately noticed is that the service implementation, well written by Shubham using Minilang, is not (much) longer than the service description that I have written in this Jira task!
This is a great point in favor of Minilang indeed.

Jacopo

> Implement an automatic GL posting service for sales invoices
> ------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>         Attachments: GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (OFBIZ-1482) Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anil K Patel reassigned OFBIZ-1482:
-----------------------------------

    Assignee: Anil K Patel

> Implement an automatic GL posting service for sales invoices
> ------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>            Assignee: Anil K Patel
>         Attachments: GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1482) Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549299 ]

Mridul Pathak commented on OFBIZ-1482:
--------------------------------------

Shubham,
I looked at your patch and I found that it is not exactly according to the requirements.  Here are the differences.
1) Look at the requirement (e). For each InvoiceItem record related to the Invoice you need to create the entry (e1).  So this means you can have mutiple e1 entries. So this code is almost correct in your patch.  Also for each entry origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1) .
2) Now if we look at the requirement (f),  it will be a single entry for a Invoice,  and for this origAmount = Sum of all the origAmounts calculated in step (e).
What you did in your patch is, you have created multiple entries for it for each InvoiceItem, and also the origAmount is calculated in the same way as it is done in the requirement (e).  Which is absolutely wrong.
3)  Also the code under the <iterate> tag is not welll formatted.
    I think in no way anyone could have misunderstood these requirements because the requirement specification given here is more than sufficient to understand the task and do the implementation.
    Please do the suggested changes and upload the patch again.

> Implement an automatic GL posting service for sales invoices
> ------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>            Assignee: Anil K Patel
>         Attachments: GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-1482) Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shubham Goyal updated OFBIZ-1482:
---------------------------------

    Attachment: GLPostingServiceForSalesInvoice.patch

Updated patch as per the changes suggested by Mridul.

> Implement an automatic GL posting service for sales invoices
> ------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>            Assignee: Anil K Patel
>         Attachments: GLPostingServiceForSalesInvoice.patch, GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-1482) Auto posting: Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacopo Cappellato updated OFBIZ-1482:
-------------------------------------

    Summary: Auto posting: Implement an automatic GL posting service for sales invoices  (was: Implement an automatic GL posting service for sales invoices)

> Auto posting: Implement an automatic GL posting service for sales invoices
> --------------------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>            Assignee: Anil K Patel
>         Attachments: GLPostingServiceForSalesInvoice.patch, GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (OFBIZ-1482) Auto posting: Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashish Vijaywargiya reassigned OFBIZ-1482:
------------------------------------------

    Assignee: Ashish Vijaywargiya  (was: Anil K Patel)

> Auto posting: Implement an automatic GL posting service for sales invoices
> --------------------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>            Assignee: Ashish Vijaywargiya
>         Attachments: GLPostingServiceForSalesInvoice.patch, GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (OFBIZ-1482) Auto posting: Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ashish Vijaywargiya closed OFBIZ-1482.
--------------------------------------

    Resolution: Fixed

Thanks Shubham Goyal for your valuable patch.
Your patch is in rev # 606046 with minor changes.

We will not provide invoiceId in creating accouting transaction entry as you had provided.
<set field="createAcctgTransAndEntriesInMap.invoiceId" from-field="parameters.invoiceId"/>

So I have removed this line and checked in your patch.

--
Ashish

> Auto posting: Implement an automatic GL posting service for sales invoices
> --------------------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>            Assignee: Ashish Vijaywargiya
>         Attachments: GLPostingServiceForSalesInvoice.patch, GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1482) Auto posting: Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12553874 ]

Jacopo Cappellato commented on OFBIZ-1482:
------------------------------------------

Hi Ashish,

thanks to all of you for your work on this.
One question: why are we disabling the:

<set field="createAcctgTransAndEntriesInMap.invoiceId" from-field="parameters.invoiceId"/>

operation?



> Auto posting: Implement an automatic GL posting service for sales invoices
> --------------------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>            Assignee: Ashish Vijaywargiya
>         Attachments: GLPostingServiceForSalesInvoice.patch, GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-1482) Auto posting: Implement an automatic GL posting service for sales invoices

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-1482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12553916 ]

Jacopo Cappellato commented on OFBIZ-1482:
------------------------------------------

Ashish,

I've figured out... it was my folt (forgot to define the invoiceId as in parameter). fifed in rev. 606147

> Auto posting: Implement an automatic GL posting service for sales invoices
> --------------------------------------------------------------------------
>
>                 Key: OFBIZ-1482
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1482
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>            Assignee: Ashish Vijaywargiya
>         Attachments: GLPostingServiceForSalesInvoice.patch, GLPostingServiceForSalesInvoice.patch
>
>
> Name of the service: "createAcctgTransForSalesInvoice" or similar
> Service definition:
>     <service name="createAcctgTransForSalesInvoice" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransForSalesInvoice">
>         <description>Create an accounting transaction for a sales invoice</description>
>         <attribute name="invoiceId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> The eca rule will be:
> <eca service="setInvoiceStatus" event="commit">
>     <condition field-name="invoiceId" operator="is-not-empty"/>
>     <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="createAcctgTransForSalesInvoice" mode="sync"/>
> </eca>
> This is the general description: this service will call the createAcctgTransAndEntries with the following input parameters:
> a) acctgTransTypeId="SALES_INVOICE"
> b) partyId = invoice.partyId
> c) roleTypeId = "BILL_TO_CUSTOMER"
> d) invoiceId = invoice.invoiceId
> e) acctgTransEntries: a list composed by the following AcctgTransEntry elements:
> e1) one element for each of the InvoiceItems; here is the content of each of these elements:
> -- debitCreditFlag = C
> -- organizationPartyId = invoice.partyIdFrom
> -- productId = invoiceItem.productId
> -- glAccountTypeId = invoiceItem.invoiceItemTypeId
> -- glAccountId = invoiceItem.overrideGlAccountId
> -- origAmount = invoiceItem.quantity * invoiceItem.amount (NOTE: if quantity is not set, then default to 1)
> -- origCurrencyUomId = invoice.currencyUomId
> -- if invoiceItem.taxAuthPartyId is-not-empty then {partyId = invoiceItem.taxAuthPartyId and roleTypeId = "TAX_AUTHORITY"}
> f) one element for the invoice total (the sum of all the items' amount*quantity):
> -- debitCreditFlag = D
> -- organizationPartyId = invoice.partyIdFrom
> -- glAccountTypeId = ACCOUNTS_RECEIVABLE
> -- origAmount = the sum of all the items' amount*quantity
> -- origCurrencyUomId = invoice.currencyUomId
> -- partyId = invoice.partyId
> -- roleTypeId = "BILL_TO_CUSTOMER"
> Some more details about the logic:
> 1) get the Invoice record
> 2) if Invoice.invoiceTypeId != SALES_INVOICE return
> 3) get the InvoiceItems and iterate over them to create the entries (e) and compute the total for the entry for the total (f)
> 4) call the createAcctgTransAndEntries service
> Add information on the wiki page: http://docs.ofbiz.org/x/Qw0

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.