version = 1
status = active
UUID = 2aee6d54-eef4-4ee6-1c47-2793cfa5f9a8
calculation_rule_name = “payment: fee for service “
type = account_receivable
sub_type = contribution
dateValidTo = None
dateValidFrom = 2000-01-01
list of impacted parameters: NULL (will take data from product, claims … )
description = “ This calculation will, for the selected level and product, calculate how much the insuree will have to pay based on the product modeling, it will also manage the conversion into an invoice“
Service
activeForObject(self, instance, context, type, sub_type)
instance.__class__ == (ContributionPan and context IN (submit)) and self.checkCalculation(instance)
check_calculation
// TBD
calculate(cls, instance, *args[date_from, date_to, productid, location])
instance.__class__ == ContractDetails[TBC policies ?]
// import BS rules
convert(type, sub_type, from, to, **agrs)
from = ‘Contract' / 'Policy’
to = 'Invoice'
argv (for all invoices, )date_from, date_to,, product_id, location
Registration on signals from other module(existing or not):
Policy activated
if active_for_object(ContractDetails/Policy, 'submit', type, sub_type):
calculate(cls, <contribution>, *args[date_from, date_to, productid, location])
Converter
informal sector
1 invoice per policy, with 1 invoiceLineItem, dependants might be documented in the details invoiceItemLine
Invoice:
field | type | comment |
subject | json | referenceSource { "label":Product-lable "code":product-code, "type": "Contribution", "id":"UUID", } |
recipient | json | referenceActor { "label":Insuree-name, "code":CHFID, "type": "Insuree", "id":"UUID", "address":{"text":"",...} } |
code | str | IV-[PRODUCT code]-CHFID |
date_due | date | policy effective date |
date_invoice | date | Date of the enrolment |
*dateValidFrom | date | validFrom: policy effective date |
*dateValidTo | date | validTo: policy expiry date |
amount_discount | float | total of the detail discount |
amount_net | float | Total without tax |
tax_analysis | json | null |
amount_total | float | total net |
status | int | validated |
currency_rcp_code | str | default-curency |
currency_code | str | default-curency-code |
note | bigttext | |
terms | bigttext |
InvoiceItem
field | type | comment |
HistoryBusinessModel fields | validFrom: Policy efective date validTo:Policy exiry date | |
code | str | PRODUCT-code |
description | str | PRODUCT-label |
details | json | Dependant otherName, name, gender, age, relation to insuree |
ledger_account | int | Product premium accounting code |
quantity | float | 1 |
unit_price | type | BASE Policy Value |
discount | float | renewal discount … |
tax_rate | Calculation uuid | null |
tax_analysis | json | null |
amount_total | float | net +tax |
amount_net | qty * unitprice - discount |