...
dateValidFrom = 2000-01-01
from_to: [{“from”:”BatchRun”,”to”:”Bill”}, {“from”:”Contribution”,”to”:”BillItem”}]
list of impacted parameters: NULL (will take data from product, claims … ):
{class:"PaymentPlan", ‘parameters':[
{'type':"number",'name':"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 “
...
instance.__class__ == PaymentPan and context IN (submit) 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])
...
create a bill through the converters
...
(not implemented) convert(from, to, **agrs)
convert_batch(from, to, **agrs)
argv:
batch_id
sub_type,
product_id,
...
billCreationFromCalculation
Batchrun will trigger billCreationFromCalculation and will send: when the payment plan would be deliver the batch run page could be replaced by payment plan (this page could call billCreationFromCalculation service on selected payment plans) page and bill pageconvert_batch for all the product part of it.
if active_for_object(<fakepaymentplan>, 'submit', type, sub_type):
calculate(cls, <fakepaymentplan>, *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-HFID-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 |