Version | date | comment | changes |
---|---|---|---|
1 | 06-2021 | formal sector | |
2 | 08-2021 | Payment layer | add Type and sub-type add bill and invoice service and signals |
https://github.com/openimis/openimis-be-calculation_rule_fs_income_percentage_py
config.py : define constant that might be used for the definition of description and impacted_class_parameter
app.py: load config
calculation_rule.py: host the code of the class that implements AbsCalculationRule
The version is used to keep track of the changes in the version of the calculation rule,
integer inactive, future, active, archived
UUID to follow the version of the calculation
short name of the calculation rule
description text of the calculation
<list>JSONObject objects {class:"className"(to be compare with property name of the FE details object which is pulled from BE), 'parameters':['type':"int",'name':"example",'label':{'en':'DiplayName'},'rights':{'read':"readAuthority", ‘write':"writeAuthority"},relevance:"frontendjsdisplaylogic",condition:"frontendjsvalidationlogic",'optionSet’:[]]} // list of the parameters required on other object,
default value can be datetime.datetime(2000, 1, 1)
date or None
extendable list
account_receivable (default if type is not set)
account_payable
tax
specify in more details the type
account_receivable :
contribution
reinsurance_payment
funding
account_payable:
third_party_payment (toward HF)
reimbursement(toward Insuree)
commissions (toward User)
fees (toward other)
reinsurance_contribution
tax
local_tax
state_tax
country_tax
…
used to define the available convereters
[{“name”:”FunctionName”,”from”:{“class”:”BusinessObject1”,”right”:”rightObject1”},”to”:{“class”:”BusinessObject2”,”right”:”rightObject2”}, parameters':['type':"int",'name':"example",'label':{'en':'DiplayName'},'rights':{'read':"readAuthority", ‘write':"writeAuthority"},relevance:"frontendjsdisplaylogic",condition:"frontendjsvalidationlogic",'optionSet’:[]]}, …]
will check the from-to, and the rights then will call the Function Name with agrv as parameters
→ might be able to define it on abstract level
None (using no database approach for CalculationRule) - Calculation Rule is saved by defining class extending the ABSCalculationClass from core module.
signal_get_rule_name
signal_get_rule_details
signal_get_param
signal_get_linked_class
signal_calculate_event
None
None
loading implemented rules from "calculation_rule.py" into global variable "CALCULATION_RULE"
This method makes sure the calculation is registered in the calculation table (if not the line should be added with "inactive status") and register the signals only if it is active
all rules, if active will have to register to the signal sent by “getRuleDetails”
this method will contains the checks if the calculation need to be executed for the object on that context. the default context will be:
create
update
delete
submit
amend
replace
check
validate
This function is required because the same class can have different calculation based on the object members values (like product ….)
this function will check if it can be used for the instance, ie. if there is a link between the instance and a calculation
1- get instance class
2- if class known then return check that the linked calculation if the current one
Function that will do the calculation based on the parameters
that function will return the possible instance that can have a link to the calculation
Convert on or several object toward another type, especially to invoice or bill
Calculation are likely to have other method that could be listening to signals