Search in sources :

Example 1 with CONTRACTOR_REFERENCE

use of eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.CONTRACTOR_REFERENCE in project dwoss by gg-net.

the class ContractorPricePartNoExporterOperation method toContractorXls.

// Manufacturer PartNo | GTIN | Name | Contractor Reference Price | ContractorPartNo
private FileJacket toContractorXls(TradeName contractor, final boolean missing) {
    SubMonitor m = monitorFactory.newSubMonitor("Lieferanten Exporter", 100);
    m.message("Loading Units").start();
    List<Object[]> rows = productEao.findByContractor(contractor).stream().filter(p -> missing ? !p.hasPrice(CONTRACTOR_REFERENCE) : true).sorted().map(p -> new Object[] { p.getPartNo(), p.getGtin(), p.getTradeName() + " " + p.getName(), p.getPrice(CONTRACTOR_REFERENCE), p.getAdditionalPartNo(contractor) }).collect(Collectors.toList());
    m.worked(5, "Generating File");
    STable table = new STable();
    table.setTableFormat(new CFormat(BLACK, WHITE));
    table.setHeadlineFormat(new CFormat(BOLD_ITALIC));
    table.add(new STableColumn("Herstellerartikelnummer", 18)).add(new STableColumn("Gtin/Ean", 15));
    table.add(new STableColumn("Bezeichnung", 25)).add(new STableColumn("Reference Preis", 12, new CFormat(CURRENCY_EURO))).add(new STableColumn("Lieferantenartikelnummer", 14));
    table.setModel(new STableModelList(rows));
    CCalcDocument cdoc = new TempCalcDocument();
    cdoc.add(new CSheet(contractor.getName(), table));
    FileJacket result = new FileJacket((missing ? "Fehlende " : "Alle ") + contractor.getName() + " Preise und Artikelnummern 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

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