Search in sources :

Example 6 with TransactionHistoryDto

use of org.mifos.dto.screen.TransactionHistoryDto in project head by mifos.

the class AccountAppAction method getTrxnHistory.

@TransactionDemarcate(joinToken = true)
public ActionForward getTrxnHistory(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    String globalAccountNum = request.getParameter("globalAccountNum");
    AccountBO accountBO = getAccountBusinessService().findBySystemId(globalAccountNum);
    List<TransactionHistoryDto> transactionHistoryDto = this.centerServiceFacade.retrieveAccountTransactionHistory(globalAccountNum);
    if (accountBO.isGroupLoanAccount() && null == ((LoanBO) accountBO).getParentAccount()) {
        SessionUtils.setAttribute(Constants.TYPE_OF_GROUP_LOAN, "parentAcc", request);
    } else if (accountBO.isGroupLoanAccount() && null != ((LoanBO) accountBO).getParentAccount()) {
        SessionUtils.setAttribute(Constants.TYPE_OF_GROUP_LOAN, "memberAcc", request);
    }
    SessionUtils.setCollectionAttribute(SavingsConstants.TRXN_HISTORY_LIST, transactionHistoryDto, request);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, accountBO, request);
    request.setAttribute("GlNamesMode", AccountingRules.getGlNamesMode());
    return mapping.findForward("getTransactionHistory_success");
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) LoanBO(org.mifos.accounts.loan.business.LoanBO) TransactionHistoryDto(org.mifos.dto.screen.TransactionHistoryDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 7 with TransactionHistoryDto

use of org.mifos.dto.screen.TransactionHistoryDto in project head by mifos.

the class AccountBOIntegrationTest method testGetTransactionHistoryView.

@Test
public void testGetTransactionHistoryView() throws Exception {
    Date currentDate = new Date(System.currentTimeMillis());
    LoanBO loan = groupLoan;
    loan.setUserContext(TestUtils.makeUser());
    List<AccountActionDateEntity> accntActionDates = new ArrayList<AccountActionDateEntity>();
    accntActionDates.addAll(loan.getAccountActionDates());
    PaymentData accountPaymentDataView = TestObjectFactory.getLoanAccountPaymentData(accntActionDates, TestUtils.createMoney(100), null, loan.getPersonnel(), "receiptNum", Short.valueOf("1"), currentDate, currentDate);
    IntegrationTestObjectMother.applyAccountPayment(loan, accountPaymentDataView);
    loan = TestObjectFactory.getObject(LoanBO.class, loan.getAccountId());
    List<Integer> ids = new ArrayList<Integer>();
    for (AccountPaymentEntity accountPaymentEntity : loan.getAccountPayments()) {
        for (AccountTrxnEntity accountTrxnEntity : accountPaymentEntity.getAccountTrxns()) {
            for (FinancialTransactionBO financialTransactionBO : accountTrxnEntity.getFinancialTransactions()) {
                ids.add(financialTransactionBO.getTrxnId());
            }
        }
    }
    loan.setUserContext(TestUtils.makeUser());
    List<TransactionHistoryDto> trxnHistlist = loan.getTransactionHistoryView();
    Assert.assertNotNull("Account TrxnHistoryView list object should not be null", trxnHistlist);
    Assert.assertTrue("Account TrxnHistoryView list object Size should be greater than zero", trxnHistlist.size() > 0);
    Assert.assertEquals(ids.size(), trxnHistlist.size());
    int i = 0;
    for (TransactionHistoryDto transactionHistoryDto : trxnHistlist) {
        Assert.assertEquals(ids.get(i), transactionHistoryDto.getAccountTrxnId());
        i++;
    }
    StaticHibernateUtil.flushSession();
    groupLoan = TestObjectFactory.getObject(LoanBO.class, loan.getAccountId());
}
Also used : PaymentData(org.mifos.accounts.util.helpers.PaymentData) FinancialTransactionBO(org.mifos.accounts.financial.business.FinancialTransactionBO) LoanBO(org.mifos.accounts.loan.business.LoanBO) ArrayList(java.util.ArrayList) Date(java.sql.Date) TransactionHistoryDto(org.mifos.dto.screen.TransactionHistoryDto) Test(org.junit.Test)

Example 8 with TransactionHistoryDto

use of org.mifos.dto.screen.TransactionHistoryDto in project head by mifos.

the class ViewLoanAccountDetailsController method showLoanAccountTransactionHistory.

@RequestMapping(value = "/viewLoanAccountTransactionHistory", method = RequestMethod.GET)
public ModelAndView showLoanAccountTransactionHistory(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView modelAndView = new ModelAndView();
    sitePreferenceHelper.resolveSiteType(modelAndView, "viewLoanAccountTransactionHistory", request);
    modelAndView.addObject("include_page", new IncludePage(request, response));
    String globalAccountNum = request.getParameter("globalAccountNum");
    LoanInformationDto loanInformationDto = loanAccountServiceFacade.retrieveLoanInformation(globalAccountNum);
    modelAndView.addObject("loanInformationDto", loanInformationDto);
    AccountingConfigurationDto configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
    modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
    List<TransactionHistoryDto> transactionHistoryDto = this.centerServiceFacade.retrieveAccountTransactionHistory(globalAccountNum);
    request.setAttribute("trxnHistoryList", transactionHistoryDto);
    return modelAndView;
}
Also used : AccountingConfigurationDto(org.mifos.config.servicefacade.dto.AccountingConfigurationDto) ModelAndView(org.springframework.web.servlet.ModelAndView) IncludePage(freemarker.ext.servlet.IncludePage) LoanInformationDto(org.mifos.dto.screen.LoanInformationDto) TransactionHistoryDto(org.mifos.dto.screen.TransactionHistoryDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

TransactionHistoryDto (org.mifos.dto.screen.TransactionHistoryDto)8 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 LoanBO (org.mifos.accounts.loan.business.LoanBO)4 AccountBO (org.mifos.accounts.business.AccountBO)3 PaymentData (org.mifos.accounts.util.helpers.PaymentData)3 Date (java.sql.Date)2 FinancialTransactionBO (org.mifos.accounts.financial.business.FinancialTransactionBO)2 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)2 IncludePage (freemarker.ext.servlet.IncludePage)1 Date (java.util.Date)1 List (java.util.List)1 Session (org.hibernate.Session)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1 AccountBusinessService (org.mifos.accounts.business.service.AccountBusinessService)1 AccountException (org.mifos.accounts.exceptions.AccountException)1 AccountingConfigurationDto (org.mifos.config.servicefacade.dto.AccountingConfigurationDto)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 CustomerBO (org.mifos.customers.business.CustomerBO)1 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)1