Search in sources :

Example 1 with AccountingConfigurationDto

use of org.mifos.config.servicefacade.dto.AccountingConfigurationDto in project head by mifos.

the class NewPenaltyPreviewController method processFormSubmit.

@RequestMapping(method = RequestMethod.POST)
public ModelAndView processFormSubmit(@RequestParam(value = EDIT_PARAM, required = false) String edit, @RequestParam(value = CANCEL_PARAM, required = false) String cancel, @ModelAttribute("formBean") PenaltyFormBean formBean, BindingResult result, SessionStatus status) {
    ModelAndView modelAndView = new ModelAndView(REDIRECT_TO_ADMIN_SCREEN);
    AccountingConfigurationDto configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
    modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
    if (StringUtils.isNotBlank(edit)) {
        modelAndView.setViewName("defineNewPenalty");
        modelAndView.addObject("formBean", formBean);
        modelAndView.addObject("param", this.penaltyServiceFacade.getPenaltyParameters());
    } else if (StringUtils.isNotBlank(cancel)) {
        modelAndView.setViewName(REDIRECT_TO_VIEW_PENALTIES);
        status.setComplete();
    } else if (result.hasErrors()) {
        modelAndView.setViewName("newPenaltyPreview");
    } else {
        boolean ratePenalty = StringUtils.isBlank(formBean.getAmount());
        Short currencyId = null;
        Double rate = null;
        Short penaltyFormula = null;
        Short periodId = 3;
        Integer duration = null;
        if (ratePenalty) {
            rate = Double.valueOf(formBean.getRate());
            penaltyFormula = Short.valueOf(formBean.getFormulaId());
        }
        if (StringUtils.isNotBlank(formBean.getDuration())) {
            duration = Integer.valueOf(formBean.getDuration());
        }
        if (StringUtils.isNotBlank(formBean.getCurrencyId())) {
            currencyId = Short.valueOf(formBean.getCurrencyId());
        }
        if (StringUtils.isNotBlank(formBean.getPeriodTypeId())) {
            periodId = Short.valueOf(formBean.getPeriodTypeId());
        }
        PenaltyFormDto dto = new PenaltyFormDto();
        dto.setCategoryType(Short.valueOf(formBean.getCategoryTypeId()));
        dto.setPenaltyPeriod(periodId);
        dto.setPenaltyFrequency(Short.valueOf(formBean.getFrequencyId()));
        dto.setGlCode(Short.valueOf(formBean.getGlCodeId()));
        dto.setPenaltyFormula(penaltyFormula);
        dto.setPenaltyName(formBean.getName());
        dto.setRatePenalty(ratePenalty);
        dto.setCurrencyId(currencyId);
        dto.setRate(rate);
        dto.setAmount(formBean.getAmount());
        dto.setDuration(duration);
        dto.setMin(Double.valueOf(formBean.getMin()));
        dto.setMax(Double.valueOf(formBean.getMax()));
        this.penaltyServiceFacade.createPenalty(dto);
        status.setComplete();
    }
    return modelAndView;
}
Also used : PenaltyFormDto(org.mifos.dto.domain.PenaltyFormDto) AccountingConfigurationDto(org.mifos.config.servicefacade.dto.AccountingConfigurationDto) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with AccountingConfigurationDto

use of org.mifos.config.servicefacade.dto.AccountingConfigurationDto in project head by mifos.

the class ViewEditSavingsProductController method showSavingProductDetails.

@RequestMapping(method = RequestMethod.GET)
public ModelAndView showSavingProductDetails(@RequestParam("productId") Integer productId) {
    ModelAndView modelAndView = new ModelAndView("viewEditSavingsProduct");
    AccountingConfigurationDto configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
    modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
    modelAndView.addObject("savingsProductDetails", adminServiceFacade.retrieveSavingsProductDetails(productId));
    return modelAndView;
}
Also used : AccountingConfigurationDto(org.mifos.config.servicefacade.dto.AccountingConfigurationDto) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with AccountingConfigurationDto

use of org.mifos.config.servicefacade.dto.AccountingConfigurationDto in project head by mifos.

the class CreateSavingsAccountFormBeanTest method setUp.

@Before
public void setUp() {
    MifosBeanValidator validator = new MifosBeanValidator();
    LocalValidatorFactoryBean targetValidator = new LocalValidatorFactoryBean();
    targetValidator.afterPropertiesSet();
    validator.setTargetValidator(targetValidator);
    formBean = new CreateSavingsAccountFormBean();
    formBean.setValidator(validator);
    questionnaireServiceFacade = mock(QuestionnaireServiceFacade.class);
    formBean.setQuestionnaireServiceFascade(questionnaireServiceFacade);
    configurationDto = new AccountingConfigurationDto();
    configurationDto.setDigitsBeforeDecimal((short) 14);
    configurationDto.setDigitsAfterDecimal((short) 1);
    configurationServiceFacade = mock(ConfigurationServiceFacade.class);
    when(configurationServiceFacade.getAccountingConfiguration()).thenReturn(configurationDto);
    formBean.setConfigurationServiceFacade(configurationServiceFacade);
    validationContext = new StubValidationContext();
    validationException = new ValidationException("Root");
    validationException.addChildException(new ValidationException("Child"));
}
Also used : LocalValidatorFactoryBean(org.springframework.validation.beanvalidation.LocalValidatorFactoryBean) ValidationException(org.mifos.platform.validations.ValidationException) MifosBeanValidator(org.mifos.platform.validation.MifosBeanValidator) AccountingConfigurationDto(org.mifos.config.servicefacade.dto.AccountingConfigurationDto) StubValidationContext(org.mifos.ui.validation.StubValidationContext) QuestionnaireServiceFacade(org.mifos.platform.questionnaire.service.QuestionnaireServiceFacade) ConfigurationServiceFacade(org.mifos.config.servicefacade.ConfigurationServiceFacade) Before(org.junit.Before)

Example 4 with AccountingConfigurationDto

use of org.mifos.config.servicefacade.dto.AccountingConfigurationDto in project head by mifos.

the class ConfigurationServiceFacadeWebTier method getAccountingConfiguration.

@Override
public AccountingConfigurationDto getAccountingConfiguration() {
    AccountingConfigurationDto dto = new AccountingConfigurationDto();
    dto.setDigitsBeforeDecimal(accountingConfigurationService.getDigitsBeforeDecimal());
    dto.setDigitsAfterDecimal(accountingConfigurationService.getDigitsAfterDecimal());
    dto.setGlCodeMode(accountingConfigurationService.getGlNameMode());
    return dto;
}
Also used : AccountingConfigurationDto(org.mifos.config.servicefacade.dto.AccountingConfigurationDto)

Example 5 with AccountingConfigurationDto

use of org.mifos.config.servicefacade.dto.AccountingConfigurationDto in project head by mifos.

the class ViewPenaltyController method showPenalty.

@RequestMapping(method = RequestMethod.GET)
public ModelAndView showPenalty(@RequestParam Integer penaltyId) {
    ModelAndView modelAndView = new ModelAndView("viewPenalty");
    AccountingConfigurationDto configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
    modelAndView.addObject("penalty", this.penaltyServiceFacade.getPenalty(penaltyId));
    modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
    return modelAndView;
}
Also used : AccountingConfigurationDto(org.mifos.config.servicefacade.dto.AccountingConfigurationDto) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

AccountingConfigurationDto (org.mifos.config.servicefacade.dto.AccountingConfigurationDto)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 ModelAndView (org.springframework.web.servlet.ModelAndView)5 PenaltyFormDto (org.mifos.dto.domain.PenaltyFormDto)2 IncludePage (freemarker.ext.servlet.IncludePage)1 BigDecimal (java.math.BigDecimal)1 Before (org.junit.Before)1 ConfigurationServiceFacade (org.mifos.config.servicefacade.ConfigurationServiceFacade)1 LoanInformationDto (org.mifos.dto.screen.LoanInformationDto)1 TransactionHistoryDto (org.mifos.dto.screen.TransactionHistoryDto)1 QuestionnaireServiceFacade (org.mifos.platform.questionnaire.service.QuestionnaireServiceFacade)1 MifosBeanValidator (org.mifos.platform.validation.MifosBeanValidator)1 ValidationException (org.mifos.platform.validations.ValidationException)1 StubValidationContext (org.mifos.ui.validation.StubValidationContext)1 MessageBuilder (org.springframework.binding.message.MessageBuilder)1 LocalValidatorFactoryBean (org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)1