updated user documentation
This commit is contained in:
@@ -1,168 +1,66 @@
|
|||||||
package zugferd;
|
package mustang15test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
import javax.xml.transform.TransformerException;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
||||||
|
|
||||||
import org.apache.pdfbox.exceptions.COSVisitorException;
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
||||||
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.ZUGFeRDExporter;
|
import org.mustangproject.ZUGFeRD.ZUGFeRDExporter;
|
||||||
|
import org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA1Factory;
|
||||||
class Contact implements IZUGFeRDExportableContact {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCountry() {
|
|
||||||
return "DE";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLocation() {
|
|
||||||
return "Spielkreis";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "Theodor Est";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStreet() {
|
|
||||||
return "Bahnstr. 42";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVATID() {
|
|
||||||
return "DE999999999";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getZIP() {
|
|
||||||
return "88802";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Item implements IZUGFeRDExportableItem {
|
|
||||||
private BigDecimal price, quantity;
|
|
||||||
|
|
||||||
public Item(BigDecimal price, BigDecimal quantity, Product product) {
|
|
||||||
super();
|
|
||||||
this.price = price;
|
|
||||||
this.quantity = quantity;
|
|
||||||
this.product = product;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Product product;
|
|
||||||
|
|
||||||
public BigDecimal getPrice() {
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrice(BigDecimal price) {
|
|
||||||
this.price = price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getQuantity() {
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuantity(BigDecimal quantity) {
|
|
||||||
this.quantity = quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Product getProduct() {
|
|
||||||
return product;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProduct(Product product) {
|
|
||||||
this.product = product;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class Product implements IZUGFeRDExportableProduct {
|
|
||||||
private String description, name, unit;
|
|
||||||
|
|
||||||
public Product(String description, String name, String unit,
|
|
||||||
BigDecimal VATPercent) {
|
|
||||||
super();
|
|
||||||
this.description = description;
|
|
||||||
this.name = name;
|
|
||||||
this.unit = unit;
|
|
||||||
this.VATPercent = VATPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BigDecimal VATPercent;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUnit() {
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getVATPercent() {
|
|
||||||
return VATPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnit(String unit) {
|
|
||||||
this.unit = unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVATPercent(BigDecimal vATPercent) {
|
|
||||||
VATPercent = vATPercent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MustangWriter implements IZUGFeRDExportableTransaction {
|
public class MustangWriter implements IZUGFeRDExportableTransaction {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
MustangWriter w=new MustangWriter();
|
MustangWriter m1=new MustangWriter();
|
||||||
w.apply();
|
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) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getCurrency() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getDeliveryDate() {
|
public Date getDeliveryDate() {
|
||||||
return new GregorianCalendar(2017, Calendar.MAY, 7).getTime();
|
return new GregorianCalendar(2017,Calendar.NOVEMBER,17).getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getDueDate() {
|
public Date getDueDate() {
|
||||||
return new GregorianCalendar(2017, Calendar.MAY, 30).getTime();
|
|
||||||
|
return new GregorianCalendar(2017,Calendar.DECEMBER,9).getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getIssueDate() {
|
public Date getIssueDate() {
|
||||||
return new GregorianCalendar(2017, Calendar.MAY, 9).getTime();
|
return new GregorianCalendar(2017,Calendar.NOVEMBER,18).getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNumber() {
|
public String getNumber() {
|
||||||
return "RE-20170509/505";
|
return "RE-20171118/506";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -190,13 +88,28 @@ public class MustangWriter implements IZUGFeRDExportableTransaction {
|
|||||||
return "Stadthausen";
|
return "Stadthausen";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnOrganisationFullPlaintextInfo() {
|
||||||
|
return "Bei Spiel GmbH\n"+
|
||||||
|
"Ecke 12\n"+
|
||||||
|
"12345 Stadthausen\n"+
|
||||||
|
"Geschäftsführer: Max Mustermann";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnOrganisationName() {
|
public String getOwnOrganisationName() {
|
||||||
return "Bei Spiel GmbH";
|
return "Bei Spiel GmbH";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnPaymentInfoText() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnStreet() {
|
public String getOwnStreet() {
|
||||||
|
|
||||||
return "Ecke 12";
|
return "Ecke 12";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,63 +128,182 @@ public class MustangWriter implements IZUGFeRDExportableTransaction {
|
|||||||
return "12345";
|
return "12345";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentTermDescription() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getRecipient() {
|
public IZUGFeRDExportableContact getRecipient() {
|
||||||
|
|
||||||
return new Contact();
|
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
|
@Override
|
||||||
public IZUGFeRDExportableItem[] getZFItems() {
|
public IZUGFeRDExportableItem[] getZFItems() {
|
||||||
Item[] allItems=new Item[3];
|
Item[] allItems=new Item[3];
|
||||||
Product designProduct = new Product("",
|
Product designProduct=new Product("", "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung", "HUR", new BigDecimal("7.000000"));
|
||||||
"Künstlerische Gestaltung (Stunde)", "HUR", new BigDecimal(
|
Product balloonProduct=new Product("", "Luftballon: Bunt, ca. 500ml", "C62", new BigDecimal("19.000000"));
|
||||||
"7.000000"));
|
Product airProduct=new Product("", "Heiße Luft pro Liter", "LTR", new BigDecimal("19.000000"));
|
||||||
Product balloonProduct = new Product("", "Luftballon", "C62",
|
|
||||||
new BigDecimal("19.000000"));
|
allItems[0]=new Item(new BigDecimal("160"), new BigDecimal("1"), designProduct);
|
||||||
Product airProduct = new Product("", "Heiße Luft pro Liter", "LTR",
|
allItems[1]=new Item(new BigDecimal("0.79"), new BigDecimal("400"), balloonProduct);
|
||||||
new BigDecimal("19.000000"));
|
allItems[2]=new Item(new BigDecimal("0.10"), new BigDecimal("200"), airProduct);
|
||||||
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;
|
return allItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void apply() {
|
@Override
|
||||||
PDDocument doc;
|
public IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges() {
|
||||||
try {
|
// TODO Auto-generated method stub
|
||||||
System.out.println("Reading blank PDF");
|
return null;
|
||||||
doc = PDDocument
|
|
||||||
.load("/Users/jstaerk/workspace/zugferd/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
|
||||||
ZUGFeRDExporter ze = new ZUGFeRDExporter();
|
|
||||||
System.out.println("Converting to PDF/A-3u");
|
|
||||||
ze.PDFmakeA3compliant(doc, "Mustangproject",
|
|
||||||
System.getProperty("user.name"), true);
|
|
||||||
System.out.println("Generating and attaching ZUGFeRD-Data");
|
|
||||||
ze.setTest();
|
|
||||||
ze.PDFattachZugferdFile(doc, this);
|
|
||||||
System.out.println("Writing ZUGFeRD-PDF");
|
|
||||||
|
|
||||||
doc.save("/Users/jstaerk/workspace/zugferd/MustangGnuaccountingBeispielRE-20170509_505.pdf");
|
|
||||||
System.out.println("Done.");
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (TransformerException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (COSVisitorException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class Contact implements IZUGFeRDExportableContact {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCountry() {
|
||||||
|
return "DE";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnOrganisationFullPlaintextInfo() {
|
public String getLocation() {
|
||||||
return "Bei Spiel GmbH\n"
|
|
||||||
+ "Ecke 12\n"
|
return "Spielkreis";
|
||||||
+ "12345 Stadthausen\n"
|
|
||||||
+ "Geschäftsführer: Max Mustermann";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
|
||||||
|
return "Theodor Est";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStreet() {
|
||||||
|
return "Bahnstr. 42";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVATID() {
|
||||||
|
|
||||||
|
return "DE999999999";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getZIP() {
|
||||||
|
return "88802";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Item implements IZUGFeRDExportableItem {
|
||||||
|
public Item(BigDecimal price, BigDecimal quantity, Product product) {
|
||||||
|
super();
|
||||||
|
this.price = price;
|
||||||
|
this.quantity = quantity;
|
||||||
|
this.product = product;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal price, quantity;
|
||||||
|
private Product product;
|
||||||
|
|
||||||
|
public BigDecimal getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(BigDecimal price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getQuantity() {
|
||||||
|
return quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantity(BigDecimal quantity) {
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product getProduct() {
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProduct(Product product) {
|
||||||
|
this.product = product;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IZUGFeRDAllowanceCharge[] getItemCharges() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Product implements IZUGFeRDExportableProduct {
|
||||||
|
public Product(String description, String name, String unit, BigDecimal vATPercent) {
|
||||||
|
super();
|
||||||
|
this.description = description;
|
||||||
|
this.name = name;
|
||||||
|
this.unit = unit;
|
||||||
|
VATPercent = vATPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String description, name, unit;
|
||||||
|
private BigDecimal VATPercent;
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUnit() {
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnit(String unit) {
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getVATPercent() {
|
||||||
|
return VATPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVATPercent(BigDecimal vATPercent) {
|
||||||
|
VATPercent = vATPercent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user