Search in sources :

Example 6 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class DocumentSupporterFlagIT method testBriefed.

private Document testBriefed() {
    Dossier dos = redTapeWorker.create(customerId, true, "JUnit");
    Document doc = dos.getActiveDocuments().get(0);
    addRandomPositions(doc);
    doc = redTapeWorker.update(doc, null, arranger);
    assertNotBriefed(doc);
    dos = documentSupporter.briefed(doc, arranger);
    assertExactlyBriefed(dos.getActiveDocuments().get(0));
    return dos.getActiveDocuments().get(0);
}
Also used : Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 7 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class ReceiptUnitOperationIT method assertsUpdate.

private void assertsUpdate(UniqueUnit receiptUnit, StockTransaction stockTransaction, ReceiptOperation receiptOperation, TradeName contractor) {
    asserts(receiptUnit, stockTransaction, receiptOperation, contractor);
    List<Dossier> allDossiers = redTapeAgent.findAllEager(Dossier.class);
    List<Document> allDocumentsWithUnit = new ArrayList<>();
    for (Dossier dossier : allDossiers) {
        for (Document document : dossier.getActiveDocuments()) {
            for (Position position : document.getPositions(PositionType.UNIT).values()) {
                if (position.getUniqueUnitId() == receiptUnit.getId()) {
                    allDocumentsWithUnit.add(document);
                }
            }
        }
    }
    List<Long> documentIds = new ArrayList<>();
    for (Document document : allDocumentsWithUnit) {
        documentIds.add(document.getId());
    }
    assertTrue("The UniqueUnit " + receiptUnit.getId() + " is in more than one document. DocumentsIds: " + documentIds, documentIds.size() <= 1);
}
Also used : Position(eu.ggnet.dwoss.redtape.ee.entity.Position) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 8 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class DossierCreateAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Ui.exec(() -> {
        Dossier dos = Dl.remote().lookup(RedTapeWorker.class).create(customer.getId(), dispatch, Dl.local().lookup(Guardian.class).getUsername());
        // This is safe, as a create will return exactly one document.
        Document doc = dos.getDocuments().iterator().next();
        Addresses addresses = Dl.remote().lookup(RedTapeWorker.class).requestAdressesByCustomer(customer.getId());
        doc.setInvoiceAddress(addresses.getInvoice());
        doc.setShippingAddress(addresses.getShipping());
        Ui.exec(() -> {
            Ui.build().parent(controller.getView()).swing().eval(() -> {
                DocumentUpdateView docView = new DocumentUpdateView(doc);
                docView.setController(new DocumentUpdateController(docView, doc));
                docView.setCustomerValues(customer.getId());
                return OkCancelWrap.vetoResult(docView);
            }).opt().filter(r -> handleFailure(r, doc)).map(Reply::getPayload).ifPresent(this::handleSuccesses);
        });
    });
}
Also used : Addresses(eu.ggnet.dwoss.redtapext.ee.RedTapeWorker.Addresses) DocumentUpdateController(eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateController) DocumentUpdateView(eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateView) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) RedTapeWorker(eu.ggnet.dwoss.redtapext.ee.RedTapeWorker) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 9 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class DossierIconPanelRenderer method getTableCellRendererComponent.

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    List<JLabel> labels = new ArrayList<>();
    // Get the Dossier status dependant icons
    Dossier dos = (Dossier) value;
    if (dos.isClosed()) {
        JLabel closedLabel = new JLabel(new ImageIcon(DossierTableController.load(IMAGE_NAME.CLOSED_ICON)));
        closedLabel.setToolTipText("Vorgang ist abgeschlossen");
        labels.add(closedLabel);
    }
    JLabel complaintLabel = new JLabel();
    if (!dos.getActiveDocuments(DocumentType.COMPLAINT).isEmpty()) {
        complaintLabel.setIcon(new ImageIcon(DossierTableController.load(IMAGE_NAME.COMPLAINT_ICON)));
        complaintLabel.setToolTipText("Eine Reklamation liegt vor");
    }
    boolean canceledExist = false;
    for (Document document : dos.getDocuments()) {
        if (!canceledExist && document.getConditions().contains(Condition.CANCELED)) {
            JLabel canceledLabel = new JLabel(new ImageIcon(DossierTableController.load(IMAGE_NAME.CANCELED_ICON)));
            canceledLabel.setToolTipText("Vorgang wurde storniert");
            labels.add(canceledLabel);
            canceledExist = true;
        }
        if (document.getConditions().contains(Condition.REJECTED)) {
            complaintLabel.setIcon(new ImageIcon(DossierTableController.load(IMAGE_NAME.COMPLAINT_REJECTED_ICON)));
            complaintLabel.setToolTipText("Eine Reklamation liegt vor");
        } else if (document.getConditions().contains(Condition.WITHDRAWN)) {
            complaintLabel.setIcon(new ImageIcon(DossierTableController.load(IMAGE_NAME.COMPLAINT_WITHDRAWN_ICON)));
            complaintLabel.setToolTipText("Eine Reklamation wurde zurückgezogen");
        } else if (document.getConditions().contains(Condition.ACCEPTED)) {
            complaintLabel.setIcon(new ImageIcon(DossierTableController.load(IMAGE_NAME.COMPLAINT_ACCEPTED_ICON)));
            complaintLabel.setToolTipText("Eine Reklamation wurde angenommen");
        }
    }
    if (complaintLabel.getIcon() != null)
        labels.add(complaintLabel);
    if (!dos.getActiveDocuments(DocumentType.ANNULATION_INVOICE).isEmpty()) {
        JLabel annulationLabel = new JLabel(new ImageIcon(DossierTableController.load(IMAGE_NAME.ANNULATION_INVOICE_ICON)));
        annulationLabel.setToolTipText("Eine Stornorechnung liegt vor");
        labels.add(annulationLabel);
    }
    if (!dos.getActiveDocuments(DocumentType.CREDIT_MEMO).isEmpty()) {
        JLabel creditMemoLabel = new JLabel(new ImageIcon(DossierTableController.load(IMAGE_NAME.CREDIT_MEMO_ICON)));
        creditMemoLabel.setToolTipText("Eine Gutschrift liegt vor");
        labels.add(creditMemoLabel);
    }
    // create and fill a panel with all icons
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    String tooltip = "";
    for (Iterator<JLabel> it = labels.iterator(); it.hasNext(); ) {
        JLabel jLabel = it.next();
        panel.add(jLabel);
        if (it.hasNext())
            tooltip += jLabel.getToolTipText() + " | ";
        else
            tooltip += jLabel.getToolTipText();
    }
    if (isSelected)
        panel.setBackground(table.getSelectionBackground());
    else
        panel.setBackground(Color.white);
    panel.setToolTipText(tooltip);
    return panel;
}
Also used : ImageIcon(javax.swing.ImageIcon) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) ArrayList(java.util.ArrayList) JLabel(javax.swing.JLabel) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 10 with Dossier

use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.

the class DossierTableView method buildDossierPopup.

private JPopupMenu buildDossierPopup() {
    JPopupMenu menu = new JPopupMenu();
    JMenuItem detailsItem = new JMenuItem(new AbstractAction("Details") {

        @Override
        public void actionPerformed(ActionEvent e) {
            Dossier dos = model.getDossier(table.convertRowIndexToModel(table.getSelectedRow()));
            new HtmlDialog(SwingUtilities.getWindowAncestor(DossierTableView.this), Dialog.ModalityType.MODELESS).setText(LegacyBridgeUtil.toHtmlDetailed(dos)).setVisible(true);
        }
    });
    detailsItem.setText("Details");
    JMenuItem historyItem = new JMenuItem(new AbstractAction("Verlauf") {

        @Override
        public void actionPerformed(ActionEvent e) {
            HtmlDialog dialog = new HtmlDialog(SwingUtilities.getWindowAncestor(DossierTableView.this), ModalityType.MODELESS);
            dialog.setText(DossierFormater.toHtmlHistory(model.getDossier(table.convertRowIndexToModel(table.getSelectedRow()))));
            dialog.setVisible(true);
        }
    });
    historyItem.setText("Verlauf");
    menu.add(detailsItem);
    menu.add(historyItem);
    return menu;
}
Also used : ActionEvent(java.awt.event.ActionEvent) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) HtmlDialog(eu.ggnet.dwoss.util.HtmlDialog)

Aggregations

Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)47 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)30 Test (org.junit.Test)17 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)11 DossierEao (eu.ggnet.dwoss.redtape.ee.eao.DossierEao)8 DocumentHistory (eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory)6 LogicTransaction (eu.ggnet.dwoss.stock.ee.entity.LogicTransaction)6 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)6 Address (eu.ggnet.dwoss.redtape.ee.entity.Address)5 StockUnit (eu.ggnet.dwoss.stock.ee.entity.StockUnit)4 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)3 AddressEmo (eu.ggnet.dwoss.redtape.ee.emo.AddressEmo)3 StockUnitEao (eu.ggnet.dwoss.stock.ee.eao.StockUnitEao)3 RepaymentCustomers (eu.ggnet.dwoss.mandator.api.value.RepaymentCustomers)2 PositionBuilder (eu.ggnet.dwoss.redtape.ee.entity.PositionBuilder)2 Reminder (eu.ggnet.dwoss.redtape.ee.entity.Reminder)2 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)2 ReportLineEao (eu.ggnet.dwoss.report.ee.eao.ReportLineEao)2 Report (eu.ggnet.dwoss.report.ee.entity.Report)2 eu.ggnet.dwoss.rules (eu.ggnet.dwoss.rules)2