Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

github: https://github.com/openimis/openimis-be-calcrule-contribution-legacy

version = 1
status = active
UUID = 2aee6d54-eef4-4ee6-1c47-2793cfa5f9a8
calculation_rule_name = “payment: fee for service “

...

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(cls, instance)
Code Block
class= class of instance

match = False

if class == ContributionPlan

  match =self.UUID == instance.calculation

else if class == PH insuree

  match = checkCalculation(instance.cpb)

else if class == ContractDetails:

  match =checkCalculation(instance.cpb)

else if class == ContractContributionPlanDetails

  match =checkCalculation(instance.cp)

else if class == ContributionPlanBundle:

  for cp in instance.cp

    if checkCalculation(cp)

      match = True

      break

// for legacy the calculation is valid for all famillies

else if class == Familly

match = True

break
calculate(cls, instance, *args[date_from, date_to, productid, location])
instance.__class__ == ContractDetails OR Policies

https://github.com/openimis/openimis-be-policy_py/blob/develop/policy/values.py

...

  • Policy activated (obj_from is the instance from the signal data)

returns the obj_to

convert_batch(from, to, **agrv)

→ only required for informal sector

...

Save the invoice in database

getLinkedClass(classname)

Code Block
ListClass = []

if class == ContributionPlan or class == None

  ListClass.amend(Calculation)

else if class == PH insuree or class == None

  ListClass.amend( ContributionPlanBundle)

else if class == ContractDetails or class == None

  ListClass.amend( ContributionPlanBundle)

else if class == ContractContributionPlanDetails or class == None

  ListClass.amend(ContributionPlan)

else if class == ContributionPlanBundle or class == None

  ListClass.amend(ContributionPlan)

Converter

informal sector

1 invoice per policy, with 1 invoiceLineItem, dependants might be documented in the details invoiceItemLine

...

field

type

comment

HistoryBusinessModel fields

validFrom: Policy efective date

validTo:Policy exiry date

line_id

policy_id

line_type

policy

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

Code Block
languagejson
null

amount_total

float

net +tax

amount_net

qty * unitprice - discount

Contract:

the invoice of a contract will match the contract value and details.

...

field

type

comment

HistoryBusinessModel fields

validFrom: contractDetails validFrom

validTo:contract contractDetails validTo

line_id

ContractContributionPlanDetails id

line_type

ContractContributionPlanDetails

code

 str 

Product-code

description

 str 

product-desc

details

 json 

Dependant otherName, name, gender, age, relation to insuree

ledger_account

 int 

Product premium accounting code

quantity

 float 

1

unit_price

 type 

contractdetail Value

discount

 float 


 tax_rate

 Calculation uuid 

null

tax_analysis

json

Code Block
null

amount_total

float

net

amount_net

qty * unitprice - discount

...