Search in sources :

Example 1 with MANUFACTURER_COST

use of eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.MANUFACTURER_COST 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

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