Search in sources :

Example 1 with AdminDocumentDto

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

the class ViewCustomerDetailsController method showLastPaymentReceipt.

@RequestMapping(value = "/printClientPaymentReceipt", method = RequestMethod.GET)
public ModelAndView showLastPaymentReceipt(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String globalAccountNum) {
    ModelAndView modelAndView = new ModelAndView("printClientPaymentReceipt");
    String gan = null;
    if (globalAccountNum == null) {
        gan = request.getSession().getAttribute("globalAccountNum").toString();
    } else {
        gan = globalAccountNum;
    }
    String clientSystemId = request.getParameter("globalCustNum");
    AccountPaymentDto clientAccountPayment = clientServiceFacade.getClientAccountPayments(gan).get(0);
    List<AdminDocumentDto> adminDocuments = adminDocumentsServiceFacade.getAdminDocumentsForAccountPayment(clientAccountPayment.getPaymentId());
    if (adminDocuments != null && !adminDocuments.isEmpty()) {
        clientAccountPayment.setAdminDocuments(adminDocuments);
    }
    modelAndView.addObject("clientAccountPayment", clientAccountPayment);
    modelAndView.addObject("globalAccountNum", gan);
    modelAndView.addObject("clientSystemId", clientSystemId);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) AdminDocumentDto(org.mifos.dto.domain.AdminDocumentDto) AccountPaymentDto(org.mifos.dto.screen.AccountPaymentDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with AdminDocumentDto

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

the class AdminDocumentsServiceImpl method getAdminDocumentsForAccountPayment.

@Override
public List<AdminDocumentDto> getAdminDocumentsForAccountPayment(Integer paymentId) {
    try {
        List<AdminDocumentDto> adminDocuments = new ArrayList<AdminDocumentDto>();
        AccountPaymentEntity accountPaymentEntity = legacyAccountDao.findPaymentById(paymentId);
        Set<AccountTrxnEntity> accountTrxnEntities = accountPaymentEntity.getAccountTrxns();
        for (AccountTrxnEntity accountTrxnEntity : accountTrxnEntities) {
            List<AdminDocumentBO> adminDocumentBOs = legacyAdminDocumentDao.getActiveAdminDocumentsByAccountActionId(accountTrxnEntity.getAccountActionEntity().getId());
            if (adminDocumentBOs != null && !adminDocumentBOs.isEmpty()) {
                for (AdminDocumentBO adminDocumentBO : adminDocumentBOs) {
                    AdminDocumentDto adminDocumentDto = new AdminDocumentDto(adminDocumentBO.getAdmindocId().intValue(), adminDocumentBO.getAdminDocumentName(), adminDocumentBO.getAdminDocumentIdentifier(), BooleanUtils.toBoolean(adminDocumentBO.getIsActive().intValue()));
                    if (!adminDocuments.contains(adminDocumentDto)) {
                        adminDocuments.add(adminDocumentDto);
                    }
                }
            }
        }
        return adminDocuments;
    } catch (PersistenceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : AccountTrxnEntity(org.mifos.accounts.business.AccountTrxnEntity) AdminDocumentBO(org.mifos.reports.admindocuments.business.AdminDocumentBO) ArrayList(java.util.ArrayList) AccountPaymentEntity(org.mifos.accounts.business.AccountPaymentEntity) PersistenceException(org.mifos.framework.exceptions.PersistenceException) AdminDocumentDto(org.mifos.dto.domain.AdminDocumentDto) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 3 with AdminDocumentDto

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

the class AdminDocumentController method showDocument.

@RequestMapping(value = "/editAdminDocs", method = RequestMethod.GET)
public ModelAndView showDocument(HttpServletRequest request) {
    Integer id = Integer.parseInt(request.getParameter("id"));
    AdminDocumentDto document = findByDocId(id);
    /*
         * Since the DocumentDto is an immutable object. We would like to have
         *  a bean bound to the form that updates the document info. Basically don't want to
         *  change the DocumentDto object.
         *
         *  TODO: Need to understand where AdminDocumentFormBean gets all it's data
         *        Some of it comes from AdminDocumentDto, but not all variables.
         *
         *  Work In Progress.
         */
    ModelAndView mav = new ModelAndView("editAdminDocs");
    // Form Backed Object
    AdminDocumentFormBean formBean = new AdminDocumentFormBean();
    formBean.setAccountType("loan");
    formBean.setName(document.getName());
    formBean.setId(document.getId());
    Map<String, String> accountType = accountTypeMap();
    Map<String, String> showStatus = accountStatusMap(formBean.getAccountType());
    mav.addObject("status", showStatus);
    mav.addObject("accountType", accountType);
    mav.addObject("formBean", formBean);
    return mav;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) AdminDocumentDto(org.mifos.dto.domain.AdminDocumentDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with AdminDocumentDto

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

the class AdminDocumentController method createStub.

@SuppressWarnings("PMD")
private List<AdminDocumentDto> createStub() {
    List<AdminDocumentDto> docs = new ArrayList<AdminDocumentDto>();
    Integer[] docid = { 0, 1, 2, 3 };
    Boolean[] isactive = { true, false, true, false };
    String[] name = { "doc 1", "doc 2", "doc 3", "doc 4" };
    String[] identifier = { "id 1", "id 2", "id 3", "id 4" };
    for (int i = 0; i < name.length; i++) {
        AdminDocumentDto adminDoc = new AdminDocumentDto(docid[i], name[i], identifier[i], isactive[i]);
        docs.add(i, adminDoc);
    }
    return docs;
}
Also used : ArrayList(java.util.ArrayList) AdminDocumentDto(org.mifos.dto.domain.AdminDocumentDto)

Example 5 with AdminDocumentDto

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

the class ViewLoanAccountDetailsController method showLastPaymentReceipt.

@RequestMapping(value = "/printPaymentReceipt", method = RequestMethod.GET)
public ModelAndView showLastPaymentReceipt(HttpServletRequest request, HttpServletResponse response, @RequestParam(required = false) String globalAccountNum) {
    ModelAndView modelAndView = new ModelAndView("printPaymentReceipt");
    String gan = null;
    if (globalAccountNum == null) {
        gan = request.getSession().getAttribute("globalAccountNum").toString();
    } else {
        gan = globalAccountNum;
    }
    AccountPaymentDto loanAccountPayment = loanAccountServiceFacade.getLoanAccountPayments(gan).get(0);
    if (loanAccountServiceFacade.getGroupLoanType(gan).equals(GROUP_LOAN_PARENT)) {
        Integer accountId = loanAccountServiceFacade.retrieveLoanInformation(gan).getAccountId();
        List<AccountPaymentDto> loanAccountPayments = loanAccountServiceFacade.getLoanAccountPayments(gan);
        for (AccountPaymentDto payment : loanAccountPayments) {
            if (payment.getAccount().getAccountId() == accountId) {
                loanAccountPayment = payment;
                break;
            }
        }
    }
    List<AdminDocumentDto> adminDocuments = adminDocumentsServiceFacade.getAdminDocumentsForAccountPayment(loanAccountPayment.getPaymentId());
    if (adminDocuments != null && !adminDocuments.isEmpty()) {
        loanAccountPayment.setAdminDocuments(adminDocuments);
    }
    modelAndView.addObject("loanAccountPayment", loanAccountPayment);
    modelAndView.addObject("globalAccountNum", gan);
    return modelAndView;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) AdminDocumentDto(org.mifos.dto.domain.AdminDocumentDto) AccountPaymentDto(org.mifos.dto.screen.AccountPaymentDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

AdminDocumentDto (org.mifos.dto.domain.AdminDocumentDto)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ModelAndView (org.springframework.web.servlet.ModelAndView)4 AccountPaymentDto (org.mifos.dto.screen.AccountPaymentDto)3 ArrayList (java.util.ArrayList)2 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)1 AccountTrxnEntity (org.mifos.accounts.business.AccountTrxnEntity)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 AdminDocumentBO (org.mifos.reports.admindocuments.business.AdminDocumentBO)1