use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveLoanInformation.
@Override
public LoanInformationDto retrieveLoanInformation(String globalAccountNum) {
MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(mifosUser);
LoanBO loan = this.loanDao.findByGlobalAccountNum(globalAccountNum);
if (loan.isDecliningBalanceInterestRecalculation()) {
loanBusinessService.computeExtraInterest(loan, DateUtils.getCurrentDateWithoutTimeStamp());
}
try {
personnelDao.checkAccessPermission(userContext, loan.getOfficeId(), loan.getCustomer().getLoanOfficerId());
} catch (AccountException e) {
throw new MifosRuntimeException("Access denied!", e);
}
String fundName = null;
if (loan.getFund() != null) {
fundName = loan.getFund().getFundName();
}
// boolean activeSurveys = surveysPersistence.isActiveSurveysForSurveyType(SurveyType.LOAN);
boolean activeSurveys = false;
List<SurveyDto> accountSurveys = loanDao.getAccountSurveyDto(loan.getAccountId());
LoanSummaryDto loanSummary = new LoanSummaryDto(loan.getLoanSummary().getOriginalPrincipal().toString(), loan.getLoanSummary().getPrincipalPaid().toString(), loan.getLoanSummary().getPrincipalDue().toString(), loan.getLoanSummary().getOriginalInterest().toString(), loan.getLoanSummary().getInterestPaid().toString(), loan.getLoanSummary().getInterestDue().toString(), loan.getLoanSummary().getOriginalFees().toString(), loan.getLoanSummary().getFeesPaid().toString(), loan.getLoanSummary().getFeesDue().toString(), loan.getLoanSummary().getOriginalPenalty().toString(), loan.getLoanSummary().getPenaltyPaid().toString(), loan.getLoanSummary().getPenaltyDue().toString(), loan.getLoanSummary().getTotalLoanAmnt().toString(), loan.getLoanSummary().getTotalAmntPaid().toString(), loan.getLoanSummary().getTotalAmntDue().toString());
LoanPerformanceHistoryEntity performanceHistory = loan.getPerformanceHistory();
LoanPerformanceHistoryDto loanPerformanceHistory = new LoanPerformanceHistoryDto(performanceHistory.getNoOfPayments(), performanceHistory.getTotalNoOfMissedPayments(), performanceHistory.getDaysInArrears(), performanceHistory.getLoanMaturityDate());
Set<AccountFeesDto> accountFeesDtos = new HashSet<AccountFeesDto>();
if (!loan.getAccountFees().isEmpty()) {
for (AccountFeesEntity accountFeesEntity : loan.getAccountFees()) {
AccountFeesDto accountFeesDto = new AccountFeesDto(accountFeesEntity.getFees().getFeeFrequency().getFeeFrequencyType().getId(), (accountFeesEntity.getFees().getFeeFrequency().getFeePayment() != null ? accountFeesEntity.getFees().getFeeFrequency().getFeePayment().getId() : null), accountFeesEntity.getFeeStatus(), accountFeesEntity.getFees().getFeeName(), accountFeesEntity.getAccountFeeAmount().toString(), getMeetingRecurrence(accountFeesEntity.getFees().getFeeFrequency().getFeeMeetingFrequency(), userContext), accountFeesEntity.getFees().getFeeId());
accountFeesDtos.add(accountFeesDto);
}
}
Set<AccountPenaltiesDto> accountPenaltiesDtos = new HashSet<AccountPenaltiesDto>();
if (!loan.getAccountPenalties().isEmpty()) {
for (AccountPenaltiesEntity accountPenaltiesEntity : loan.getAccountPenalties()) {
accountPenaltiesDtos.add(new AccountPenaltiesDto(accountPenaltiesEntity.getPenalty().getPenaltyFrequency().getId(), accountPenaltiesEntity.getPenaltyStatus(), accountPenaltiesEntity.getPenalty().getPenaltyName(), accountPenaltiesEntity.getAccountPenaltyAmount().toString(), accountPenaltiesEntity.getPenalty().getPenaltyFrequency().getName(), accountPenaltiesEntity.getPenalty().getPenaltyId()));
}
}
Set<String> accountFlagNames = getAccountStateFlagEntityNames(loan.getAccountFlags());
Short accountStateId = loan.getAccountState().getId();
String accountStateName = getAccountStateName(accountStateId);
boolean disbursed = AccountState.isDisbursed(accountStateId);
String gracePeriodTypeName = getGracePeriodTypeName(loan.getGracePeriodType().getId());
Short interestType = loan.getInterestType().getId();
String interestTypeName = getInterestTypeName(interestType);
List<CustomerNoteDto> recentNoteDtos = new ArrayList<CustomerNoteDto>();
List<AccountNotesEntity> recentNotes = loan.getRecentAccountNotes();
for (AccountNotesEntity accountNotesEntity : recentNotes) {
recentNoteDtos.add(new CustomerNoteDto(accountNotesEntity.getCommentDate(), accountNotesEntity.getComment(), accountNotesEntity.getPersonnelName()));
}
CustomValueDto customValueDto = legacyMasterDao.getLookUpEntity(MasterConstants.COLLATERAL_TYPES);
List<CustomValueListElementDto> collateralTypes = customValueDto.getCustomValueListElements();
String collateralTypeName = null;
for (CustomValueListElementDto collateralType : collateralTypes) {
if (collateralType.getId() == loan.getCollateralTypeId()) {
collateralTypeName = collateralType.getName();
break;
}
}
return new LoanInformationDto(loan.getLoanOffering().getPrdOfferingName(), globalAccountNum, accountStateId, accountStateName, disbursed, accountFlagNames, loan.getDisbursementDate(), loan.isRedone(), loan.getBusinessActivityId(), loan.getAccountId(), gracePeriodTypeName, interestType, interestTypeName, loan.getCustomer().getCustomerId(), loan.getAccountType().getAccountTypeId(), loan.getOffice().getOfficeId(), loan.getPersonnel().getPersonnelId(), loan.getNextMeetingDate(), loan.getTotalAmountDue().toString(), loan.getTotalAmountInArrears().toString(), loanSummary, loan.getLoanActivityDetails().isEmpty() ? false : true, loan.getInterestRate(), loan.isInterestDeductedAtDisbursement(), loan.getLoanMeeting().getMeetingDetails().getRecurAfter(), loan.getLoanMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceId(), loan.getLoanOffering().isPrinDueLastInst(), loan.getNoOfInstallments(), loan.getMaxMinNoOfInstall().getMinNoOfInstall(), loan.getMaxMinNoOfInstall().getMaxNoOfInstall(), loan.getGracePeriodDuration(), fundName, loan.getCollateralTypeId(), collateralTypeName, loan.getCollateralNote(), loan.getExternalId(), accountFeesDtos, loan.getCreatedDate(), loanPerformanceHistory, loan.getCustomer().isGroup(), getRecentActivityView(globalAccountNum), activeSurveys, accountSurveys, loan.getCustomer().getDisplayName(), loan.getCustomer().getGlobalCustNum(), loan.getOffice().getOfficeName(), recentNoteDtos, accountPenaltiesDtos, AccountingRules.isGroupLoanWithMembers());
}
use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveLoanDetailsForLoanAccountCreation.
@Override
public LoanCreationLoanDetailsDto retrieveLoanDetailsForLoanAccountCreation(Integer customerId, Short productId, boolean isLoanWithBackdatedPayments) {
try {
List<org.mifos.dto.domain.FeeDto> additionalFees = new ArrayList<org.mifos.dto.domain.FeeDto>();
List<org.mifos.dto.domain.FeeDto> defaultFees = new ArrayList<org.mifos.dto.domain.FeeDto>();
List<PenaltyDto> defaultPenalties = new ArrayList<PenaltyDto>();
LoanOfferingBO loanProduct = this.loanProductDao.findById(productId.intValue());
MeetingBO loanProductMeeting = loanProduct.getLoanOfferingMeetingValue();
MeetingDto loanOfferingMeetingDto = loanProductMeeting.toDto();
List<FeeBO> fees = this.feeDao.getAllAppllicableFeeForLoanCreation();
for (FeeBO fee : fees) {
if (!fee.isPeriodic() || (MeetingBO.isMeetingMatched(fee.getFeeFrequency().getFeeMeetingFrequency(), loanProductMeeting))) {
org.mifos.dto.domain.FeeDto feeDto = fee.toDto();
FeeFrequencyType feeFrequencyType = FeeFrequencyType.getFeeFrequencyType(fee.getFeeFrequency().getFeeFrequencyType().getId());
FeeFrequencyTypeEntity feeFrequencyEntity = this.loanProductDao.retrieveFeeFrequencyType(feeFrequencyType);
String feeFrequencyTypeName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(feeFrequencyEntity.getLookUpValue());
feeDto.setFeeFrequencyType(feeFrequencyTypeName);
if (feeDto.getFeeFrequency().isOneTime()) {
FeePayment feePayment = FeePayment.getFeePayment(fee.getFeeFrequency().getFeePayment().getId());
FeePaymentEntity feePaymentEntity = this.loanProductDao.retrieveFeePaymentType(feePayment);
String feePaymentName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(feePaymentEntity.getLookUpValue());
feeDto.getFeeFrequency().setPayment(feePaymentName);
}
if (loanProduct.isFeePresent(fee)) {
defaultFees.add(feeDto);
} else {
additionalFees.add(feeDto);
}
}
}
List<PenaltyBO> penalties = this.penaltyDao.getAllAppllicablePenaltyForLoanCreation();
for (PenaltyBO penalty : penalties) {
if (loanProduct.isPenaltyPresent(penalty)) {
defaultPenalties.add(penalty.toDto());
}
}
if (AccountingRules.isMultiCurrencyEnabled()) {
defaultFees = getFilteredFeesByCurrency(defaultFees, loanProduct.getCurrency().getCurrencyId());
additionalFees = getFilteredFeesByCurrency(additionalFees, loanProduct.getCurrency().getCurrencyId());
}
Map<String, String> defaultFeeOptions = new LinkedHashMap<String, String>();
for (org.mifos.dto.domain.FeeDto feeDto : defaultFees) {
defaultFeeOptions.put(feeDto.getId(), feeDto.getName());
}
Map<String, String> additionalFeeOptions = new LinkedHashMap<String, String>();
for (org.mifos.dto.domain.FeeDto feeDto : additionalFees) {
additionalFeeOptions.put(feeDto.getId(), feeDto.getName());
}
CustomerBO customer = this.customerDao.findCustomerById(customerId);
boolean isRepaymentIndependentOfMeetingEnabled = new ConfigurationBusinessService().isRepaymentIndepOfMeetingEnabled();
LoanDisbursementDateFactory loanDisbursementDateFactory = new LoanDisbursmentDateFactoryImpl();
LoanDisbursementDateFinder loanDisbursementDateFinder = null;
LocalDate nextPossibleDisbursementDate = null;
MeetingBO customerMeeting = customer.getCustomerMeetingValue();
LocalDate dateToStart = new LocalDate();
if (customerMeeting.isWeekly()) {
LocalDate meetingStartDate = new LocalDate(customerMeeting.getMeetingStartDate());
if (dateToStart.isBefore(meetingStartDate)) {
dateToStart = meetingStartDate;
loanDisbursementDateFinder = loanDisbursementDateFactory.create(customer, loanProduct, false, isLoanWithBackdatedPayments);
} else {
loanDisbursementDateFinder = loanDisbursementDateFactory.create(customer, loanProduct, isRepaymentIndependentOfMeetingEnabled, isLoanWithBackdatedPayments);
}
nextPossibleDisbursementDate = loanDisbursementDateFinder.findClosestMatchingDateFromAndInclusiveOf(dateToStart);
} else {
loanDisbursementDateFinder = loanDisbursementDateFactory.create(customer, loanProduct, isRepaymentIndependentOfMeetingEnabled, isLoanWithBackdatedPayments);
nextPossibleDisbursementDate = loanDisbursementDateFinder.findClosestMatchingDateFromAndInclusiveOf(dateToStart);
}
LoanAmountOption eligibleLoanAmount = loanProduct.eligibleLoanAmount(customer.getMaxLoanAmount(loanProduct), customer.getMaxLoanCycleForProduct(loanProduct));
LoanOfferingInstallmentRange eligibleNoOfInstall = loanProduct.eligibleNoOfInstall(customer.getMaxLoanAmount(loanProduct), customer.getMaxLoanCycleForProduct(loanProduct));
Double defaultInterestRate = loanProduct.getDefInterestRate();
Double maxInterestRate = loanProduct.getMaxInterestRate();
Double minInterestRate = loanProduct.getMinInterestRate();
LinkedHashMap<String, String> collateralOptions = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> purposeOfLoanOptions = new LinkedHashMap<String, String>();
CustomValueDto customValueDto = legacyMasterDao.getLookUpEntity(MasterConstants.COLLATERAL_TYPES);
List<CustomValueListElementDto> collateralTypes = customValueDto.getCustomValueListElements();
for (CustomValueListElementDto element : collateralTypes) {
collateralOptions.put(element.getId().toString(), element.getName());
}
// Business activities got in getPrdOfferings also but only for glim.
List<ValueListElement> loanPurposes = legacyMasterDao.findValueListElements(MasterConstants.LOAN_PURPOSES);
for (ValueListElement element : loanPurposes) {
purposeOfLoanOptions.put(element.getId().toString(), element.getName());
}
List<FundDto> fundDtos = new ArrayList<FundDto>();
List<FundBO> funds = getFunds(loanProduct);
for (FundBO fund : funds) {
FundDto fundDto = new FundDto();
fundDto.setId(Short.toString(fund.getFundId()));
fundDto.setCode(translateFundCodeToDto(fund.getFundCode()));
fundDto.setName(fund.getFundName());
fundDtos.add(fundDto);
}
ProductDetailsDto productDto = loanProduct.toDetailsDto();
CustomerDetailDto customerDetailDto = customer.toCustomerDetailDto();
Integer gracePeriodInInstallments = loanProduct.getGracePeriodDuration().intValue();
final List<PrdOfferingDto> loanProductDtos = retrieveActiveLoanProductsApplicableForCustomer(customer, isRepaymentIndependentOfMeetingEnabled);
InterestType interestType = InterestType.fromInt(loanProduct.getInterestTypes().getId().intValue());
InterestTypesEntity productInterestType = this.loanProductDao.findInterestType(interestType);
String interestTypeName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(productInterestType.getLookUpValue());
LinkedHashMap<String, String> daysOfTheWeekOptions = new LinkedHashMap<String, String>();
List<WeekDay> workingDays = new FiscalCalendarRules().getWorkingDays();
for (WeekDay workDay : workingDays) {
String weekdayName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(workDay.getPropertiesKey());
workDay.setWeekdayName(weekdayName);
daysOfTheWeekOptions.put(workDay.getValue().toString(), weekdayName);
}
LinkedHashMap<String, String> weeksOfTheMonthOptions = new LinkedHashMap<String, String>();
for (RankOfDay weekOfMonth : RankOfDay.values()) {
String weekOfMonthName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(weekOfMonth.getPropertiesKey());
weeksOfTheMonthOptions.put(weekOfMonth.getValue().toString(), weekOfMonthName);
}
boolean variableInstallmentsAllowed = loanProduct.isVariableInstallmentsAllowed();
boolean fixedRepaymentSchedule = loanProduct.isFixedRepaymentSchedule();
Integer minGapInDays = Integer.valueOf(0);
Integer maxGapInDays = Integer.valueOf(0);
BigDecimal minInstallmentAmount = BigDecimal.ZERO;
if (variableInstallmentsAllowed) {
VariableInstallmentDetailsBO variableInstallmentsDetails = loanProduct.getVariableInstallmentDetails();
minGapInDays = variableInstallmentsDetails.getMinGapInDays();
maxGapInDays = variableInstallmentsDetails.getMaxGapInDays();
minInstallmentAmount = variableInstallmentsDetails.getMinInstallmentAmount().getAmount();
}
boolean compareCashflowEnabled = loanProduct.isCashFlowCheckEnabled();
// GLIM specific
final boolean isGroup = customer.isGroup();
final boolean isGlimEnabled = configurationPersistence.isGlimEnabled();
//Group Loan Account with members specific
final boolean isGroupLoanWithMembersEnabled = AccountingRules.isGroupLoanWithMembers();
List<LoanAccountDetailsDto> clientDetails = new ArrayList<LoanAccountDetailsDto>();
if (isGroup && (isGlimEnabled || isGroupLoanWithMembersEnabled)) {
final List<ClientBO> activeClientsOfGroup = customerDao.findActiveClientsUnderGroup(customer);
if (activeClientsOfGroup == null || activeClientsOfGroup.isEmpty()) {
throw new BusinessRuleException(GroupConstants.IMPOSSIBLE_TO_CREATE_GROUP_LOAN);
}
for (ClientBO client : activeClientsOfGroup) {
LoanAccountDetailsDto clientDetail = new LoanAccountDetailsDto();
clientDetail.setClientId(client.getGlobalCustNum());
clientDetail.setClientName(client.getDisplayName());
clientDetails.add(clientDetail);
}
}
// end of GLIM specific
int digitsAfterDecimalForInterest = AccountingRules.getDigitsAfterDecimalForInterest().intValue();
int digitsBeforeDecimalForInterest = AccountingRules.getDigitsBeforeDecimalForInterest().intValue();
int digitsAfterDecimalForMonetaryAmounts = AccountingRules.getDigitsAfterDecimal().intValue();
int digitsBeforeDecimalForMonetaryAmounts = AccountingRules.getDigitsBeforeDecimal().intValue();
ApplicationConfigurationDto appConfig = new ApplicationConfigurationDto(digitsAfterDecimalForInterest, digitsBeforeDecimalForInterest, digitsAfterDecimalForMonetaryAmounts, digitsBeforeDecimalForMonetaryAmounts);
Map<String, String> disbursalPaymentTypes = new LinkedHashMap<String, String>();
try {
for (PaymentTypeDto paymentTypeDto : accountService.getLoanDisbursementTypes()) {
disbursalPaymentTypes.put(paymentTypeDto.getValue().toString(), paymentTypeDto.getName());
}
} catch (Exception e) {
throw new SystemException(e);
}
Map<String, String> repaymentpaymentTypes = new LinkedHashMap<String, String>();
try {
for (PaymentTypeDto paymentTypeDto : accountService.getLoanPaymentTypes()) {
repaymentpaymentTypes.put(paymentTypeDto.getValue().toString(), paymentTypeDto.getName());
}
} catch (Exception e) {
throw new SystemException(e);
}
String currency = loanProduct.getCurrency().getCurrencyCode();
return new LoanCreationLoanDetailsDto(currency, isRepaymentIndependentOfMeetingEnabled, loanOfferingMeetingDto, customer.getCustomerMeetingValue().toDto(), loanPurposes, productDto, gracePeriodInInstallments, customerDetailDto, loanProductDtos, interestTypeName, fundDtos, collateralOptions, purposeOfLoanOptions, defaultFeeOptions, additionalFeeOptions, defaultFees, additionalFees, BigDecimal.valueOf(eligibleLoanAmount.getDefaultLoanAmount()), BigDecimal.valueOf(eligibleLoanAmount.getMaxLoanAmount()), BigDecimal.valueOf(eligibleLoanAmount.getMinLoanAmount()), defaultInterestRate, maxInterestRate, minInterestRate, eligibleNoOfInstall.getDefaultNoOfInstall().intValue(), eligibleNoOfInstall.getMaxNoOfInstall().intValue(), eligibleNoOfInstall.getMinNoOfInstall().intValue(), nextPossibleDisbursementDate, daysOfTheWeekOptions, weeksOfTheMonthOptions, variableInstallmentsAllowed, fixedRepaymentSchedule, minGapInDays, maxGapInDays, minInstallmentAmount, compareCashflowEnabled, isGlimEnabled, isGroup, clientDetails, appConfig, defaultPenalties, disbursalPaymentTypes, repaymentpaymentTypes, isGroupLoanWithMembersEnabled);
} catch (SystemException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.
the class GroupLoanAccountServiceFacadeWebTier method retrieveLoanInformation.
@Override
public LoanInformationDto retrieveLoanInformation(String globalAccountNum) {
MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(mifosUser);
LoanBO loan = this.loanDao.findByGlobalAccountNum(globalAccountNum);
try {
personnelDao.checkAccessPermission(userContext, loan.getOfficeId(), loan.getCustomer().getLoanOfficerId());
} catch (AccountException e) {
throw new MifosRuntimeException("Access denied!", e);
}
String fundName = null;
if (loan.getFund() != null) {
fundName = loan.getFund().getFundName();
}
boolean activeSurveys = false;
List<SurveyDto> accountSurveys = loanDao.getAccountSurveyDto(loan.getAccountId());
LoanSummaryDto loanSummary = generateGroupLoanSummaryDto(new ArrayList<LoanBO>(loan.getMemberAccounts()));
LoanPerformanceHistoryEntity performanceHistory = loan.getPerformanceHistory();
LoanPerformanceHistoryDto loanPerformanceHistory = new LoanPerformanceHistoryDto(performanceHistory.getNoOfPayments(), performanceHistory.getTotalNoOfMissedPayments(), performanceHistory.getDaysInArrears(), performanceHistory.getLoanMaturityDate());
Set<AccountFeesDto> accountFeesDtos = new HashSet<AccountFeesDto>();
if (!loan.getAccountFees().isEmpty()) {
for (AccountFeesEntity accountFeesEntity : loan.getAccountFees()) {
AccountFeesDto accountFeesDto = new AccountFeesDto(accountFeesEntity.getFees().getFeeFrequency().getFeeFrequencyType().getId(), (accountFeesEntity.getFees().getFeeFrequency().getFeePayment() != null ? accountFeesEntity.getFees().getFeeFrequency().getFeePayment().getId() : null), accountFeesEntity.getFeeStatus(), accountFeesEntity.getFees().getFeeName(), accountFeesEntity.getAccountFeeAmount().toString(), getMeetingRecurrence(accountFeesEntity.getFees().getFeeFrequency().getFeeMeetingFrequency(), userContext), accountFeesEntity.getFees().getFeeId());
accountFeesDtos.add(accountFeesDto);
}
}
Set<AccountPenaltiesDto> accountPenaltiesDtos = new HashSet<AccountPenaltiesDto>();
if (!loan.getAccountPenalties().isEmpty()) {
for (AccountPenaltiesEntity accountPenaltiesEntity : loan.getAccountPenalties()) {
accountPenaltiesDtos.add(new AccountPenaltiesDto(accountPenaltiesEntity.getPenalty().getPenaltyFrequency().getId(), accountPenaltiesEntity.getPenaltyStatus(), accountPenaltiesEntity.getPenalty().getPenaltyName(), accountPenaltiesEntity.getAccountPenaltyAmount().toString(), accountPenaltiesEntity.getPenalty().getPenaltyFrequency().getName(), accountPenaltiesEntity.getPenalty().getPenaltyId()));
}
}
Set<String> accountFlagNames = getAccountStateFlagEntityNames(loan.getAccountFlags());
Short accountStateId = loan.getAccountState().getId();
String accountStateName = getAccountStateName(accountStateId);
boolean disbursed = AccountState.isDisbursed(accountStateId);
String gracePeriodTypeName = getGracePeriodTypeName(loan.getGracePeriodType().getId());
Short interestType = loan.getInterestType().getId();
String interestTypeName = getInterestTypeName(interestType);
List<CustomerNoteDto> recentNoteDtos = new ArrayList<CustomerNoteDto>();
List<AccountNotesEntity> recentNotes = loan.getRecentAccountNotes();
for (AccountNotesEntity accountNotesEntity : recentNotes) {
recentNoteDtos.add(new CustomerNoteDto(accountNotesEntity.getCommentDate(), accountNotesEntity.getComment(), accountNotesEntity.getPersonnelName()));
}
CustomValueDto customValueDto = legacyMasterDao.getLookUpEntity(MasterConstants.COLLATERAL_TYPES);
List<CustomValueListElementDto> collateralTypes = customValueDto.getCustomValueListElements();
String collateralTypeName = null;
for (CustomValueListElementDto collateralType : collateralTypes) {
if (collateralType.getId() == loan.getCollateralTypeId()) {
collateralTypeName = collateralType.getName();
break;
}
}
Boolean groupLoanWithMembers = AccountingRules.isGroupLoanWithMembers();
return new LoanInformationDto(loan.getLoanOffering().getPrdOfferingName(), globalAccountNum, accountStateId, accountStateName, disbursed, accountFlagNames, loan.getDisbursementDate(), loan.isRedone(), loan.getBusinessActivityId(), loan.getAccountId(), gracePeriodTypeName, interestType, interestTypeName, loan.getCustomer().getCustomerId(), loan.getAccountType().getAccountTypeId(), loan.getOffice().getOfficeId(), loan.getPersonnel().getPersonnelId(), loan.getNextMeetingDate(), loan.getTotalAmountDue().toString(), loan.getTotalAmountInArrears().toString(), loanSummary, loan.getLoanActivityDetails().isEmpty() ? false : true, loan.getInterestRate(), loan.isInterestDeductedAtDisbursement(), loan.getLoanOffering().getLoanOfferingMeeting().getMeeting().getMeetingDetails().getRecurAfter(), loan.getLoanOffering().getLoanOfferingMeeting().getMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceId(), loan.getLoanOffering().isPrinDueLastInst(), loan.getNoOfInstallments(), loan.getMaxMinNoOfInstall().getMinNoOfInstall(), loan.getMaxMinNoOfInstall().getMaxNoOfInstall(), loan.getGracePeriodDuration(), fundName, loan.getCollateralTypeId(), collateralTypeName, loan.getCollateralNote(), loan.getExternalId(), accountFeesDtos, loan.getCreatedDate(), loanPerformanceHistory, loan.getCustomer().isGroup(), getRecentActivityView(globalAccountNum), activeSurveys, accountSurveys, loan.getCustomer().getDisplayName(), loan.getCustomer().getGlobalCustNum(), loan.getOffice().getOfficeName(), recentNoteDtos, accountPenaltiesDtos, groupLoanWithMembers);
}
use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.
the class BulkEntryDisplayHelper method generateAttendance.
private void generateAttendance(final StringBuilder builder, final List<CustomValueListElementDto> custAttTypes, final int row, final CollectionSheetEntryDto collectionSheetEntryDto, final String method) {
Short collectionSheetEntryViewAttendence = collectionSheetEntryDto.getAttendence();
if (method.equals(CollectionSheetEntryConstants.GETMETHOD)) {
builder.append("<td class=\"drawtablerow\">");
builder.append("<select name=\"attendanceSelected[" + row + "]\" style=\"width:80px;\" class=\"fontnormal8pt\">");
for (CustomValueListElementDto attendance : custAttTypes) {
builder.append("<option value=\"" + attendance.getAssociatedId() + "\"");
if (attendancesAreEqual(collectionSheetEntryViewAttendence, attendance)) {
builder.append(" selected=\"selected\"");
}
builder.append(">" + attendance.getLookUpValue() + "</option>");
}
builder.append("</select>");
builder.append("</td>");
} else if (method.equals(CollectionSheetEntryConstants.PREVIEWMETHOD)) {
builder.append("<td class=\"drawtablerow\">");
for (CustomValueListElementDto attendance : custAttTypes) {
if (attendancesAreEqual(collectionSheetEntryViewAttendence, attendance)) {
if (!collectionSheetEntryViewAttendence.toString().equals("1")) {
builder.append("<font color=\"#FF0000\">" + attendance.getLookUpValue() + "</font>");
} else {
builder.append(attendance.getLookUpValue());
}
}
}
builder.append("</td>");
} else if (method.equals(CollectionSheetEntryConstants.PREVIOUSMETHOD) || method.equals(CollectionSheetEntryConstants.VALIDATEMETHOD)) {
builder.append("<td class=\"drawtablerow\">");
builder.append("<select name=\"attendanceSelected[" + row + "]\" style=\"width:80px;\" class=\"fontnormal8pt\">");
for (CustomValueListElementDto attendance : custAttTypes) {
builder.append("<option value=\"" + attendance.getAssociatedId() + "\"");
if (null != collectionSheetEntryViewAttendence && attendance.getAssociatedId().equals(Integer.valueOf(collectionSheetEntryViewAttendence))) {
builder.append(" selected ");
}
builder.append(">" + attendance.getLookUpValue() + "</option>");
}
builder.append("</select>");
builder.append("</td>");
}
}
use of org.mifos.application.master.business.CustomValueListElementDto in project head by mifos.
the class MifosValueList method doEndTag.
/**
* Function to render the tag in jsp
*
* @throws JspException
*/
@Override
public int doEndTag() throws JspException {
StringBuffer results = new StringBuffer();
List<CustomValueListElementDto> inputList = null;
Object obj = null;
try {
logger.debug("Inside doEndTag of MifosValueList Tag");
obj = pageContext.findAttribute(getName());
if (null == obj) {
logger.debug("Can't get the bean form from the bean name");
throw new Exception("Can't get the bean form from the bean name. Please check the bean name defined in the name attribute");
}
logger.debug("object is " + obj);
if (null == getUserContext()) {
logger.debug("userContext is null");
getList = obj.getClass().getDeclaredMethod("get" + getProperty2(), (Class[]) null);
logger.debug("method called is " + getList);
inputList = (List<CustomValueListElementDto>) getList.invoke(obj, (Object[]) null);
logger.debug("List got is " + inputList);
} else {
logger.debug("userContext is not null");
getList = obj.getClass().getDeclaredMethod("get" + getProperty2(), new Class[] { Object.class });
logger.debug("method called is " + getList);
inputList = (List<CustomValueListElementDto>) getList.invoke(obj, new Object[] { new Object() });
logger.debug("List got is " + inputList);
}
} catch (Exception e) {
throw new JspException(e.getMessage());
}
results = render(inputList);
TagUtils.getInstance().write(pageContext, results.toString());
return super.doEndTag();
}
Aggregations