Payment plan calculation rule: Commission
version = 1
status = active
UUID = a23b6d567-5cc1-eeee-ak47-2a99c235eaa8
calculation_rule_name = “payment: commission“
type = account_payable
sub_type = commissions
dateValidTo = None
dateValidFrom = 2000-01-01
from_to: [{“from”:”BatchRun”,”to”:”Bill”}, {“from”:”Contribution”,”to”:”BillItem”}]
list of impacted parameters:
{class:"PaymentPlan", ‘parameters':[
{'type':"number",'name':"commission_rate",'label':{'en':'Commission rate(%)',’fr':'Taux de commission (%)'},'rights':{'read':"157101", “write':'157102', 'update’:'157103','replace’:'157206'}, relevance:"True",condition:".$_<100",'default':'10'},
]}
commission_rate
description = “ This calculation will, for the selected level and product, calculate how much the insurance need to pay the commission to EO “
Service
activeForObject(self, instance, context, type, sub_type)
instance.__class__ == PaymentPan and context IN (batchValuation) and self.checkCalculation(instance)
check_calculation(cls, instance)
if instance = BatchRun
check_calculation(cls, location)
else if instance == Location
for each Product where Product.locaiton = Location:
check_calculation(cls, Product )
else if Product
if there active payment plan for Product and self.UUID return true
calculate(cls, instance, *args[date_from, date_to, productid, location])
instance.__class__ == contribution
return comission_rate / 100 * contribution value
convert(from, to, context, **agrs)
if context == BatchPayment
argv:
batch_id
sub_type,
product_id,
Batchrun will trigger convert_batch for all the product part of it.
if active_for_object(<paymentplan>, context , type, sub_type):
calculate(cls, <paymentplan>, *args[date_from, date_to, productid, location])
then convert
one accountPayable per EO,
one asset (line) per product/commission, sum of policy value as quantity, commission as unit price, product account code as ledger account
one asset (line) per policy : policy value as quantity, commission as unit price, product account code as ledger account (dependent detail as asset description)
bill:
field | type | comment |
subject_type | json | batch_run |
subject_id | json | run_id |
thirdparty_type | str | User |
thirdparty_id | id/uuid | UserID |
code | str | CP-User_name-YYYYMM |
date_due | date | batch run date +30 days |
date_invoice | date | batch run date |
*dateValidFrom | date | validFrom: first day of batch run |
*dateValidTo | date | validTo: last first day of batch run |
amount_discount | float | N/A |
amount_net | float | Total without tax |
tax_analysis | json | N/A |
amount_total | float | total net |
status | int | validated |
currency_rcp_code | str | default-curency |
currency_code | str | default-curency-code |
note | bigttext |
|
terms | bigttext | Product: Product Name, commission_rate |
billItem
field | type | comment |
line_id |
| contribution_id |
line_type |
| Contribution |
code | str | Paymentplan-Code |
description | str | Capitation payment |
details | json | Head of family CHFID |
ledger_account | int | N/A |
quantity | float | 1 |
unit_price | type | Contribution value |
deduction | float | n/a |
discount | float | 1-(rate of contribution/100) |
tax_rate | Calculation uuid | N/A |
tax_analysis | json |
|
amount_total | float | net |
amount_net | float | total |
Did you encounter a problem or do you have a suggestion?
Please contact our Service Desk
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/