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