use of org.mifos.customers.util.helpers.CustomerAccountDto in project head by mifos.
the class CollectionSheetEntryAction method getAmountTotalLogs.
private String getAmountTotalLogs(CollectionSheetEntryDecomposedDto decomposedViews) {
String logMsg = "";
Double totalCustomerAccountAmountDue = 0.0;
Double totalCustomerAccountAmountEntered = 0.0;
Double totalLoanDisBursementAmountEntered = 0.0;
Double totalLoanEnteredAmount = 0.0;
Double totalLoanAmountDue = 0.0;
Double totalLoanDisbursalAmountDue = 0.0;
Double totalLoanDisbursalAmount = 0.0;
for (CustomerAccountDto customerAccountDto : decomposedViews.getCustomerAccountViews()) {
if (customerAccountDto.getCustomerAccountAmountEntered() != null) {
totalCustomerAccountAmountEntered += Double.parseDouble(customerAccountDto.getCustomerAccountAmountEntered());
}
totalCustomerAccountAmountDue += customerAccountDto.getTotalAmountDue().getAmount().doubleValue();
}
for (LoanAccountsProductDto loanAccountsProductDto : decomposedViews.getLoanAccountViews()) {
if (loanAccountsProductDto.getDisBursementAmountEntered() != null) {
totalLoanDisBursementAmountEntered += Double.parseDouble(loanAccountsProductDto.getDisBursementAmountEntered());
}
if (loanAccountsProductDto.getEnteredAmount() != null) {
totalLoanEnteredAmount += Double.parseDouble(loanAccountsProductDto.getEnteredAmount());
}
totalLoanAmountDue += loanAccountsProductDto.getTotalAmountDue();
totalLoanDisbursalAmountDue += loanAccountsProductDto.getTotalDisbursalAmountDue();
totalLoanDisbursalAmount += loanAccountsProductDto.getTotalDisburseAmount();
}
logMsg += ", totalDisBursementAmountEntered:" + totalLoanDisBursementAmountEntered;
logMsg += ", totalDisbursalAmount:" + totalLoanDisbursalAmount;
logMsg += ", totalEnteredAmount:" + totalLoanEnteredAmount;
logMsg += ", totalAmountDue:" + totalLoanAmountDue;
logMsg += ", totalDisbursalAmountDue:" + totalLoanDisbursalAmountDue;
logMsg += ", totalCustomerAccountAmountEntered:" + totalCustomerAccountAmountEntered;
logMsg += ", totalCustomerAccountAmountDue:" + totalCustomerAccountAmountDue;
return logMsg;
}
use of org.mifos.customers.util.helpers.CustomerAccountDto in project head by mifos.
the class CollectionSheetEntryDtoPostPreviewValidator method validatePopulatedData.
private ActionErrors validatePopulatedData(final CollectionSheetEntryDto parent, final ActionErrors errors, final Locale locale) {
List<CollectionSheetEntryDto> children = parent.getCollectionSheetEntryChildren();
String acCollections = MessageLookup.getLocalizedMessage(CollectionSheetEntryConstants.AC_COLLECTION);
if (null != children) {
for (CollectionSheetEntryDto collectionSheetEntryDto : children) {
validatePopulatedData(collectionSheetEntryDto, errors, locale);
}
}
for (LoanAccountsProductDto accountView : parent.getLoanAccountDetails()) {
if (accountView.isDisburseLoanAccountPresent() || accountView.getLoanAccountViews().size() > 1) {
Money enteredAmount = new Money(Money.getDefaultCurrency(), 0.0);
if (null != accountView.getEnteredAmount() && accountView.isValidAmountEntered()) {
enteredAmount = new Money(Money.getDefaultCurrency(), getDoubleValue(accountView.getEnteredAmount()));
}
Money enteredDisbursalAmount = new Money(Money.getDefaultCurrency(), 0.0);
if (null != accountView.getDisBursementAmountEntered() && accountView.isValidDisbursementAmount()) {
enteredDisbursalAmount = new Money(Money.getDefaultCurrency(), getDoubleValue(accountView.getDisBursementAmountEntered()));
}
Money totalDueAmount = new Money(Money.getDefaultCurrency(), accountView.getTotalAmountDue());
Money totalDisburtialAmount = new Money(Money.getDefaultCurrency(), accountView.getTotalDisburseAmount());
if (totalDisburtialAmount.isGreaterThanZero()) {
if ((!accountView.isValidDisbursementAmount() || accountView.getDisBursementAmountEntered() == null || !enteredDisbursalAmount.toString().equals(totalDisburtialAmount.toString())) && !enteredDisbursalAmount.isZero()) {
errors.add(CollectionSheetEntryConstants.BULKENTRYINVALIDAMOUNT, new ActionMessage(CollectionSheetEntryConstants.BULKENTRYINVALIDAMOUNT, accountView.getPrdOfferingShortName(), parent.getCustomerDetail().getDisplayName()));
}
}
if (totalDueAmount.isGreaterThanZero()) {
if ((!accountView.isValidAmountEntered() || accountView.getEnteredAmount() == null || !enteredAmount.toString().equals(totalDueAmount.toString())) && !enteredAmount.isZero()) {
errors.add(CollectionSheetEntryConstants.BULKENTRYINVALIDAMOUNT, new ActionMessage(CollectionSheetEntryConstants.BULKENTRYINVALIDAMOUNT, accountView.getPrdOfferingShortName(), parent.getCustomerDetail().getDisplayName()));
}
}
boolean moreThanTwoLoanAccountsToPrepaid = isThereMoreThanTwoLoanAccountsToPrepaid(accountView.getLoanAccountViews());
if (totalDisburtialAmount.isLessThanOrEqualZero() && totalDueAmount.isLessThanOrEqualZero()) {
if (!accountView.isValidAmountEntered() || !accountView.isValidDisbursementAmount() || !enteredDisbursalAmount.isZero() || (!moreThanTwoLoanAccountsToPrepaid && !enteredAmount.isZero())) {
errors.add(CollectionSheetEntryConstants.BULKENTRYINVALIDAMOUNT, new ActionMessage(CollectionSheetEntryConstants.BULKENTRYINVALIDAMOUNT, accountView.getPrdOfferingShortName(), parent.getCustomerDetail().getDisplayName()));
} else if (moreThanTwoLoanAccountsToPrepaid && !enteredAmount.isZero()) {
errors.add(CollectionSheetEntryConstants.BULKENTRYINVALIDPREPAYAMOUNT, new ActionMessage(CollectionSheetEntryConstants.BULKENTRYINVALIDPREPAYAMOUNT, accountView.getPrdOfferingShortName(), parent.getCustomerDetail().getDisplayName()));
}
}
}
}
for (SavingsAccountDto savingsAccountDto : parent.getSavingsAccountDetails()) {
if (!savingsAccountDto.isValidDepositAmountEntered() || !savingsAccountDto.isValidWithDrawalAmountEntered()) {
errors.add(CollectionSheetEntryConstants.ERRORINVALIDAMOUNT, new ActionMessage(CollectionSheetEntryConstants.ERRORINVALIDAMOUNT, savingsAccountDto.getSavingsOfferingShortName(), parent.getCustomerDetail().getDisplayName()));
}
}
CustomerAccountDto customerAccountDto = parent.getCustomerAccountDetails();
Double customerAccountAmountEntered = 0.0;
if (null != customerAccountDto.getCustomerAccountAmountEntered() && customerAccountDto.isValidCustomerAccountAmountEntered()) {
customerAccountAmountEntered = getDoubleValue(customerAccountDto.getCustomerAccountAmountEntered());
}
if (!customerAccountDto.isValidCustomerAccountAmountEntered() || customerAccountAmountEntered < 0.0) {
errors.add(CollectionSheetEntryConstants.BULKENTRYINVALIDACCOLLECTIONS, new ActionMessage(CollectionSheetEntryConstants.BULKENTRYINVALIDACCOLLECTIONS, acCollections, parent.getCustomerDetail().getDisplayName()));
}
return errors;
}
use of org.mifos.customers.util.helpers.CustomerAccountDto in project head by mifos.
the class BulkEntryActionStrutsTest method getCustomerAccountView.
private CustomerAccountDto getCustomerAccountView(final CustomerBO customer) {
CustomerAccountDto customerAccountDto = new CustomerAccountDto(customer.getCustomerAccount().getAccountId(), getCurrency());
List<AccountActionDateEntity> accountAction = new ArrayList<AccountActionDateEntity>();
accountAction.add(customer.getCustomerAccount().getAccountActionDate(Short.valueOf("1")));
customerAccountDto.setAccountActionDates(TestObjectFactory.getBulkEntryAccountActionViews(accountAction));
customerAccountDto.setCustomerAccountAmountEntered("100.0");
customerAccountDto.setValidCustomerAccountAmountEntered(true);
return customerAccountDto;
}
use of org.mifos.customers.util.helpers.CustomerAccountDto in project head by mifos.
the class TestObjectFactory method getCustomerAccountView.
public static CustomerAccountDto getCustomerAccountView(final CustomerBO customer) throws Exception {
CustomerAccountDto customerAccountDto = new CustomerAccountDto(customer.getCustomerAccount().getAccountId(), TestUtils.RUPEE);
List<AccountActionDateEntity> accountAction = getDueActionDatesForAccount(customer.getCustomerAccount().getAccountId(), new java.sql.Date(System.currentTimeMillis()));
customerAccountDto.setAccountActionDates(getBulkEntryAccountActionViews(accountAction));
return customerAccountDto;
}
use of org.mifos.customers.util.helpers.CustomerAccountDto in project head by mifos.
the class CollectionSheetEntryDto method populateCustomerAccountInformation.
public void populateCustomerAccountInformation(final List<CustomerAccountDto> customerAccountList, final List<CollectionSheetEntryInstallmentDto> collectionSheetEntryAccountActionViews, final List<CollectionSheetEntryAccountFeeActionDto> collectionSheetEntryAccountFeeActionDtos) {
Integer accountId = Integer.valueOf(0);
for (CustomerAccountDto customerAccountDto : customerAccountList) {
if (customerDetail.getCustomerId().equals(customerAccountDto.getCustomerId())) {
accountId = customerAccountDto.getAccountId();
customerAccountDto.setAccountActionDates(retrieveCustomerSchedule(accountId, customerAccountDto.getCustomerId(), collectionSheetEntryAccountActionViews, collectionSheetEntryAccountFeeActionDtos));
setCustomerAccountDetails(customerAccountDto);
}
}
}
Aggregations