Search in sources :

Example 6 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportPersistence method extractLoanArrearsAgingInfoInPeriod.

public BranchReportLoanArrearsAgingBO extractLoanArrearsAgingInfoInPeriod(LoanArrearsAgingPeriod period, Short branchId, MifosCurrency currency) throws PersistenceException {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put(OFFICEID, branchId);
    params.put(MAX_DAYS, period.getMaxDays());
    params.put(MIN_DAYS, period.getMinDays());
    params.put(NOT_LESS_THAN_DAYS, period.getNotLessThanDays());
    params.put(CUSTOMER_LEVEL_ID, CLIENT.getValue());
    List queryResult = executeNamedQuery(EXTRACT_BRANCH_REPORT_LOAN_ARREARS_IN_PERIOD, params);
    if (queryResult.isEmpty()) {
        return new BranchReportLoanArrearsAgingBO(period, INTEGER_ZERO, INTEGER_ZERO, zero(currency), zero(currency), zero(currency));
    }
    Object[] resultSet = (Object[]) queryResult.get(0);
    return new BranchReportLoanArrearsAgingBO(period, (Integer) resultSet[0], (Integer) resultSet[1], createMoney(currency, (BigDecimal) resultSet[2]), createMoney(currency, (BigDecimal) resultSet[3]), createMoney(currency, (BigDecimal) resultSet[4]));
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO) HashMap(java.util.HashMap) List(java.util.List) ArrayList(java.util.ArrayList) BigDecimal(java.math.BigDecimal)

Example 7 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportHelperIntegrationTest method assertLoanArrearsAging.

private void assertLoanArrearsAging(Set<BranchReportLoanArrearsAgingBO> generatedLoanArrearsAgingReport, IBranchReportService branchReportService) throws ServiceException {
    List<BranchReportLoanArrearsAgingBO> retrievedLoanArrearsAgingReports = branchReportService.getLoanArrearsAgingInfo(BRANCH_ID, RUN_DATE_STR);
    assertNotEmpty(generatedLoanArrearsAgingReport);
    Iterator iterator = generatedLoanArrearsAgingReport.iterator();
    while (iterator.hasNext()) {
        BranchReportLoanArrearsAgingBO loanArrearsAging = (BranchReportLoanArrearsAgingBO) iterator.next();
        Assert.assertTrue(find(loanArrearsAging, retrievedLoanArrearsAgingReports));
    }
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO) Iterator(java.util.Iterator)

Example 8 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportLoanArrearsAgingHelperIntegrationTest method testLoanArrearsContructor.

@Test
public void testLoanArrearsContructor() throws Exception {
    Money agingAmount = createMoney(TestUtils.RUPEE, 3.3333);
    BranchReportLoanArrearsAgingBO loanArrears = new BranchReportLoanArrearsAgingBO(null, null, null, agingAmount, createMoney(TestUtils.RUPEE, 3.3333), createMoney(TestUtils.RUPEE, 666.70));
    Assert.assertEquals(agingAmount.getAmount().setScale(AccountingRules.getDigitsAfterDecimal(), RoundingMode.HALF_UP), loanArrears.getAmountAging());
}
Also used : Money(org.mifos.framework.util.helpers.Money) MoneyUtils.createMoney(org.mifos.framework.util.helpers.MoneyUtils.createMoney) BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO) Test(org.junit.Test)

Example 9 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportPersistenceIntegrationTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    branchReportPersistence = new BranchReportPersistence();
    runDate = DateUtils.getDate(2008, Calendar.JANUARY, 1);
    branchReportWithLoanArrears = new BranchReportBO(BRANCH_ID, runDate);
    branchReportWithLoanArrears.addLoanArrearsAging(new BranchReportLoanArrearsAgingBO(LoanArrearsAgingPeriod.ONE_WEEK));
    branchReportWithClientSummaries = new BranchReportBO(BRANCH_ID, runDate);
    branchReportWithClientSummaries.addClientSummary(BranchReportBOFixture.createBranchReportClientSummaryBO(BranchReportClientSummaryBO.CENTER_COUNT));
    branchReportWithStaffSummary = new BranchReportBO(BRANCH_ID, runDate);
    branchReportWithStaffSummary.addStaffSummary(BranchReportBOFixture.createBranchReportStaffSummaryBO());
    session = StaticHibernateUtil.getSessionTL();
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO) BranchReportBO(org.mifos.reports.branchreport.BranchReportBO) Before(org.junit.Before)

Example 10 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportServiceIntegrationTest method populateLoanArrearSummary.

private void populateLoanArrearSummary() {
    loanArrearReportForFirstWeek = new BranchReportLoanArrearsAgingBO(LoanArrearsAgingPeriod.ONE_WEEK);
    loanArrearReportForSecondWeek = new BranchReportLoanArrearsAgingBO(LoanArrearsAgingPeriod.TWO_WEEK);
    loanArrearReportForThirdWeek = new BranchReportLoanArrearsAgingBO(LoanArrearsAgingPeriod.THREE_WEEK);
    branchReport.addLoanArrearsAging(loanArrearReportForFirstWeek);
    branchReport.addLoanArrearsAging(loanArrearReportForSecondWeek);
    branchReport.addLoanArrearsAging(loanArrearReportForThirdWeek);
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO)

Aggregations

BranchReportLoanArrearsAgingBO (org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO)11 Test (org.junit.Test)5 BranchReportBO (org.mifos.reports.branchreport.BranchReportBO)2 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Before (org.junit.Before)1 BatchJobException (org.mifos.framework.components.batchjobs.exceptions.BatchJobException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 ServiceException (org.mifos.framework.exceptions.ServiceException)1 Money (org.mifos.framework.util.helpers.Money)1 MoneyUtils.createMoney (org.mifos.framework.util.helpers.MoneyUtils.createMoney)1 LoanArrearsAgingPeriod (org.mifos.reports.branchreport.LoanArrearsAgingPeriod)1