use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.
the class UniqueUnitReporterOperation method buildSumModel.
private List<Object[]> buildSumModel(Step step, NavigableSet<TradeName> usedManufacturers, NavigableMap<Date, BrandContractorCount> revenue) {
List<Object[]> rows = new ArrayList<>();
for (Entry<Date, BrandContractorCount> e : revenue.entrySet()) {
BrandContractorCount r = e.getValue();
Object[] row = new Object[usedManufacturers.size() + 2];
row[0] = step.format(e.getKey());
int count = 1;
for (TradeName manufacturer : usedManufacturers) {
row[count] = r.countByManufacturer(manufacturer);
count++;
}
row[count] = r.count();
rows.add(row);
}
return rows;
}
use of eu.ggnet.dwoss.rules.TradeName 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;
}
use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.
the class ProductModelEmoIT method testRequestBrandGroupNameByHand.
@Test
public void testRequestBrandGroupNameByHand() throws Exception {
TradeName sb = TradeName.HP;
ProductGroup sg = ProductGroup.PROJECTOR;
String sn = "SERIES";
String fn = "FAMILY";
String mn = "MODEL";
utx.begin();
em.joinTransaction();
new ProductSeriesEmo(em).request(sb, sg, sn);
utx.commit();
utx.begin();
em.joinTransaction();
new ProductFamilyEmo(em).request(sb, sg, sn, fn);
utx.commit();
utx.begin();
em.joinTransaction();
ProductModel model = new ProductModelEmo(em).request(sb, sg, sn, fn, mn);
assertNotNull(model);
utx.commit();
}
use of eu.ggnet.dwoss.rules.TradeName 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;
}
use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.
the class PriceActionFactory method createMetaActions.
@Override
public List<MetaAction> createMetaActions() {
List<MetaAction> actions = new ArrayList<>();
for (TradeName contractor : Dl.local().lookup(CachedMandators.class).loadContractors().all()) {
if (contractor.isManufacturer()) {
actions.add(new MetaAction("Geschäftsführung", "Im-/Export", new ManufacturerExportAction(contractor)));
} else {
actions.add(new MetaAction("Geschäftsführung", "Im-/Export", new ContractorExportAction(contractor, true)));
actions.add(new MetaAction("Geschäftsführung", "Im-/Export", new ContractorExportAction(contractor, false)));
}
actions.add(new MetaAction("Geschäftsführung", "Im-/Export", new ContractorImportAction(contractor)));
}
actions.add(new MetaAction("Geschäftsführung", "Preise", new PriceExportAction()));
actions.add(new MetaAction("Geschäftsführung", "Preise", new PriceImportAction()));
actions.add(new MetaAction("Geschäftsführung", "Preise", new PriceBlockerAction()));
actions.add(new MetaAction("Geschäftsführung", "Preise", new GenerateOnePriceAction()));
actions.add(new MetaAction("Geschäftsführung", "Preise", new PriceExportImportAction()));
actions.add(new MetaAction("Geschäftsführung", "Preise", new PriceByInputFileAction()));
return actions;
}
Aggregations