use of org.mifos.dto.screen.SavingsTransactionHistoryDto in project head by mifos.
the class SavingsAccountController method showSavingsAccountTransactionHistory.
@RequestMapping(value = "/viewSavingsAccountTransactionHistory", method = RequestMethod.GET)
public ModelAndView showSavingsAccountTransactionHistory(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewSavingsAccountTransactionHistory", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String globalAccountNum = request.getParameter("globalAccountNum");
SavingsAccountDetailDto savingsAccountDetailDto = savingsServiceFacade.retrieveSavingsAccountDetails(globalAccountNum);
modelAndView.addObject("savingsAccountDetailDto", savingsAccountDetailDto);
List<SavingsTransactionHistoryDto> savingsTransactionHistoryViewList = this.savingsServiceFacade.retrieveTransactionHistory(globalAccountNum);
request.setAttribute("trxnHistoryList", savingsTransactionHistoryViewList);
savingsServiceFacade.putSavingsBusinessKeyInSession(globalAccountNum, request);
return modelAndView;
}
use of org.mifos.dto.screen.SavingsTransactionHistoryDto in project head by mifos.
the class SavingsActionStrutsTest method ignore_testSuccessfulGetStatusHistory.
/**
* ignoring as test fails due to lazy init which doesnt happen in application
*/
public void ignore_testSuccessfulGetStatusHistory() throws Exception {
SavingsTestHelper helper = new SavingsTestHelper();
createInitialObjects();
savingsOffering = helper.createSavingsOffering("asfddsf", "213a");
savings = helper.createSavingsAccount("000100000000017", savingsOffering, group, AccountStates.SAVINGS_ACC_PARTIALAPPLICATION, userContext);
Hibernate.initialize(savings);
savingsOffering = null;
AccountStateMachines.getInstance().initialize(AccountTypes.SAVINGS_ACCOUNT, null);
PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
savings.changeStatus(AccountState.SAVINGS_PENDING_APPROVAL, null, "notes", loggedInUser);
Assert.assertEquals(AccountStates.SAVINGS_ACC_PENDINGAPPROVAL, savings.getAccountState().getId().shortValue());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, savings, request);
SessionUtils.setAttribute(Constants.USER_CONTEXT_KEY, TestUtils.makeUser(), request.getSession());
setRequestPathInfo("/savingsAction.do");
addRequestParameter("method", "getStatusHistory");
addRequestParameter("globalAccountNum", savings.getGlobalAccountNum());
actionPerform();
verifyForward("getStatusHistory_success");
verifyNoActionErrors();
verifyNoActionMessages();
Assert.assertEquals(2, ((List<SavingsTransactionHistoryDto>) SessionUtils.getAttribute(SavingsConstants.STATUS_CHANGE_HISTORY_LIST, request)).size());
}
use of org.mifos.dto.screen.SavingsTransactionHistoryDto in project head by mifos.
the class SavingsServiceFacadeWebTier method retrieveTransactionHistory.
@Override
public List<SavingsTransactionHistoryDto> retrieveTransactionHistory(String globalAccountNum) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
SavingsBO savingsAccount = this.savingsDao.findBySystemId(globalAccountNum);
CustomerBO customerBO = savingsAccount.getCustomer();
savingsAccount.updateDetails(userContext);
try {
personnelDao.checkAccessPermission(userContext, customerBO.getOfficeId(), customerBO.getLoanOfficerId());
} catch (AccountException e) {
throw new MifosRuntimeException("Access denied!", e);
}
List<SavingsTransactionHistoryDto> savingsTransactionHistoryViewList = new ArrayList<SavingsTransactionHistoryDto>();
// Check for order-by clause in AccountBO.hbm.xml,
// AccountPayment.hbm.xml and AccountTrxnEntity.hbm.xml for
// accountPaymentSet ,
// accountTrxnSet and financialBoSet. They all should be set for their
// primay key column desc in both. If stated is not there, the code
// below will behave abnormally.
List<AccountPaymentEntity> accountPaymentSet = savingsAccount.getAccountPayments();
for (AccountPaymentEntity accountPaymentEntity : accountPaymentSet) {
Set<AccountTrxnEntity> accountTrxnEntitySet = accountPaymentEntity.getAccountTrxns();
for (AccountTrxnEntity accountTrxnEntity : accountTrxnEntitySet) {
Set<FinancialTransactionBO> financialTransactionBOSet = accountTrxnEntity.getFinancialTransactions();
for (FinancialTransactionBO financialTransactionBO : financialTransactionBOSet) {
SavingsTransactionHistoryDto savingsTransactionHistoryDto = new SavingsTransactionHistoryDto();
savingsTransactionHistoryDto.setTransactionDate(financialTransactionBO.getActionDate());
String preferredTransactionDate = DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), financialTransactionBO.getActionDate().toString());
savingsTransactionHistoryDto.setUserPrefferedTransactionDate(preferredTransactionDate);
savingsTransactionHistoryDto.setPaymentId(accountTrxnEntity.getAccountPayment().getPaymentId());
savingsTransactionHistoryDto.setAccountTrxnId(accountTrxnEntity.getAccountTrxnId());
savingsTransactionHistoryDto.setType(financialTransactionBO.getFinancialAction().getName());
savingsTransactionHistoryDto.setGlcode(financialTransactionBO.getGlcode().getGlcode());
savingsTransactionHistoryDto.setGlname(financialTransactionBO.getGlcode().getAssociatedCOA().getAccountName());
if (financialTransactionBO.isDebitEntry()) {
savingsTransactionHistoryDto.setDebit(String.valueOf(removeSign(financialTransactionBO.getPostedAmount())));
} else if (financialTransactionBO.isCreditEntry()) {
savingsTransactionHistoryDto.setCredit(String.valueOf(removeSign(financialTransactionBO.getPostedAmount())));
}
savingsTransactionHistoryDto.setBalance(String.valueOf(removeSign(((SavingsTrxnDetailEntity) accountTrxnEntity).getBalance())));
savingsTransactionHistoryDto.setClientName(accountTrxnEntity.getCustomer().getDisplayName());
savingsTransactionHistoryDto.setPostedDate(financialTransactionBO.getPostedDate());
String preferredDate = DateUtils.getUserLocaleDate(userContext.getPreferredLocale(), financialTransactionBO.getPostedDate().toString());
savingsTransactionHistoryDto.setUserPrefferedPostedDate(preferredDate);
if (accountTrxnEntity.getPersonnel() != null) {
savingsTransactionHistoryDto.setPostedBy(accountTrxnEntity.getPersonnel().getDisplayName());
}
if (financialTransactionBO.getNotes() != null && !financialTransactionBO.getNotes().equals("")) {
savingsTransactionHistoryDto.setNotes(financialTransactionBO.getNotes());
}
savingsTransactionHistoryViewList.add(savingsTransactionHistoryDto);
}
}
}
return savingsTransactionHistoryViewList;
}
Aggregations