use of org.mifos.reports.branchreport.BranchReportStaffSummaryBO in project head by mifos.
the class BranchReportPersistence method extractBranchReportStaffSummary.
public List<BranchReportStaffSummaryBO> extractBranchReportStaffSummary(Short branchId, Integer daysInArrears, MifosCurrency currency) throws PersistenceException {
Map<String, Object> params = new HashMap<String, Object>();
params.put(OFFICEID, branchId);
List<Object[]> queryResults = executeNamedQuery(EXTRACT_BRANCH_REPORT_STAFF_SUMMARY_ACTIVE_BORROWERS_LOANS, params);
Map<Short, BranchReportStaffSummaryBO> staffSummaries = new HashMap<Short, BranchReportStaffSummaryBO>();
for (Object[] queryResult : queryResults) {
BranchReportStaffSummaryBO staffSummary = createStaffSummaryFromResultset(queryResult, currency);
staffSummaries.put(staffSummary.getPersonnelId(), staffSummary);
}
populateCustomerCounts(staffSummaries, params);
populateTotalClientsEnrolledByPersonnel(staffSummaries);
populateClientsEnrolledByPersonnelThisMonth(staffSummaries);
populateOutstandingAmounts(staffSummaries, branchId, currency);
params.put(DAYS_IN_ARREARS, daysInArrears);
populatePortfolioAtRiskPercentage(staffSummaries, params);
populateLoanArrearsAmountForPersonnel(staffSummaries, currency);
return new ArrayList<BranchReportStaffSummaryBO>(staffSummaries.values());
}
use of org.mifos.reports.branchreport.BranchReportStaffSummaryBO in project head by mifos.
the class BranchReportPersistence method populateOutstandingAmounts.
void populateOutstandingAmounts(Map<Short, BranchReportStaffSummaryBO> staffSummaries, Short branchId, MifosCurrency currency) throws PersistenceException {
List<Object[]> resultSet = executeNamedQuery(EXTRACT_BRANCH_REPORT_STAFF_SUMMARY_LOAN_AMOUNT_OUTSTANDING, populateQueryParamsWithBranchAndCurrency(branchId));
for (Object[] outstandingAmounts : resultSet) {
BranchReportStaffSummaryBO staffSummary = staffSummaries.get(outstandingAmounts[0]);
staffSummary.setLoanAmountOutstanding(createMoney(currency, (BigDecimal) outstandingAmounts[1]));
staffSummary.setInterestAndFeesAmountOutstanding(createMoney(currency, (BigDecimal) outstandingAmounts[2]));
}
}
use of org.mifos.reports.branchreport.BranchReportStaffSummaryBO in project head by mifos.
the class BranchReportStaffSummaryHelper method populateStaffSummary.
public void populateStaffSummary() throws BatchJobException {
try {
List<BranchReportStaffSummaryBO> staffSummaries = branchReportService.extractBranchReportStaffSummary(branchReport.getBranchId(), branchReportConfigService.getGracePeriodDays(), branchReportConfigService.getCurrency());
branchReport.addStaffSummaries(staffSummaries);
} catch (ServiceException e) {
throw new BatchJobException(e);
}
}
use of org.mifos.reports.branchreport.BranchReportStaffSummaryBO in project head by mifos.
the class BranchReportServiceIntegrationTest method testGetStaffSummaryReportReturnsStaffSummaryForBranchAndDate.
@Test
public void testGetStaffSummaryReportReturnsStaffSummaryForBranchAndDate() throws Exception {
BranchReportBO branchReportWithStaffSummary = createBranchReportWithStaffSummary(BRANCH_ID_SHORT, RUN_DATE);
BranchReportBO otherBranchReportWithStaffSummary = createBranchReportWithStaffSummary(BRANCH_ID_SHORT, FIRST_JAN_2008);
session.save(branchReportWithStaffSummary);
session.save(otherBranchReportWithStaffSummary);
List<BranchReportStaffSummaryBO> retrievedStaffSummary = branchReportService.getStaffSummary(BRANCH_ID, RUN_DATE_STR);
Assert.assertEquals(1, retrievedStaffSummary.size());
assertSameCollections(branchReportWithStaffSummary.getStaffSummaries(), retrievedStaffSummary);
}
Aggregations