Search in sources :

Example 6 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class LoanAccountServiceFacadeWebTier method retrieveAllActiveBranchesAndLoanOfficerDetails.

@Override
public ChangeAccountStatusDto retrieveAllActiveBranchesAndLoanOfficerDetails() {
    MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = new UserContextFactory().create(mifosUser);
    List<PersonnelDto> loanOfficers = new ArrayList<PersonnelDto>();
    List<OfficeDetailsDto> activeBranches = this.officeDao.findActiveBranches(userContext.getBranchId());
    if (onlyOneActiveBranchExists(activeBranches)) {
        OfficeDetailsDto singleOffice = activeBranches.get(0);
        CenterCreation officeDetails = new CenterCreation(singleOffice.getOfficeId(), userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
        loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(officeDetails);
    }
    boolean loanPendingApprovalStateEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
    Short accountState = AccountState.LOAN_PARTIAL_APPLICATION.getValue();
    if (loanPendingApprovalStateEnabled) {
        accountState = AccountState.LOAN_PENDING_APPROVAL.getValue();
    }
    boolean centerHierarchyExists = ClientRules.getCenterHierarchyExists();
    return new ChangeAccountStatusDto(activeBranches, loanOfficers, loanPendingApprovalStateEnabled, accountState, centerHierarchyExists);
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) UserContext(org.mifos.security.util.UserContext) CenterCreation(org.mifos.dto.domain.CenterCreation) ArrayList(java.util.ArrayList) PersonnelDto(org.mifos.dto.domain.PersonnelDto) MifosUser(org.mifos.security.MifosUser) UserContextFactory(org.mifos.accounts.servicefacade.UserContextFactory) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 7 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class LoanAccountServiceFacadeWebTier method retrieveLoanOfficerDetailsForBranch.

@Override
public ChangeAccountStatusDto retrieveLoanOfficerDetailsForBranch(Short officeId) {
    MifosUser mifosUser = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = new UserContextFactory().create(mifosUser);
    CenterCreation officeDetails = new CenterCreation(officeId, userContext.getId(), userContext.getLevelId(), userContext.getPreferredLocale());
    List<PersonnelDto> loanOfficers = this.personnelDao.findActiveLoanOfficersForOffice(officeDetails);
    boolean loanPendingApprovalStateEnabled = ProcessFlowRules.isLoanPendingApprovalStateEnabled();
    Short accountState = AccountState.LOAN_PARTIAL_APPLICATION.getValue();
    if (loanPendingApprovalStateEnabled) {
        accountState = AccountState.LOAN_PENDING_APPROVAL.getValue();
    }
    boolean centerHierarchyExists = ClientRules.getCenterHierarchyExists();
    return new ChangeAccountStatusDto(new ArrayList<OfficeDetailsDto>(), loanOfficers, loanPendingApprovalStateEnabled, accountState, centerHierarchyExists);
}
Also used : ChangeAccountStatusDto(org.mifos.dto.screen.ChangeAccountStatusDto) UserContext(org.mifos.security.util.UserContext) CenterCreation(org.mifos.dto.domain.CenterCreation) PersonnelDto(org.mifos.dto.domain.PersonnelDto) MifosUser(org.mifos.security.MifosUser) UserContextFactory(org.mifos.accounts.servicefacade.UserContextFactory) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 8 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class CustomerServiceFacadeWebTier method retrieveBranchOnlyOfficeHierarchy.

@Override
public OnlyBranchOfficeHierarchyDto retrieveBranchOnlyOfficeHierarchy() {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);
    OfficeDto office = officeDao.findOfficeDtoById(userContext.getBranchId());
    List<OfficeBO> branchParents = officeDao.findBranchsOnlyWithParentsMatching(office.getSearchId());
    List<OfficeDetailsDto> levels = officeDao.findActiveOfficeLevels();
    List<OfficeHierarchyDto> branchOnlyOfficeHierarchy = OfficeBO.convertToBranchOnlyHierarchyWithParentsOfficeHierarchy(branchParents);
    return new OnlyBranchOfficeHierarchyDto(userContext.getPreferredLocale(), levels, office.getSearchId(), branchOnlyOfficeHierarchy);
}
Also used : OfficeHierarchyDto(org.mifos.dto.domain.OfficeHierarchyDto) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) OfficeDto(org.mifos.dto.domain.OfficeDto) OfficeBO(org.mifos.customers.office.business.OfficeBO) OnlyBranchOfficeHierarchyDto(org.mifos.dto.screen.OnlyBranchOfficeHierarchyDto) UserContext(org.mifos.security.util.UserContext) MifosUser(org.mifos.security.MifosUser) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 9 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class FormEnteredDataAssembler method toDto.

public CollectionSheetFormEnteredDataDto toDto() {
    final OfficeDetailsDto office = collectionSheetFormDtoDecorator.findSelectedBranchOfficeById(Short.valueOf(collectionSheetForm.getOfficeId()));
    final PersonnelDto loanOfficer = collectionSheetFormDtoDecorator.findSelectedLoanOfficerById(Short.valueOf(collectionSheetForm.getLoanOfficerId()));
    final CustomerDto selectedCustomer = collectionSheetFormDtoDecorator.findSelectedCustomerById(Integer.valueOf(collectionSheetForm.getCustomerId()));
    final ListItem<Short> selectedPaymentType = collectionSheetFormDtoDecorator.findSelectedPaymentTypeById(Short.valueOf(collectionSheetForm.getPaymentId()));
    final java.sql.Date meetingDate = collectionSheetFormDtoDecorator.getMeetingDateAsSqlDate();
    final java.sql.Date receiptDate = determineReceiptDateIfPopulated();
    return new CollectionSheetFormEnteredDataDto(office, loanOfficer, selectedCustomer, selectedPaymentType, meetingDate, receiptDate, collectionSheetForm.getReceiptId());
}
Also used : CustomerDto(org.mifos.dto.domain.CustomerDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto)

Example 10 with OfficeDetailsDto

use of org.mifos.dto.domain.OfficeDetailsDto in project head by mifos.

the class BulkEntryActionStrutsTest method getFailureBulkEntry.

private CollectionSheetEntryGridDto getFailureBulkEntry() throws Exception {
    Date startDate = new Date(System.currentTimeMillis());
    MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
    client = TestObjectFactory.createClient("Client", CustomerStatus.CLIENT_ACTIVE, group);
    LoanOfferingBO loanOffering1 = TestObjectFactory.createLoanOffering(startDate, meeting);
    LoanOfferingBO loanOffering2 = TestObjectFactory.createLoanOffering("Loan2345", "313f", startDate, meeting);
    groupAccount = TestObjectFactory.createLoanAccount("42423142341", group, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering1);
    clientAccount = TestObjectFactory.createLoanAccount("3243", client, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING, startDate, loanOffering2);
    MeetingBO meetingIntCalc = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    MeetingBO meetingIntPost = TestObjectFactory.createMeeting(TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    SavingsOfferingBO savingsOffering = TestObjectFactory.createSavingsProduct("SavingPrd123c", "ased", ApplicableTo.GROUPS, startDate, PrdStatus.SAVINGS_ACTIVE, 300.0, RecommendedAmountUnit.PER_INDIVIDUAL, 1.2, 200.0, 200.0, SavingsType.VOLUNTARY, InterestCalcType.MINIMUM_BALANCE, meetingIntCalc, meetingIntPost);
    SavingsOfferingBO savingsOffering1 = TestObjectFactory.createSavingsProduct("SavingPrd1we", "vbgr", ApplicableTo.GROUPS, startDate, PrdStatus.SAVINGS_ACTIVE, 300.0, RecommendedAmountUnit.PER_INDIVIDUAL, 1.2, 200.0, 200.0, SavingsType.VOLUNTARY, InterestCalcType.MINIMUM_BALANCE, meetingIntCalc, meetingIntPost);
    centerSavingsAccount = TestObjectFactory.createSavingsAccount("432434", center, Short.valueOf("16"), startDate, savingsOffering);
    clientSavingsAccount = TestObjectFactory.createSavingsAccount("432434", client, Short.valueOf("16"), startDate, savingsOffering1);
    CollectionSheetEntryDto bulkEntryParent = new CollectionSheetEntryDto(getCusomerView(center), null);
    bulkEntryParent.addSavingsAccountDetail(getSavingsAccountView(centerSavingsAccount));
    bulkEntryParent.setCustomerAccountDetails(getCustomerAccountView(center));
    CollectionSheetEntryDto bulkEntryChild = new CollectionSheetEntryDto(getCusomerView(group), null);
    LoanAccountDto groupLoanAccountView = getLoanAccountView(groupAccount);
    bulkEntryChild.addLoanAccountDetails(groupLoanAccountView);
    bulkEntryChild.setCustomerAccountDetails(getCustomerAccountView(group));
    CollectionSheetEntryDto bulkEntrySubChild = new CollectionSheetEntryDto(getCusomerView(client), null);
    LoanAccountDto clientLoanAccountView = getLoanAccountView(clientAccount);
    bulkEntrySubChild.addLoanAccountDetails(clientLoanAccountView);
    bulkEntrySubChild.addSavingsAccountDetail(getSavingsAccountView(clientSavingsAccount));
    bulkEntrySubChild.setCustomerAccountDetails(getCustomerAccountView(client));
    bulkEntryChild.addChildNode(bulkEntrySubChild);
    bulkEntryParent.addChildNode(bulkEntryChild);
    bulkEntryChild.getLoanAccountDetails().get(0).setEnteredAmount("100.0");
    bulkEntryChild.getLoanAccountDetails().get(0).setPrdOfferingId(groupLoanAccountView.getPrdOfferingId());
    bulkEntrySubChild.getLoanAccountDetails().get(0).setEnteredAmount("100.0");
    bulkEntrySubChild.getLoanAccountDetails().get(0).setPrdOfferingId(clientLoanAccountView.getPrdOfferingId());
    ProductDto loanOfferingDto = new ProductDto(loanOffering1.getPrdOfferingId(), loanOffering1.getPrdOfferingShortName());
    ProductDto loanOfferingDto2 = new ProductDto(loanOffering2.getPrdOfferingId(), loanOffering2.getPrdOfferingShortName());
    List<ProductDto> loanProducts = Arrays.asList(loanOfferingDto, loanOfferingDto2);
    ProductDto savingsOfferingDto = new ProductDto(savingsOffering.getPrdOfferingId(), savingsOffering.getPrdOfferingShortName());
    List<ProductDto> savingsProducts = Arrays.asList(savingsOfferingDto);
    final PersonnelDto loanOfficer = getPersonnelView(center.getPersonnel());
    final OfficeDetailsDto officeDetailsDto = null;
    final List<CustomValueListElementDto> attendanceTypesList = new ArrayList<CustomValueListElementDto>();
    bulkEntryParent.setCountOfCustomers(3);
    final CollectionSheetEntryGridDto bulkEntry = new CollectionSheetEntryGridDto(bulkEntryParent, loanOfficer, officeDetailsDto, getPaymentTypeView(), startDate, "324343242", startDate, loanProducts, savingsProducts, attendanceTypesList);
    return bulkEntry;
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) CustomValueListElementDto(org.mifos.application.master.business.CustomValueListElementDto) ArrayList(java.util.ArrayList) LoanAccountDto(org.mifos.accounts.loan.util.helpers.LoanAccountDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) Date(java.util.Date) LoanOfferingBO(org.mifos.accounts.productdefinition.business.LoanOfferingBO) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) CollectionSheetEntryDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryDto) LoanAccountsProductDto(org.mifos.accounts.loan.util.helpers.LoanAccountsProductDto) ProductDto(org.mifos.application.servicefacade.ProductDto) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)

Aggregations

OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)37 PersonnelDto (org.mifos.dto.domain.PersonnelDto)19 ArrayList (java.util.ArrayList)13 Test (org.junit.Test)13 CustomerDto (org.mifos.dto.domain.CustomerDto)10 Date (java.util.Date)7 OfficeBO (org.mifos.customers.office.business.OfficeBO)7 UserContext (org.mifos.security.util.UserContext)6 CollectionSheetEntryGridDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)5 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)5 OfficeDto (org.mifos.dto.domain.OfficeDto)5 CollectionSheetEntryDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryDto)4 MessageLookup (org.mifos.application.master.MessageLookup)4 MeetingBO (org.mifos.application.meeting.business.MeetingBO)4 MifosRuntimeException (org.mifos.core.MifosRuntimeException)4 MifosUser (org.mifos.security.MifosUser)4 LoanAccountDto (org.mifos.accounts.loan.util.helpers.LoanAccountDto)3 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)3 SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)3 CustomValueListElementDto (org.mifos.application.master.business.CustomValueListElementDto)3