From 0553cda5e31d13392b00ac4ab2ef4bb922b33d8e Mon Sep 17 00:00:00 2001 From: Pramod Nuthakki Date: Tue, 7 Oct 2014 15:37:48 +0530 Subject: [PATCH] script to insert charges paid by for accruals --- .../V204__insert_script_for_charges_paid_by_for_accruals.sql | 1 + 1 file changed, 1 insertion(+) create mode 100755 mifosng-provider/src/main/resources/sql/migrations/core_db/V204__insert_script_for_charges_paid_by_for_accruals.sql diff --git a/mifosng-provider/src/main/resources/sql/migrations/core_db/V204__insert_script_for_charges_paid_by_for_accruals.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V204__insert_script_for_charges_paid_by_for_accruals.sql new file mode 100755 index 000000000..39d5e4e75 --- /dev/null +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V204__insert_script_for_charges_paid_by_for_accruals.sql @@ -0,0 +1 @@ +insert into m_loan_charge_paid_by (`loan_transaction_id`,`loan_charge_id`,`amount`) select lt.id, lc.id, if(lic.amount is null,lc.amount,lic.amount) from m_loan_transaction lt join m_loan_repayment_schedule rs on rs.loan_id = lt.loan_id and rs.duedate = lt.transaction_date join m_loan_charge lc on lc.loan_id = rs.loan_id and ((lc.due_for_collection_as_of_date > rs.fromdate and lc.due_for_collection_as_of_date <= rs.duedate) or lc.charge_time_enum = 8) and lc.is_active=1 join m_loan loan on loan.id = lt.loan_id join m_product_loan lp on lp.id = loan.product_id and lp.accounting_type =3 left join m_loan_installment_charge lic on lic.loan_charge_id = lc.id and lic.loan_schedule_id = rs.id where lt.transaction_type_enum = 10 and (lt.fee_charges_portion_derived is not null or lt.penalty_charges_portion_derived is not null) and lt.is_reversed = 0 \ No newline at end of file