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);
}
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);
}
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);
}
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());
}
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;
}
Aggregations