Search in sources :

Example 1 with TradeName

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;
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) BrandContractorCount(eu.ggnet.dwoss.uniqueunit.ee.eao.BrandContractorCount)

Example 2 with TradeName

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;
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) SubMonitor(eu.ggnet.dwoss.progress.SubMonitor) FileJacket(eu.ggnet.dwoss.util.FileJacket) UniqueUnitEao(eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao) BrandContractorCount(eu.ggnet.dwoss.uniqueunit.ee.eao.BrandContractorCount) JExcelLucidCalcWriter(eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter)

Example 3 with TradeName

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();
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ProductGroup(eu.ggnet.dwoss.rules.ProductGroup) ProductModelEmo(eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo) ProductFamilyEmo(eu.ggnet.dwoss.spec.ee.emo.ProductFamilyEmo) ProductSeriesEmo(eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Test(org.junit.Test)

Example 4 with TradeName

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

Example 5 with TradeName

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;
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ArrayList(java.util.ArrayList)

Aggregations

TradeName (eu.ggnet.dwoss.rules.TradeName)18 ProductGroup (eu.ggnet.dwoss.rules.ProductGroup)5 Test (org.junit.Test)4 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)3 ProductModelEmo (eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo)3 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)3 BrandContractorCount (eu.ggnet.dwoss.uniqueunit.ee.eao.BrandContractorCount)3 FileJacket (eu.ggnet.dwoss.util.FileJacket)3 JExcelLucidCalcWriter (eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter)3 MonitorFactory (eu.ggnet.dwoss.progress.MonitorFactory)2 ReportLine (eu.ggnet.dwoss.report.ee.entity.ReportLine)2 SimpleReportLine (eu.ggnet.dwoss.report.ee.entity.partial.SimpleReportLine)2 ProductFamilyEmo (eu.ggnet.dwoss.spec.ee.emo.ProductFamilyEmo)2 ProductSeriesEmo (eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo)2 ProductEao (eu.ggnet.dwoss.uniqueunit.ee.eao.ProductEao)2 CONTRACTOR_REFERENCE (eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.CONTRACTOR_REFERENCE)2 MANUFACTURER_COST (eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.MANUFACTURER_COST)2 ProductFormater (eu.ggnet.dwoss.uniqueunit.ee.format.ProductFormater)2 ISO (eu.ggnet.dwoss.util.DateFormats.ISO)2 eu.ggnet.lucidcalc (eu.ggnet.lucidcalc)2