use of org.mifos.application.master.business.MifosCurrency in project head by mifos.
the class CustomerPersistence method getTotalAmountForGroup.
public Money getTotalAmountForGroup(final Integer groupId, final AccountState accountState) throws PersistenceException {
MifosCurrency currency = getCurrencyForTotalAmountForGroup(groupId, accountState);
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("customerId", groupId);
params.put("accountState", accountState.getValue());
BigDecimal amount = getCalculateValueFromQueryResult(executeNamedQuery(NamedQueryConstants.GET_TOTAL_AMOUNT_FOR_GROUP, params));
Money totalAmount = new Money(currency, amount);
return totalAmount;
}
use of org.mifos.application.master.business.MifosCurrency in project head by mifos.
the class AccountApplyPaymentActionForm method validateAmount.
protected void validateAmount(ActionErrors errors) {
MifosCurrency currency = null;
if (getCurrencyId() != null && AccountingRules.isMultiCurrencyEnabled()) {
currency = AccountingRules.getCurrencyByCurrencyId(getCurrencyId());
}
DoubleConversionResult conversionResult = validateAmount(getAmount(), currency, AccountConstants.ACCOUNT_AMOUNT, errors, "");
if (amountCannotBeZero() && conversionResult.getErrors().size() == 0 && !(conversionResult.getDoubleValue() > 0.0)) {
addError(errors, AccountConstants.ACCOUNT_AMOUNT, AccountConstants.ERRORS_MUST_BE_GREATER_THAN_ZERO, getLocalizedMessage(AccountConstants.ACCOUNT_AMOUNT));
}
}
use of org.mifos.application.master.business.MifosCurrency in project head by mifos.
the class ApplyAdjustmentActionForm method validateAmount.
protected void validateAmount(ActionErrors errors) {
MifosCurrency currency = null;
if (getCurrencyId() != null && AccountingRules.isMultiCurrencyEnabled()) {
currency = AccountingRules.getCurrencyByCurrencyId(getCurrencyId());
}
DoubleConversionResult conversionResult = validateAmount(getAmount(), currency, AccountConstants.ACCOUNT_AMOUNT, errors, "");
if (conversionResult.getErrors().size() == 0 && !(conversionResult.getDoubleValue() > 0.0)) {
addError(errors, AccountConstants.ACCOUNT_AMOUNT, AccountConstants.ERRORS_MUST_BE_GREATER_THAN_ZERO, getLocalizedMessage(AccountConstants.ACCOUNT_AMOUNT));
}
}
use of org.mifos.application.master.business.MifosCurrency in project head by mifos.
the class LoanBusinessServiceTest method shouldGenerateMonthlyInstallmentScheduleFromRepaymentScheduleUsingDailyInterest.
@Test
public void shouldGenerateMonthlyInstallmentScheduleFromRepaymentScheduleUsingDailyInterest() {
MifosCurrency rupee = new MifosCurrency(Short.valueOf("1"), "Rupee", BigDecimal.valueOf(1), "INR");
RepaymentScheduleInstallment installment1 = getRepaymentScheduleInstallment("25-Sep-2010", 1, "78.6", "20.4", "1", "100", "0", "0");
RepaymentScheduleInstallment installment2 = getRepaymentScheduleInstallment("25-Oct-2010", 2, "182.8", "16.2", "1", "200", "0", "0");
RepaymentScheduleInstallment installment3 = getRepaymentScheduleInstallment("25-Nov-2010", 3, "186.0", "13.0", "1", "200", "0", "0");
RepaymentScheduleInstallment installment4 = getRepaymentScheduleInstallment("25-Dec-2010", 4, "452.6", "8.9", "1", "462.5", "0", "0");
List<RepaymentScheduleInstallment> installments = asList(installment1, installment2, installment3, installment4);
Date disbursementDate = TestUtils.getDate(25, 8, 2010);
final Money loanAmount = new Money(rupee, "1000");
loanBusinessService.applyDailyInterestRates(new LoanScheduleGenerationDto(disbursementDate, loanAmount, 24d, installments), false);
assertInstallment(installment1, "78.6", "20.4");
assertInstallment(installment2, "180.8", "18.2");
assertInstallment(installment3, "183.9", "15.1");
assertInstallment(installment4, "556.7", "11.0");
}
use of org.mifos.application.master.business.MifosCurrency in project head by mifos.
the class InstallmentRulesValidatorTest method setupAndInjectDependencies.
@Before
public void setupAndInjectDependencies() {
locale = new Locale("en", "GB");
installmentBuilder = new RepaymentScheduleInstallmentBuilder(locale);
rupee = new MifosCurrency(Short.valueOf("1"), "Rupee", BigDecimal.valueOf(1), "INR");
installmentRulesValidator = new InstallmentRulesValidatorImpl();
officeId = Short.valueOf("1");
}
Aggregations