Overview
Fineract Platform already supports the ability to set up pre-defined general ledger journal entries via the accounting rules and frequent postings features. Community feels the need for a feature to automatically post a journal entry that can be controlled using recurrence settings.
Ref: - FINERACT-128Getting issue details... STATUS
Design Approach
Accounting Rule can be enhanced to hold the recurrence information which can then be used by a scheduler job to make the required journal entry.
Design
DB changes
Add following fields to existing acc_accounting_rule table:
acc_accounting_rule | |
is_scheduled | TINYINT |
is_active | TINYINT |
amount | DECIMAL |
recurrence_start_date | DATE |
recur_num_times | INT |
recur_num_times_completed | INT |
recurrence_frequency | VARCHAR(100) |
last_trigger_date | DATE |
next_trigger_date | DATE |
API changes
Existing ‘/accountingrules’ shall take additional parameters representing above data base fields except is_active, recur_num_times_completed, last_trigger_date, next_trigger_date which are system internal fields.
During Creation: recurrence_start_date can only be in future.
During Update: amount, recurrence_start_date(only if in future/not defined), recur_num_times(only if recur_num_times_completed < recur_num_times), recurrence_frequency shall be allowed to edit.
During Delete: is_active will be updated.
Last_trigger_date, next_trigger_date and recur_num_times_completed are for internal use.
Scheduled Job
A new scheduled job would be created that would run once a day. It will pick up all scheduled and active accounting rule definitions. If next_trigger_date is in the past, then a journal entry will be passed for the given from GL, to GL and amount. The job would also update the last_trigger_date, next_trigger_date and recur_num_times_completed fields appropriately.