Search in sources :

Example 6 with AfterInvoicePosition

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

the class CreditMemoView method pre.

@Override
public boolean pre(CloseType type) {
    if (type == CloseType.OK) {
        for (AfterInvoicePosition afterInvoicePosition : creditPositions) {
            if (afterInvoicePosition.getPosition().getPrice() == 0) {
                JOptionPane.showMessageDialog(this, "Eine Position hat keinen Preis.\nPosition entfernen oder Preis hinzufügen.");
                return false;
            }
            if (afterInvoicePosition.isPartialCredit() && afterInvoicePosition.getOriginalPrice() == afterInvoicePosition.getPosition().getPrice()) {
                String[] options = new String[] { "Nein, kommt nicht wieder vor." };
                JOptionPane.showOptionDialog(this, "Soll der Kunde die Position:\n" + afterInvoicePosition.getPosition().getName() + "\nwirklich behalten und den gesamten Betrag erhalten?", null, JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, null, options, options[0]);
                return false;
            }
        }
        positions = extractPositions();
        if (positions.isEmpty()) {
            JOptionPane.showMessageDialog(this, "keine Positionen zur Gutschrift gewählt");
            return false;
        }
        if (tablePanel.getComment() == null || tablePanel.getComment().trim().isEmpty()) {
            JOptionPane.showMessageDialog(this, "Bitte Storno/Gutschriftsgrund angeben");
            return false;
        }
        positions.add(Position.builder().amount(1).type(COMMENT).name("Grund/Beschreibung").description(tablePanel.getComment() + "\n\n" + balancingBox.getSelectedItem().toString()).build());
        if (selectedStock == null) {
            JOptionPane.showMessageDialog(this, "bitte Standort für die Gutschrift auswählen");
            return false;
        }
    }
    return true;
}
Also used : AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition)

Aggregations

AfterInvoicePosition (eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition)6 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)4 OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)4 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)3 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)3 CreditMemoView (eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.CreditMemoView)3 ComplaintView (eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.ComplaintView)1 StockAgent (eu.ggnet.dwoss.stock.ee.StockAgent)1 ArrayList (java.util.ArrayList)1