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]));
}
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));
}
}
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());
}
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();
}
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);
}
Aggregations