Search in sources :

Example 1 with LoanInstallmentDetailsDto

use of org.mifos.dto.domain.LoanInstallmentDetailsDto in project head by mifos.

the class LoanAccountAction method getInstallmentDetails.

@TransactionDemarcate(joinToken = true)
public ActionForward getInstallmentDetails(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception {
    Integer accountId = Integer.valueOf(request.getParameter(ACCOUNT_ID));
    LoanInstallmentDetailsDto loanInstallmentDetailsDto = this.loanAccountServiceFacade.retrieveInstallmentDetails(accountId);
    SessionUtils.setAttribute(VIEW_UPCOMING_INSTALLMENT_DETAILS, loanInstallmentDetailsDto.getUpcomingInstallmentDetails(), request);
    SessionUtils.setAttribute(VIEW_OVERDUE_INSTALLMENT_DETAILS, loanInstallmentDetailsDto.getOverDueInstallmentDetails(), request);
    SessionUtils.setAttribute(TOTAL_AMOUNT_OVERDUE, loanInstallmentDetailsDto.getTotalAmountDue(), request);
    SessionUtils.setAttribute(NEXTMEETING_DATE, loanInstallmentDetailsDto.getNextMeetingDate(), request);
    if (null == this.loanDao.findById(accountId).getParentAccount() && this.loanDao.findById(accountId).isGroupLoanAccount()) {
        SessionUtils.setAttribute("isNewGlim", "isNewGlim", request);
    }
    return mapping.findForward(VIEWINSTALLMENTDETAILS_SUCCESS);
}
Also used : LoanInstallmentDetailsDto(org.mifos.dto.domain.LoanInstallmentDetailsDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with LoanInstallmentDetailsDto

use of org.mifos.dto.domain.LoanInstallmentDetailsDto in project head by mifos.

the class LoanAccountServiceFacadeWebTier method retrieveInstallmentDetails.

@Override
public LoanInstallmentDetailsDto retrieveInstallmentDetails(Integer accountId) {
    MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = new UserContextFactory().create(mifosUser);
    LoanBO loanBO = this.loanDao.findById(accountId);
    try {
        personnelDao.checkAccessPermission(userContext, loanBO.getOfficeId(), loanBO.getCustomer().getLoanOfficerId());
    } catch (AccountException e) {
        throw new MifosRuntimeException(e.getMessage(), e);
    }
    InstallmentDetailsDto viewUpcomingInstallmentDetails;
    InstallmentDetailsDto viewOverDueInstallmentDetails;
    if (loanBO.isGroupLoanAccount() && null == loanBO.getParentAccount()) {
        List<AccountActionDateEntity> memberDetailsOfNextInstallment = new ArrayList<AccountActionDateEntity>();
        List<List<AccountActionDateEntity>> memberDetailsOfInstallmentsInArrears = new ArrayList<List<AccountActionDateEntity>>();
        for (LoanBO member : loanBO.getMemberAccounts()) {
            memberDetailsOfNextInstallment.add(member.getDetailsOfNextInstallment());
            memberDetailsOfInstallmentsInArrears.add(member.getDetailsOfInstallmentsInArrears());
        }
        viewUpcomingInstallmentDetails = getUpcomingInstallmentDetailsForGroupLoan(memberDetailsOfNextInstallment, loanBO.getCurrency());
        viewOverDueInstallmentDetails = getOverDueInstallmentDetailsForGroupLoan(memberDetailsOfInstallmentsInArrears, loanBO.getCurrency());
    } else {
        viewUpcomingInstallmentDetails = getUpcomingInstallmentDetails(loanBO.getDetailsOfNextInstallment(), loanBO.getCurrency());
        viewOverDueInstallmentDetails = getOverDueInstallmentDetails(loanBO.getDetailsOfInstallmentsInArrears(), loanBO.getCurrency());
    }
    Money upcomingInstallmentSubTotal = new Money(loanBO.getCurrency(), viewUpcomingInstallmentDetails.getSubTotal());
    Money overdueInstallmentSubTotal = new Money(loanBO.getCurrency(), viewOverDueInstallmentDetails.getSubTotal());
    Money totalAmountDue = upcomingInstallmentSubTotal.add(overdueInstallmentSubTotal);
    return new LoanInstallmentDetailsDto(viewUpcomingInstallmentDetails, viewOverDueInstallmentDetails, totalAmountDue.toString(), loanBO.getNextMeetingDate());
}
Also used : InstallmentDetailsDto(org.mifos.dto.domain.InstallmentDetailsDto) LoanInstallmentDetailsDto(org.mifos.dto.domain.LoanInstallmentDetailsDto) UserContext(org.mifos.security.util.UserContext) LoanBO(org.mifos.accounts.loan.business.LoanBO) ArrayList(java.util.ArrayList) MifosUser(org.mifos.security.MifosUser) UserContextFactory(org.mifos.accounts.servicefacade.UserContextFactory) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) Money(org.mifos.framework.util.helpers.Money) AccountException(org.mifos.accounts.exceptions.AccountException) ArrayList(java.util.ArrayList) List(java.util.List) LoanInstallmentDetailsDto(org.mifos.dto.domain.LoanInstallmentDetailsDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 3 with LoanInstallmentDetailsDto

use of org.mifos.dto.domain.LoanInstallmentDetailsDto in project head by mifos.

the class ViewLoanAccountDetailsController method showLoanAccountNextInstallmentDetails.

@RequestMapping(value = "/viewLoanAccountNextInstallmentDetails", method = RequestMethod.GET)
public ModelAndView showLoanAccountNextInstallmentDetails(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView modelAndView = new ModelAndView();
    sitePreferenceHelper.resolveSiteType(modelAndView, "viewLoanAccountNextInstallmentDetails", request);
    modelAndView.addObject("include_page", new IncludePage(request, response));
    String globalAccountNum = request.getParameter("globalAccountNum");
    LoanInformationDto loanInformationDto = loanAccountServiceFacade.retrieveLoanInformation(globalAccountNum);
    LoanInstallmentDetailsDto loanInstallmentDetailsDto = this.loanAccountServiceFacade.retrieveInstallmentDetails(loanInformationDto.getAccountId());
    modelAndView.addObject("loanInformationDto", loanInformationDto);
    modelAndView.addObject("loanInstallmentDetailsDto", loanInstallmentDetailsDto);
    this.loanAccountServiceFacade.putLoanBusinessKeyInSession(globalAccountNum, request);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) IncludePage(freemarker.ext.servlet.IncludePage) LoanInformationDto(org.mifos.dto.screen.LoanInformationDto) LoanInstallmentDetailsDto(org.mifos.dto.domain.LoanInstallmentDetailsDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

LoanInstallmentDetailsDto (org.mifos.dto.domain.LoanInstallmentDetailsDto)3 IncludePage (freemarker.ext.servlet.IncludePage)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1 AccountException (org.mifos.accounts.exceptions.AccountException)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 InstallmentDetailsDto (org.mifos.dto.domain.InstallmentDetailsDto)1 LoanInformationDto (org.mifos.dto.screen.LoanInformationDto)1 Money (org.mifos.framework.util.helpers.Money)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1 MifosUser (org.mifos.security.MifosUser)1 UserContext (org.mifos.security.util.UserContext)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1