Search in sources :

Example 6 with SavingsProductDto

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;
}
Also used : BusinessRuleException(org.mifos.service.BusinessRuleException) ModelAndView(org.springframework.web.servlet.ModelAndView) PrdOfferingDto(org.mifos.dto.domain.PrdOfferingDto) SavingsProductDto(org.mifos.dto.domain.SavingsProductDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with SavingsProductDto

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;
}
Also used : SavingsProductFormDto(org.mifos.dto.screen.SavingsProductFormDto) ModelAndView(org.springframework.web.servlet.ModelAndView) SavingsProductDto(org.mifos.dto.domain.SavingsProductDto) ProductDetailsDto(org.mifos.dto.domain.ProductDetailsDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with SavingsProductDto

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);
}
Also used : SavingsProductDto(org.mifos.dto.domain.SavingsProductDto) AuditLogScreenDto(org.mifos.dto.screen.AuditLogScreenDto) AuditLogDto(org.mifos.dto.domain.AuditLogDto) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with SavingsProductDto

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;
}
Also used : SavingsProductDto(org.mifos.dto.domain.SavingsProductDto) ProductDetailsDto(org.mifos.dto.domain.ProductDetailsDto)

Aggregations

SavingsProductDto (org.mifos.dto.domain.SavingsProductDto)9 ProductDetailsDto (org.mifos.dto.domain.ProductDetailsDto)4 SavingsProductReferenceDto (org.mifos.dto.screen.SavingsProductReferenceDto)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 BigDecimal (java.math.BigDecimal)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 DateTime (org.joda.time.DateTime)1 Test (org.junit.Test)1 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)1 AuditLogDto (org.mifos.dto.domain.AuditLogDto)1 PrdOfferingDto (org.mifos.dto.domain.PrdOfferingDto)1 SavingsAccountCreationDto (org.mifos.dto.domain.SavingsAccountCreationDto)1 SavingsAccountDetailDto (org.mifos.dto.domain.SavingsAccountDetailDto)1 AuditLogScreenDto (org.mifos.dto.screen.AuditLogScreenDto)1 ListElement (org.mifos.dto.screen.ListElement)1 SavingsProductFormDto (org.mifos.dto.screen.SavingsProductFormDto)1 BusinessRuleException (org.mifos.service.BusinessRuleException)1