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;
}
Aggregations