@@ -1,218 +1,41 @@
|
|||||||
package mustang15test;
|
package mustangtest;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTransaction;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTransaction;
|
||||||
import org.mustangproject.ZUGFeRD.ZUGFeRD2PullProvider;
|
|
||||||
import org.mustangproject.ZUGFeRD.ZUGFeRDExporter;
|
import org.mustangproject.ZUGFeRD.ZUGFeRDExporter;
|
||||||
import org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA1Factory;
|
import org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA1Factory;
|
||||||
|
|
||||||
public class MustangWriter implements IZUGFeRDExportableTransaction {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
MustangWriter m1 = new MustangWriter();
|
|
||||||
m1.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void apply() {
|
|
||||||
try {
|
|
||||||
System.out.println("Reading Blanko-PDF");
|
|
||||||
ZUGFeRDExporter ze =
|
|
||||||
new ZUGFeRDExporterFromA1Factory().setProducer("My Application").setCreator(System.getProperty("user.name")).load("./MustangGnuaccountingBeispielRE-20171118_506blanko.pdf");
|
|
||||||
System.out.println("Generating and attaching ZUGFeRD-Data");
|
|
||||||
ze.PDFattachZugferdFile(this);
|
|
||||||
System.out.println("Writing ZUGFeRD-PDF");
|
|
||||||
ze.export("./MustangGnuaccountingBeispielRE-20171118_506new.pdf");
|
|
||||||
System.out.println("Done.");
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.getLogger(MustangWriter.class.getName()).log(Level.SEVERE, null, e1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCurrency() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getDeliveryDate() {
|
|
||||||
return new GregorianCalendar(2017, Calendar.NOVEMBER, 17).getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getDueDate() {
|
|
||||||
|
|
||||||
return new GregorianCalendar(2017, Calendar.DECEMBER, 9).getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Date getIssueDate() {
|
|
||||||
return new GregorianCalendar(2017, Calendar.NOVEMBER, 18).getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getNumber() {
|
|
||||||
return "RE-20171118/506";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBIC() {
|
|
||||||
return "COBADEFFXXX";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBankName() {
|
|
||||||
return "Commerzbank";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnCountry() {
|
|
||||||
return "DE";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnIBAN() {
|
|
||||||
return "DE88 2008 0000 0970 3757 00";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnLocation() {
|
|
||||||
return "Stadthausen";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnOrganisationFullPlaintextInfo() {
|
|
||||||
return "Bei Spiel GmbH\n" +
|
|
||||||
"Ecke 12\n" +
|
|
||||||
"12345 Stadthausen\n" +
|
|
||||||
"Geschäftsführer: Max Mustermann";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnOrganisationName() {
|
|
||||||
return "Bei Spiel GmbH";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnPaymentInfoText() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnStreet() {
|
|
||||||
|
|
||||||
return "Ecke 12";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnTaxID() {
|
|
||||||
return "22/815/0815/4";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnVATID() {
|
|
||||||
return "DE136695976";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnZIP() {
|
|
||||||
return "12345";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPaymentTermDescription() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDExportableContact getRecipient() {
|
|
||||||
|
|
||||||
return new Contact();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getReferenceNumber() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDAllowanceCharge[] getZFCharges() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDExportableItem[] getZFItems() {
|
|
||||||
Item[] allItems = new Item[3];
|
|
||||||
Product designProduct = new Product("", "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung", "HUR", new BigDecimal("7.000000"));
|
|
||||||
Product balloonProduct = new Product("", "Luftballon: Bunt, ca. 500ml", "C62", new BigDecimal("19.000000"));
|
|
||||||
Product airProduct = new Product("", "Heiße Luft pro Liter", "LTR", new BigDecimal("19.000000"));
|
|
||||||
|
|
||||||
allItems[0] = new Item(new BigDecimal("160"), new BigDecimal("1"), designProduct);
|
|
||||||
allItems[1] = new Item(new BigDecimal("0.79"), new BigDecimal("400"), balloonProduct);
|
|
||||||
allItems[2] = new Item(new BigDecimal("0.10"), new BigDecimal("200"), airProduct);
|
|
||||||
return allItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class Contact implements IZUGFeRDExportableContact {
|
class Contact implements IZUGFeRDExportableContact {
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCountry() {
|
public String getCountry() {
|
||||||
return "DE";
|
return "DE";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLocation() {
|
public String getLocation() {
|
||||||
|
|
||||||
return "Spielkreis";
|
return "Spielkreis";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
||||||
return "Theodor Est";
|
return "Theodor Est";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStreet() {
|
public String getStreet() {
|
||||||
return "Bahnstr. 42";
|
return "Bahnstr. 42";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVATID() {
|
public String getVATID() {
|
||||||
|
|
||||||
return "DE999999999";
|
return "DE999999999";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getZIP() {
|
public String getZIP() {
|
||||||
return "88802";
|
return "88802";
|
||||||
}
|
}
|
||||||
@@ -253,13 +76,11 @@ class Item implements IZUGFeRDExportableItem {
|
|||||||
this.product = product;
|
this.product = product;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
|
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDAllowanceCharge[] getItemCharges() {
|
public IZUGFeRDAllowanceCharge[] getItemCharges() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
@@ -310,3 +131,147 @@ class Product implements IZUGFeRDExportableProduct {
|
|||||||
VATPercent = vATPercent;
|
VATPercent = vATPercent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MustangWriter implements IZUGFeRDExportableTransaction {
|
||||||
|
|
||||||
|
private void apply() {
|
||||||
|
try {
|
||||||
|
System.out.println("Reading Blanko-PDF");
|
||||||
|
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().setProducer("My Application")
|
||||||
|
.setCreator(System.getProperty("user.name"))
|
||||||
|
.load("./MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
||||||
|
System.out.println("Generating and attaching ZUGFeRD-Data");
|
||||||
|
ze.PDFattachZugferdFile(this);
|
||||||
|
System.out.println("Writing ZUGFeRD-PDF");
|
||||||
|
ze.export("./MustangGnuaccountingBeispielRE-20170509_505new.pdf");
|
||||||
|
System.out.println("Done.");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
MustangWriter mw=new MustangWriter();
|
||||||
|
mw.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrency() {
|
||||||
|
return "EUR";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDeliveryDate() {
|
||||||
|
return new GregorianCalendar(2017, Calendar.NOVEMBER, 17).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDueDate() {
|
||||||
|
return new GregorianCalendar(2017, Calendar.DECEMBER, 9).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getIssueDate() {
|
||||||
|
return new GregorianCalendar(2017, Calendar.NOVEMBER, 18).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "RE-20171118/506";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnBIC() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "COBADEFFXXX";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnBankName() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "Commerzbank";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnCountry() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "DE";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnIBAN() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "DE88 2008 0000 0970 3757 00";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnLocation() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "Stadthausen";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnOrganisationFullPlaintextInfo() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "Bei Spiel GmbH\n" + "Ecke 12\n" + "12345 Stadthausen\n" + "Geschäftsführer: Max Mustermann";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnOrganisationName() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "Bei Spiel GmbH";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnPaymentInfoText() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnStreet() {
|
||||||
|
return "Ecke 12";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnTaxID() {
|
||||||
|
return "22/815/0815/4";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnVATID() {
|
||||||
|
return "DE136695976";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnZIP() {
|
||||||
|
return "12345";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPaymentTermDescription() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDExportableContact getRecipient() {
|
||||||
|
return new Contact();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReferenceNumber() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDAllowanceCharge[] getZFCharges() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDExportableItem[] getZFItems() {
|
||||||
|
Item[] allItems = new Item[3];
|
||||||
|
Product designProduct = new Product("", "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung", "HUR",
|
||||||
|
new BigDecimal("7.000000"));
|
||||||
|
Product balloonProduct = new Product("", "Luftballon: Bunt, ca. 500ml", "C62", new BigDecimal("19.000000"));
|
||||||
|
Product airProduct = new Product("", "Heiße Luft pro Liter", "LTR", new BigDecimal("19.000000"));
|
||||||
|
allItems[0] = new Item(new BigDecimal("160"), new BigDecimal("1"), designProduct);
|
||||||
|
allItems[1] = new Item(new BigDecimal("0.79"), new BigDecimal("400"), balloonProduct);
|
||||||
|
allItems[2] = new Item(new BigDecimal("0.10"), new BigDecimal("200"), airProduct);
|
||||||
|
return allItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user