use of org.mifos.platform.cashflow.ui.model.MonthlyCashFlowForm in project head by mifos.
the class CashFlowController method retrieveMonthlyCashflowDetails.
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public List<MonthlyCashFlowDto> retrieveMonthlyCashflowDetails(CashFlowForm cashFlowForm, Date disbursementDate, Double loanAmount) {
List<MonthlyCashFlowDto> cashflowDtos = new ArrayList<MonthlyCashFlowDto>();
for (MonthlyCashFlowForm monthlyCashflowform : cashFlowForm.getMonthlyCashFlows()) {
BigDecimal monthlyRevenue = monthlyCashflowform.getRevenue();
BigDecimal cumulativeCashflow = monthlyCashflowform.getCumulativeCashFlow();
if (isSameMonthYear(new LocalDate(monthlyCashflowform.getDate()), new LocalDate(disbursementDate))) {
if (monthlyRevenue == null) {
monthlyRevenue = BigDecimal.valueOf(loanAmount);
} else {
monthlyRevenue = BigDecimal.valueOf(loanAmount).add(monthlyCashflowform.getRevenue());
}
}
if (isAfterOrOnDisbursementMonthYear(new LocalDate(monthlyCashflowform.getDate()), new LocalDate(disbursementDate))) {
if (cumulativeCashflow == null) {
cumulativeCashflow = BigDecimal.valueOf(loanAmount);
} else {
cumulativeCashflow = cumulativeCashflow.add(BigDecimal.valueOf(loanAmount));
}
}
MonthlyCashFlowDto monthlyCashFlow = new MonthlyCashFlowDto(monthlyCashflowform.getDateTime(), cumulativeCashflow, monthlyCashflowform.getNotes(), monthlyRevenue, monthlyCashflowform.getExpense());
cashflowDtos.add(monthlyCashFlow);
}
return cashflowDtos;
}
use of org.mifos.platform.cashflow.ui.model.MonthlyCashFlowForm in project head by mifos.
the class CashFlowController method transformCashFlow.
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public LoanAccountCashFlow transformCashFlow(CashFlowForm cashFlow) {
BigDecimal totalCapital = cashFlow.getTotalCapital();
BigDecimal totalLiability = cashFlow.getTotalLiability();
List<MonthlyCashFlowDto> cashflowDtos = new ArrayList<MonthlyCashFlowDto>();
for (MonthlyCashFlowForm monthlyCashflowform : cashFlow.getMonthlyCashFlows()) {
MonthlyCashFlowDto monthlyCashFlow = new MonthlyCashFlowDto(monthlyCashflowform.getDateTime(), monthlyCashflowform.getCumulativeCashFlow(), monthlyCashflowform.getNotes(), monthlyCashflowform.getRevenue(), monthlyCashflowform.getExpense());
cashflowDtos.add(monthlyCashFlow);
}
return new LoanAccountCashFlow(cashflowDtos, totalCapital, totalLiability);
}
Aggregations