support flexible repayment strategies for loans.

This commit is contained in:
Keith Woodlock
2012-07-28 01:47:54 +01:00
parent ef12c864ab
commit 89230969ea
20 changed files with 1120 additions and 254 deletions
@@ -325,6 +325,7 @@ CREATE TABLE `portfolio_loan_repayment_schedule` (
`principal_completed_derived` decimal(19,6) DEFAULT NULL,
`interest_amount` decimal(19,6) DEFAULT NULL,
`interest_completed_derived` decimal(19,6) DEFAULT NULL,
`interest_waived_derived` decimal(19,6) DEFAULT NULL,
`completed_derived` bit(1) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
@@ -342,6 +343,8 @@ CREATE TABLE `portfolio_loan_transaction` (
`contra_id` bigint(20) DEFAULT NULL,
`transaction_date` date NOT NULL,
`amount` decimal(19,6) NOT NULL,
`principal_portion_derived` decimal(19,6) NOT NULL,
`interest_portion_derived` decimal(19,6) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
@@ -8,7 +8,8 @@ VALUES
(300, 'Active'),
(400, 'Withdrawn by client'),
(500, 'Rejected'),
(600, 'Closed');
(600, 'Closed'),
(700, 'Overpaid');
INSERT INTO `ref_currency`
@@ -0,0 +1,12 @@
-- add derived fields for loan transactions and extra
ALTER TABLE `portfolio_loan_transaction`
ADD COLUMN `principal_portion_derived` decimal(19,6) NOT NULL DEFAULT 0,
ADD COLUMN `interest_portion_derived` decimal(19,6) NOT NULL DEFAULT 0,
ADD COLUMN `interest_waived_derived` decimal(19,6) NOT NULL DEFAULT 0;
ALTER TABLE `portfolio_loan_repayment_schedule`
ADD COLUMN `interest_waived_derived` decimal(19,6) NOT NULL DEFAULT 0;
INSERT INTO `ref_loan_status` (`id`,`display_name`) VALUES (700, 'Overpaid');