|
||||||||
|
This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira |
||||||||
------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev
_______________________________________________ Mifos-issues mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mifos-issues

Functional Requirement note:
Every loan product will have a flag stating whether to include the loan in the loan cycle or not.
A counter is incremented when a loan is disbursed if, at loan product definition level, the attribute Include in loan cycle is set to Yes. If the loan account is rescheduled, written off, or cancelled, the loan cycle number is decremented.
Separate loan counters for each product are maintained for each client. This is maintained/incremented, irrespective of whether the "include in loan cycle" flag is set for the product or not. For example, if the client has taken two agricultural loans and three cattle loans, her performance history displays a loan cycle for educational loan=2; loan cycle for cattle loan=3. In performance history of client, both the client-level loan cycle (5) and individual loan cycles per product are displayed. The client-level loan cycle is increment based on the flag.
The counter is incremented when a loan account is approved and decremented for rescheduled loans or written off loans.
Lessons learnt from Mifos:
Mifos tracked the loan cycle count at a product level, this made it difficult to report the loan cycle for individual loans of the same product, we should ideally handle the same (unless it seems like an overkill)
Suggested Technical Implementation:
Add a new table called m_client_loan_counter with the following columns
client_id (FK m_client)
loan_product_id (FK to m_product_loan)
loan_id (FK to m_loan)
running_counter (int tracking loan cycle count)
Add a boolean flag to m_product_loan called "include_in_borrower_cycle" (or something more appropriately named)
On Disbursal ( loans/
{loanId}?command=disburse), a new row for the client/loan product/loan combination would be created in this table (with running_counter value set to select ifnull(max(running_counter),0) + 1 as "nextRunningCount" from m_client_counter where client_id=? and loan_product_id=?)On undoing disbursal (loans/{loanId}
?command=undoDisbursal) or writeoff ( loans/
{loanId}/transactions?command=writeoff) , delete the entry made for the loan from m_client_loan_counter and for all other loans (of same loan product and belonging to this client) with a running_counter greater than the running counter of the deleted record, decrement their running counter by 1
Modify client summary api https://demo.openmf.org/api-docs/apiLive.htm#clients_loansummary
to return loan cycle details as an optional association..
i.e clients/1/loans?associations=loanCycleDetails.
The appended JSON structure could be something like (Note that clientLoanCycle should be summation of all max running counts of loan products which have include_in_counter flag set to true)
{ .....Current Content.... "loanCycleDetails": { "clientLoanCycle": 5, "loanCycles": [ { "productName": "General Loan", "productId": 12, "loanCycle": 3 }, { "productName": "Special Loan", "productId": 13, "loanCycle": 2 } ] } }