Package org.fenixedu.academic.domain.accounting

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


    }

    public ActionForward changeCreditNoteState(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) {
        final CreditNote creditNote = getCreditNoteFromViewState();
        final CreditNoteState creditNoteState = CreditNoteState.valueOf(((CreditNotesActionForm) form).getCreditNoteState());

        try {
            ChangeCreditNoteState.run(getUserView(request).getPerson(), creditNote, creditNoteState);
View Full Code Here


        return mapping.findForward("show");

    }

    private CreditNote getCreditNoteFromViewState() {
        final CreditNote creditNote = (CreditNote) RenderUtils.getViewState("creditNote").getMetaObject().getObject();
        return creditNote;
    }
View Full Code Here

    }

    public ActionForward printCreditNote(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws IOException {

        final CreditNote creditNote = getCreditNoteFromViewState();

        try {

            final CreditNoteDocument original = new CreditNoteDocument(creditNote, getMessageResourceProvider(request), true);
            final CreditNoteDocument duplicate = new CreditNoteDocument(creditNote, getMessageResourceProvider(request), false);

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

            CreditNoteGeneratedDocument.store(creditNote, original.getReportFileName() + ".pdf", data);
            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("creditNoteId", creditNote.getExternalId());

            return showCreditNote(mapping, form, request, response);
        }

    }
View Full Code Here

TOP

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

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.