use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.
the class CreateGroupCreationDetailDto method feeAsAccountFeeDto.
public List<ApplicableAccountFeeDto> feeAsAccountFeeDto(List<CreationFeeDto> feesToApply) {
List<ApplicableAccountFeeDto> feeDto = new ArrayList<ApplicableAccountFeeDto>();
for (CreationFeeDto f : feesToApply) {
ApplicableAccountFeeDto accFee = new ApplicableAccountFeeDto();
accFee.setFeeId(f.getFeeId());
accFee.setAmount(f.getAmount());
feeDto.add(accFee);
}
return feeDto;
}
use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.
the class ClientServiceFacadeWebTier method retrieveClientFormCreationData.
@Override
public ClientFormCreationDto retrieveClientFormCreationData(Short groupFlag, Short officeId, String parentGroupId) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
List<PersonnelDto> personnelList = new ArrayList<PersonnelDto>();
MeetingBO parentCustomerMeeting = null;
Short formedByPersonnelId = null;
String formedByPersonnelName = "";
String centerDisplayName = "";
String groupDisplayName = "";
String officeName = "";
List<FeeBO> fees = new ArrayList<FeeBO>();
Short applicableOfficeId = officeId;
if (YesNoFlag.YES.getValue().equals(groupFlag)) {
Integer parentCustomerId = Integer.valueOf(parentGroupId);
CustomerBO parentCustomer = this.customerDao.findCustomerById(parentCustomerId);
groupDisplayName = parentCustomer.getDisplayName();
if (parentCustomer.getPersonnel() != null) {
formedByPersonnelId = parentCustomer.getPersonnel().getPersonnelId();
formedByPersonnelName = parentCustomer.getPersonnel().getDisplayName();
}
if (parentCustomer.getParentCustomer() != null) {
centerDisplayName = parentCustomer.getParentCustomer().getDisplayName();
}
applicableOfficeId = parentCustomer.getOffice().getOfficeId();
officeName = parentCustomer.getOffice().getOfficeName();
if (parentCustomer.getCustomerMeeting() != null) {
parentCustomerMeeting = parentCustomer.getCustomerMeetingValue();
fees = this.customerDao.retrieveFeesApplicableToClientsRefinedBy(parentCustomer.getCustomerMeetingValue());
} else {
fees = this.customerDao.retrieveFeesApplicableToClients();
}
} else if (YesNoFlag.NO.getValue().equals(groupFlag)) {
CenterCreation centerCreation = new CenterCreation(applicableOfficeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
personnelList = this.personnelDao.findActiveLoanOfficersForOffice(centerCreation);
fees = this.customerDao.retrieveFeesApplicableToClients();
}
CustomerApplicableFeesDto applicableFees = CustomerApplicableFeesDto.toDto(fees, userContext);
List<ApplicableAccountFeeDto> defaultFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getDefaultFees()) {
defaultFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
List<ApplicableAccountFeeDto> additionalFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getAdditionalFees()) {
additionalFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
List<SavingsDetailDto> savingsOfferings = this.customerDao.retrieveSavingOfferingsApplicableToClient();
ClientRulesDto clientRules = retrieveClientRules();
ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
List<PersonnelDto> formedByPersonnel = this.customerDao.findLoanOfficerThatFormedOffice(applicableOfficeId);
MeetingDto parentMeeting = null;
if (parentCustomerMeeting != null) {
parentMeeting = parentCustomerMeeting.toDto();
}
return new ClientFormCreationDto(clientDropdowns, clientRules, applicableOfficeId, officeName, formedByPersonnelId, formedByPersonnelName, personnelList, formedByPersonnel, savingsOfferings, parentMeeting, centerDisplayName, groupDisplayName, additionalFees, defaultFees);
}
use of org.mifos.dto.domain.ApplicableAccountFeeDto 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;
}
use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveCenterFormCreationData.
@Override
public CenterFormCreationDto retrieveCenterFormCreationData(CenterCreation centerCreation) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
List<PersonnelDto> activeLoanOfficersForBranch = personnelDao.findActiveLoanOfficersForOffice(centerCreation);
List<FeeBO> fees = customerDao.retrieveFeesApplicableToCenters();
CustomerApplicableFeesDto applicableFees = CustomerApplicableFeesDto.toDto(fees, userContext);
List<ApplicableAccountFeeDto> applicableDefaultAccountFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getDefaultFees()) {
applicableDefaultAccountFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
List<ApplicableAccountFeeDto> applicableDefaultAdditionalFees = new ArrayList<ApplicableAccountFeeDto>();
for (FeeDto fee : applicableFees.getAdditionalFees()) {
applicableDefaultAdditionalFees.add(new ApplicableAccountFeeDto(fee.getFeeIdValue().intValue(), fee.getFeeName(), fee.getAmount(), fee.isRemoved(), fee.isWeekly(), fee.isMonthly(), fee.isPeriodic(), fee.getFeeSchedule()));
}
return new CenterFormCreationDto(activeLoanOfficersForBranch, applicableDefaultAdditionalFees, applicableDefaultAccountFees);
}
use of org.mifos.dto.domain.ApplicableAccountFeeDto in project head by mifos.
the class CustomerActionForm method validateForFeeRecurrence.
@SuppressWarnings("unchecked")
protected void validateForFeeRecurrence(HttpServletRequest request, ActionErrors errors) throws ApplicationException {
MeetingBO meeting = getCustomerMeeting(request);
if (meeting != null) {
List<ApplicableAccountFeeDto> feeList = getDefaultFees();
for (ApplicableAccountFeeDto fee : feeList) {
if (!fee.isRemoved() && fee.isPeriodic() && !isFrequencyMatches(fee, meeting)) {
errors.add(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH, new ActionMessage(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH));
return;
}
}
List<ApplicableAccountFeeDto> additionalFeeList = (List<ApplicableAccountFeeDto>) SessionUtils.getAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, request);
for (ApplicableAccountFeeDto selectedFee : getAdditionalFees()) {
for (ApplicableAccountFeeDto fee : additionalFeeList) {
if (selectedFee.getFeeId() != null && selectedFee.getFeeId().equals(fee.getFeeId())) {
if (fee.isPeriodic() && !isFrequencyMatches(fee, meeting)) {
errors.add(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH, new ActionMessage(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH));
return;
}
}
}
}
}
}
Aggregations