...
Create a database structure to save the account receivable
Save the different account receivable (contribution and funding)
Convert the different account receivable following that structure
Create a FHIR interface for the accounting systems
Create a database structure to save the account receivable
The concept is to use a widely use format as base. inspiration can form FHIR invoice and SAGE API Invoices. openIMIS is not an accounting system therefore generating book and ledger is not in the project scope but invoice are a good representation for the account receivable mentioned above. To bring flexibility, a JSON fields was added to the invoice line in case a structured details is required.
The link with the Source and actor won’t be in a form a database foreign keys because those could be from different table.
...
invoices
field | type | comment | |||||
HistoryBusinessModel fields | |||||||
subject | json |
| |||||
recipient | json |
| |||||
id | UUID | ||||||
code | str | or reference for the insurance | |||||
code_rcp | str | or reference for the recipient | |||||
code_ext | str | if required for external system integration such as payment systems | |||||
date_due | date | date on which the payment is due | |||||
date_invoice | date | Date of the “invoice“ | |||||
date_from | date | invoice covering service/item from | |||||
date_to | date | invoice covering service/item to | |||||
date_payed | date | Date on which the payment was actually documented as Done | |||||
amount_discount | float | total of the detail discount | |||||
amount_net | float | Total without tax | |||||
tax_analysis | json |
| |||||
amount_total | float | total net + tax total | |||||
status | int | ENUM: draft, validated, payed, cancelled, deleted | |||||
currency_rcp_code | str | currency of the recipient (if different) | |||||
currency_code | str | currency of insurance | |||||
note | bigttext | ||||||
terms | bigttext | conditions |
...
invoiceLineItems
to docuement document the content fo for the inboundInvoiceInvoice
field | type | comment | |||||
code | str | reference | |||||
HistoryModel fields | |||||||
inboundInvoiceId | UUID | reference to inboundInvoiceinvoice | |||||
description | str | ||||||
details | json | depend of the type, TBD | |||||
ledger_account | int | from config | |||||
quantity | float | ||||||
unit_price | type | ||||||
discount | float | to document difference between the std price and the price to be paid, usefull useful for relative pricing | |||||
tax_rate | Calculation uuid | Calculation to calculate the tax | |||||
tax_analysis | json |
| |||||
amount_total | float | net +tax | |||||
amount_net | qty * unitprice - discount |
inboundInvoicePayments
To document the payment done on the invoice. out of scope: a payment done for 2 invoice, to support such scenario an “generalPayment“ table need to be created, this table will have sub table with relationships to inboundInvoicePayments, once the reconciliation between the different invoice will be done.
...
field | type | comment |
HistoryModel fields |
| |
Status | int | Accepted / Rejected |
code_ext | str | payment reference |
label | str | label of the payment |
code_rcp | str | Reference from the payment system / bank |
inboundInvoiceIdinvoiceId | UUID | reference to inboundInvoiceinvoice |
code_recieptreceipt | str | reciept receipt number |
amount_payed | float | Amount that need to be matched against business items (fees might be added if there were removed before reaching the system) |
fees | float | |
amount_recievedreceived | float | Amount that is received (may include or not the fees) |
date_payment | date |
...
invoiceEvents
this table will log the event relating to the invoice
field | type | comment |
HistoryModel fields |
| |
inboundInvoiceIdinvoiceId | UUID | reference to inboundInvoiceinvoice |
type | int | (Message / Status / Warning / Payment / Payment error) module configuation |
data | json | Payload linked to type (TODO) |
[Nice to have] inboundInvoicedocuments
...
field | type | comment |
HistoryModel fields |
| |
invoiceId | UUID | reference to invoice |
type | int | (invoice, receipt, other)Module configuration |
pathType | int | local/Hyperlink/other (sdb, s3, nfs… ) |
path | json | Payload linked to type (TODO) |
Service: Save the different account receivable
Contribution:
the grouping will be done per Head of family, therefore such invoice will have only 1 detail.
Contract:
the invoice of a contract will match the contract value and details.
Funding:
Manually filled invoice for a payer, the details of the pool/product to be funded will be in the details
Converters: Convert the different account receivable following the new structure
Contribution:
Contract:
Funding:
Create a FHIR interface for the accounting systems (change FHIR_R4 ?)
Here the FHIR ressource to be used:
https://www.hl7.org/fhir/invoice.html
Acceptance criteria:
Insurance clerk generates informal sector insurance invoice per head of family for a given time period
Insurance clerk generates formal sector insurance invoice per Policyholder for a given time period
Insurance clerk generates a funding invoice for a product/pool
Insurance clerk display the invoice with details
Insurance clerk add a payment on the invoice
Insurance clerk print the invoice
Insurance clerk delete an invoice (this won’t delete the generating Item)
Front end
Search page
search criteria
search result
card page
general information
detials
...