Search in sources :

Example 6 with TradeName

use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.

the class ResolveRepaymentAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Ui.exec(() -> {
        Contractors contractors = Ui.progress().call(() -> Dl.local().lookup(CachedMandators.class).loadContractors());
        Ui.exec(() -> {
            Ui.build().dialog().eval(() -> {
                ChoiceDialog<TradeName> dialog = new ChoiceDialog<>(contractors.all().iterator().next(), contractors.all());
                dialog.setTitle("Gutschriften");
                dialog.setHeaderText(RESOLVE_REPAYMENT.toName());
                dialog.setContentText("Lieferant auswählen:");
                return dialog;
            }).opt().ifPresent(c -> Ui.build().fxml().show(() -> c, ResolveRepaymentController.class));
        });
    });
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ChoiceDialog(javafx.scene.control.ChoiceDialog) Contractors(eu.ggnet.dwoss.mandator.api.value.Contractors) ResolveRepaymentController(eu.ggnet.dwoss.misc.repayment.ResolveRepaymentController)

Example 7 with TradeName

use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.

the class ReportViewTryout method main.

public static void main(String[] args) {
    Dl.local().add(RemoteLookup.class, new RemoteLookup() {

        @Override
        public <T> boolean contains(Class<T> clazz) {
            return false;
        }

        @Override
        public <T> T lookup(Class<T> clazz) {
            return null;
        }
    });
    TradeName tradeName = TradeName.FUJITSU;
    UiCore.startSwing(() -> new JLabel("Main Applikation"));
    EnumMap<ViewReportResult.Type, NavigableSet<ReportLine>> lines = new EnumMap<>(ViewReportResult.Type.class);
    ReportLineGenerator op = new ReportLineGenerator();
    NavigableSet<ReportLine> invoicedLines = new TreeSet<>();
    NavigableSet<ReportLine> repayedLinesLines = new TreeSet<>();
    for (int i = 0; i < 30; i++) {
        invoicedLines.add(op.makeReportLine(Arrays.asList(tradeName), new Date(), i));
        repayedLinesLines.add(op.makeReportLine(Arrays.asList(tradeName), new Date(), i));
    }
    lines.put(INVOICED, invoicedLines);
    lines.put(REPAYMENTS, repayedLinesLines);
    ViewReportResult result = new ViewReportResult(lines, ReportParameter.builder().reportName("JUnit " + tradeName + " Report").contractor(tradeName).start(new Date()).end(new Date()).build());
    Ui.build().fxml().show(() -> new ReportController.In(result, false), ReportController.class);
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) JLabel(javax.swing.JLabel) RemoteLookup(eu.ggnet.saft.core.cap.RemoteLookup) ViewReportResult(eu.ggnet.dwoss.report.ee.ReportAgent.ViewReportResult) ReportController(eu.ggnet.dwoss.report.ui.main.ReportController) ReportLineGenerator(eu.ggnet.dwoss.report.ee.assist.gen.ReportLineGenerator)

Example 8 with TradeName

use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.

the class ShipmentUpdateStage method init.

private void init(Shipment s) {
    okButton.setOnAction((ActionEvent event) -> {
        shipment = getShipment();
        if (isValid())
            close();
    });
    cancelButton.setOnAction((ActionEvent event) -> {
        close();
    });
    idField = new TextField(Long.toString(s.getId()));
    idField.setDisable(true);
    shipIdField = new TextField(s.getShipmentId());
    Callback<ListView<TradeName>, ListCell<TradeName>> cb = new Callback<ListView<TradeName>, ListCell<TradeName>>() {

        @Override
        public ListCell<TradeName> call(ListView<TradeName> param) {
            return new ListCell<TradeName>() {

                @Override
                protected void updateItem(TradeName item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item == null || empty)
                        setText("Hersteller wählen...");
                    else
                        setText(item.getName());
                }
            };
        }
    };
    Set<TradeName> contractors = Dl.local().lookup(CachedMandators.class).loadContractors().all();
    ownerBox = new ComboBox<>(FXCollections.observableArrayList(contractors));
    ownerBox.setMaxWidth(MAX_VALUE);
    ownerBox.setCellFactory(cb);
    ownerBox.getSelectionModel().selectedItemProperty().addListener((ObservableValue<? extends TradeName> observable, TradeName oldValue, TradeName newValue) -> {
        if (newValue == null)
            return;
        shipment.setContractor(newValue);
        manufacturerBox.getSelectionModel().select(newValue.getManufacturer());
    });
    ObservableList<TradeName> manufacturers = FXCollections.observableArrayList(TradeName.getManufacturers());
    manufacturerBox = new ComboBox<>(manufacturers);
    manufacturerBox.setMaxWidth(MAX_VALUE);
    manufacturerBox.setCellFactory(cb);
    SingleSelectionModel<TradeName> sm = ownerBox.getSelectionModel();
    if (s.getContractor() == null)
        sm.selectFirst();
    else
        sm.select(s.getContractor());
    if (shipment.getDefaultManufacturer() != null)
        manufacturerBox.getSelectionModel().select(shipment.getDefaultManufacturer());
    statusBox = new ComboBox<>(FXCollections.observableArrayList(Shipment.Status.values()));
    statusBox.setMaxWidth(MAX_VALUE);
    statusBox.getSelectionModel().select(s.getStatus() == null ? OPENED : s.getStatus());
    GridPane grid = new GridPane();
    grid.addRow(1, new Label("ID:"), idField);
    grid.addRow(2, new Label("Shipment ID:"), shipIdField);
    grid.addRow(3, new Label("Besitzer:"), ownerBox);
    grid.addRow(4, new Label("Hersteller:"), manufacturerBox);
    grid.addRow(5, new Label("Status"), statusBox);
    grid.setMaxWidth(MAX_VALUE);
    grid.vgapProperty().set(2.);
    grid.getColumnConstraints().add(0, new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.SOMETIMES, HPos.LEFT, false));
    grid.getColumnConstraints().add(1, new ColumnConstraints(100, 150, Double.MAX_VALUE, Priority.ALWAYS, HPos.LEFT, true));
    HBox hButtonBox = new HBox(okButton, cancelButton);
    hButtonBox.alignmentProperty().set(Pos.TOP_RIGHT);
    errorLabel.setWrapText(true);
    BorderPane rootPane = new BorderPane(grid, errorLabel, null, hButtonBox, null);
    this.setTitle(s.getId() > 0 ? "Shipment bearbeiten" : "Shipment anlegen");
    this.setScene(new Scene(rootPane));
    this.setResizable(false);
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ActionEvent(javafx.event.ActionEvent) ObservableValue(javafx.beans.value.ObservableValue) Scene(javafx.scene.Scene) Callback(javafx.util.Callback)

Example 9 with TradeName

use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.

the class ReportLineEaoIT method testFindProductIdMissingContractorPartNo.

@Test
public void testFindProductIdMissingContractorPartNo() throws Exception {
    utx.begin();
    em.joinTransaction();
    final Random R = new Random();
    final long PRODUCT_ID = 10;
    final TradeName CONTRACTOR = HP;
    // Different contarctor and productId
    em.persist(make(DELL, PRODUCT_ID + 5, null));
    // Different contarctor
    em.persist(make(DELL, PRODUCT_ID, null));
    // Different productId
    em.persist(make(CONTRACTOR, PRODUCT_ID + 5, null));
    // has already a contracotrPartNo
    em.persist(make(CONTRACTOR, PRODUCT_ID, "123556"));
    // Two matching Lines
    ReportLine l1 = make(CONTRACTOR, PRODUCT_ID, null);
    ReportLine l2 = make(CONTRACTOR, PRODUCT_ID, null);
    em.persist(l1);
    em.persist(l2);
    utx.commit();
    utx.begin();
    em.joinTransaction();
    List<ReportLine> missing = new ReportLineEao(em).findByProductIdMissingContractorPartNo(PRODUCT_ID, CONTRACTOR);
    assertEquals(2, missing.size());
    assertTrue(missing.contains(l1));
    assertTrue(missing.contains(l2));
    utx.commit();
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ReportLineEao(eu.ggnet.dwoss.report.ee.eao.ReportLineEao) SimpleReportLine(eu.ggnet.dwoss.report.ee.entity.partial.SimpleReportLine) Test(org.junit.Test)

Example 10 with TradeName

use of eu.ggnet.dwoss.rules.TradeName 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;
}
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

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