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