Search in sources :

Example 11 with Address

use of eu.ggnet.dwoss.redtape.ee.entity.Address 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)11 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)6 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)5 DocumentHistory (eu.ggnet.dwoss.redtape.ee.entity.DocumentHistory)4 Test (org.junit.Test)4 AddressEao (eu.ggnet.dwoss.redtape.ee.eao.AddressEao)2 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)2 PositionBuilder (eu.ggnet.dwoss.redtape.ee.entity.PositionBuilder)2 Date (java.util.Date)2 JasperPrint (net.sf.jasperreports.engine.JasperPrint)2 PositionEao (eu.ggnet.dwoss.redtape.ee.eao.PositionEao)1 AddressEmo (eu.ggnet.dwoss.redtape.ee.emo.AddressEmo)1 Reminder (eu.ggnet.dwoss.redtape.ee.entity.Reminder)1 DocumentSupporterOperation (eu.ggnet.dwoss.redtapext.ee.DocumentSupporterOperation)1 BorderLayout (java.awt.BorderLayout)1 JFrame (javax.swing.JFrame)1 JRViewer (net.sf.jasperreports.swing.JRViewer)1 Logger (org.slf4j.Logger)1