use of org.mifos.accounts.savings.util.helpers.SavingsAccountDto 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);
}
}
}
}
use of org.mifos.accounts.savings.util.helpers.SavingsAccountDto in project head by mifos.
the class ProductDtoComparator method createEntryViewHierarchyFromCollectionSheetData.
private CollectionSheetEntryDto createEntryViewHierarchyFromCollectionSheetData(final List<CollectionSheetCustomerDto> collectionSheetCustomerHierarchy, final MifosCurrency currency) {
final int countOfCustomers = collectionSheetCustomerHierarchy.size();
CollectionSheetEntryDto parentView = null;
for (CollectionSheetCustomerDto customer : collectionSheetCustomerHierarchy) {
final CustomerDto parentCustomerDetail = new CustomerDto(customer.getCustomerId(), customer.getName(), customer.getParentCustomerId(), customer.getLevelId());
CollectionSheetEntryDto childView = new CollectionSheetEntryDto(parentCustomerDetail, currency);
childView.setAttendence(customer.getAttendanceId());
childView.setCountOfCustomers(countOfCustomers);
final Integer accountId = customer.getCollectionSheetCustomerAccount().getAccountId();
final Integer customerId = customer.getCustomerId();
final Short installmentId = null;
final Integer actionDateId = null;
final Date actionDate = null;
final Money miscFee = new Money(currency, customer.getCollectionSheetCustomerAccount().getTotalCustomerAccountCollectionFee().toString());
final Money miscFeePaid = new Money(currency, "0.0");
final Money miscPenalty = new Money(currency, "0.0");
final Money miscPenaltyPaid = new Money(currency, "0.0");
final CustomerAccountDto customerAccountDetails = new CustomerAccountDto(customer.getCollectionSheetCustomerAccount().getAccountId(), customer.getCustomerId(), currency);
customerAccountDetails.setAccountId(customer.getCollectionSheetCustomerAccount().getAccountId());
// we only create one installment fee and set the total amount due
// in the miscFee column for now
final CollectionSheetEntryInstallmentDto installmentView = new CollectionSheetEntryCustomerAccountInstallmentDto(accountId, customerId, installmentId, actionDateId, actionDate, miscFee, miscFeePaid, miscPenalty, miscPenaltyPaid, currency);
final List<CollectionSheetEntryInstallmentDto> installmentViewList = java.util.Arrays.asList(installmentView);
customerAccountDetails.setAccountActionDates(installmentViewList);
childView.setCustomerAccountDetails(customerAccountDetails);
// saving accounts
for (CollectionSheetCustomerSavingDto customerSavingDto : customer.getCollectionSheetCustomerSaving()) {
final Integer savCustomerId = customerSavingDto.getCustomerId();
final Integer savAccountId = customerSavingDto.getAccountId();
final String savingProductShortName = customerSavingDto.getProductShortName();
final Short savOfferingId = customerSavingDto.getProductId();
final Short savingsTypeId = Short.valueOf("1");
final Short recommendedAmntUnitId = customerSavingDto.getRecommendedAmountUnitId();
final SavingsAccountDto savingsAccount = new SavingsAccountDto(savAccountId, savCustomerId, savingProductShortName, savOfferingId, savingsTypeId, recommendedAmntUnitId);
final Short savInstallmentId = null;
final Integer savActionDateId = null;
final Date savActionDate = null;
final Money savDeposit = new Money(currency, customerSavingDto.getTotalDepositAmount().toString());
final Money savDepositPaid = new Money(currency, "0.0");
final CollectionSheetEntryInstallmentDto accountTrxnDetail = new CollectionSheetEntrySavingsInstallmentDto(savAccountId, savCustomerId, savInstallmentId, savActionDateId, savActionDate, savDeposit, savDepositPaid);
savingsAccount.addAccountTrxnDetail(accountTrxnDetail);
childView.addSavingsAccountDetail(savingsAccount);
}
// special savings accounts to be paid individually by clients
for (CollectionSheetCustomerSavingDto clientIndividualSavingsAccount : customer.getIndividualSavingAccounts()) {
final Integer savCustomerId = clientIndividualSavingsAccount.getCustomerId();
final Integer savAccountId = clientIndividualSavingsAccount.getAccountId();
final String savingProductShortName = clientIndividualSavingsAccount.getProductShortName();
final Short savOfferingId = clientIndividualSavingsAccount.getProductId();
final Short savingsTypeId = Short.valueOf("1");
final Short recommendedAmntUnitId = Short.valueOf("1");
final SavingsAccountDto savingsAccount = new SavingsAccountDto(savAccountId, savCustomerId, savingProductShortName, savOfferingId, savingsTypeId, recommendedAmntUnitId);
final Short savInstallmentId = null;
final Integer savActionDateId = null;
final Date savActionDate = null;
final Money savDeposit = new Money(currency, clientIndividualSavingsAccount.getDepositDue().toString());
final Money savDepositPaid = new Money(currency, clientIndividualSavingsAccount.getDepositPaid().toString());
final CollectionSheetEntryInstallmentDto accountTrxnDetail = new CollectionSheetEntrySavingsInstallmentDto(savAccountId, savCustomerId, savInstallmentId, savActionDateId, savActionDate, savDeposit, savDepositPaid);
savingsAccount.addAccountTrxnDetail(accountTrxnDetail);
childView.addSavingsAccountDetail(savingsAccount);
}
// loan accounts
for (CollectionSheetCustomerLoanDto customerLoanDto : customer.getCollectionSheetCustomerLoan()) {
final Integer loanAccountId = customerLoanDto.getAccountId();
final Integer loanCustomerId = customerLoanDto.getCustomerId();
final String loanOfferingShortName = customerLoanDto.getProductShortName();
final Short loanOfferingId = customerLoanDto.getProductId();
final Short loanInstallmentId = null;
final Integer loanActionDateId = null;
final Date loanActionDate = null;
final Short loanAccountState = customerLoanDto.getAccountStateId();
final Short interestDeductedAtDisbursement = customerLoanDto.getPayInterestAtDisbursement();
final Money loanAmount = new Money(currency, customerLoanDto.getTotalDisbursement().toString());
final Money principal = new Money(currency, customerLoanDto.getTotalRepaymentDue().toString());
final LoanAccountDto loanAccount = new LoanAccountDto(loanAccountId, loanCustomerId, loanOfferingShortName, loanOfferingId, loanAccountState, interestDeductedAtDisbursement, loanAmount);
loanAccount.setAmountPaidAtDisbursement(customerLoanDto.getAmountDueAtDisbursement());
final CollectionSheetEntryInstallmentDto accountTrxnDetail = new CollectionSheetEntryLoanInstallmentDto(loanAccountId, loanCustomerId, loanInstallmentId, loanActionDateId, loanActionDate, principal, new Money(currency), new Money(currency), new Money(currency), new Money(currency), new Money(currency), new Money(currency), new Money(currency), new Money(currency), new Money(currency), currency);
loanAccount.addTrxnDetails(Arrays.asList(accountTrxnDetail));
childView.addLoanAccountDetails(loanAccount);
}
// center-group-client hierarchy
if (parentView == null) {
parentView = childView;
} else {
addChildToAppropriateParent(parentView, childView);
}
}
return parentView;
}
use of org.mifos.accounts.savings.util.helpers.SavingsAccountDto in project head by mifos.
the class BulkEntryDisplayHelper method getDepositSavingsRow.
private void getDepositSavingsRow(final StringBuilder builder, final List<SavingsAccountDto> bulkEntryAccountList, final List<ProductDto> savingsProducts, final int rows, final Money[] groupTotals, final int size, final int initialAccNo, final int loanProductsSize, final String method, final int levelId, final MifosCurrency currency) {
for (ProductDto prdOffering : savingsProducts) {
boolean isIdMatched = false;
builder.append("<td class=\"drawtablerow\">");
for (SavingsAccountDto accountView : bulkEntryAccountList) {
if (levelId == 1) {
isIdMatched = prdOffering.getId().equals(accountView.getSavingsOfferingId()) && !accountView.getAccountTrxnDetails().isEmpty();
} else {
isIdMatched = prdOffering.getId().equals(accountView.getSavingsOfferingId());
}
if (isIdMatched) {
generateSavingsValues(builder, rows, columnIndex, accountView, groupTotals, size, initialAccNo, method, true, columnIndex, loanProductsSize, savingsProducts.size(), levelId, currency);
break;
}
}
if (!isIdMatched) {
builder.append(" ");
}
builder.append("</td>");
columnIndex++;
}
}
use of org.mifos.accounts.savings.util.helpers.SavingsAccountDto in project head by mifos.
the class BulkEntryActionStrutsTest method getSavingsAccountView.
private SavingsAccountDto getSavingsAccountView(final SavingsBO account) {
final Integer customerId = null;
final String savingOfferingShortName = account.getSavingsOffering().getPrdOfferingShortName();
final Short savingOfferingId = account.getSavingsOffering().getPrdOfferingId();
final Short savingsTypeId = account.getSavingsOffering().getSavingsType().getId();
Short reccomendedAmountUnitId = null;
if (account.getSavingsOffering().getRecommendedAmntUnit() != null) {
reccomendedAmountUnitId = account.getSavingsOffering().getRecommendedAmntUnit().getId();
}
SavingsAccountDto accountView = new SavingsAccountDto(account.getAccountId(), customerId, savingOfferingShortName, savingOfferingId, savingsTypeId, reccomendedAmountUnitId);
accountView.addAccountTrxnDetail(TestObjectFactory.getBulkEntryAccountActionView(account.getAccountActionDate((short) 1)));
return accountView;
}
use of org.mifos.accounts.savings.util.helpers.SavingsAccountDto in project head by mifos.
the class BulkEntryDisplayHelperIntegrationTest method getSavingsAccountView.
private SavingsAccountDto getSavingsAccountView(final SavingsBO account) {
final Integer customerId = null;
final String savingOfferingShortName = account.getSavingsOffering().getPrdOfferingShortName();
final Short savingOfferingId = account.getSavingsOffering().getPrdOfferingId();
final Short savingsTypeId = account.getSavingsOffering().getSavingsType().getId();
Short reccomendedAmountUnitId = null;
if (account.getSavingsOffering().getRecommendedAmntUnit() != null) {
reccomendedAmountUnitId = account.getSavingsOffering().getRecommendedAmntUnit().getId();
}
SavingsAccountDto accountView = new SavingsAccountDto(account.getAccountId(), customerId, savingOfferingShortName, savingOfferingId, savingsTypeId, reccomendedAmountUnitId);
accountView.addAccountTrxnDetail(TestObjectFactory.getBulkEntryAccountActionView(account.getAccountActionDate((short) 1)));
return accountView;
}
Aggregations