Search in sources :

Example 11 with LocalizationConverter

use of org.mifos.framework.util.LocalizationConverter in project head by mifos.

the class CollectionSheetEntryDto method setSavinsgAmountsEntered.

public void setSavinsgAmountsEntered(final Short prdOfferingId, final String depositAmountEnteredValue, final String withDrawalAmountEnteredValue) {
    for (SavingsAccountDto savingsAccountDto : savingsAccountDetails) {
        if (prdOfferingId.equals(savingsAccountDto.getSavingsOfferingId())) {
            savingsAccountDto.setDepositAmountEntered(depositAmountEnteredValue);
            savingsAccountDto.setWithDrawalAmountEntered(withDrawalAmountEnteredValue);
            try {
                if (depositAmountEnteredValue != null && !"".equals(depositAmountEnteredValue.trim())) {
                    new LocalizationConverter().getDoubleValueForCurrentLocale(depositAmountEnteredValue);
                    savingsAccountDto.setValidDepositAmountEntered(true);
                }
            } catch (NumberFormatException nfe) {
                savingsAccountDto.setValidDepositAmountEntered(false);
            }
            try {
                if (withDrawalAmountEnteredValue != null && !"".equals(withDrawalAmountEnteredValue.trim())) {
                    new LocalizationConverter().getDoubleValueForCurrentLocale(withDrawalAmountEnteredValue);
                    savingsAccountDto.setValidWithDrawalAmountEntered(true);
                }
            } catch (NumberFormatException nfe) {
                savingsAccountDto.setValidWithDrawalAmountEntered(false);
            }
        }
    }
}
Also used : LocalizationConverter(org.mifos.framework.util.LocalizationConverter) SavingsAccountDto(org.mifos.accounts.savings.util.helpers.SavingsAccountDto)

Example 12 with LocalizationConverter

use of org.mifos.framework.util.LocalizationConverter in project head by mifos.

the class CollectionSheetEntryDto method setLoanAmountsEntered.

public void setLoanAmountsEntered(final Short prdOfferingId, final String enteredAmountValue, final String disbursementAmount) {
    for (LoanAccountsProductDto loanAccountView : loanAccountDetails) {
        if (prdOfferingId.equals(loanAccountView.getPrdOfferingId())) {
            loanAccountView.setEnteredAmount(enteredAmountValue);
            loanAccountView.setDisBursementAmountEntered(disbursementAmount);
            try {
                if (null != enteredAmountValue) {
                    new LocalizationConverter().getDoubleValueForCurrentLocale(enteredAmountValue);
                }
                loanAccountView.setValidAmountEntered(true);
            } catch (NumberFormatException ne) {
                loanAccountView.setValidAmountEntered(false);
            }
            try {
                if (null != disbursementAmount) {
                    new LocalizationConverter().getDoubleValueForCurrentLocale(disbursementAmount);
                }
                loanAccountView.setValidDisbursementAmount(true);
            } catch (NumberFormatException ne) {
                loanAccountView.setValidDisbursementAmount(false);
            }
        }
    }
}
Also used : LocalizationConverter(org.mifos.framework.util.LocalizationConverter) LoanAccountsProductDto(org.mifos.accounts.loan.util.helpers.LoanAccountsProductDto)

Example 13 with LocalizationConverter

use of org.mifos.framework.util.LocalizationConverter in project head by mifos.

the class AccountBusinessService method populaleApplicableCharge.

private void populaleApplicableCharge(List<ApplicableCharge> applicableChargeList, List<FeeBO> feeList, UserContext userContext) {
    for (FeeBO fee : feeList) {
        ApplicableCharge applicableCharge = new ApplicableCharge();
        applicableCharge.setFeeId(fee.getFeeId().toString());
        applicableCharge.setFeeName(fee.getFeeName());
        applicableCharge.setIsPenaltyType(false);
        if (fee.getFeeType().getValue().equals(RateAmountFlag.RATE.getValue())) {
            applicableCharge.setAmountOrRate(new LocalizationConverter().getDoubleStringForInterest(((RateFeeBO) fee).getRate()));
            applicableCharge.setFormula(((RateFeeBO) fee).getFeeFormula().getFormulaStringThatHasName());
            applicableCharge.setIsRateType(true);
        } else {
            applicableCharge.setAmountOrRate(((AmountFeeBO) fee).getFeeAmount().toString());
            applicableCharge.setIsRateType(false);
        }
        MeetingBO meeting = fee.getFeeFrequency().getFeeMeetingFrequency();
        if (meeting != null) {
            applicableCharge.setPeriodicity(new MeetingHelper().getDetailMessageWithFrequency(meeting, userContext));
        } else {
            applicableCharge.setPaymentType(fee.getFeeFrequency().getFeePayment().getName());
        }
        applicableChargeList.add(applicableCharge);
    }
}
Also used : RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) LocalizationConverter(org.mifos.framework.util.LocalizationConverter) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ApplicableCharge(org.mifos.dto.domain.ApplicableCharge) FeeBO(org.mifos.accounts.fees.business.FeeBO) RateFeeBO(org.mifos.accounts.fees.business.RateFeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) MeetingHelper(org.mifos.application.meeting.util.helpers.MeetingHelper) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO)

Example 14 with LocalizationConverter

use of org.mifos.framework.util.LocalizationConverter in project head by mifos.

the class GroupServiceFacadeWebTier method convertFeeViewsToAccountFeeEntities.

private List<AccountFeesEntity> convertFeeViewsToAccountFeeEntities(List<ApplicableAccountFeeDto> feesToApply) {
    List<AccountFeesEntity> feesForCustomerAccount = new ArrayList<AccountFeesEntity>();
    for (ApplicableAccountFeeDto feeDto : feesToApply) {
        FeeBO fee = feeDao.findById(feeDto.getFeeId().shortValue());
        Double feeAmount = new LocalizationConverter().getDoubleValueForCurrentLocale(feeDto.getAmount());
        AccountBO nullReferenceForNow = null;
        AccountFeesEntity accountFee = new AccountFeesEntity(nullReferenceForNow, fee, feeAmount);
        feesForCustomerAccount.add(accountFee);
    }
    return feesForCustomerAccount;
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) LocalizationConverter(org.mifos.framework.util.LocalizationConverter) ArrayList(java.util.ArrayList) FeeBO(org.mifos.accounts.fees.business.FeeBO) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto)

Example 15 with LocalizationConverter

use of org.mifos.framework.util.LocalizationConverter in project head by mifos.

the class ClientServiceFacadeWebTier method convertFeeViewsToAccountFeeEntities.

private List<AccountFeesEntity> convertFeeViewsToAccountFeeEntities(List<ApplicableAccountFeeDto> feesToApply) {
    List<AccountFeesEntity> feesForCustomerAccount = new ArrayList<AccountFeesEntity>();
    for (ApplicableAccountFeeDto feeDto : feesToApply) {
        FeeBO fee = this.feeDao.findById(feeDto.getFeeId().shortValue());
        Double feeAmount = new LocalizationConverter().getDoubleValueForCurrentLocale(feeDto.getAmount());
        AccountBO nullReferenceForNow = null;
        AccountFeesEntity accountFee = new AccountFeesEntity(nullReferenceForNow, fee, feeAmount);
        feesForCustomerAccount.add(accountFee);
    }
    return feesForCustomerAccount;
}
Also used : AccountBO(org.mifos.accounts.business.AccountBO) LocalizationConverter(org.mifos.framework.util.LocalizationConverter) ArrayList(java.util.ArrayList) FeeBO(org.mifos.accounts.fees.business.FeeBO) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto)

Aggregations

LocalizationConverter (org.mifos.framework.util.LocalizationConverter)19 Test (org.junit.Test)6 Ignore (org.junit.Ignore)5 Locale (java.util.Locale)4 FeeBO (org.mifos.accounts.fees.business.FeeBO)4 DoubleConversionResult (org.mifos.framework.util.helpers.DoubleConversionResult)4 ArrayList (java.util.ArrayList)3 AccountBO (org.mifos.accounts.business.AccountBO)3 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)3 StringTokenizer (java.util.StringTokenizer)2 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)2 ApplicableCharge (org.mifos.dto.domain.ApplicableCharge)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 GregorianCalendar (java.util.GregorianCalendar)1 SimpleTimeZone (java.util.SimpleTimeZone)1 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)1 RateFeeBO (org.mifos.accounts.fees.business.RateFeeBO)1 LoanAccountsProductDto (org.mifos.accounts.loan.util.helpers.LoanAccountsProductDto)1