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