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;
}
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;
}
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"));
}
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;
}
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;
}
Aggregations