use of org.mifos.accounts.loan.business.LoanTrxnDetailEntity in project head by mifos.
the class DisbursalAmountReversalAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
FinancialActionTypeEntity finloanDibursal = getFinancialAction(FinancialActionConstants.DISBURSAL);
// debit take form the prd offering
GLCodeEntity glcodeDebit = ((LoanBO) loanTrxn.getAccount()).getLoanOffering().getPrincipalGLcode();
addAccountEntryDetails(loanTrxn.getAmount(), finloanDibursal, glcodeDebit, FinancialConstants.CREDIT);
addAccountEntryDetails(loanTrxn.getAmount(), finloanDibursal, getGLcode(finloanDibursal.getApplicableCreditCharts()), FinancialConstants.DEBIT);
}
use of org.mifos.accounts.loan.business.LoanTrxnDetailEntity in project head by mifos.
the class DisbursementAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
FinancialActionTypeEntity finloanDibursal = getFinancialAction(FinancialActionConstants.DISBURSAL);
// debit take form the prd offering
GLCodeEntity glcodeDebit = ((LoanBO) loanTrxn.getAccount()).getLoanOffering().getPrincipalGLcode();
addAccountEntryDetails(loanTrxn.getAmount(), finloanDibursal, glcodeDebit, FinancialConstants.DEBIT);
Set<COABO> creditCharts = finloanDibursal.getApplicableCreditCharts();
GLCodeEntity glcodeCredit = getGLcode(creditCharts);
addAccountEntryDetails(loanTrxn.getAmount(), finloanDibursal, glcodeCredit, FinancialConstants.CREDIT);
}
use of org.mifos.accounts.loan.business.LoanTrxnDetailEntity in project head by mifos.
the class FeesAdjustmentAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
Set<FeesTrxnDetailEntity> feesTrxn = loanTrxn.getFeesTrxnDetails();
Iterator<FeesTrxnDetailEntity> iterFees = feesTrxn.iterator();
FinancialActionTypeEntity finActionFee = getFinancialAction(FinancialActionConstants.FEEPOSTING);
while (iterFees.hasNext()) {
FeesTrxnDetailEntity feeTrxn = iterFees.next();
addAccountEntryDetails(feeTrxn.getFeeAmount(), finActionFee, feeTrxn.getAccountFees().getFees().getGlCode(), FinancialConstants.DEBIT);
addAccountEntryDetails(feeTrxn.getFeeAmount(), finActionFee, getGLcode(finActionFee.getApplicableDebitCharts()), FinancialConstants.CREDIT);
}
// For Misc Fee
FinancialActionTypeEntity finActionMiscFee = FinancialActionCache.getFinancialAction(FinancialActionConstants.MISCFEEPOSTING);
addAccountEntryDetails(loanTrxn.getMiscFeeAmount(), finActionMiscFee, getGLcode(finActionMiscFee.getApplicableDebitCharts()), FinancialConstants.CREDIT);
addAccountEntryDetails(loanTrxn.getMiscFeeAmount(), finActionMiscFee, getGLcode(finActionMiscFee.getApplicableCreditCharts()), FinancialConstants.DEBIT);
}
use of org.mifos.accounts.loan.business.LoanTrxnDetailEntity in project head by mifos.
the class InterestAdjustmentAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
LoanTrxnDetailEntity loanTrxn = (LoanTrxnDetailEntity) financialActivity.getAccountTrxn();
LoanBO loan = (LoanBO) loanTrxn.getAccount();
if (loan.isLegacyLoan()) {
logTransactions_v1(loanTrxn);
} else {
logTransactions_v2(loanTrxn);
}
}
use of org.mifos.accounts.loan.business.LoanTrxnDetailEntity in project head by mifos.
the class FinancialBusinessServiceIntegrationTest method testLoanWriteOffAccountingEntries.
@Test
public void testLoanWriteOffAccountingEntries() throws Exception {
loan = getLoanAccount();
loan.setUserContext(TestUtils.makeUser());
AccountPaymentEntity accountPaymentEntity = new AccountPaymentEntity(loan, TestUtils.createMoney(630), null, null, new PaymentTypeEntity(Short.valueOf("1")), new Date(System.currentTimeMillis()));
FinancialBusinessService financialBusinessService = new FinancialBusinessService();
AccountActionDateEntity accountActionDateEntity = loan.getAccountActionDate(Short.valueOf("1"));
PersonnelBO personnel = legacyPersonnelDao.getPersonnel(loan.getUserContext().getId());
LoanTrxnDetailEntity loanTrxnDetailEntity = new LoanTrxnDetailEntity(accountPaymentEntity, AccountActionTypes.WRITEOFF, accountActionDateEntity.getInstallmentId(), accountActionDateEntity.getActionDate(), personnel, new Date(System.currentTimeMillis()), ((LoanScheduleEntity) accountActionDateEntity).getPrincipal(), "Loan Written Off", null, ((LoanScheduleEntity) accountActionDateEntity).getPrincipal(), new Money(getCurrency()), new Money(getCurrency()), new Money(getCurrency()), new Money(getCurrency()), null, null);
accountPaymentEntity.addAccountTrxn(loanTrxnDetailEntity);
AccountTestUtils.addAccountPayment(accountPaymentEntity, loan);
financialBusinessService.buildAccountingEntries(loanTrxnDetailEntity);
TestObjectFactory.updateObject(loan);
Set<FinancialTransactionBO> finTrxnSet = loanTrxnDetailEntity.getFinancialTransactions();
Assert.assertEquals(finTrxnSet.size(), 2);
for (FinancialTransactionBO finTrxn : finTrxnSet) {
if (finTrxn.getFinancialAction().getId().equals(Short.valueOf("22")) && finTrxn.isCreditEntry()) {
Assert.assertEquals(finTrxn.getPostedAmount(), TestUtils.createMoney("100"));
Assert.assertEquals(finTrxn.getBalanceAmount(), TestUtils.createMoney("100"));
Assert.assertEquals(finTrxn.getGlcode().getGlcodeId(), Short.valueOf("22"));
} else if (finTrxn.getFinancialAction().getId().equals(Short.valueOf("22")) && finTrxn.isDebitEntry()) {
Assert.assertEquals(finTrxn.getPostedAmount(), TestUtils.createMoney("100"));
Assert.assertEquals(finTrxn.getBalanceAmount(), TestUtils.createMoney("100"));
Assert.assertEquals(finTrxn.getGlcode().getGlcodeId(), Short.valueOf("24"));
} else {
//--fail("There should not be any other entry");
}
}
}
Aggregations