Search in sources :

Example 1 with JExcelLucidCalcWriter

use of eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter in project dwoss by gg-net.

the class CustomerExporterOperation method toXls.

/**
 * Converts customers to a xls file.
 * Method is here for tryout.
 *
 * @param customers
 * @return
 */
public static FileJacket toXls(List<Customer> customers) {
    STable table = new STable();
    table.setTableFormat(new CFormat(BLACK, WHITE, new CBorder(BLACK)));
    table.setHeadlineFormat(new CFormat(BOLD_ITALIC, Color.BLACK, Color.YELLOW, CENTER, new CBorder(BLACK)));
    table.add(new STableColumn("DW Kid"));
    table.add(new STableColumn("Lexware Id", 12));
    table.add(new STableColumn("Sage Id"));
    table.add(new STableColumn("Fibu Konto", 12));
    table.add(new STableColumn("Firma", 35));
    table.add(new STableColumn("UST Id", 15));
    table.add(new STableColumn("Vorname", 15));
    table.add(new STableColumn("Nachname", 15));
    table.add(new STableColumn("Geschl.", 9));
    table.add(new STableColumn("Straße", 30));
    table.add(new STableColumn("Plz", 9));
    table.add(new STableColumn("Ort", 20));
    table.add(new STableColumn("Tel", 20));
    table.add(new STableColumn("Mobil", 20));
    table.add(new STableColumn("eMail", 25));
    table.add(new STableColumn("DatenQuelle", 15));
    table.add(new STableColumn("Branche", 20));
    table.add(new STableColumn("CS Upd. Kd.", 12, new CFormat(FontStyle.BOLD)));
    table.add(new STableColumn("Systemh.", 11, new CFormat(FontStyle.BOLD)));
    table.add(new STableColumn("Prio A", 10, new CFormat(FontStyle.BOLD)));
    table.add(new STableColumn("Anmerkungen", 40));
    table.setModel(new STableModelList(buildModel(customers)));
    CCalcDocument cdoc = new TempCalcDocument("Kundenexport");
    cdoc.add(new CSheet("Kunden", table));
    FileJacket result = new FileJacket("Kundenexport", ".xls", new JExcelLucidCalcWriter().write(cdoc));
    return result;
}
Also used : JExcelLucidCalcWriter(eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter) FileJacket(eu.ggnet.dwoss.util.FileJacket)

Example 2 with JExcelLucidCalcWriter

use of eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter in project dwoss by gg-net.

the class RevenueReporterOperation method toXls.

@Override
public FileJacket toXls(Date start, Date end, Step step, boolean extraReported) {
    String name = "Umsatzreport";
    SubMonitor m = monitorFactory.newSubMonitor(name);
    m.start();
    NavigableMap<Date, Revenue> revenue = eao.revenueByPositionTypesAndDate(Arrays.asList(UNIT, UNIT_ANNEX), start, end, step, extraReported);
    m.worked(10);
    STable template = new STable();
    template.setTableFormat(new CFormat(BLACK, WHITE, new CBorder(BLACK)));
    template.setHeadlineFormat(new CFormat(BOLD_ITALIC, WHITE, BLUE, CENTER, new CBorder(BLACK)));
    template.add(new STableColumn(step.name(), 12));
    template.add(new STableColumn("Einnahmen Händler", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    template.add(new STableColumn("Einnahmen Endkunde", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    template.add(new STableColumn("Einnahmen Unknown", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    template.add(new STableColumn("Einnahmen Summe", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    template.add(new STableColumn("Storno Händler", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    template.add(new STableColumn("Storno Endkunde", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    template.add(new STableColumn("Storno Summe", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    template.add(new STableColumn("Umsatz Summe", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    template.add(new STableColumn("Ertrag Reported Summe", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    template.add(new STableColumn("Einkauf Reported Summe", 18, new CFormat(RIGHT, CURRENCY_EURO)));
    STable all = new STable(template);
    all.setModel(new STableModelList(buildSumModel(step, revenue)));
    CCalcDocument cdoc = new TempCalcDocument(name);
    cdoc.add(new CSheet("Revenue_All", all));
    for (TradeName contractor : contractors.all()) {
        STable simple = new STable(template);
        simple.setModel(new STableModelList(buildContractorModel(step, contractor, revenue)));
        cdoc.add(new CSheet("Revenue_" + contractor, simple));
    }
    FileJacket result = new FileJacket(name, ".xls", new JExcelLucidCalcWriter().write(cdoc));
    m.finish();
    return result;
}
Also used : SubMonitor(eu.ggnet.dwoss.progress.SubMonitor) FileJacket(eu.ggnet.dwoss.util.FileJacket) JExcelLucidCalcWriter(eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter)

Example 3 with JExcelLucidCalcWriter

use of eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter in project dwoss by gg-net.

the class UniqueUnitReporterOperation method unitInputAsXls.

@Override
public FileJacket unitInputAsXls(Date start, Date end, Step step) {
    String name = "Aufnahmemengereport";
    SubMonitor m = monitorFactory.newSubMonitor(name);
    m.start();
    UniqueUnitEao eao = new UniqueUnitEao(em);
    NavigableSet<TradeName> usedManufacturers = eao.findUsedManufactuers();
    NavigableMap<Date, BrandContractorCount> revenue = eao.countByInputDateContractor(start, end, step);
    STable template = new STable();
    template.setTableFormat(new CFormat(BLACK, WHITE, new CBorder(BLACK)));
    template.setHeadlineFormat(new CFormat(BOLD_ITALIC, WHITE, BLUE, CENTER, new CBorder(BLACK)));
    template.add(new STableColumn(step.name(), 12));
    for (TradeName manufacturer : usedManufacturers) {
        template.add(new STableColumn(manufacturer.getName(), 15, new CFormat(RIGHT)));
    }
    template.add(new STableColumn("Summe", 18, new CFormat(RIGHT)));
    STable all = new STable(template);
    all.setModel(new STableModelList(buildSumModel(step, usedManufacturers, revenue)));
    CCalcDocument cdoc = new TempCalcDocument(name);
    cdoc.add(new CSheet("Input_All", all));
    for (TradeName contractor : contractors.all()) {
        STable simple = new STable(template);
        simple.setModel(new STableModelList(buildContractorModel(step, contractor, usedManufacturers, revenue)));
        cdoc.add(new CSheet("Input_" + contractor, simple));
    }
    FileJacket result = new FileJacket(name, ".xls", new JExcelLucidCalcWriter().write(cdoc));
    m.finish();
    return result;
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) SubMonitor(eu.ggnet.dwoss.progress.SubMonitor) FileJacket(eu.ggnet.dwoss.util.FileJacket) UniqueUnitEao(eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao) BrandContractorCount(eu.ggnet.dwoss.uniqueunit.ee.eao.BrandContractorCount) JExcelLucidCalcWriter(eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter)

Example 4 with JExcelLucidCalcWriter

use of eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter in project dwoss by gg-net.

the class DocumentSupporterOperation method toXls.

@Override
public FileJacket toXls(String identifier) {
    DossierEao dossierEao = new DossierEao(redTapeEm);
    UniqueUnitEao uniqueUnitEao = new UniqueUnitEao(uuEm);
    List<Dossier> dossiers = dossierEao.findByIdentifier(identifier);
    if (dossiers.isEmpty())
        return null;
    Map<String, List<Object[]>> datas = new HashMap<>();
    for (Dossier dossier : dossiers) {
        for (Document document : dossier.getActiveDocuments()) {
            List<Object[]> rows = new ArrayList<>();
            datas.put(dossier.getIdentifier() + "_" + document.getType().getName() + "_" + (document.getIdentifier() == null ? "" : document.getIdentifier()), rows);
            for (Position pos : document.getPositions().values()) {
                if (pos.getUniqueUnitId() > 0) {
                    UniqueUnit uu = uniqueUnitEao.findById(pos.getUniqueUnitId());
                    rows.add(new Object[] { pos.getType().getName(), pos.getAmount(), pos.getName(), pos.getPrice(), pos.toAfterTaxPrice(), DateFormats.ISO.format(uu.getMfgDate()), uu.getProduct().getPrice(PriceType.MANUFACTURER_COST) });
                } else {
                    rows.add(new Object[] { pos.getType().getName(), pos.getAmount(), pos.getName(), pos.getPrice(), pos.toAfterTaxPrice(), null, null });
                }
            }
        }
    }
    STable template = new STable();
    CFormat euro = new CFormat(RIGHT, CURRENCY_EURO);
    CFormat date = new CFormat(CENTER, SHORT_DATE);
    CFormat percent = new CFormat(ITALIC, BLUE, null, null, null, PERCENT_FLOAT);
    template.setHeadlineFormat(new CFormat(BOLD_ITALIC, BLACK, WHITE, CENTER, new CBorder(BLACK)));
    template.add(new STableColumn("Type", 7)).add(new STableColumn("Menge", 10)).add(new STableColumn("Name", 30)).add(new STableColumn("Preis", 15, euro)).add(new STableColumn("Preis inc. Mwst", 15, euro)).add(new STableColumn("MfgDate", 13, date)).add(new STableColumn("CostPrice", 12, euro)).add(new STableColumn("%Cost", 12, percent).setAction(new SFormulaAction(SR(3), "/", SR(6))));
    CCalcDocument document = new TempCalcDocument();
    for (Map.Entry<String, List<Object[]>> entry : datas.entrySet()) {
        CSheet sheet = new CSheet(entry.getKey());
        STable table = new STable(template);
        table.setModel(new STableModelList(entry.getValue()));
        sheet.addBelow(table);
        document.add(sheet);
    }
    FileJacket fj = new FileJacket("Dossiers", ".xls", new JExcelLucidCalcWriter().write(document));
    return fj;
}
Also used : DossierEao(eu.ggnet.dwoss.redtape.ee.eao.DossierEao) UniqueUnitEao(eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao) UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) JExcelLucidCalcWriter(eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter)

Example 5 with JExcelLucidCalcWriter

use of eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter in project dwoss by gg-net.

the class ContractorPricePartNoExporterOperation method toManufacturerMissingXls.

@Override
public FileJacket toManufacturerMissingXls(TradeName contractorManufacturer) {
    if (!contractorManufacturer.isManufacturer())
        throw new RuntimeException(contractorManufacturer + " is not a Manufacturer, wrong exporter");
    SubMonitor m = monitorFactory.newSubMonitor("Lieferanten und Hersteller Exporter");
    m.message("Loading Units").start();
    List<Object[]> rows = productEao.findByTradeNames(contractorManufacturer.getBrands()).stream().filter(p -> p.getPrice(MANUFACTURER_COST) <= 0.01).sorted().map(p -> new Object[] { p.getPartNo(), 0.0, ProductFormater.toName(p) }).collect(Collectors.toList());
    m.setWorkRemaining(rows.size() + 10).message("Filtering");
    m.message("Generating Document");
    STable table = new STable();
    table.setTableFormat(new CFormat(BLACK, WHITE));
    table.setHeadlineFormat(new CFormat(BOLD_ITALIC));
    table.add(new STableColumn("Artikelnummer", 18)).add(new STableColumn("Kostpreis", 12, new CFormat(CURRENCY_EURO))).add(new STableColumn("Name", 45));
    table.setModel(new STableModelList(rows));
    CCalcDocument cdoc = new TempCalcDocument();
    cdoc.add(new CSheet("Kostpreise", table));
    FileJacket result = new FileJacket("Fehlende " + contractorManufacturer.getName() + " Kostpreise vom " + ISO.format(new Date()), ".xls", new JExcelLucidCalcWriter().write(cdoc));
    m.finish();
    return result;
}
Also used : Stateless(javax.ejb.Stateless) CURRENCY_EURO(eu.ggnet.lucidcalc.CFormat.Representation.CURRENCY_EURO) TradeName(eu.ggnet.dwoss.rules.TradeName) ProductFormater(eu.ggnet.dwoss.uniqueunit.ee.format.ProductFormater) Date(java.util.Date) SubMonitor(eu.ggnet.dwoss.progress.SubMonitor) FileJacket(eu.ggnet.dwoss.util.FileJacket) WHITE(java.awt.Color.WHITE) Collectors(java.util.stream.Collectors) ISO(eu.ggnet.dwoss.util.DateFormats.ISO) CONTRACTOR_REFERENCE(eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.CONTRACTOR_REFERENCE) Inject(javax.inject.Inject) BLACK(java.awt.Color.BLACK) List(java.util.List) MANUFACTURER_COST(eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.MANUFACTURER_COST) ProductEao(eu.ggnet.dwoss.uniqueunit.ee.eao.ProductEao) eu.ggnet.lucidcalc(eu.ggnet.lucidcalc) MonitorFactory(eu.ggnet.dwoss.progress.MonitorFactory) BOLD_ITALIC(eu.ggnet.lucidcalc.CFormat.FontStyle.BOLD_ITALIC) JExcelLucidCalcWriter(eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter) SubMonitor(eu.ggnet.dwoss.progress.SubMonitor) FileJacket(eu.ggnet.dwoss.util.FileJacket) Date(java.util.Date) JExcelLucidCalcWriter(eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter)

Aggregations

JExcelLucidCalcWriter (eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter)6 FileJacket (eu.ggnet.dwoss.util.FileJacket)5 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)4 TradeName (eu.ggnet.dwoss.rules.TradeName)3 MonitorFactory (eu.ggnet.dwoss.progress.MonitorFactory)2 ProductEao (eu.ggnet.dwoss.uniqueunit.ee.eao.ProductEao)2 UniqueUnitEao (eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao)2 CONTRACTOR_REFERENCE (eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.CONTRACTOR_REFERENCE)2 MANUFACTURER_COST (eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.MANUFACTURER_COST)2 ProductFormater (eu.ggnet.dwoss.uniqueunit.ee.format.ProductFormater)2 ISO (eu.ggnet.dwoss.util.DateFormats.ISO)2 eu.ggnet.lucidcalc (eu.ggnet.lucidcalc)2 BOLD_ITALIC (eu.ggnet.lucidcalc.CFormat.FontStyle.BOLD_ITALIC)2 CURRENCY_EURO (eu.ggnet.lucidcalc.CFormat.Representation.CURRENCY_EURO)2 BLACK (java.awt.Color.BLACK)2 WHITE (java.awt.Color.WHITE)2 Date (java.util.Date)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Stateless (javax.ejb.Stateless)2