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