Search in sources :

Example 1 with Document

use of com.roadtocubaandbeyond.ordermanagement.entity.Document in project rtcab-ordermanagement by mariodavid.

the class OrderEdit method generateInvoice.

public void generateInvoice() {
    Report invoiceReport = reportLoadService.loadReportBySystemcode("order_invoice");
    String fileName = "myFile";
    Map<String, Object> params = new HashMap<>();
    params.put("entity", getItem());
    FileDescriptor invoiceFile = reportService.createAndSaveReport(invoiceReport, params, fileName);
    Document invoiceDocument = metadata.create(Document.class);
    invoiceDocument.setFile(invoiceFile);
    invoiceDocument.setName(fileName);
    invoiceDocument.setType(DocumentType.INVOICE);
    invoiceDocument.setOrder(getItem());
    documentsDs.addItem(invoiceDocument);
}
Also used : Report(com.haulmont.reports.entity.Report) HashMap(java.util.HashMap) Document(com.roadtocubaandbeyond.ordermanagement.entity.Document) FileDescriptor(com.haulmont.cuba.core.entity.FileDescriptor)

Aggregations

FileDescriptor (com.haulmont.cuba.core.entity.FileDescriptor)1 Report (com.haulmont.reports.entity.Report)1 Document (com.roadtocubaandbeyond.ordermanagement.entity.Document)1 HashMap (java.util.HashMap)1