Package org.fenixedu.academic.domain.accounting

Examples of org.fenixedu.academic.domain.accounting.Receipt


        }

        //This is here to force the load of the relation to debug a possible bug in FenixFramework
        paymentsManagementDTO.getPerson().getReceiptsSet().size();
        try {
            final Receipt receipt =
                    CreatePaymentsForEvents.run(getUserView(request).getPerson().getUser(),
                            paymentsManagementDTO.getSelectedEntries(), PaymentMode.CASH,
                            paymentsManagementDTO.isDifferedPayment(), paymentsManagementDTO.getPaymentDate(),
                            paymentsManagementDTO.getPerson(), paymentsManagementDTO.getContributorName(),
                            paymentsManagementDTO.getContributorNumber(), paymentsManagementDTO.getContributorAddress());

            request.setAttribute("personId", paymentsManagementDTO.getPerson().getExternalId());
            request.setAttribute("receiptID", receipt.getExternalId());

            return mapping.findForward("showReceipt");

        } catch (DomainExceptionWithLabelFormatter ex) {
            addActionMessage(request, ex.getKey(), solveLabelFormatterArgs(request, ex.getLabelFormatterArgs()));
View Full Code Here


                (CreateReceiptBean) RenderUtils.getViewState("createReceiptBeanConfirm").getMetaObject().getObject();

        //This is here to force the load of the relation to debug a possible bug in FenixFramework
        createReceiptBean.getPerson().getReceiptsSet().size();
        try {
            final Receipt receipt =
                    CreateReceipt.run(getUserView(request).getPerson(), createReceiptBean.getPerson(),
                            createReceiptBean.getContributorName(), createReceiptBean.getContributorNumber(),
                            createReceiptBean.getContributorAddress(), createReceiptBean.getYear(),
                            createReceiptBean.getSelectedEntries());

            request.setAttribute("personId", receipt.getPerson().getExternalId());
            request.setAttribute("receiptID", receipt.getExternalId());

            return prepareShowReceipt(mapping, form, request, response);

        } catch (DomainException ex) {
View Full Code Here

    }

    public ActionForward printReceipt(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
            HttpServletResponse response) throws IOException {

        final Receipt receipt = getRenderedObject("receipt");
        try {

            final ReceiptDocument original = new ReceiptDocument(receipt, getMessageResourceProvider(request), true);
            final ReceiptDocument duplicate = new ReceiptDocument(receipt, getMessageResourceProvider(request), false);

            final byte[] data = ReportsUtils.exportMultipleToPdfAsByteArray(original, duplicate);

            ReceiptGeneratedDocument.store(receipt, original.getReportFileName() + ".pdf", data);

            RegisterReceiptPrint.run(receipt, getUserView(request).getPerson());

            response.setContentLength(data.length);
            response.setContentType("application/pdf");
            response.addHeader("Content-Disposition", String.format("attachment; filename=%s.pdf", original.getReportFileName()));

            response.getOutputStream().write(data);

            return null;

        } catch (DomainException e) {
            addActionMessage(request, e.getKey(), e.getArgs());

            request.setAttribute("personId", receipt.getPerson().getExternalId());
            request.setAttribute("receiptID", receipt.getExternalId());

            return prepareShowReceipt(mapping, actionForm, request, response);
        }

    }
View Full Code Here

    public ActionForward prepareShowReceipt(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
            HttpServletResponse response) {

        final Person person = getPerson(request);
        final Receipt receipt = getReceipt(request);

        if (receipt == null) {
            addActionMessage("context", request, "error.payments.receipt.not.found");
            request.setAttribute("person", person);
            return mapping.findForward("showReceipts");
        }
        if (receipt.getPerson() != person) {
            addActionMessage("context", request, "error.payments.person.doesnot.contain.receipt");
            request.setAttribute("person", person);
            return mapping.findForward("showReceipts");
        }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.accounting.Receipt

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.