Search in sources :

Example 1 with ComplaintView

use of eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.ComplaintView in project dwoss by gg-net.

the class ComplaintAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Calendar release = Calendar.getInstance();
    release.setTime(doc.getHistory().getRelease());
    Calendar beforeOneYear = Calendar.getInstance();
    beforeOneYear.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR) - 1);
    if (beforeOneYear.after(release) && JOptionPane.CANCEL_OPTION == JOptionPane.showConfirmDialog(parent, "Der Vorgang ist über ein Jahr alt und die Garantie ist abgelaufen!\nMöchten sie fortfahren?", "Garantie Warnung", JOptionPane.OK_CANCEL_OPTION)) {
        return;
    }
    List<AfterInvoicePosition> creditPositions = new ArrayList<>();
    for (Position position : doc.getPositions().values()) {
        if (position.getType() != PositionType.COMMENT) {
            AfterInvoicePosition aiPosition = new AfterInvoicePosition(position);
            if (doc.getDossier().isDispatch() && position.getType() == PositionType.SHIPPING_COST)
                aiPosition.setParticipate(true);
            creditPositions.add(aiPosition);
        }
    }
    ComplaintView view = new ComplaintView(creditPositions);
    OkCancelDialog<ComplaintView> dialog = new OkCancelDialog<>("Reklamation anmelden", view);
    dialog.setLocationRelativeTo(parent);
    dialog.setVisible(true);
    if (dialog.getCloseType() == CloseType.OK) {
        doc.removeAllPositions();
        for (Position position : view.getPositions()) {
            doc.append(position);
        }
        doc.setType(DocumentType.COMPLAINT);
        doc.setDirective(Directive.WAIT_FOR_COMPLAINT_COMPLETION);
        Document d = Dl.remote().lookup(RedTapeWorker.class).update(doc, null, Dl.local().lookup(Guardian.class).getUsername());
        controller.reloadSelectionOnStateChange(d.getDossier());
    }
}
Also used : AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) ComplaintView(eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.ComplaintView) Position(eu.ggnet.dwoss.redtape.ee.entity.Position) AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) RedTapeWorker(eu.ggnet.dwoss.redtapext.ee.RedTapeWorker) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Aggregations

Document (eu.ggnet.dwoss.redtape.ee.entity.Document)1 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)1 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)1 AfterInvoicePosition (eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition)1 ComplaintView (eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.ComplaintView)1 OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)1