Search in sources :

Example 1 with Type

use of eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult.Type in project dwoss by gg-net.

the class XlsExporter method toFullXls.

public static File toFullXls(ViewReportResult report) {
    STable template = new STable();
    template.setTableFormat(new CFormat("Verdana", 10, new CBorder(Color.BLACK, CBorder.LineStyle.THIN)));
    template.setHeadlineFormat(new CFormat(BOLD, Color.BLACK, Color.YELLOW, CENTER, MIDDLE));
    template.add(new STableColumn("Datum", 10, new CFormat(SHORT_DATE)));
    template.add(new STableColumn("SopoNr", 10));
    template.add(new STableColumn("ArtikelNr", 15));
    template.add(new STableColumn("Bezeichnung", 40));
    template.add(new STableColumn("Seriennummer", 32));
    template.add(new STableColumn("CP", 15, EURO));
    template.add(new STableColumn("VK", 15, EURO));
    template.add(new STableColumn("%CP", 12, new CFormat(RIGHT, PERCENT_FLOAT)).setAction(SUtil.getSelfRow()));
    template.add(new STableColumn("EK", 15, EURO));
    template.add(new STableColumn("Marge", 12, new CFormat(RIGHT, CURRENCY_EURO)).setAction(SUtil.getSelfRow()));
    template.add(new STableColumn("%Marge", 12, new CFormat(RIGHT, PERCENT_FLOAT)));
    template.add(new STableColumn("MFGDate", 10, new CFormat(SHORT_DATE)));
    template.add(new STableColumn("CID", 12));
    template.add(new STableColumn("Firma", 35));
    template.add(new STableColumn("Name", 30));
    template.add(new STableColumn("Postionstype", 15));
    template.add(new STableColumn("DocumenType", 15));
    template.add(new STableColumn("Workflow", 15));
    template.add(new STableColumn("Bemerkung", 30));
    ReportParameter parameter = report.getParameter();
    CSheet sheet = new CSheet(parameter.getReportName());
    for (Type type : report.getLines().keySet()) {
        sheet.addBelow(new SBlock(type.name(), new CFormat(BOLD), true));
        STable table = new STable(template);
        table.setModel(new STableModelList<>(toLucidModel(report.getLines().get(type))));
        sheet.addBelow(table);
        SResult summary = createSummary(table, parameter.getStart(), parameter.getEnd());
        sheet.addBelow(4, 1, summary.block);
    }
    // Construct to create a summary for multivple tables.
    // 
    // SBlock summary = new SBlock();
    // summary.setFormat(new CFormat(BOLD, Color.BLACK, Color.YELLOW, RIGHT, new CBorder(Color.BLACK)));
    // SCell sum1 = new SCell(new SFormula(newSummary.sum1, "+", oldSummary.sum1), EURO);
    // SCell sum2 = new SCell(new SFormula(newSummary.sum2, "+", oldSummary.sum2), EURO);
    // summary.add("Summe", new CFormat(Color.BLUE, Color.WHITE, LEFT),
    // sum1,
    // sum2,
    // new SFormula(sum2, "/", sum1), new CFormat(PERCENT_FLOAT),
    // new SFormula(newSummary.sum3, "+", oldSummary.sum3), EURO,
    // new SFormula(newSummary.sum4, "+", oldSummary.sum4), EURO);
    // 
    CCalcDocument doc = new TempCalcDocument(parameter.getReportName() + "_");
    doc.add(sheet);
    LucidCalcWriter writer = LucidCalc.createWriter(LucidCalc.Backend.XLS);
    return writer.write(doc);
}
Also used : ReportParameter(eu.ggnet.dwoss.report.ee.ReportAgent.ReportParameter) Type(eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult.Type)

Aggregations

ReportParameter (eu.ggnet.dwoss.report.ee.ReportAgent.ReportParameter)1 Type (eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult.Type)1