use of org.mifos.config.servicefacade.dto.AccountingConfigurationDto in project head by mifos.
the class ViewLoanAccountDetailsController method showLoanAccountTransactionHistory.
@RequestMapping(value = "/viewLoanAccountTransactionHistory", method = RequestMethod.GET)
public ModelAndView showLoanAccountTransactionHistory(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewLoanAccountTransactionHistory", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String globalAccountNum = request.getParameter("globalAccountNum");
LoanInformationDto loanInformationDto = loanAccountServiceFacade.retrieveLoanInformation(globalAccountNum);
modelAndView.addObject("loanInformationDto", loanInformationDto);
AccountingConfigurationDto configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
List<TransactionHistoryDto> transactionHistoryDto = this.centerServiceFacade.retrieveAccountTransactionHistory(globalAccountNum);
request.setAttribute("trxnHistoryList", transactionHistoryDto);
return modelAndView;
}
use of org.mifos.config.servicefacade.dto.AccountingConfigurationDto in project head by mifos.
the class MandatorySavings method validateMandatoryDepositAmountDigits.
private void validateMandatoryDepositAmountDigits(ValidationContext context) {
if (mandatoryDepositAmount == null) {
return;
}
AccountingConfigurationDto accountingConfiguration = configurationServiceFacade.getAccountingConfiguration();
BigDecimal decimalAmount;
try {
decimalAmount = new BigDecimal(mandatoryDepositAmount);
} catch (NumberFormatException e) {
return;
}
if ((decimalAmount.precision() - decimalAmount.scale()) > accountingConfiguration.getDigitsBeforeDecimal()) {
context.getMessageContext().addMessage(new MessageBuilder().error().source("mandatoryDepositAmount").code("DigitsBefore.CreateSavingsAccountFormBean.mandatoryDepositAmount").arg(accountingConfiguration.getDigitsBeforeDecimal()).build());
}
if (decimalAmount.scale() > accountingConfiguration.getDigitsAfterDecimal()) {
context.getMessageContext().addMessage(new MessageBuilder().error().source("mandatoryDepositAmount").code("DigitsAfter.CreateSavingsAccountFormBean.mandatoryDepositAmount").arg(accountingConfiguration.getDigitsAfterDecimal()).build());
}
}
use of org.mifos.config.servicefacade.dto.AccountingConfigurationDto in project head by mifos.
the class EditPenaltyPreviewController 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, PenaltyFormBean formBean, BindingResult result, SessionStatus status) {
ModelAndView modelAndView = new ModelAndView();
AccountingConfigurationDto configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
if (StringUtils.isNotBlank(edit)) {
modelAndView.setViewName("editPenalty");
modelAndView.addObject("formBean", formBean);
modelAndView.addObject("param", this.penaltyServiceFacade.getPenaltyParameters());
} else if (StringUtils.isNotBlank(cancel)) {
modelAndView.setViewName(REDIRECT_TO_VIEW_PENALTY + formBean.getId());
status.setComplete();
} else if (result.hasErrors()) {
modelAndView.setViewName("penaltyPreview");
} else {
modelAndView.setViewName(REDIRECT_TO_VIEW_PENALTY + formBean.getId());
Short id = Short.valueOf(formBean.getId());
Short categoryType = Short.valueOf(formBean.getCategoryTypeId());
Short penaltyStatus = Short.valueOf(formBean.getStatusId());
Short penaltyFrequency = Short.valueOf(formBean.getFrequencyId());
Short glCode = Short.valueOf(formBean.getGlCodeId());
boolean ratePenalty = StringUtils.isBlank(formBean.getAmount());
Short currencyId = null;
Double rate = null;
Short penaltyFormula = null;
Integer duration = null;
Short penaltyPeriod = 3;
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())) {
penaltyPeriod = Short.valueOf(formBean.getPeriodTypeId());
}
Double min = Double.valueOf(formBean.getMin());
Double max = Double.valueOf(formBean.getMax());
PenaltyFormDto dto = new PenaltyFormDto();
dto.setId(id);
dto.setCategoryType(categoryType);
dto.setPenaltyStatus(penaltyStatus);
dto.setPenaltyPeriod(penaltyPeriod);
dto.setPenaltyFrequency(penaltyFrequency);
dto.setGlCode(glCode);
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(min);
dto.setMax(max);
this.penaltyServiceFacade.updatePenalty(dto);
status.setComplete();
}
return modelAndView;
}
Aggregations