Search in sources :

Example 1 with ListItem

use of org.mifos.application.servicefacade.ListItem in project head by mifos.

the class ImportTransactionsAction method load.

public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    final ImportTransactionsActionForm importTransactionsForm = (ImportTransactionsActionForm) form;
    importTransactionsForm.clear();
    clearOurSessionVariables(request.getSession());
    final List<ListItem<String>> importPlugins = this.importTransactionsServiceFacade.retrieveImportPlugins();
    request.setAttribute("importPlugins", importPlugins);
    return mapping.findForward("import_load");
}
Also used : ImportTransactionsActionForm(org.mifos.application.importexport.struts.actionforms.ImportTransactionsActionForm) ListItem(org.mifos.application.servicefacade.ListItem)

Example 2 with ListItem

use of org.mifos.application.servicefacade.ListItem in project head by mifos.

the class BulkEntryActionStrutsTest method createCollectionSheetDto.

private CollectionSheetEntryFormDto createCollectionSheetDto(final CustomerDto customerDto, final OfficeDetailsDto officeDetailsDto, final PersonnelDto personnelDto) {
    List<ListItem<Short>> paymentTypesDtoList = new ArrayList<ListItem<Short>>();
    List<OfficeDetailsDto> activeBranches = Arrays.asList(officeDetailsDto);
    List<CustomerDto> customerList = Arrays.asList(customerDto);
    List<PersonnelDto> loanOfficerList = Arrays.asList(personnelDto);
    final Short reloadFormAutomatically = Constants.YES;
    final Short backDatedTransactionAllowed = Constants.NO;
    final Short centerHierarchyExists = Constants.YES;
    final Date meetingDate = new Date();
    return new CollectionSheetEntryFormDto(activeBranches, paymentTypesDtoList, loanOfficerList, customerList, reloadFormAutomatically, centerHierarchyExists, backDatedTransactionAllowed, meetingDate);
}
Also used : ArrayList(java.util.ArrayList) CustomerDto(org.mifos.dto.domain.CustomerDto) PersonnelDto(org.mifos.dto.domain.PersonnelDto) ListItem(org.mifos.application.servicefacade.ListItem) OfficeDetailsDto(org.mifos.dto.domain.OfficeDetailsDto) Date(java.util.Date) CollectionSheetEntryFormDto(org.mifos.application.servicefacade.CollectionSheetEntryFormDto)

Example 3 with ListItem

use of org.mifos.application.servicefacade.ListItem in project head by mifos.

the class WebTierAccountServiceFacade method constructPaymentTypeList.

private List<ListItem<Short>> constructPaymentTypeList(String paymentType, Short localeId) {
    try {
        List<PaymentTypeEntity> paymentTypeList = null;
        if (paymentType != null && !Constants.EMPTY_STRING.equals(paymentType.trim())) {
            if (isLoanPayment(paymentType)) {
                paymentTypeList = acceptedPaymentTypePersistence.getAcceptedPaymentTypesForATransaction(localeId, TrxnTypes.loan_repayment.getValue());
            } else {
                paymentTypeList = acceptedPaymentTypePersistence.getAcceptedPaymentTypesForATransaction(localeId, TrxnTypes.fee.getValue());
            }
        }
        List<ListItem<Short>> listItems = new ArrayList<ListItem<Short>>();
        for (PaymentTypeEntity paymentTypeEntity : paymentTypeList) {
            listItems.add(new ListItem<Short>(paymentTypeEntity.getId(), paymentTypeEntity.getName()));
        }
        return listItems;
    } catch (PersistenceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : PaymentTypeEntity(org.mifos.application.master.business.PaymentTypeEntity) ArrayList(java.util.ArrayList) PersistenceException(org.mifos.framework.exceptions.PersistenceException) ListItem(org.mifos.application.servicefacade.ListItem) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 4 with ListItem

use of org.mifos.application.servicefacade.ListItem in project head by mifos.

the class WebTierAccountServiceFacade method getAccountPaymentInformation.

@Override
public AccountPaymentDto getAccountPaymentInformation(Integer accountId, String paymentType, Short localeId, UserReferenceDto userReferenceDto, Date paymentDate) {
    try {
        AccountBO account = accountBusinessService.getAccount(accountId);
        CustomerDto customer = account.getCustomer().toCustomerDto();
        List<SavingsDetailDto> savingsInUse = clientServiceFacade.retrieveSavingsInUseForClient(customer.getCustomerId());
        List<SavingsDetailDto> accountsForTransfer = new ArrayList<SavingsDetailDto>();
        if (savingsInUse != null) {
            for (SavingsDetailDto savingsAccount : savingsInUse) {
                if (savingsAccount.getAccountStateId().equals(AccountState.SAVINGS_ACTIVE.getValue())) {
                    accountsForTransfer.add(savingsAccount);
                }
            }
        }
        if (isLoanPayment(paymentType)) {
            scheduleCalculatorAdaptor.computeExtraInterest((LoanBO) account, paymentDate);
        }
        UserReferenceDto accountUser = userReferenceDto;
        if (account.getPersonnel() != null) {
            accountUser = new UserReferenceDto(account.getPersonnel().getPersonnelId());
        }
        List<ListItem<Short>> paymentTypeList = constructPaymentTypeList(paymentType, localeId);
        AccountTypeDto accountType = AccountTypeDto.getAccountType(account.getAccountType().getAccountTypeId());
        Money totalPaymentDueMoney = account.getTotalPaymentDue();
        String totalPaymentDue;
        if (account instanceof LoanBO && totalPaymentDueMoney.isZero()) {
            totalPaymentDue = ((LoanBO) account).getTotalRepayableAmount().toString();
        } else {
            totalPaymentDue = totalPaymentDueMoney.toString();
        }
        clearSessionAndRollback();
        return new AccountPaymentDto(accountType, account.getVersionNo(), paymentTypeList, totalPaymentDue, accountUser, getLastPaymentDate(account), accountsForTransfer, customer);
    } catch (ServiceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : SavingsDetailDto(org.mifos.dto.domain.SavingsDetailDto) LoanBO(org.mifos.accounts.loan.business.LoanBO) CustomerDto(org.mifos.dto.domain.CustomerDto) ArrayList(java.util.ArrayList) UserReferenceDto(org.mifos.dto.domain.UserReferenceDto) AccountBO(org.mifos.accounts.business.AccountBO) Money(org.mifos.framework.util.helpers.Money) ServiceException(org.mifos.framework.exceptions.ServiceException) ListItem(org.mifos.application.servicefacade.ListItem) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 5 with ListItem

use of org.mifos.application.servicefacade.ListItem in project head by mifos.

the class ApplyAdjustment method previewAdjustment.

@TransactionDemarcate(joinToken = true)
public ActionForward previewAdjustment(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    ApplyAdjustmentActionForm appAdjustActionForm = (ApplyAdjustmentActionForm) form;
    appAdjustActionForm.setAdjustData(!appAdjustActionForm.getAdjustcheckbox());
    if (appAdjustActionForm.isAdjustData()) {
        @SuppressWarnings("unchecked") List<ListItem<Short>> paymentTypes = (List<ListItem<Short>>) SessionUtils.getAttribute(MasterConstants.PAYMENT_TYPE, request);
        Short elementType = Short.valueOf(appAdjustActionForm.getPaymentType());
        for (ListItem<Short> item : paymentTypes) {
            if (item.getId().equals(elementType)) {
                SessionUtils.setAttribute(Constants.ADJUSTMENT_PAYMENT_TYPE, item.getDisplayValue(), request);
            }
        }
    }
    if (appAdjustActionForm.getNewAmounts() != null && !appAdjustActionForm.getNewAmounts().isEmpty()) {
        BigDecimal newAmount = BigDecimal.ZERO;
        for (String memberNewAmountString : appAdjustActionForm.getNewAmounts().values()) {
            BigDecimal memberNewAmount = BigDecimal.ZERO;
            if (!StringUtils.isBlank(memberNewAmountString)) {
                memberNewAmount = new BigDecimal(memberNewAmountString);
            }
            newAmount = newAmount.add(memberNewAmount);
        }
        appAdjustActionForm.setAmount(newAmount.toString());
    }
    request.setAttribute("method", "previewAdjustment");
    return mapping.findForward("previewadj_success");
}
Also used : ApplyAdjustmentActionForm(org.mifos.accounts.struts.actionforms.ApplyAdjustmentActionForm) ArrayList(java.util.ArrayList) List(java.util.List) ListItem(org.mifos.application.servicefacade.ListItem) BigDecimal(java.math.BigDecimal) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

ListItem (org.mifos.application.servicefacade.ListItem)9 ArrayList (java.util.ArrayList)6 Date (java.util.Date)3 MifosRuntimeException (org.mifos.core.MifosRuntimeException)3 CustomerDto (org.mifos.dto.domain.CustomerDto)3 AccountBO (org.mifos.accounts.business.AccountBO)2 ApplyAdjustmentActionForm (org.mifos.accounts.struts.actionforms.ApplyAdjustmentActionForm)2 PaymentTypeEntity (org.mifos.application.master.business.PaymentTypeEntity)2 CollectionSheetEntryFormDto (org.mifos.application.servicefacade.CollectionSheetEntryFormDto)2 OfficeDetailsDto (org.mifos.dto.domain.OfficeDetailsDto)2 PersonnelDto (org.mifos.dto.domain.PersonnelDto)2 PersistenceException (org.mifos.framework.exceptions.PersistenceException)2 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)2 BigDecimal (java.math.BigDecimal)1 HashMap (java.util.HashMap)1 List (java.util.List)1 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 ImportTransactionsActionForm (org.mifos.application.importexport.struts.actionforms.ImportTransactionsActionForm)1 SavingsDetailDto (org.mifos.dto.domain.SavingsDetailDto)1