Search in sources :

Example 1 with BranchReportBO

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

the class BranchReportHelper method createBranchReport.

BranchReportBO createBranchReport(Session session, OfficeBO branchOffice, Date runDate) throws BatchJobException {
    BranchReportBO branchReport = new BranchReportBO(branchOffice.getOfficeId(), runDate);
    new BranchReportClientSummaryHelper(customerBusinessService, branchReportService, branchReportConfigService).populateClientSummary(branchReport, branchOffice);
    new BranchReportLoanArrearsAgingHelper(branchReport, branchReportService, branchReportConfigService).populateLoanArrearsAging();
    new BranchReportStaffSummaryHelper(branchReport, branchReportService, branchReportConfigService).populateStaffSummary();
    new BranchReportStaffingLevelSummaryHelper(branchReport, branchReportService).populateStaffingLevelSummary();
    new BranchReportLoanDetailsHelper(branchReport, branchReportService, branchReportConfigService).populateLoanDetails();
    new BranchReportLoanArrearsProfileHelper(branchReport, branchReportService, branchReportConfigService).populateLoanArrearsProfile();
    session.save(branchReport);
    session.flush();
    session.clear();
    return branchReport;
}
Also used : BranchReportBO(org.mifos.reports.branchreport.BranchReportBO)

Example 2 with BranchReportBO

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

the class BranchReportClientSummaryHelperIntegrationTest method testPopulatesClientSummary.

@Test
public void testPopulatesClientSummary() throws Exception {
    BranchReportBO branchReport = BranchReportBOFixture.createBranchReport(Integer.valueOf(1), BRANCH_ID, DateUtils.currentDate());
    new BranchReportClientSummaryHelper(getCustomerBusinessServiceStub(), getBranchReportServiceStub(), getBranchReportConfigServiceStub()).populateClientSummary(branchReport, OfficecFixture.createOffice(BRANCH_ID));
    assertClientSummary(branchReport);
}
Also used : BranchReportBO(org.mifos.reports.branchreport.BranchReportBO) Test(org.junit.Test)

Example 3 with BranchReportBO

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

the class BranchReportStaffSummaryHelperIntegrationTest method testPopulateStaffSummary.

@Test
public void testPopulateStaffSummary() throws BatchJobException {
    BranchReportBO branchReportBO = new BranchReportBO(BRANCH_ID_SHORT, RUN_DATE);
    BranchReportStaffSummaryHelper staffSummaryHelper = new BranchReportStaffSummaryHelper(branchReportBO, new BranchReportService(), getConfigServiceStub());
    staffSummaryHelper.populateStaffSummary();
    Set<BranchReportStaffSummaryBO> staffSummaries = branchReportBO.getStaffSummaries();
    Assert.assertNotNull(staffSummaries);
}
Also used : BranchReportStaffSummaryBO(org.mifos.reports.branchreport.BranchReportStaffSummaryBO) BranchReportBO(org.mifos.reports.branchreport.BranchReportBO) BranchReportService(org.mifos.reports.business.service.BranchReportService) Test(org.junit.Test)

Example 4 with BranchReportBO

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

the class BranchReportPersistenceIntegrationTest method testSaveLoanArrearsBOWithLargeValueForAmountOutstanding.

@Test
public void testSaveLoanArrearsBOWithLargeValueForAmountOutstanding() throws Exception {
    BranchReportLoanArrearsAgingBO branchReportLoanArrearsAgingBO = new BranchReportLoanArrearsAgingBO(LoanArrearsAgingPeriod.FIVE_TO_EIGHT_WEEK, Integer.valueOf(1), Integer.valueOf(2), createMoney(TestUtils.RUPEE, 15724323.10), createMoney(TestUtils.RUPEE, 1283439.70), createMoney(TestUtils.RUPEE, 459625.70));
    BranchReportBO branchReport = BranchReportBOFixture.createBranchReport(null, Short.valueOf("2"), DateUtils.currentDate());
    branchReport.addLoanArrearsAging(branchReportLoanArrearsAgingBO);
    try {
        session.save(branchReport);
        session.flush();
        //            transaction = session.beginTransaction();
        deleteBranchReport(branchReport.getBranchReportId());
    } catch (Exception e) {
        e.printStackTrace(System.out);
        Assert.fail("Should not throw error when saving: " + e);
    }
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO) BranchReportBO(org.mifos.reports.branchreport.BranchReportBO) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Test(org.junit.Test)

Example 5 with BranchReportBO

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

the class BranchReportPersistenceIntegrationTest method testGetBranchReportBatchForDateAndBranch.

@Test
public void testGetBranchReportBatchForDateAndBranch() throws Exception {
    BranchReportBO branchReportBO = new BranchReportBO(BRANCH_ID, runDate);
    session.save(branchReportBO);
    List<BranchReportBO> retrievedBranchReports = branchReportPersistence.getBranchReport(BRANCH_ID, runDate);
    assertListSizeAndTrueCondition(1, retrievedBranchReports, PredicateUtils.equalPredicate(branchReportBO));
}
Also used : BranchReportBO(org.mifos.reports.branchreport.BranchReportBO) Test(org.junit.Test)

Aggregations

BranchReportBO (org.mifos.reports.branchreport.BranchReportBO)12 Test (org.junit.Test)9 BranchReportService (org.mifos.reports.business.service.BranchReportService)3 Before (org.junit.Before)2 OfficeBO (org.mifos.customers.office.business.OfficeBO)2 OfficeBusinessService (org.mifos.customers.office.business.service.OfficeBusinessService)2 BranchReportLoanArrearsAgingBO (org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO)2 BranchReportStaffSummaryBO (org.mifos.reports.branchreport.BranchReportStaffSummaryBO)2 PersonnelBusinessService (org.mifos.customers.personnel.business.service.PersonnelBusinessService)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 LoanArrearsAgingPeriod (org.mifos.reports.branchreport.LoanArrearsAgingPeriod)1 BranchReportPersistence (org.mifos.reports.branchreport.persistence.BranchReportPersistence)1 IBranchReportService (org.mifos.reports.business.service.IBranchReportService)1