Search in sources :

Example 1 with DocumentSupporterOperation

use of eu.ggnet.dwoss.redtapext.ee.DocumentSupporterOperation in project dwoss by gg-net.

the class DocumentRendererTryout method main.

public static void main(String[] args) {
    DocumentSupporterOperation documentSupporter = new DocumentSupporterOperation();
    documentSupporter.setMandator(Sample.MANDATOR);
    Dossier dos = new Dossier();
    dos.setPaymentMethod(PaymentMethod.ADVANCE_PAYMENT);
    dos.setDispatch(true);
    dos.setCustomerId(1);
    Document doc = new Document();
    doc.setTaxType(TaxType.GENERAL_SALES_TAX_DE_SINCE_2007);
    doc.setType(DocumentType.ORDER);
    doc.setActive(true);
    doc.setDirective(Document.Directive.WAIT_FOR_MONEY);
    doc.setHistory(new DocumentHistory("JUnit", "Automatische Erstellung eines leeren Dokuments"));
    Address a = new Address("Herr Muh\nMuhstrasse 7\n12345 Muhstadt");
    doc.setInvoiceAddress(a);
    doc.setShippingAddress(a);
    dos.add(doc);
    NaivBuilderUtil.overwriteTax(doc.getTaxType());
    doc.append(NaivBuilderUtil.comment());
    doc.append(NaivBuilderUtil.service());
    doc.append(NaivBuilderUtil.shippingcost());
    System.out.println("Tax: " + doc.getSingleTax());
    System.out.println("Netto " + doc.getPrice());
    System.out.println("Brutto: " + doc.toAfterTaxPrice());
    System.out.println("SumTax: " + (doc.toAfterTaxPrice() - doc.getPrice()));
    JasperPrint print = documentSupporter.render(doc, DocumentViewType.DEFAULT);
    JRViewer viewer = new JRViewer(print);
    JFrame frame = new JFrame("Viewer");
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(viewer, BorderLayout.CENTER);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
}
Also used : DocumentSupporterOperation(eu.ggnet.dwoss.redtapext.ee.DocumentSupporterOperation) Address(eu.ggnet.dwoss.redtape.ee.entity.Address) JRViewer(net.sf.jasperreports.swing.JRViewer) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) JasperPrint(net.sf.jasperreports.engine.JasperPrint) DocumentHistory(eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Aggregations

Address (eu.ggnet.dwoss.redtape.ee.entity.Address)1 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)1 DocumentHistory (eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory)1 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)1 DocumentSupporterOperation (eu.ggnet.dwoss.redtapext.ee.DocumentSupporterOperation)1 BorderLayout (java.awt.BorderLayout)1 JFrame (javax.swing.JFrame)1 JasperPrint (net.sf.jasperreports.engine.JasperPrint)1 JRViewer (net.sf.jasperreports.swing.JRViewer)1