Search in sources :

Example 1 with ClientDropdownsDto

use of org.mifos.dto.screen.ClientDropdownsDto in project head by mifos.

the class ClientServiceFacadeWebTier method retrieveFamilyInfoForEdit.

@Override
public ClientFamilyInfoDto retrieveFamilyInfoForEdit(String clientGlobalCustNum) {
    ClientBO client = this.customerDao.findClientBySystemId(clientGlobalCustNum);
    ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
    ClientRulesDto clientRules = retrieveClientRules();
    CustomerDetailDto customerDetail = client.toCustomerDetailDto();
    ClientDetailDto clientDetail = client.toClientDetailDto(clientRules.isFamilyDetailsRequired());
    List<ClientNameDetailDto> familyMembers = new ArrayList<ClientNameDetailDto>();
    Map<Integer, List<ClientFamilyDetailDto>> clientFamilyDetails = new HashMap<Integer, List<ClientFamilyDetailDto>>();
    int familyMemberCount = 0;
    for (ClientNameDetailEntity clientNameDetailEntity : client.getNameDetailSet()) {
        if (clientNameDetailEntity.isNotClientNameType()) {
            ClientNameDetailDto nameView1 = clientNameDetailEntity.toDto();
            familyMembers.add(nameView1);
            for (ClientFamilyDetailEntity clientFamilyDetailEntity : client.getFamilyDetailSet()) {
                if (clientNameDetailEntity.matchesCustomerId(clientFamilyDetailEntity.getClientName().getCustomerNameId())) {
                    ClientFamilyDetailDto clientFamilyDetail = clientFamilyDetailEntity.toDto();
                    addFamilyDetailsDtoToMap(clientFamilyDetails, familyMemberCount, clientFamilyDetail);
                }
            }
            familyMemberCount++;
        }
    }
    return new ClientFamilyInfoDto(clientDropdowns, customerDetail, clientDetail, familyMembers, clientFamilyDetails);
}
Also used : HashMap(java.util.HashMap) ClientBO(org.mifos.customers.client.business.ClientBO) ArrayList(java.util.ArrayList) ClientFamilyDetailDto(org.mifos.dto.screen.ClientFamilyDetailDto) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientNameDetailEntity(org.mifos.customers.client.business.ClientNameDetailEntity) ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) ArrayList(java.util.ArrayList) List(java.util.List) ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto) ClientFamilyDetailEntity(org.mifos.customers.client.business.ClientFamilyDetailEntity) ClientFamilyInfoDto(org.mifos.dto.screen.ClientFamilyInfoDto)

Example 2 with ClientDropdownsDto

use of org.mifos.dto.screen.ClientDropdownsDto 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);
}
Also used : SavingsDetailDto(org.mifos.dto.domain.SavingsDetailDto) UserContext(org.mifos.security.util.UserContext) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) FeeDto(org.mifos.accounts.fees.business.FeeDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) MifosUser(org.mifos.security.MifosUser) ApplicableAccountFeeDto(org.mifos.dto.domain.ApplicableAccountFeeDto) CustomerMeetingDto(org.mifos.dto.domain.CustomerMeetingDto) MeetingDto(org.mifos.dto.domain.MeetingDto) CenterCreation(org.mifos.dto.domain.CenterCreation) ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) CustomerBO(org.mifos.customers.business.CustomerBO) FeeBO(org.mifos.accounts.fees.business.FeeBO) ClientFormCreationDto(org.mifos.dto.screen.ClientFormCreationDto) ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto)

Example 3 with ClientDropdownsDto

use of org.mifos.dto.screen.ClientDropdownsDto in project head by mifos.

the class ClientServiceFacadeWebTier method retrieveClientDropdownData.

private ClientDropdownsDto retrieveClientDropdownData() {
    List<ValueListElement> salutations = this.customerDao.retrieveSalutations();
    List<ValueListElement> genders = this.customerDao.retrieveGenders();
    List<ValueListElement> maritalStatuses = this.customerDao.retrieveMaritalStatuses();
    List<ValueListElement> citizenship = this.customerDao.retrieveCitizenship();
    List<ValueListElement> ethnicity = this.customerDao.retrieveEthnicity();
    List<ValueListElement> educationLevels = this.customerDao.retrieveEducationLevels();
    List<ValueListElement> businessActivity = this.customerDao.retrieveBusinessActivities();
    List<ValueListElement> poverty = this.customerDao.retrievePoverty();
    List<ValueListElement> handicapped = this.customerDao.retrieveHandicapped();
    List<ValueListElement> livingStatus = this.customerDao.retrieveLivingStatus();
    ClientDropdownsDto clientDropdowns = new ClientDropdownsDto(salutations, genders, maritalStatuses, citizenship, ethnicity, educationLevels, businessActivity, poverty, handicapped, livingStatus);
    return clientDropdowns;
}
Also used : ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto) ValueListElement(org.mifos.dto.domain.ValueListElement)

Example 4 with ClientDropdownsDto

use of org.mifos.dto.screen.ClientDropdownsDto in project head by mifos.

the class ClientServiceFacadeWebTier method retrieveClientPersonalInfoForUpdate.

@Override
public ClientPersonalInfoDto retrieveClientPersonalInfoForUpdate(String clientSystemId, String clientStatus, short loanOfficerId) {
    ClientDropdownsDto clientDropdowns = retrieveClientDropdownData();
    ClientRulesDto clientRules = retrieveClientRules();
    ClientBO client = this.customerDao.findClientBySystemId(clientSystemId);
    CustomerDetailDto customerDetailDto = client.toCustomerDetailDto();
    ClientDetailDto clientDetailDto = client.toClientDetailDto(clientRules.isFamilyDetailsRequired());
    return new ClientPersonalInfoDto(clientDropdowns, clientRules, customerDetailDto, clientDetailDto);
}
Also used : ClientRulesDto(org.mifos.dto.domain.ClientRulesDto) ClientBO(org.mifos.customers.client.business.ClientBO) ClientDetailDto(org.mifos.dto.screen.ClientDetailDto) CustomerDetailDto(org.mifos.dto.domain.CustomerDetailDto) ClientPersonalInfoDto(org.mifos.dto.screen.ClientPersonalInfoDto) ClientDropdownsDto(org.mifos.dto.screen.ClientDropdownsDto)

Aggregations

ClientDropdownsDto (org.mifos.dto.screen.ClientDropdownsDto)4 ClientRulesDto (org.mifos.dto.domain.ClientRulesDto)3 ArrayList (java.util.ArrayList)2 ClientBO (org.mifos.customers.client.business.ClientBO)2 CustomerDetailDto (org.mifos.dto.domain.CustomerDetailDto)2 ClientDetailDto (org.mifos.dto.screen.ClientDetailDto)2 HashMap (java.util.HashMap)1 List (java.util.List)1 FeeBO (org.mifos.accounts.fees.business.FeeBO)1 FeeDto (org.mifos.accounts.fees.business.FeeDto)1 MeetingBO (org.mifos.application.meeting.business.MeetingBO)1 CustomerBO (org.mifos.customers.business.CustomerBO)1 ClientFamilyDetailEntity (org.mifos.customers.client.business.ClientFamilyDetailEntity)1 ClientNameDetailEntity (org.mifos.customers.client.business.ClientNameDetailEntity)1 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)1 CenterCreation (org.mifos.dto.domain.CenterCreation)1 CustomerMeetingDto (org.mifos.dto.domain.CustomerMeetingDto)1 MeetingDto (org.mifos.dto.domain.MeetingDto)1 PersonnelDto (org.mifos.dto.domain.PersonnelDto)1 SavingsDetailDto (org.mifos.dto.domain.SavingsDetailDto)1