use of org.mifos.dto.domain.SavingsProductDto in project head by mifos.
the class SavingsProductPreviewController method processFormSubmit.
@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @RequestParam(value = EDIT_PARAM, required = false) String edit, @RequestParam(value = "editFormview", required = false) String editFormview, @ModelAttribute("savingsProduct") SavingsProductFormBean savingsProduct, BindingResult result) {
ModelAndView modelAndView = new ModelAndView(REDIRECT_TO_ADMIN);
configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
if (StringUtils.isNotBlank(cancel)) {
modelAndView.setViewName(REDIRECT_TO_ADMIN);
} else if (StringUtils.isNotBlank(edit)) {
modelAndView.setViewName(editFormview);
modelAndView.addObject("savingsProduct", savingsProduct);
} else if (result.hasErrors()) {
modelAndView.setViewName("previewSavingsProducts");
modelAndView.addObject("savingsProduct", savingsProduct);
modelAndView.addObject("editFormview", editFormview);
populateModelAndViewForPreview(savingsProduct, modelAndView);
} else {
PrdOfferingDto product;
SavingsProductDto savingsProductRequest = new SavingsProductFormBeanAssembler().assembleSavingsProductRequest(savingsProduct);
if (editFormview.equalsIgnoreCase("defineSavingsProduct")) {
try {
product = this.adminServiceFacade.createSavingsProduct(savingsProductRequest);
modelAndView.setViewName("redirect:/confirmSavingsProduct.ftl");
modelAndView.addObject("product", product);
} catch (BusinessRuleException e) {
handleBusinessRuleViolation(editFormview, savingsProduct, result, modelAndView, e.getMessageKey());
}
} else if (editFormview.equalsIgnoreCase("editSavingsProduct")) {
try {
product = this.adminServiceFacade.updateSavingsProduct(savingsProductRequest);
modelAndView.setViewName("redirect:/viewEditSavingsProduct.ftl?productId=" + product.getPrdOfferingId());
modelAndView.addObject("product", product);
} catch (BusinessRuleException e) {
handleBusinessRuleViolation(editFormview, savingsProduct, result, modelAndView, e.getMessageKey());
}
}
}
return modelAndView;
}
use of org.mifos.dto.domain.SavingsProductDto in project head by mifos.
the class EditSavingsProductsFormController method showPopulatedForm.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView showPopulatedForm(@RequestParam(value = "productId", required = true) Integer productId) {
ModelAndView modelAndView = new ModelAndView("editSavingsProduct");
configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
SavingsProductFormDto referenceData = this.adminServiceFacade.retrieveSavingsProductFormReferenceData();
SavingsProductDto savingsProductDto = adminServiceFacade.retrieveSavingsProductDetails(productId);
SavingsProductFormBean savingsProductBean = new SavingsProductFormBeanAssembler().assembleReferenceData(referenceData);
ProductDetailsDto productDto = savingsProductDto.getProductDetails();
GeneralProductBean productBean = new GeneralProductBeanAssembler().assembleFrom(savingsProductBean.getGeneralDetails(), productDto);
savingsProductBean.setGeneralDetails(productBean);
savingsProductBean.setSelectedDepositType(savingsProductDto.getDepositType().toString());
savingsProductBean.setAmountForDeposit(savingsProductDto.getAmountForDeposit());
if (savingsProductDto.getGroupMandatorySavingsType() > 0) {
savingsProductBean.setSelectedGroupSavingsApproach(savingsProductDto.getGroupMandatorySavingsType().toString());
} else {
savingsProductBean.setSelectedGroupSavingsApproach("");
}
savingsProductBean.setMaxWithdrawalAmount(savingsProductDto.getMaxWithdrawal());
savingsProductBean.setInterestRate(savingsProductDto.getInterestRate());
savingsProductBean.setSelectedInterestCalculation(savingsProductDto.getInterestCalculationType().toString());
savingsProductBean.setInterestCalculationFrequency(savingsProductDto.getInterestCalculationFrequency());
savingsProductBean.setSelectedFequencyPeriod(savingsProductDto.getInterestCalculationFrequencyPeriod().toString());
savingsProductBean.setInterestPostingMonthlyFrequency(savingsProductDto.getInterestPostingFrequency());
savingsProductBean.setMinBalanceRequiredForInterestCalculation(Long.toString(savingsProductDto.getMinBalanceForInterestCalculation().longValue()));
savingsProductBean.setIsDaily(savingsProductDto.isDailyPosting());
savingsProductBean.setSelectedPrincipalGlCode(savingsProductDto.getDepositGlCode().toString());
savingsProductBean.setSelectedInterestGlCode(savingsProductDto.getInterestGlCode().toString());
savingsProductBean.setNotUpdateable(savingsProductDto.isOpenSavingsAccountsExist());
modelAndView.addObject("savingsProduct", savingsProductBean);
return modelAndView;
}
use of org.mifos.dto.domain.SavingsProductDto in project head by mifos.
the class SavingsProductChangeLogController method showAllAuditLogsForSavingsProducts.
@ModelAttribute("auditLog")
@RequestMapping(method = RequestMethod.GET)
public AuditLogScreenDto showAllAuditLogsForSavingsProducts(@RequestParam(value = "productId", required = true) Integer productId) {
SavingsProductDto productDetails = adminServiceFacade.retrieveSavingsProductDetails(productId);
List<AuditLogDto> auditLogRecords = adminServiceFacade.retrieveSavingsProductAuditLogs(productId);
return new AuditLogScreenDto(productDetails.getProductDetails().getId(), productDetails.getProductDetails().getName(), productDetails.getProductDetails().getCreatedDateFormatted(), auditLogRecords);
}
use of org.mifos.dto.domain.SavingsProductDto in project head by mifos.
the class SavingsOfferingBO method toFullDto.
public SavingsProductDto toFullDto() {
ProductDetailsDto details = super.toDetailsDto();
Integer groupSavingsType = Integer.valueOf(0);
boolean groupSavingsAccount = false;
if (this.recommendedAmntUnit != null) {
groupSavingsType = this.recommendedAmntUnit.getId().intValue();
groupSavingsAccount = true;
}
PrdOfferingMeetingEntity interestCalculationPeriod = getTimePerForInstcalc();
PrdOfferingMeetingEntity interestPosting = getFreqOfPostIntcalc();
SavingsProductDto savingsProductDto = new SavingsProductDto(details, groupSavingsAccount, this.savingsType.getId().intValue(), groupSavingsType, this.recommendedAmount.getAmountDoubleValue(), this.maxAmntWithdrawl.getAmountDoubleValue(), BigDecimal.valueOf(this.interestRate), this.interestCalcType.getId().intValue(), interestCalculationPeriod.getMeeting().getRecurAfter().intValue(), interestCalculationPeriod.getMeeting().getRecurrenceType().getValue().intValue(), interestPosting.getMeeting().getRecurAfter().intValue(), this.minAmntForInt.getAmount(), this.depositGLCode.getGlcodeId().intValue(), this.interestGLCode.getGlcodeId().intValue(), interestPosting.getMeeting().isDaily());
savingsProductDto.setDepositGlCodeValue(this.depositGLCode.getGlcode());
savingsProductDto.setInterestGlCodeValue(this.interestGLCode.getGlcode());
savingsProductDto.setDepositGlCodeName(this.depositGLCode.getAssociatedCOA().getAccountName());
savingsProductDto.setInterestGlCodeName(this.interestGLCode.getAssociatedCOA().getAccountName());
return savingsProductDto;
}
Aggregations