Search in sources :

Example 1 with OriginalScheduleInfoDto

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

the class ViewLoanAccountDetailsController method showLoanAccountRepaymentSchedule.

@RequestMapping(value = "/viewLoanAccountRepaymentSchedule", method = RequestMethod.GET)
public ModelAndView showLoanAccountRepaymentSchedule(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView modelAndView = new ModelAndView();
    sitePreferenceHelper.resolveSiteType(modelAndView, "viewLoanAccountRepaymentSchedule", request);
    modelAndView.addObject("include_page", new IncludePage(request, response));
    String globalAccountNum = request.getParameter("globalAccountNum");
    LoanInformationDto loanInformationDto = loanAccountServiceFacade.retrieveLoanInformation(globalAccountNum);
    modelAndView.addObject("loanInformationDto", loanInformationDto);
    modelAndView.addObject("currentDate", new Date());
    OriginalScheduleInfoDto originalScheduleInfoDto = loanAccountServiceFacade.retrieveOriginalLoanSchedule(globalAccountNum);
    modelAndView.addObject("isOriginalScheduleAvailable", originalScheduleInfoDto.hasOriginalInstallments());
    this.loanAccountServiceFacade.putLoanBusinessKeyInSession(globalAccountNum, request);
    return modelAndView;
}
Also used : OriginalScheduleInfoDto(org.mifos.dto.domain.OriginalScheduleInfoDto) ModelAndView(org.springframework.web.servlet.ModelAndView) IncludePage(freemarker.ext.servlet.IncludePage) LoanInformationDto(org.mifos.dto.screen.LoanInformationDto) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with OriginalScheduleInfoDto

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

the class ViewLoanAccountDetailsController method showLoanAccountOriginalSchedule.

@RequestMapping(value = "/viewLoanAccountOriginalSchedule", method = RequestMethod.GET)
public ModelAndView showLoanAccountOriginalSchedule(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView modelAndView = new ModelAndView();
    sitePreferenceHelper.resolveSiteType(modelAndView, "viewLoanAccountOriginalSchedule", request);
    modelAndView.addObject("include_page", new IncludePage(request, response));
    String globalAccountNum = request.getParameter("globalAccountNum");
    LoanInformationDto loanInformationDto = loanAccountServiceFacade.retrieveLoanInformation(globalAccountNum);
    modelAndView.addObject("loanInformationDto", loanInformationDto);
    OriginalScheduleInfoDto originalScheduleInfoDto = loanAccountServiceFacade.retrieveOriginalLoanSchedule(globalAccountNum);
    modelAndView.addObject("originalScheduleInfoDto", originalScheduleInfoDto);
    // for mifostabletag 
    request.setAttribute("originalInstallments", originalScheduleInfoDto.getOriginalLoanScheduleInstallments());
    this.loanAccountServiceFacade.putLoanBusinessKeyInSession(globalAccountNum, request);
    return modelAndView;
}
Also used : OriginalScheduleInfoDto(org.mifos.dto.domain.OriginalScheduleInfoDto) ModelAndView(org.springframework.web.servlet.ModelAndView) IncludePage(freemarker.ext.servlet.IncludePage) LoanInformationDto(org.mifos.dto.screen.LoanInformationDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with OriginalScheduleInfoDto

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

the class LoanAccountServiceFacadeWebTier method retrieveOriginalLoanSchedule.

@Override
public OriginalScheduleInfoDto retrieveOriginalLoanSchedule(String globalAccountNum) {
    LoanBO loanBO = this.loanDao.findByGlobalAccountNum(globalAccountNum);
    Integer accountId = loanBO.getAccountId();
    try {
        List<OriginalLoanScheduleEntity> loanScheduleEntities = loanBusinessService.retrieveOriginalLoanSchedule(accountId);
        ArrayList<RepaymentScheduleInstallmentDto> repaymentScheduleInstallments = new ArrayList<RepaymentScheduleInstallmentDto>();
        for (OriginalLoanScheduleEntity loanScheduleEntity : loanScheduleEntities) {
            RepaymentScheduleInstallment repaymentScheduleInstallment = loanScheduleEntity.toDto();
            RepaymentScheduleInstallmentDto installmentDto = new RepaymentScheduleInstallmentDto(repaymentScheduleInstallment.getInstallment(), repaymentScheduleInstallment.getPrincipal().toString(), repaymentScheduleInstallment.getInterest().toString(), repaymentScheduleInstallment.getFees().toString(), repaymentScheduleInstallment.getMiscFees().toString(), repaymentScheduleInstallment.getFeesWithMiscFee().toString(), repaymentScheduleInstallment.getMiscPenalty().toString(), repaymentScheduleInstallment.getTotal(), repaymentScheduleInstallment.getDueDate());
            repaymentScheduleInstallments.add(installmentDto);
        }
        return new OriginalScheduleInfoDto(loanBO.getLoanAmount().toString(), loanBO.getDisbursementDate(), repaymentScheduleInstallments);
    } catch (PersistenceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment) OriginalScheduleInfoDto(org.mifos.dto.domain.OriginalScheduleInfoDto) LoanBO(org.mifos.accounts.loan.business.LoanBO) OriginalLoanScheduleEntity(org.mifos.accounts.loan.business.OriginalLoanScheduleEntity) RepaymentScheduleInstallmentDto(org.mifos.dto.domain.RepaymentScheduleInstallmentDto) ArrayList(java.util.ArrayList) PersistenceException(org.mifos.framework.exceptions.PersistenceException) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Aggregations

OriginalScheduleInfoDto (org.mifos.dto.domain.OriginalScheduleInfoDto)3 IncludePage (freemarker.ext.servlet.IncludePage)2 LoanInformationDto (org.mifos.dto.screen.LoanInformationDto)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 OriginalLoanScheduleEntity (org.mifos.accounts.loan.business.OriginalLoanScheduleEntity)1 RepaymentScheduleInstallment (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 RepaymentScheduleInstallmentDto (org.mifos.dto.domain.RepaymentScheduleInstallmentDto)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1