Search in sources :

Example 1 with AfterInvoicePosition

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

the class CreditMemoTableModel method manipulateShippingCost.

private void manipulateShippingCost() {
    AfterInvoicePosition shippingPos = getShippingCost();
    shippingPos.setParticipate(true);
    if (isEveryoneParticipant()) {
        shippingPos.setPartialCredit(false);
        shippingPos.setFullCredit(true);
        shippingPos.getPosition().setPrice(shippingPos.getOriginalPrice());
    } else {
        shippingPos.setFullCredit(false);
        shippingPos.setPartialCredit(true);
        shippingPos.getPosition().setPrice(.0);
    }
}
Also used : AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition)

Example 2 with AfterInvoicePosition

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

the class AnnulationViewTryout method main.

public static void main(String[] args) {
    StockAgent stockStub = mock(StockAgent.class);
    Dl.remote().add(StockAgent.class, stockStub);
    Position p1 = Position.builder().amount(1).name("P1").price(12.).tax(1.19).build();
    Position p2 = Position.builder().amount(1).name("P2").price(20.).tax(1.19).build();
    Position p3 = Position.builder().amount(1).name("P3").price(13.24).tax(1.19).build();
    Position p4 = Position.builder().amount(1).name("P4").price(400.).tax(1.19).build();
    Position p5 = Position.builder().amount(1).name("P5").price(1234.).tax(1.19).build();
    List<AfterInvoicePosition> positions = new ArrayList<>();
    positions.add(new AfterInvoicePosition(p1));
    positions.add(new AfterInvoicePosition(p2));
    positions.add(new AfterInvoicePosition(p3));
    positions.add(new AfterInvoicePosition(p4));
    positions.add(new AfterInvoicePosition(p5));
    CreditMemoView view = new CreditMemoView(positions);
    OkCancelDialog<CreditMemoView> dialog = new OkCancelDialog<>("Test", view);
    dialog.setVisible(true);
    System.out.println(view.getPositions());
    System.exit(0);
}
Also used : AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) Position(eu.ggnet.dwoss.redtape.ee.entity.Position) AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) StockAgent(eu.ggnet.dwoss.stock.ee.StockAgent) ArrayList(java.util.ArrayList) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) CreditMemoView(eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.CreditMemoView)

Example 3 with AfterInvoicePosition

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

the class AnnulationInvoiceAction 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)
            creditPositions.add(new AfterInvoicePosition(position));
    }
    CreditMemoView view = new CreditMemoView(creditPositions);
    OkCancelDialog<CreditMemoView> dialog = new OkCancelDialog<>(getValue(Action.NAME).toString(), view);
    dialog.setLocationRelativeTo(parent);
    dialog.setVisible(true);
    if (dialog.getCloseType() == CloseType.OK) {
        doc.removeAllPositions();
        for (Position position : view.getPositions()) {
            position.setPrice(position.getPrice() * (-1));
            doc.append(position);
        }
        doc.setType(DocumentType.ANNULATION_INVOICE);
        doc.setDirective(Directive.BALANCE_REPAYMENT);
        Document d = Dl.remote().lookup(RedTapeWorker.class).update(doc, view.getStockLocation(), Dl.local().lookup(Guardian.class).getUsername());
        controller.reloadSelectionOnStateChange(d.getDossier());
    }
}
Also used : AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) 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) CreditMemoView(eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.CreditMemoView)

Example 4 with AfterInvoicePosition

use of eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition 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)

Example 5 with AfterInvoicePosition

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

the class CreditMemoAction 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)
            creditPositions.add(new AfterInvoicePosition(position));
    }
    CreditMemoView view = new CreditMemoView(creditPositions);
    OkCancelDialog<CreditMemoView> dialog = new OkCancelDialog<>("Test", 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.CREDIT_MEMO);
        doc.setDirective(Directive.BALANCE_REPAYMENT);
        Document d = Dl.remote().lookup(RedTapeWorker.class).update(doc, view.getStockLocation(), Dl.local().lookup(Guardian.class).getUsername());
        controller.reloadSelectionOnStateChange(d.getDossier());
    }
}
Also used : AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) 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) CreditMemoView(eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.CreditMemoView)

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