Versions Compared

Key

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

...

We need to create a table to keep all loan provision categories.The table name is 'm_provision_category''. The table definition is defined below. The category names will vary based customer to customer. 

NameDatatypeLengthRemarks
idBIGINT20Primary Key & Auto Increment
category_nameVARCHAR100Not Null
DescriptionVARCHAR200  

By default Mifos X system will create and insert the following categories into this table based on customer requirements. So the data will look like below.

idcategory_nameDescription
1STANDARDPunctual Payment without any dues
2SUB-STANDARDPrincipal and/or Interest overdue by x days
3DOUBTFUL

Principal and/or Interest overdue by y days with 1 year original term (or)

Principal and/or Interest overdue by z days with more than 1 year term

 

4LOSSPrincipal and/or Interest overdue by t1 days with 1 year original term (or)
Principal and/or Interest overdue by t2 days with more than 1 year term

...

Now how to associate loan provision to  a product? In create loan product screen, we have the option to enable loan loss provision as shown in mock up screen below

rganization Organization can choose each category one by one and can add it to the loan product. Organization can choose minimum and maximum over dues in days and can provide provision percentage differently for each loan product. Both Liability & Expense combos will have all GL accounts. So organization can choose liability & expense accounts against each provision category differently,

Once the new loan product form is submitted, product loan provision details will be stored in 'm_loanproduct_provision_details'. The table definition is defined below.

NAMEDatatypeLengthRemarks
idBIGINT20PRIMARY KEY & AUTOINCREMENTAUTO INCREMENT
loanproduct_idBIGINT20FOREIGN KEY
category_idBIGINT20FOREIGN KEY
min_ageBIGINT20NOT NULL
max_ageBIGINT20NOT NULL
provision_percentageINT4DEFAULT 0
liability_accountBIGINT20FOREIGN KEY acc_gl_account.id
expense_accountBIGINT20FOREIGN KEY acc_gl_account.id
created_byBIGINT20FOREIGN KEY m_appuser.id
created_onDATE  
modified_byVARCHAR100FOREIGN KEY m_appuser.id
modified_onDATE  

For any given tenant, the provision details for a particular loan product will look like below.

idloanproduct_idcategory_idmin_agemax_ageprovision_percentageliability_accountexpense_accountcreated_bycreated_onmodified_bymodified_by
1103451005abcd accountdcba account10031-Dec-201420010-Jan-2015
2103452306020abcd accountdcba account20031-Dec-201440010-Jan-2015
31034536018050abcd accountdcba account40031-Dec-201450010-Jan-2015
410345418036090abcd accountdcba account30031-Dec-201460010-Jan-2015

 

While editing the loan product, persisted provision details will be restored in the edit loan product screen

...

By using the following query we can get all active loan ids along with product id, overdue in days, outstanding loan balance, provision category id, provision percentage, due date


SELECT loan.id as loanid,
loan.product_id as productid,
GREATEST(datediff(CURDATE(),sch.duedate),0) as numberofdaysoverdue,
loan.total_outstanding_derived as outstandingbalance,
lpc.category_id,
lpc.provision_percentage,
sch.duedate
FROM m_loan_repayment_schedule as sch
LEFT JOIN m_loan as loan
ON sch.loan_id = loan.id
LEFT JOIN m_loanproduct_provision_category lpc
ON loan.product_id=lpc.product_id
and lpc.min_age <= GREATEST(datediff(CURDATE(),sch.duedate),0) and  GREATEST(datediff(CURDATE(),sch.duedate),0) < lpc.max_age
WHERE loan.loan_status_id=300 and sch.principal_amount > 0 and sch.completed_derived=false and
lpc.category_id > 0 and lpc.provision_percentage > 0
GROUP BY sch.loan_id
HAVING sch.duedate=min(sch.duedate)

The result of the above query will look like below (mock data).The charge calculation for above data is shown below.

loanidproductidnumberofdaysoverdueoutstandingbalancecategory_idprovision_percentageduedate
44011150.000000152015-10-28
55011310.000000192015-10-28
131169216300.00000041002013-10-15

The charge calculation for above data is shown below.

loanidproductidnumberofdaysoverdueoutstandingbalancecategory_idprovision_percentageduedateAmount to be reserved
44011150.000000152015-10-28557.500000
55011310.000000192015-10-281017.900000
131169216300.00000041002013-10-1513040.000000

As current journal entry is not sufficient for provision reports, we need to introduce a new table in the database. The table name is 'm_loan_provision_entry' and the table definition is shown below.

NameDatatypeLengthRemarks
idBIGINT20PRIMARY KEY and AUTOINCREMENT
currency_codeBIGINT20FOREIGN KEY m_currency.id
office_idBIGINT20FOREIGN KEY m_office.id
product_idBIGINT20FOREIGN KEY m_product_loan.id
category_idBIGINT20FOREIGN KEY m_provision_category.id
overdue_in_daysBIGINT20DEFAULT 0
amount_to_be_reservedBIGINT20DEFAULT 0
created_byBIGINT20FOREIGN KEY m_appuser.id
created_onDATE NOT NULL
modified_byBIGINT20FOREIGN KEY m_appuser.id
modified_onDATE  

 

Whenever the provision calculation is done, system is going to make an entry in the 'provision_history' table. The structure of the table is shown below

NameDatatypeLengthDescription
idBIGINT20PRIMARY KEY & AUTO INCREMENT
created_onDATE NOT NULL
journal_entry_createdINT1DEFAULT 0
created_byBIGINT20m_appuser_id or scheduler job dummy id
created_onDATE  

Changes required in existing Classes:

  • While creating any loan product template, provision categories should be added to the response object. For this
    • org.mifosplatform.portfolio.loanproduct.data.LoanProductData should have one more instance variable to hold provision categories
    • New interface org.mifosplatform.organisation.provisioning.service.ProvisionCategoriesReadPlatformService should have a method to retrieve all provision categories.
      • The method name is List<EnumOptionData> retrieveProvisionCategories() ;
    • Provision Categories should retrieved and set to LoanProductData in org.mifosplatform.LoanProductsApiResource.handleTemplate(final LoanProductData productData)
    • Client application should read response param "provisioncategoies" if available it should display provision categories as shown in create product mock up screen
  • While creating a loan product, the provision categories along with min age, max age, percentage to provision should be read and saved into DB. For this
    • New entity class org.mifosplatform.organisation.provisioning.domain.LoanProductProvision for 'm_loanproduct_provision_category' should be added
    • org.mifosplatform.portfolio.loanproduct.domain.LoanProduct should have set of LoanProductProvision
    • Client application should send loan product provision categories as part of the request params while creating a loan product. The parameter name is 'loanproductprovisons'
    • Provision categories should be read and added in org.mifosplatform.portfolio.loanproduct.domain.LoanProduct.assembleFromJson(...)
  • While retrieving a loan product (s), we need to retrieve the provision categories and associate with the Loan Product object (s). For this
    • org.mifosplatform.portfolio.loanproduct.service.LoanProductReadPlatformServiceImpl.retrieveLoanProduct(Long loanProductId) should be modified to associate provision categories
    • org.mifosplatform.portfolio.loanproduct.service.LoanProductReadPlatformServiceImpl.retrieveAllLoanProducts() should be modified to associate provision categories
    • org.mifosplatform.organisation.provisioning.service.ProvisionCategoriesReadPlatformService should expose a method to retrieve the provision categories based on loan product id
  • While updating a loan product (s), we need to update the provision categories associated to that loan product (s). For this
    • org.mifosplatform.portfolio.loanproduct.service.LoanProductWritePlatformServiceJpaRepositoryImpl.updateLoanProduct(...) should be modified to validate and update loan product provision categories

 

 

New Screens

  • Provisioning History Screen
  • Provisioning Screen

...