Search in sources :

Example 1 with AccountPaymentDto

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

the class ViewCustomerDetailsController method showLastPaymentReceipt.

@RequestMapping(value = "/printClientPaymentReceipt", method = RequestMethod.GET)
public ModelAndView showLastPaymentReceipt(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String globalAccountNum) {
    ModelAndView modelAndView = new ModelAndView("printClientPaymentReceipt");
    String gan = null;
    if (globalAccountNum == null) {
        gan = request.getSession().getAttribute("globalAccountNum").toString();
    } else {
        gan = globalAccountNum;
    }
    String clientSystemId = request.getParameter("globalCustNum");
    AccountPaymentDto clientAccountPayment = clientServiceFacade.getClientAccountPayments(gan).get(0);
    List<AdminDocumentDto> adminDocuments = adminDocumentsServiceFacade.getAdminDocumentsForAccountPayment(clientAccountPayment.getPaymentId());
    if (adminDocuments != null && !adminDocuments.isEmpty()) {
        clientAccountPayment.setAdminDocuments(adminDocuments);
    }
    modelAndView.addObject("clientAccountPayment", clientAccountPayment);
    modelAndView.addObject("globalAccountNum", gan);
    modelAndView.addObject("clientSystemId", clientSystemId);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) AdminDocumentDto(org.mifos.dto.domain.AdminDocumentDto) AccountPaymentDto(org.mifos.dto.screen.AccountPaymentDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with AccountPaymentDto

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

the class ClientServiceFacadeWebTier method getClientAccountPayments.

@Override
public List<AccountPaymentDto> getClientAccountPayments(String globalAccountNum) {
    List<AccountPaymentDto> clientAccountPayments = new ArrayList<AccountPaymentDto>();
    try {
        AccountBO account = legacyAccountDao.findBySystemId(globalAccountNum);
        List<AccountPaymentEntity> clientAccountPaymentsEntities = account.getAccountPayments();
        for (AccountPaymentEntity accountPaymentEntity : clientAccountPaymentsEntities) {
            clientAccountPayments.add(accountPaymentEntity.toScreenDto());
        }
    } catch (PersistenceException e) {
        throw new MifosRuntimeException(e);
    }
    return clientAccountPayments;
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) ArrayList(java.util.ArrayList) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) PersistenceException(org.mifos.framework.exceptions.PersistenceException) AccountPaymentDto(org.mifos.dto.screen.AccountPaymentDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 3 with AccountPaymentDto

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

the class LoanAccountServiceFacadeWebTier method getLoanAccountPayments.

@Override
public List<AccountPaymentDto> getLoanAccountPayments(String globalAccountNum) {
    List<AccountPaymentDto> loanAccountPayments = new ArrayList<AccountPaymentDto>();
    LoanBO loanAccount = loanDao.findByGlobalAccountNum(globalAccountNum);
    List<AccountPaymentEntity> loanAccountPaymentsEntities = loanAccount.getAccountPayments();
    for (AccountPaymentEntity accountPaymentEntity : loanAccountPaymentsEntities) {
        loanAccountPayments.add(accountPaymentEntity.toScreenDto());
    }
    //for new group loan accounts
    if (loanAccount.isGroupLoanAccount() && null == loanAccount.getParentAccount()) {
        for (LoanBO member : loanAccount.getMemberAccounts()) {
            for (AccountPaymentEntity accPayment : member.getAccountPayments()) {
                if (!accPayment.isLoanDisbursment()) {
                    loanAccountPayments.add(accPayment.toScreenDto());
                }
            }
        }
        Collections.sort(loanAccountPayments, new AccountPaymentDtoComperator());
        Collections.reverse(loanAccountPayments);
    }
    return loanAccountPayments;
}
Also used : AccountPaymentDtoComperator(org.mifos.application.util.helpers.AccountPaymentDtoComperator) LoanBO(org.mifos.accounts.loan.business.LoanBO) ArrayList(java.util.ArrayList) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) AccountPaymentDto(org.mifos.dto.screen.AccountPaymentDto)

Example 4 with AccountPaymentDto

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

the class ViewLoanAccountDetailsController method showLastPaymentReceipt.

@RequestMapping(value = "/printPaymentReceipt", method = RequestMethod.GET)
public ModelAndView showLastPaymentReceipt(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String globalAccountNum) {
    ModelAndView modelAndView = new ModelAndView("printPaymentReceipt");
    String gan = null;
    if (globalAccountNum == null) {
        gan = request.getSession().getAttribute("globalAccountNum").toString();
    } else {
        gan = globalAccountNum;
    }
    AccountPaymentDto loanAccountPayment = loanAccountServiceFacade.getLoanAccountPayments(gan).get(0);
    if (loanAccountServiceFacade.getGroupLoanType(gan).equals(GROUP_LOAN_PARENT)) {
        Integer accountId = loanAccountServiceFacade.retrieveLoanInformation(gan).getAccountId();
        List<AccountPaymentDto> loanAccountPayments = loanAccountServiceFacade.getLoanAccountPayments(gan);
        for (AccountPaymentDto payment : loanAccountPayments) {
            if (payment.getAccount().getAccountId() == accountId) {
                loanAccountPayment = payment;
                break;
            }
        }
    }
    List<AdminDocumentDto> adminDocuments = adminDocumentsServiceFacade.getAdminDocumentsForAccountPayment(loanAccountPayment.getPaymentId());
    if (adminDocuments != null && !adminDocuments.isEmpty()) {
        loanAccountPayment.setAdminDocuments(adminDocuments);
    }
    modelAndView.addObject("loanAccountPayment", loanAccountPayment);
    modelAndView.addObject("globalAccountNum", gan);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) AdminDocumentDto(org.mifos.dto.domain.AdminDocumentDto) AccountPaymentDto(org.mifos.dto.screen.AccountPaymentDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with AccountPaymentDto

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

the class ViewLoanAccountDetailsController method showLoanAccountPayments.

@RequestMapping(value = "/viewLoanAccountPayments", method = RequestMethod.GET)
public ModelAndView showLoanAccountPayments(HttpServletRequest request, HttpServletResponse response, @RequestParam String globalAccountNum) {
    ModelAndView modelAndView = new ModelAndView("viewLoanAccountPayments");
    List<AccountPaymentDto> loanAccountPayments = loanAccountServiceFacade.getLoanAccountPayments(globalAccountNum);
    for (AccountPaymentDto accountPaymentDto : loanAccountPayments) {
        List<AdminDocumentDto> adminDocuments = adminDocumentsServiceFacade.getAdminDocumentsForAccountPayment(accountPaymentDto.getPaymentId());
        if (adminDocuments != null && !adminDocuments.isEmpty()) {
            accountPaymentDto.setAdminDocuments(adminDocuments);
        }
    }
    modelAndView.addObject("loanType", loanAccountServiceFacade.getGroupLoanType(globalAccountNum));
    modelAndView.addObject("loanAccountPayments", loanAccountPayments);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) AdminDocumentDto(org.mifos.dto.domain.AdminDocumentDto) AccountPaymentDto(org.mifos.dto.screen.AccountPaymentDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

AccountPaymentDto (org.mifos.dto.screen.AccountPaymentDto)5 AdminDocumentDto (org.mifos.dto.domain.AdminDocumentDto)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ModelAndView (org.springframework.web.servlet.ModelAndView)3 ArrayList (java.util.ArrayList)2 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)2 AccountBO (org.mifos.accounts.business.AccountBO)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 AccountPaymentDtoComperator (org.mifos.application.util.helpers.AccountPaymentDtoComperator)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1