Search in sources :

Example 11 with LoanActivityDto

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

the class ReverseLoanDisbursalAction method load.

@TransactionDemarcate(joinToken = true)
public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    logger.debug("Inside load method");
    ReverseLoanDisbursalActionForm actionForm = (ReverseLoanDisbursalActionForm) form;
    String searchString = actionForm.getSearchString();
    String globalAccountNum = searchString;
    if (StringUtils.isNotEmpty(globalAccountNum)) {
        globalAccountNum = globalAccountNum.trim();
    }
    List<LoanActivityDto> payments = this.loanAccountServiceFacade.retrieveLoanPaymentsForReversal(globalAccountNum);
    LoanBO loan = this.loanDao.findByGlobalAccountNum(globalAccountNum);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, loan, request);
    SessionUtils.setCollectionAttribute(LoanConstants.PAYMENTS_LIST, payments, request);
    SessionUtils.setAttribute(LoanConstants.PAYMENTS_SIZE, payments.size(), request);
    logger.debug("Outside load method");
    return mapping.findForward(ActionForwards.load_success.toString());
}
Also used : ReverseLoanDisbursalActionForm(org.mifos.accounts.loan.struts.actionforms.ReverseLoanDisbursalActionForm) LoanActivityDto(org.mifos.dto.domain.LoanActivityDto) LoanBO(org.mifos.accounts.loan.business.LoanBO) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 12 with LoanActivityDto

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

the class LoanActivityEntity method sumGroupToDto.

public LoanActivityDto sumGroupToDto(Money interestOutstanding, Money principalOutstanding, Money feeOutstanding, Money penaltyOutstanding) {
    LoanActivityDto loanActivityDto = new LoanActivityDto();
    loanActivityDto.setId(this.account.getAccountId());
    loanActivityDto.setActionDate(this.trxnCreatedDate);
    loanActivityDto.setActivity(this.comments);
    loanActivityDto.setPrincipal(removeSign(this.principal).toString());
    loanActivityDto.setInterest(removeSign(this.interest).toString());
    loanActivityDto.setPenalty(removeSign(this.penalty).toString());
    loanActivityDto.setFees(removeSign(this.fee).toString());
    Money total = removeSign(this.fee).add(removeSign(this.penalty)).add(removeSign(this.principal)).add(removeSign(this.interest));
    loanActivityDto.setTotal(total.toString());
    loanActivityDto.setTotalValue(total.getAmount().doubleValue());
    loanActivityDto.setTimeStamp(this.trxnCreatedDate);
    loanActivityDto.setRunningBalanceInterest(interestOutstanding.toString());
    loanActivityDto.setRunningBalancePrinciple(principalOutstanding.toString());
    loanActivityDto.setRunningBalanceFees(feeOutstanding.toString());
    loanActivityDto.setRunningBalancePenalty(penaltyOutstanding.toString());
    loanActivityDto.setRunningBalancePrincipleWithInterestAndFees(principalOutstanding.add(interestOutstanding).add(feeOutstanding).toString());
    return loanActivityDto;
}
Also used : Money(org.mifos.framework.util.helpers.Money) LoanActivityDto(org.mifos.dto.domain.LoanActivityDto)

Example 13 with LoanActivityDto

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

the class LoanActivityEntity method toDto.

public LoanActivityDto toDto() {
    LoanActivityDto loanActivityDto = new LoanActivityDto();
    loanActivityDto.setId(this.account.getAccountId());
    loanActivityDto.setActionDate(this.trxnCreatedDate);
    loanActivityDto.setActivity(this.comments);
    loanActivityDto.setPrincipal(removeSign(this.principal).toString());
    loanActivityDto.setInterest(removeSign(this.interest).toString());
    loanActivityDto.setPenalty(removeSign(this.penalty).toString());
    loanActivityDto.setFees(removeSign(this.fee).toString());
    Money total = removeSign(this.fee).add(removeSign(this.penalty)).add(removeSign(this.principal)).add(removeSign(this.interest));
    loanActivityDto.setTotal(total.toString());
    loanActivityDto.setTotalValue(total.getAmount().doubleValue());
    loanActivityDto.setTimeStamp(this.trxnCreatedDate);
    loanActivityDto.setRunningBalanceInterest(this.interestOutstanding.toString());
    loanActivityDto.setRunningBalancePrinciple(this.principalOutstanding.toString());
    loanActivityDto.setRunningBalanceFees(this.feeOutstanding.toString());
    loanActivityDto.setRunningBalancePenalty(this.penaltyOutstanding.toString());
    loanActivityDto.setRunningBalancePrincipleWithInterestAndFees(this.principalOutstanding.add(this.interestOutstanding).add(this.feeOutstanding).toString());
    return loanActivityDto;
}
Also used : Money(org.mifos.framework.util.helpers.Money) LoanActivityDto(org.mifos.dto.domain.LoanActivityDto)

Example 14 with LoanActivityDto

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

the class LoanAccountServiceFacadeWebTier method getRecentActivityView.

private List<LoanActivityDto> getRecentActivityView(final String globalAccountNumber) {
    LoanBO loanBO = loanDao.findByGlobalAccountNum(globalAccountNumber);
    List<LoanActivityEntity> loanAccountActivityDetails = loanBO.getLoanActivityDetails();
    List<LoanActivityDto> recentActivityView = new ArrayList<LoanActivityDto>();
    int count = 0;
    for (LoanActivityEntity loanActivity : loanAccountActivityDetails) {
        recentActivityView.add(getLoanActivityView(loanActivity));
        if (++count == 3) {
            break;
        }
    }
    return recentActivityView;
}
Also used : LoanActivityEntity(org.mifos.accounts.loan.business.LoanActivityEntity) LoanActivityDto(org.mifos.dto.domain.LoanActivityDto) LoanBO(org.mifos.accounts.loan.business.LoanBO) ArrayList(java.util.ArrayList)

Example 15 with LoanActivityDto

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

the class LoanAccountServiceFacadeWebTier method retrieveAllLoanAccountActivities.

@Override
public List<LoanActivityDto> retrieveAllLoanAccountActivities(String globalAccountNum) {
    LoanBO loan = this.loanDao.findByGlobalAccountNum(globalAccountNum);
    List<LoanActivityEntity> loanAccountActivityDetails = loan.getLoanActivityDetails();
    List<LoanActivityDto> loanActivityViewSet = new ArrayList<LoanActivityDto>();
    for (LoanActivityEntity loanActivity : loanAccountActivityDetails) {
        loanActivityViewSet.add(loanActivity.toDto());
    }
    return loanActivityViewSet;
}
Also used : LoanActivityEntity(org.mifos.accounts.loan.business.LoanActivityEntity) LoanActivityDto(org.mifos.dto.domain.LoanActivityDto) LoanBO(org.mifos.accounts.loan.business.LoanBO) ArrayList(java.util.ArrayList)

Aggregations

LoanActivityDto (org.mifos.dto.domain.LoanActivityDto)16 LoanBO (org.mifos.accounts.loan.business.LoanBO)8 ArrayList (java.util.ArrayList)7 LoanInformationDto (org.mifos.dto.screen.LoanInformationDto)5 Money (org.mifos.framework.util.helpers.Money)5 LoanAccountDetailsDto (org.mifos.dto.domain.LoanAccountDetailsDto)4 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)4 UserContext (org.mifos.security.util.UserContext)4 HashSet (java.util.HashSet)3 LoanActivityEntity (org.mifos.accounts.loan.business.LoanActivityEntity)3 LoanAccountActionForm (org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm)3 RepaymentScheduleInstallment (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)3 MessageLookup (org.mifos.application.master.MessageLookup)3 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)3 MifosRuntimeException (org.mifos.core.MifosRuntimeException)3 ValueListElement (org.mifos.dto.domain.ValueListElement)3 ApplicationException (org.mifos.framework.exceptions.ApplicationException)3 QuestionGroupInstanceDetail (org.mifos.platform.questionnaire.service.QuestionGroupInstanceDetail)3 IncludePage (freemarker.ext.servlet.IncludePage)2 Date (java.util.Date)2