Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commission calculation #5522

Closed
metas-ts opened this issue Sep 13, 2019 · 1 comment

Comments

@metas-ts
Copy link
Member

@metas-ts metas-ts commented Sep 13, 2019

Is this a bug or feature request?

FR

What is the current behavior?

Which are the steps to reproduce?

What is the expected or desired behavior?

metas-ts added a commit that referenced this issue Sep 13, 2019
- implement nice rudimentary domain model
- TODO: see how it connects to metasfresh :-D
#5522
metas-ts added a commit that referenced this issue Sep 16, 2019
- rename `Percent.multiply()` to `.computePercentage()` because i think it's easier on the average dev
- move the actual BL to a dedicated package
- start adding "surrounding" services to drive the BL
#5522
metas-ts added a commit that referenced this issue Sep 17, 2019
- working towards connecting the BL with metasfresh
#5522
metas-ts added a commit that referenced this issue Sep 17, 2019
- work on commission instance repo
- add tables and model classes
#5522
metas-ts added a commit that referenced this issue Sep 17, 2019
- minor: add launch config for model class generation
#5522
metas-ts added a commit that referenced this issue Sep 17, 2019
- enable to be serializable and derserializable to/from JSON
  - CommissionInstances
  - Percent
- add tests for CommissionInstanceRepository
#5522
metas-ts added a commit that referenced this issue Sep 17, 2019
- introduce C_Order.C_BPartner_SalesRep_ID and propagate it to C_Invoice_Candidate
#5522
metas-ts added a commit that referenced this issue Sep 17, 2019
- attempt to circumvent jenkins compile error
#5522
metas-ts added a commit that referenced this issue Sep 17, 2019
- solve unit test fails
#5522
metas-ts added a commit that referenced this issue Sep 19, 2019
- delete a bunch of commission tables from compiere times
- add windows and fields
- fix bugs
#5522
metas-ts added a commit that referenced this issue Sep 20, 2019
- start working on CommissionShareHandler to create the actual commission invoice candidates
- cleanup IInvoiceCandDAO and a bunch of related classes
#5522
metas-ts added a commit that referenced this issue Sep 20, 2019
- work on sales rep fields and insterceptors for sales order creation
#5522
metas-ts added a commit that referenced this issue Sep 24, 2019
metas-ts added a commit that referenced this issue Sep 24, 2019
- WIP - continue creation of invoice candidates for commission shares;
- WIP - minor refactorings (=>adding RepoIdAwares) in the pricing API
#5522
metas-ts added a commit that referenced this issue Sep 24, 2019
- solve some compiler errors
#5522
metas-ts added a commit that referenced this issue Oct 4, 2019
metas-ts added a commit that referenced this issue Oct 8, 2019
metas-ts added a commit that referenced this issue Oct 14, 2019
add contract settings window
#5522
metas-ts referenced this issue Oct 14, 2019
- resolve currently remaining compile error
- i think as a next step i need to create the contracts stuff
#5652
metas-ts added a commit that referenced this issue Oct 14, 2019
minor unit test fix (there are others yet to fix)
#5522
metas-ts added a commit that referenced this issue Oct 15, 2019
- start working on commission cotnract stuff
- CommissionConfigFactoryTest - currently failing; when it works i'm a big steap ahead :-D
#5522
metas-ts added a commit that referenced this issue Oct 15, 2019
minor - remove hierachy level from settings (at least from this level)
#5522
metas-ts added a commit that referenced this issue Oct 15, 2019
- WIP on loading/storing contracts
#5522
metas-ts added a commit that referenced this issue Oct 18, 2019
- WIP on loading/storing contracts
#5522
metas-ts added a commit that referenced this issue Oct 18, 2019
implement CommissionConfigFactory and fix compile errors
#5522
metas-ts added a commit that referenced this issue Oct 21, 2019
- stitch together commission invoice candidate changes and how they are recorded in the commission instances' shares
  - TODO: unit and dev-tests
- refactor and move stuff
- add dedicated commission-invoice-doctype
#5522
metas-ts added a commit that referenced this issue Oct 22, 2019
- fix div unit tests
- add code to more easily create test records
- rearrange the model a bit (remove contract from sales-share - it's still in the instance's config and a sales-share is never alone anyways)
#5522
metas-ts added a commit that referenced this issue Oct 22, 2019
- support deletion of a settlement IC
- add a lot of stuff (fields/callout) to set the sales rep from a sales order
#5522
metas-ts added a commit that referenced this issue Oct 23, 2019
remove obsolete field&column
#5522
metas-ts added a commit that referenced this issue Oct 23, 2019
- fix order callout and MI
- tweak some fields
#5522
metas-ts added a commit that referenced this issue Oct 23, 2019
- deal gracefully with the case that a nasty user deleted a sales invoice candidate
#5522
@metas-ts metas-ts closed this in 07c0713 Oct 23, 2019
@metas-ts metas-ts reopened this Oct 23, 2019
@metas-ts

This comment has been minimized.

Copy link
Member Author

@metas-ts metas-ts commented Oct 23, 2019

Dev-Test WIP

New Product:

There is a "system-product" for commission settlement.
URL: https://yourhost.metasfresh.com/window/140/540420

image

  • The produkt is used by metasfresh when creating commission invoices (a.k.a. commission settlements)
  • ❗️ Important: this product needs to have a purchase price for every salesrep that shall receive commission.
  • the price specifies how much noney a sales rep gets for each commission point
    • e.g. if you have a price of 1EUR, that means one commission point is one euro

New fields in bpartner

image

  • sales rep releated
    • Ist Vertriebspartner (Is sales rep): yes means that the partner can get a commission contract and can be selected as a sales rep for end customers
    • Vertriebspartnercode (sales rep code): string (max 100 digits) that a sales rep can share with "his" endcustomers. They can specify that string when placing a sales order
  • endcustomer related
    • Auftrag nur mit Vertriebspartner (sales rep required): if yes, then the sales order for a for a given customer cannot be completed, unless a sales rep is specified in that order
  • both
    • Vertriebspartner (sales rep): "default" sales rep for this endcustomer or "parent" sales rep (=> hierarchy!) for a sales rep
      • note: can be changed in this window, or from a sales order

New fields in sales order

image

  • Auftrag nur mit Vertriebspartner (sales rep required): read-only, set from the endcustomer's masterdata
  • Vertriebspartnercode (sales rep code) can be entered here, to look up the respective sales rep
  • Vertriebspartner (sales rep) the sales rep in question.
    • note: you can also set a sales repo, if it's not required for the endcustomer in question
    • you can also choose a sales rep without having a code

New in contract conditions

image

  • New type "Commission"; if selected, then "Hierachy commission settings" needs to be referenced
  • Rechnungsstellung/InvoiceRule will be used for the commission settlement contract.
    • after delivery => commission can only be invoiced when the sales produuct was delivered

New window "Hierachy commission settings"

image

  • note that in this window we specify which product categories and bpartner groups amount to which commission percentage
  • both product categories and bpartner groups are optional; "empty" matches "all"
  • the matching record with the lowest sequence number is used

New window "commission instance"

A user can zoom to this window from the respective sales order

image

  • One record for each "commission-trigger" (i.e. a sales invoice candidate)
  • on the left, we see which customer, sales order, invoice candiate and product the instance is about
  • on the right, we see the number of commission points (actually the respective net ammounts) which are
    • just ordered, but not invoicable
    • invoicable
    • invoiced
  • 💡 this is directly related to the sales invoice candidate (e.g. invoice rule, and/or delivered quantity)!

New window "commission share"

  • for every instance, there is one share per sale rep that gets commission
  • A user can zoom to this window from the respective commission instance

Here we have the window's "list" view

image

we see:

  • the endcustomer has a sales rep, which in turn also has a sales rep
    • => 💡 commission hierarchy!
  • each share contains
    • specific commission points that are related to the commission trigger, i.e. the sales invoice candidate (the first 3 points-columns)
    • specific commission points that are related to the commission settlement (the last 2 points-columns)
  • according to the commission settings:
    • each sales rep gets 30% from the commission instance's base points
    • the commission points for lower levels are subtracted from the base when computing the commission for higher levels (that what the secondary sales rep gets less points)
  • if a commission trigger is invoicable, the respective commission can already be settled (might become another settings parameter in future)
  • the share with level=1 was already settled, the share with level=0 was not yet settled
    • settled means "commission invoice" (SOTrx='N') was created for the respective sales rep

Here we have the window's "detail" view for one of the two shares:

image

In the detail view, we see the commission log.

It contains

  • all changes (e.g. if sales invoice was voided)
  • a referenece to the commission settlements invoice candidate

commission settlement invoice candidate

image

This is a normal purchase invoice candidate with the respective sales rep as partner and the commissionpoint product as product.

commission settlement invoice

image

here you see

  • the decidated document type
  • that the commission points we converted to qtyInvoice
metas-ts added a commit that referenced this issue Oct 23, 2019
- change name of the commission product, and add a trl
#5522
metas-ts added a commit that referenced this issue Oct 28, 2019
  * [#5522](#5522) Commission calculation
  * [#5566](#5566) Add integration with Google Maps
  * [#5611](#5611) Add DHL Shipper and DHL integration
  * [#5683](#5683) Empties Saldo report per Day
  * [#5556](#5556) Prevent Running Link Organisation Process if Organisation Field is empty
  * [#5666](#5666) Freight Cost invoice candidates bug
  * [#5687](#5687) Assumption failure: There is no active M_Attribute record with M_Attribute.Value=M_Material_Tracking_ID
  * [#5701](#5701) Document no not updated when changing doctype
metas-ts added a commit that referenced this issue Oct 28, 2019
- extend settings with product category and bpartner group (both optional)
#5522
metas-ts added a commit that referenced this issue Oct 28, 2019
- CommissionConfigStagingDataService: fix caching for commission config lines
- FlatrateDAO: fix flatrate term retrieval if no product/productcategory or charge is given and the conditions has no flatrate-matching records
#5522
metas-ts added a commit that referenced this issue Oct 29, 2019
- bugfix: commission shares were not ordered by level
- cleanup: staging service *always* filters by isActive anyways
- minor in the SQL file
#5522
@metas-ts metas-ts closed this in bb078c0 Oct 29, 2019
@metas-ts metas-ts reopened this Oct 29, 2019
metas-ts added a commit that referenced this issue Oct 29, 2019
- add dedicated product category and UOM for the commission product
- AbstractInvoiceBL and UOMConversionBL : minor
#5522
metas-ts added a commit that referenced this issue Oct 29, 2019
- SQL fix (had wrong C_UOM_ID)
#5522
metas-ts added a commit that referenced this issue Oct 30, 2019
- fix bug where commission instance without shares was created if the contracts of the sales reps in question didn'T matche the commission trigger
- also some refactoring
#5522
metas-ts added a commit that referenced this issue Oct 31, 2019
- fix unit test i created earlier yesterday
#5522
metas-ts added a commit that referenced this issue Nov 1, 2019
- do precise serializing/deserializing of Instants (toString / parse was useless)
- in commission facts, display "Updated" instead of the now useful but not anymore userfriendly timestamp-string
#5522
metas-ts added a commit that referenced this issue Nov 1, 2019
…piere/util/TimeUtil.java


#5522
metas-ts added a commit that referenced this issue Nov 1, 2019
- finish tweaking the commission share window
#5522
metas-ts added a commit that referenced this issue Nov 1, 2019
finally, migrate old records
#5522
@metas-ts metas-ts closed this Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.