Merge branch 'master' into issues/458-multiple-payment-details
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
<parent>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
<version>2.17.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>library</artifactId>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
<version>2.17.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Library to write, read and validate e-invoices (Factur-X, ZUGFeRD, Order-X, XRechnung/CII)</name>
|
||||
<description>FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT
|
||||
@@ -59,6 +59,12 @@
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>2.0.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.offo</groupId>
|
||||
<artifactId>fop-hyph</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/net.sf.saxon/Saxon-HE -->
|
||||
<dependency>
|
||||
<groupId>net.sf.saxon</groupId>
|
||||
|
||||
@@ -134,7 +134,10 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
||||
if (totalAmount!=null) {
|
||||
return totalAmount;
|
||||
} else {
|
||||
throw new RuntimeException("totalAmount must be set");
|
||||
if (percent==null) {
|
||||
throw new RuntimeException("totalAmount must be set");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public class FileAttachment {
|
||||
|
||||
protected String filename;
|
||||
protected String mimetype;
|
||||
protected String relation;
|
||||
protected String relation = "Unspecified";
|
||||
protected String description;
|
||||
protected byte[] data;
|
||||
|
||||
@@ -29,6 +29,13 @@ public class FileAttachment {
|
||||
this.description = "Additional file attachment";
|
||||
}
|
||||
|
||||
public FileAttachment(String filename, String mimetype, byte[] data) {
|
||||
this.filename = filename;
|
||||
this.mimetype = mimetype;
|
||||
this.data = data;
|
||||
this.description = "Additional file attachment";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
@@ -60,6 +67,28 @@ public class FileAttachment {
|
||||
return relation;
|
||||
}
|
||||
|
||||
/***
|
||||
* only needed when embedded in PDF described
|
||||
*
|
||||
* values
|
||||
* - Source shall be used if this file specification is the original
|
||||
* source material for the associated content.
|
||||
* - Data shall be used if this file specification represents information
|
||||
* used to derive a visual presentation, such as for a table or a
|
||||
* graph.
|
||||
* - Alternative shall be used if this file specification is an alternative
|
||||
* representation of content, for example audio.
|
||||
* - Supplement shall be used if this file specification represents a
|
||||
* supplemental representation of the original source or data that
|
||||
* may be more easily consumable (e.g. A MathML version of an
|
||||
* equation).
|
||||
* - Unspecified shall be used when the relationship is not known
|
||||
* or cannot be described using one of the other values.
|
||||
* @param relation String: either : Source, Data or Alternative. Usually Data, except source if the file attachment
|
||||
* is the basis for the pdf (xrechnung2fx) or Alternative if it contains the same content (e.g. the
|
||||
* factur-x.xml file in a factur-x PDF)
|
||||
* @return fluent setter
|
||||
*/
|
||||
public FileAttachment setRelation(String relation) {
|
||||
this.relation = relation;
|
||||
return this;
|
||||
|
||||
@@ -69,6 +69,7 @@ public class Invoice implements IExportableTransaction {
|
||||
protected String vatDueDateTypeCode = null;
|
||||
protected String creditorReferenceID; // required when direct debit is used.
|
||||
private BigDecimal roundingAmount=null;
|
||||
private String paymentReference; // Remittance information / Verwendungszweck, BT-83
|
||||
|
||||
public Invoice() {
|
||||
ZFItems = new ArrayList<>();
|
||||
@@ -124,7 +125,11 @@ public class Invoice implements IExportableTransaction {
|
||||
* @return fluent setter
|
||||
*/
|
||||
public Invoice setAdditionalReferencedDocuments(FileAttachment[] fileArr) {
|
||||
xmlEmbeddedFiles = new ArrayList<>(Arrays.asList(fileArr));
|
||||
if (fileArr!=null) {
|
||||
xmlEmbeddedFiles = new ArrayList<>(Arrays.asList(fileArr));
|
||||
} else {
|
||||
xmlEmbeddedFiles = new ArrayList<>();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -153,7 +158,6 @@ public class Invoice implements IExportableTransaction {
|
||||
*/
|
||||
public Invoice setCorrection(String number) {
|
||||
setInvoiceReferencedDocumentID(number);
|
||||
addInvoiceReferencedDocument(new ReferencedDocument(number));
|
||||
documentCode = DocumentCodeTypeConstants.CORRECTEDINVOICE;
|
||||
return this;
|
||||
}
|
||||
@@ -679,6 +683,15 @@ public class Invoice implements IExportableTransaction {
|
||||
}
|
||||
|
||||
|
||||
public String getPaymentReference() {
|
||||
return paymentReference;
|
||||
}
|
||||
|
||||
public Invoice setPaymentReference(String paymentReference) {
|
||||
this.paymentReference = paymentReference;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradeParty getDeliveryAddress() {
|
||||
return deliveryAddress;
|
||||
|
||||
@@ -42,6 +42,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<>();
|
||||
protected ArrayList<IZUGFeRDAllowanceCharge> Charges = new ArrayList<>();
|
||||
protected List<IncludedNote> includedNotes = null;
|
||||
protected String accountingReference;
|
||||
//protected HashMap<String, String> attributes = new HashMap<>();
|
||||
|
||||
/***
|
||||
@@ -172,7 +173,10 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
icnm.getAsNodeMap("ApplicableTradeTax")
|
||||
.flatMap(cnm -> cnm.getAsBigDecimal("RateApplicablePercent", "ApplicablePercent"))
|
||||
.ifPresent(product::setVATPercent);
|
||||
icnm.getAsNodeMap("SpecifiedTradeAllowanceCharge").ifPresent(stac -> {
|
||||
icnm.getAsNodeMap("ApplicableTradeTax")
|
||||
.flatMap(cnm -> cnm.getAsString("ExemptionReason"))
|
||||
.ifPresent(product::setTaxExemptionReason);
|
||||
icnm.getAllNodes("SpecifiedTradeAllowanceCharge").map(NodeMap::new).forEach(stac -> {
|
||||
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
|
||||
String isChargeString=ci.getAsString("Indicator").get();
|
||||
String percentString=stac.getAsStringOrNull("CalculationPercent");
|
||||
@@ -187,8 +191,12 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
if (amountString!=null) {
|
||||
izac.setTotalAmount(new BigDecimal(amountString));
|
||||
}
|
||||
if(percentString!=null) {
|
||||
izac.setPercent(new BigDecimal(percentString));
|
||||
}
|
||||
if(reason!=null) {
|
||||
izac.setReason(reason);
|
||||
}
|
||||
|
||||
if (isChargeString.equalsIgnoreCase("false")) {
|
||||
addAllowance(izac);
|
||||
@@ -206,6 +214,14 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
}
|
||||
|
||||
icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode).forEach(this::addAdditionalReference);
|
||||
|
||||
icnm.getAsString("ReceivableSpecifiedTradeAccountingAccount").ifPresent(s -> this.accountingReference = s == null ? null : s.trim());
|
||||
|
||||
icnm.getAsNodeMap("BillingSpecifiedPeriod").ifPresent(periodNode -> {
|
||||
Date start = periodNode.getAsNodeMap("StartDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(dts -> XMLTools.tryDate(dts)).orElse(null);
|
||||
Date end = periodNode.getAsNodeMap("EndDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(dts -> XMLTools.tryDate(dts)).orElse(null);
|
||||
setDetailedDeliveryPeriod(start, end);
|
||||
});
|
||||
});
|
||||
|
||||
itemMap.getAsNodeMap("AssociatedDocumentLineDocument").ifPresent(adld -> {
|
||||
@@ -353,6 +369,29 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
return Allowances.toArray(new IZUGFeRDAllowanceCharge[0]);
|
||||
}
|
||||
|
||||
/***
|
||||
* jackson convenience method
|
||||
*/
|
||||
public void setItemAllowances(ArrayList<Allowance> theAllowances) {
|
||||
if (theAllowances!=null) {
|
||||
Allowances.clear();
|
||||
for (Allowance theAllowance : theAllowances) {
|
||||
Allowances.add(theAllowance);
|
||||
}
|
||||
}
|
||||
}
|
||||
/***
|
||||
* jackson convenience method
|
||||
*/
|
||||
public void setItemCharges(ArrayList<Charge> theCharges) {
|
||||
if (theCharges!=null) {
|
||||
Charges.clear();
|
||||
for (Charge theCharge : theCharges) {
|
||||
Charges.add(theCharge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IZUGFeRDAllowanceCharge[] getItemCharges() {
|
||||
if (Charges.isEmpty()) {
|
||||
@@ -525,4 +564,9 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
public List<IncludedNote> getNotesWithSubjectCode() {
|
||||
return includedNotes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccountingReference() {
|
||||
return accountingReference;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ public class LegalOrganisation implements IZUGFeRDLegalOrganisation {
|
||||
this.schemedID = new SchemedID(scheme, ID);
|
||||
}
|
||||
|
||||
public LegalOrganisation(String ID) {
|
||||
this.schemedID = new SchemedID(null, ID);
|
||||
}
|
||||
|
||||
public LegalOrganisation(SchemedID schemedID, String tradingBusinessName) {
|
||||
this.schemedID = schemedID;
|
||||
this.tradingBusinessName=tradingBusinessName;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Product implements IZUGFeRDExportableProduct {
|
||||
nodeMap.getAsString("Description").ifPresent(this::setDescription);
|
||||
|
||||
|
||||
nodeMap.getAsNodeMap("ApplicableProductCharacteristic").ifPresent(apcNodes -> {
|
||||
nodeMap.getAllNodes("ApplicableProductCharacteristic").map(NodeMap::new).forEach(apcNodes -> { // ApplicableProductCharacteristic is 0 .. unbounded
|
||||
String key = apcNodes.getAsStringOrNull("Description");
|
||||
String value = apcNodes.getAsStringOrNull("Value");
|
||||
if (key != null && value != null) {
|
||||
@@ -80,7 +80,6 @@ public class Product implements IZUGFeRDExportableProduct {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//UBL
|
||||
nodeMap.getAsNodeMap("AdditionalItemProperty").ifPresent(aipNodes -> {
|
||||
String name = aipNodes.getAsStringOrNull("Name");
|
||||
|
||||
@@ -129,7 +129,16 @@ public class XMLTools extends XMLWriter {
|
||||
* @return a util.Date, or null, if not parseable
|
||||
*/
|
||||
public static Date tryDate(String toParse) {
|
||||
final SimpleDateFormat formatter = ZUGFeRDDateFormat.DATE.getFormatter();
|
||||
SimpleDateFormat formatter = null;
|
||||
if (toParse==null) {
|
||||
return null;
|
||||
}
|
||||
if (toParse.contains("-")) {
|
||||
// from ubl
|
||||
formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
} else {
|
||||
formatter = ZUGFeRDDateFormat.DATE.getFormatter();
|
||||
}
|
||||
try {
|
||||
return formatter.parse(toParse);
|
||||
} catch (final Exception e) {
|
||||
@@ -211,7 +220,8 @@ public class XMLTools extends XMLWriter {
|
||||
}
|
||||
|
||||
public static byte[] getBytesFromStream(InputStream fileinput) throws IOException {
|
||||
return IOUtils.toByteArray (fileinput);
|
||||
// Stream closing responsibility is with the caller
|
||||
return IOUtils.toByteArray(fileinput);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -313,6 +313,10 @@ public interface IExportableTransaction {
|
||||
return null;
|
||||
}
|
||||
|
||||
default String getPaymentReference() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get payment terms for the EXTENDED profile (multiple terms are allowed)
|
||||
* @return
|
||||
|
||||
@@ -172,4 +172,8 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
|
||||
default List<IncludedNote> getNotesWithSubjectCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default String getAccountingReference() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.Map;
|
||||
|
||||
import org.mustangproject.EStandard;
|
||||
import org.mustangproject.FileAttachment;
|
||||
import org.mustangproject.ReferencedDocument;
|
||||
import org.mustangproject.XMLTools;
|
||||
|
||||
public class OXPullProvider extends ZUGFeRD2PullProvider {
|
||||
@@ -460,7 +461,7 @@ public class OXPullProvider extends ZUGFeRD2PullProvider {
|
||||
xml += "</ram:InvoiceReferencedDocument>";
|
||||
}
|
||||
if (trans.getInvoiceReferencedDocuments() != null) {
|
||||
for (var doc : trans.getInvoiceReferencedDocuments()) {
|
||||
for (ReferencedDocument doc : trans.getInvoiceReferencedDocuments()) {
|
||||
xml += "<ram:InvoiceReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(doc.getIssuerAssignedID()) + "</ram:IssuerAssignedID>";
|
||||
|
||||
@@ -13,14 +13,14 @@ import org.apache.pdfbox.preflight.parser.PreflightParser;
|
||||
|
||||
import jakarta.activation.DataSource;
|
||||
|
||||
// Copied from PDFBox preflight 2.0.x
|
||||
// Copied from PDFBox preflight 2.0.x
|
||||
final class ByteArrayDataSource implements DataSource
|
||||
{
|
||||
private ByteArrayOutputStream data;
|
||||
private String type = null;
|
||||
private String name = null;
|
||||
|
||||
public ByteArrayDataSource (InputStream is) throws IOException
|
||||
public ByteArrayDataSource (final InputStream is) throws IOException
|
||||
{
|
||||
data = new ByteArrayOutputStream ();
|
||||
IOUtils.copy (is, data);
|
||||
@@ -36,7 +36,7 @@ final class ByteArrayDataSource implements DataSource
|
||||
* @param type
|
||||
* the type to set
|
||||
*/
|
||||
public void setType (String type)
|
||||
public void setType (final String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ final class ByteArrayDataSource implements DataSource
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName (String name)
|
||||
public void setName (final String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
@@ -70,12 +70,13 @@ final class ByteArrayDataSource implements DataSource
|
||||
// Try to create an API similar to the 2.x one
|
||||
final class PreflightParserHelper
|
||||
{
|
||||
private static File createTmpFile (InputStream input) throws IOException
|
||||
private static File createTmpFile (final InputStream input) throws IOException
|
||||
{
|
||||
FileOutputStream fos = null;
|
||||
try
|
||||
{
|
||||
File tmpFile = File.createTempFile ("mustang-pdf", ".pdf");
|
||||
final File tmpFile = File.createTempFile ("mustang-pdf", ".pdf");
|
||||
tmpFile.deleteOnExit ();
|
||||
fos = new FileOutputStream (tmpFile);
|
||||
IOUtils.copy (input, fos);
|
||||
return tmpFile;
|
||||
@@ -87,7 +88,7 @@ final class PreflightParserHelper
|
||||
}
|
||||
}
|
||||
|
||||
public static PreflightParser createPreflightParser (DataSource dataSource) throws IOException
|
||||
public static PreflightParser createPreflightParser (final DataSource dataSource) throws IOException
|
||||
{
|
||||
return new PreflightParser (createTmpFile (dataSource.getInputStream ()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.StringReader;
|
||||
import org.apache.fop.apps.*;
|
||||
import org.apache.fop.apps.io.ResourceResolverFactory;
|
||||
import org.apache.fop.configuration.Configuration;
|
||||
@@ -10,11 +18,12 @@ import org.mustangproject.ClasspathResolverURIAdapter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.*;
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import java.io.*;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class ValidationLogVisualizer {
|
||||
@@ -70,7 +79,7 @@ public class ValidationLogVisualizer {
|
||||
return baos.toString(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public void toPDF(String xmlLogfileContent, String pdfFilename) {
|
||||
public byte[] createPDFBytes(String xmlLogfileContent) {
|
||||
|
||||
// the writing part
|
||||
|
||||
@@ -111,13 +120,19 @@ public class ValidationLogVisualizer {
|
||||
// Step 2: Set up output stream.
|
||||
// Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
|
||||
|
||||
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(pdfFilename))) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try (OutputStream out = new BufferedOutputStream(baos)) {
|
||||
|
||||
// Step 3: Construct fop with desired output format
|
||||
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
|
||||
|
||||
// Step 4: Setup JAXP using identity transformer
|
||||
TransformerFactory factory = TransformerFactory.newInstance();
|
||||
|
||||
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||
Transformer transformer = factory.newTransformer(); // identity transformer
|
||||
|
||||
// Step 5: Setup input and output for XSLT transformation
|
||||
@@ -133,6 +148,20 @@ public class ValidationLogVisualizer {
|
||||
} catch (FOPException | IOException | TransformerException e) {
|
||||
LOGGER.error("Failed to create PDF", e);
|
||||
}
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
public byte[] toPDF(String xmlLogfileContent) {
|
||||
return createPDFBytes(xmlLogfileContent);
|
||||
}
|
||||
|
||||
public void toPDF(String xmlLogfileContent, String pdfFilename) {
|
||||
byte[] pdfData = createPDFBytes(xmlLogfileContent);
|
||||
try (FileOutputStream fos = new FileOutputStream(pdfFilename)) {
|
||||
fos.write(pdfData);
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Failed to write PDF to file", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ClasspathResourceURIResolver implements URIResolver {
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
import org.mustangproject.FileAttachment;
|
||||
import org.mustangproject.IncludedNote;
|
||||
import org.mustangproject.ReferencedDocument;
|
||||
import org.mustangproject.XMLTools;
|
||||
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
|
||||
import org.slf4j.Logger;
|
||||
@@ -139,7 +140,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
xml += "<ram:GlobalID schemeID=\"" + XMLTools.encodeXML(party.getGlobalIDScheme()) + "\">"
|
||||
+ XMLTools.encodeXML(party.getGlobalID()) + "</ram:GlobalID>";
|
||||
}
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(party.getName()) + "</ram:Name>";
|
||||
if (party.getName() != null && !party.getName().isEmpty()) {
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(party.getName()) + "</ram:Name>";
|
||||
}
|
||||
if (party.getDescription() != null) {
|
||||
xml += "<ram:Description>" + XMLTools.encodeXML(party.getDescription()) + "</ram:Description>";
|
||||
}
|
||||
@@ -149,7 +152,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
if (profile == Profiles.getByName("Minimum")) {
|
||||
xml += "<ram:ID>" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getID()) + "</ram:ID>";
|
||||
} else {
|
||||
xml += "<ram:ID schemeID=\"" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getScheme()) + "\">" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getID()) + "</ram:ID>";
|
||||
String schemeAttribute="";
|
||||
if ((party.getLegalOrganisation().getSchemedID().getScheme()!=null)&&(party.getLegalOrganisation().getSchemedID().getScheme().length()>0)) {
|
||||
schemeAttribute="schemeID=\"" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getScheme())+"\"";
|
||||
|
||||
}
|
||||
xml += "<ram:ID "+schemeAttribute+">" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemedID().getID()) + "</ram:ID>";
|
||||
}
|
||||
}
|
||||
if (party.getLegalOrganisation().getTradingBusinessName() != null) {
|
||||
@@ -277,7 +285,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
String reason = "";
|
||||
if ((allowance.getReason() != null) && (profile == Profiles.getByName("Extended") || profile == Profiles.getByName("XRechnung")) || profile == Profiles.getByName("EN16931")) {
|
||||
if ((allowance.getReason() != null) && (profile == Profiles.getByName("Extended") || profile == Profiles.getByName("XRechnung") || profile == Profiles.getByName("EN16931"))) {
|
||||
reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
||||
}
|
||||
String reasonCode = "";
|
||||
@@ -337,8 +345,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
boolean hasDueDate = trans.getDueDate() != null;
|
||||
final SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
|
||||
String exemptionReason = "";
|
||||
|
||||
if (trans.getPaymentTermDescription() != null) {
|
||||
paymentTermsDescription = XMLTools.encodeXML(trans.getPaymentTermDescription());
|
||||
}
|
||||
@@ -388,14 +394,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ "</ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||
+ "</rsm:ExchangedDocumentContext>"
|
||||
+ "<rsm:ExchangedDocument>"
|
||||
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>"
|
||||
// + "<ram:Name>RECHNUNG</ram:Name>"
|
||||
// + "<ram:TypeCode>380</ram:TypeCode>"
|
||||
+ "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
|
||||
+ "<ram:IssueDateTime>"
|
||||
+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
|
||||
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>";
|
||||
if (profile == Profiles.getByName("Extended") && trans.getDocumentName() != null) {
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(trans.getDocumentName()) + "</ram:Name>";
|
||||
}
|
||||
xml += "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
|
||||
+ "<ram:IssueDateTime>" + DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
|
||||
+ buildNotes(trans)
|
||||
|
||||
+ "</rsm:ExchangedDocument>"
|
||||
+ "<rsm:SupplyChainTradeTransaction>";
|
||||
int lineID = 0;
|
||||
@@ -405,9 +410,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
if (currentItem.getId()!=null) {
|
||||
lineIDStr=currentItem.getId();
|
||||
}
|
||||
if (currentItem.getProduct().getTaxExemptionReason() != null) {
|
||||
exemptionReason = "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
||||
}
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
if ((getProfile() != Profiles.getByName("Minimum")) && (getProfile() != Profiles.getByName("BasicWL"))) {
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
@@ -450,7 +452,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>";
|
||||
if (currentItem.getProduct().getDescription().length() > 0) {
|
||||
if (currentItem.getProduct().getDescription() != null && currentItem.getProduct().getDescription().length() > 0) {
|
||||
xml += "<ram:Description>" +
|
||||
XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
|
||||
"</ram:Description>";
|
||||
@@ -458,7 +460,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
if (currentItem.getProduct().getClassifications() != null && currentItem.getProduct().getClassifications().length > 0) {
|
||||
for (IDesignatedProductClassification classification : currentItem.getProduct().getClassifications()) {
|
||||
xml += "<ram:DesignatedProductClassification>"
|
||||
+ "<ram:ClassCode listId=\"" + XMLTools.encodeXML(classification.getClassCode().getListID()) + "\"";
|
||||
+ "<ram:ClassCode listID=\"" + XMLTools.encodeXML(classification.getClassCode().getListID()) + "\"";
|
||||
if (classification.getClassCode().getListVersionID() != null) {
|
||||
xml += " listVersionID=\"" + XMLTools.encodeXML(classification.getClassCode().getListVersionID()) + "\"";
|
||||
}
|
||||
@@ -528,9 +530,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ "</ram:SpecifiedLineTradeDelivery>"
|
||||
+ "<ram:SpecifiedLineTradeSettlement>"
|
||||
+ "<ram:ApplicableTradeTax>"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
||||
+ exemptionReason
|
||||
+ "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>";
|
||||
|
||||
if (currentItem.getProduct().getTaxExemptionReason() != null) {
|
||||
xml += "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
||||
}
|
||||
|
||||
xml += "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>"
|
||||
+ "<ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>"
|
||||
+ "</ram:ApplicableTradeTax>";
|
||||
@@ -662,8 +668,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
if ((trans.getCreditorReferenceID() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
|
||||
xml += "<ram:CreditorReferenceID>" + XMLTools.encodeXML(trans.getCreditorReferenceID()) + "</ram:CreditorReferenceID>";
|
||||
}
|
||||
if ((trans.getNumber() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
|
||||
xml += "<ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>";
|
||||
if ((trans.getPaymentReference() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
|
||||
xml += "<ram:PaymentReference>" + XMLTools.encodeXML(trans.getPaymentReference()) + "</ram:PaymentReference>";
|
||||
}
|
||||
xml += "<ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>";
|
||||
if (this.trans.getPayee() != null) {
|
||||
@@ -894,7 +900,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
xml += "</ram:InvoiceReferencedDocument>";
|
||||
}
|
||||
if (trans.getInvoiceReferencedDocuments() != null) {
|
||||
for (var doc : trans.getInvoiceReferencedDocuments()) {
|
||||
for (ReferencedDocument doc : trans.getInvoiceReferencedDocuments()) {
|
||||
xml += "<ram:InvoiceReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(doc.getIssuerAssignedID()) + "</ram:IssuerAssignedID>";
|
||||
|
||||
@@ -58,6 +58,7 @@ import org.apache.pdfbox.pdmodel.font.PDCIDFontType2;
|
||||
import org.apache.pdfbox.pdmodel.font.PDFont;
|
||||
import org.apache.pdfbox.pdmodel.font.PDFontDescriptor;
|
||||
import org.apache.pdfbox.pdmodel.font.PDType0Font;
|
||||
import org.apache.pdfbox.pdmodel.graphics.PDXObject;
|
||||
import org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent;
|
||||
import org.apache.xmpbox.XMPMetadata;
|
||||
import org.apache.xmpbox.schema.AdobePDFSchema;
|
||||
@@ -559,6 +560,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
||||
// https://github.com/ZUGFeRD/mustangproject/issues/249
|
||||
|
||||
COSName cidSet = COSName.getPDFName("CIDSet");
|
||||
COSName resources = COSName.getPDFName("Resources");
|
||||
|
||||
// iterate over all pdf pages
|
||||
|
||||
@@ -567,29 +569,45 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
||||
|
||||
PDPage page = (PDPage) object;
|
||||
PDResources res = page.getResources();
|
||||
for (COSName fontName : res.getFontNames()) {
|
||||
try {
|
||||
PDFont pdFont = res.getFont(fontName);
|
||||
if (pdFont instanceof PDType0Font) {
|
||||
PDType0Font typedFont = (PDType0Font) pdFont;
|
||||
|
||||
if (typedFont.getDescendantFont() instanceof PDCIDFontType2) {
|
||||
@SuppressWarnings("unused")
|
||||
PDCIDFontType2 f = (PDCIDFontType2) typedFont.getDescendantFont();
|
||||
PDFontDescriptor fontDescriptor = pdFont.getFontDescriptor();
|
||||
|
||||
fontDescriptor.getCOSObject().removeItem(cidSet);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
// Check for fonts in PDXObjects:
|
||||
for (COSName xObjectName : res.getXObjectNames()) {
|
||||
PDXObject xObject = res.getXObject(xObjectName);
|
||||
COSDictionary d = xObject.getCOSObject().getCOSDictionary(resources);
|
||||
if (d != null) {
|
||||
PDResources xr = new PDResources(d);
|
||||
removeCIDSetFromPDResources(cidSet, xr);
|
||||
}
|
||||
// do stuff with the font
|
||||
}
|
||||
|
||||
// Check for fonts in document-resources:
|
||||
removeCIDSetFromPDResources(cidSet, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeCIDSetFromPDResources(COSName cidSet, PDResources res) throws IOException {
|
||||
for (COSName fontName : res.getFontNames()) {
|
||||
try {
|
||||
PDFont pdFont = res.getFont(fontName);
|
||||
if (pdFont instanceof PDType0Font) {
|
||||
PDType0Font typedFont = (PDType0Font) pdFont;
|
||||
|
||||
if (typedFont.getDescendantFont() instanceof PDCIDFontType2) {
|
||||
@SuppressWarnings("unused")
|
||||
PDCIDFontType2 f = (PDCIDFontType2) typedFont.getDescendantFont();
|
||||
PDFontDescriptor fontDescriptor = pdFont.getFontDescriptor();
|
||||
|
||||
fontDescriptor.getCOSObject().removeItem(cidSet);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
}
|
||||
// do stuff with the font
|
||||
}
|
||||
}
|
||||
|
||||
protected void prepareDocument() throws IOException {
|
||||
|
||||
PDDocumentCatalog cat = doc.getDocumentCatalog();
|
||||
|
||||
@@ -90,9 +90,10 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter {
|
||||
|
||||
protected byte[] inputstreamToByteArray(InputStream fileInputStream) throws IOException {
|
||||
byte[] bytes = new byte[fileInputStream.available()];
|
||||
DataInputStream dataInputStream = new DataInputStream(fileInputStream);
|
||||
dataInputStream.readFully(bytes);
|
||||
return bytes;
|
||||
try (DataInputStream dataInputStream = new DataInputStream(fileInputStream)) {
|
||||
dataInputStream.readFully(bytes);
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -86,6 +86,7 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter {
|
||||
case "urn:factur-x.eu:1p0:minimum":
|
||||
return "MINIMUM";
|
||||
case "urn:ferd:CrossIndustryDocument:invoice:1p0:extended":
|
||||
case "urn:cen.eu:en16931:2017#conformant#urn:zugferd.de:2p0:extended":
|
||||
case "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended":
|
||||
return "EXTENDED";
|
||||
default:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.pdfbox.Loader;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
@@ -137,9 +138,9 @@ public class ZUGFeRDInvoiceImporter {
|
||||
return;
|
||||
}
|
||||
|
||||
final InputStream XMP = doc.getDocumentCatalog().getMetadata().exportXMPMetadata();
|
||||
|
||||
xmpString = new String(XMLTools.getBytesFromStream(XMP), StandardCharsets.UTF_8);
|
||||
try (final InputStream XMP = doc.getDocumentCatalog().getMetadata().exportXMPMetadata()) {
|
||||
xmpString = new String(XMLTools.getBytesFromStream(XMP), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
final PDEmbeddedFilesNameTreeNode etn = names.getEmbeddedFiles();
|
||||
if (etn == null) {
|
||||
@@ -258,9 +259,25 @@ public class ZUGFeRDInvoiceImporter {
|
||||
}
|
||||
|
||||
private void setDocument() throws ParserConfigurationException, IOException, SAXException, ParseException {
|
||||
final DocumentBuilderFactory xmlFact = DocumentBuilderFactory.newInstance();
|
||||
xmlFact.setNamespaceAware(true);
|
||||
final DocumentBuilder builder = xmlFact.newDocumentBuilder();
|
||||
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
//REDHAT
|
||||
//https://www.blackhat.com/docs/us-15/materials/us-15-Wang-FileCry-The-New-Age-Of-XXE-java-wp.pdf
|
||||
dbf.setAttribute(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
|
||||
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
|
||||
|
||||
//OWASP
|
||||
//https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html
|
||||
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||
// Disable external DTDs as well
|
||||
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||
// and these as well, per Timothy Morgan's 2014 paper: "XML Schema, DTD, and Entity Attacks"
|
||||
dbf.setXIncludeAware(false);
|
||||
dbf.setExpandEntityReferences(false);
|
||||
dbf.setNamespaceAware(true);
|
||||
final DocumentBuilder builder = dbf.newDocumentBuilder();
|
||||
final ByteArrayInputStream is = new ByteArrayInputStream(rawXML);
|
||||
/// is.skip(guessBOMSize(is));
|
||||
document = builder.parse(is);
|
||||
@@ -288,6 +305,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
public Invoice extractInto(Invoice zpp) throws XPathExpressionException, ParseException {
|
||||
|
||||
String number = "";
|
||||
String documentName = null;
|
||||
String typeCode = null;
|
||||
String deliveryPeriodStart = null;
|
||||
String deliveryPeriodEnd = null;
|
||||
@@ -496,6 +514,9 @@ public class ZUGFeRDInvoiceImporter {
|
||||
if ((item.getLocalName() != null) && (item.getLocalName().equals("ID"))) {
|
||||
number = XMLTools.trimOrNull(item);
|
||||
}
|
||||
if ((item.getLocalName() != null) && (item.getLocalName().equals("Name"))) {
|
||||
documentName = XMLTools.trimOrNull(item);
|
||||
}
|
||||
if ((item.getLocalName() != null) && (item.getLocalName().equals("TypeCode"))) {
|
||||
typeCode = XMLTools.trimOrNull(item);
|
||||
}
|
||||
@@ -556,13 +577,13 @@ public class ZUGFeRDInvoiceImporter {
|
||||
}
|
||||
zpp.addNotes(includedNotes);
|
||||
String rootNode = extractString("local-name(/*)");
|
||||
if (rootNode.equals("Invoice")||rootNode.equals("CreditNote")) {
|
||||
if (rootNode.equals("Invoice") || rootNode.equals("CreditNote")) {
|
||||
// UBL...
|
||||
// //*[local-name()="Invoice" or local-name()="CreditNote"]
|
||||
number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim();
|
||||
typeCode = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"InvoiceTypeCode\"]").trim();
|
||||
String issueDateStr = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"IssueDate\"]").trim();
|
||||
if (issueDateStr.length()>0) {
|
||||
if (issueDateStr.length() > 0) {
|
||||
issueDate = new SimpleDateFormat("yyyy-MM-dd").parse(issueDateStr);
|
||||
}
|
||||
String dueDt = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"DueDate\"]").trim();
|
||||
@@ -651,7 +672,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
zpp.setCurrency(currency);
|
||||
|
||||
String paymentTermsDescription = extractString("//*[local-name()=\"SpecifiedTradePaymentTerms\"]/*[local-name()=\"Description\"]|//*[local-name()=\"PaymentTerms\"]/*[local-name()=\"Note\"]");
|
||||
if ((paymentTermsDescription!=null)&&(!paymentTermsDescription.isEmpty())) {
|
||||
if ((paymentTermsDescription != null) && (!paymentTermsDescription.isEmpty())) {
|
||||
zpp.setPaymentTermDescription(paymentTermsDescription);
|
||||
}
|
||||
|
||||
@@ -661,6 +682,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
List<BankDetails> bankDetails = new ArrayList<>();
|
||||
String directDebitMandateID = null;
|
||||
String IBAN = null, BIC = null, paymentMeansCode = null, paymentMeansInformation = null;
|
||||
String accountName = null;
|
||||
|
||||
for (int i = 0; i < headerTradeSettlementNodes.getLength(); i++) {
|
||||
// XMLTools.trimOrNull(nodes.item(i)))) {
|
||||
@@ -668,6 +690,12 @@ public class ZUGFeRDInvoiceImporter {
|
||||
|
||||
NodeList headerTradeSettlementChilds = headerTradeSettlementNode.getChildNodes();
|
||||
for (int settlementChildIndex = 0; settlementChildIndex < headerTradeSettlementChilds.getLength(); settlementChildIndex++) {
|
||||
if ((headerTradeSettlementChilds.item(settlementChildIndex).getLocalName() != null)
|
||||
&& (headerTradeSettlementChilds.item(settlementChildIndex).getLocalName().equals("PaymentReference"))) {
|
||||
String paymentReference = headerTradeSettlementChilds.item(settlementChildIndex).getTextContent();
|
||||
zpp.setPaymentReference(paymentReference);
|
||||
}
|
||||
|
||||
if ((headerTradeSettlementChilds.item(settlementChildIndex).getLocalName() != null)
|
||||
&& (headerTradeSettlementChilds.item(settlementChildIndex).getLocalName().equals("SpecifiedTradePaymentTerms"))) {
|
||||
NodeList paymentTermChilds = headerTradeSettlementChilds.item(settlementChildIndex).getChildNodes();
|
||||
@@ -712,6 +740,9 @@ public class ZUGFeRDInvoiceImporter {
|
||||
if ((accountChilds.item(accountChildIndex).getLocalName() != null) && (accountChilds.item(accountChildIndex).getLocalName().equals("IBANID"))) {//CII
|
||||
IBAN = XMLTools.trimOrNull(accountChilds.item(accountChildIndex));
|
||||
}
|
||||
if ((accountChilds.item(accountChildIndex).getLocalName() != null) && (accountChilds.item(accountChildIndex).getLocalName().equals("AccountName"))) {//CII
|
||||
accountName = XMLTools.trimOrNull(accountChilds.item(accountChildIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((paymentMeansChilds.item(paymentMeansChildIndex).getLocalName() != null) && (paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("PayeeSpecifiedCreditorFinancialInstitution"))) {
|
||||
@@ -729,6 +760,9 @@ public class ZUGFeRDInvoiceImporter {
|
||||
if (BIC != null) {
|
||||
bd.setBIC(BIC);
|
||||
}
|
||||
if (accountName!=null) {
|
||||
bd.setAccountName(accountName);
|
||||
}
|
||||
bankDetails.add(bd);
|
||||
}
|
||||
}
|
||||
@@ -758,6 +792,21 @@ public class ZUGFeRDInvoiceImporter {
|
||||
}
|
||||
}
|
||||
|
||||
xpr = xpath.compile("/*[local-name()=\"Invoice\"]/*[local-name()=\"InvoicePeriod\"]/*"); //UBL only
|
||||
NodeList periodNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
|
||||
for (int periodChildIndex = 0; periodChildIndex < periodNodes.getLength(); periodChildIndex++) {
|
||||
String localName=periodNodes.item(periodChildIndex).getLocalName();
|
||||
if ((localName != null) && (periodNodes.item(periodChildIndex).getLocalName().equals("StartDate"))) {
|
||||
deliveryPeriodStart = XMLTools.trimOrNull(periodNodes.item(periodChildIndex));
|
||||
}
|
||||
if ((localName != null) && (periodNodes.item(periodChildIndex).getLocalName().equals("EndDate"))) {
|
||||
deliveryPeriodEnd = XMLTools.trimOrNull(periodNodes.item(periodChildIndex));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ((deliveryPeriodStart != null) && (deliveryPeriodEnd != null)) {
|
||||
zpp.setDetailedDeliveryPeriod(XMLTools.tryDate(deliveryPeriodStart), XMLTools.tryDate(deliveryPeriodEnd));
|
||||
} else if (deliveryPeriodStart != null) {
|
||||
@@ -776,12 +825,12 @@ public class ZUGFeRDInvoiceImporter {
|
||||
&& (paymentMeansChilds.item(meansChildIndex).getLocalName().equals("PayeeFinancialAccount"))) {
|
||||
NodeList paymentTermChilds = paymentMeansChilds.item(meansChildIndex).getChildNodes();
|
||||
for (int paymentTermChildIndex = 0; paymentTermChildIndex < paymentTermChilds.getLength(); paymentTermChildIndex++) {
|
||||
|
||||
if ((paymentTermChilds.item(paymentTermChildIndex).getLocalName() != null) && (paymentTermChilds.item(paymentTermChildIndex).getLocalName().equals("Name"))) {
|
||||
accountName = XMLTools.trimOrNull(paymentTermChilds.item(paymentTermChildIndex));
|
||||
}
|
||||
if ((paymentTermChilds.item(paymentTermChildIndex).getLocalName() != null) && (paymentTermChilds.item(paymentTermChildIndex).getLocalName().equals("ID"))) {
|
||||
IBAN = XMLTools.trimOrNull(paymentTermChilds.item(paymentTermChildIndex));
|
||||
if (IBAN != null) {
|
||||
BankDetails bd = new BankDetails(IBAN);
|
||||
bankDetails.add(bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -799,10 +848,18 @@ public class ZUGFeRDInvoiceImporter {
|
||||
|
||||
}
|
||||
}
|
||||
if (IBAN != null) {
|
||||
BankDetails bd = new BankDetails(IBAN);
|
||||
if (accountName!=null) {
|
||||
bd.setAccountName(accountName);
|
||||
}
|
||||
bankDetails.add(bd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
zpp.setIssueDate(issueDate).setDueDate(dueDate).setDeliveryDate(deliveryDate).setSender(new TradeParty(SellerNodes)).setRecipient(new TradeParty(BuyerNodes)).setNumber(number).setDocumentCode(typeCode);
|
||||
zpp.setIssueDate(issueDate).setDueDate(dueDate).setDeliveryDate(deliveryDate).setSender(new TradeParty(SellerNodes)).setRecipient(new TradeParty(BuyerNodes)).setNumber(number).setDocumentName(documentName).setDocumentCode(typeCode);
|
||||
|
||||
if ((directDebitMandateID != null) && (IBAN != null)) {
|
||||
DirectDebit d = new DirectDebit(IBAN, directDebitMandateID);
|
||||
@@ -848,15 +905,14 @@ public class ZUGFeRDInvoiceImporter {
|
||||
|
||||
Node currentItemNode = nodes.item(i);
|
||||
ReferencedDocument doc = ReferencedDocument.fromNode(currentItemNode);
|
||||
if (doc != null
|
||||
&& (!Objects.equals(zpp.getInvoiceReferencedDocumentID(), doc.getIssuerAssignedID())
|
||||
|| !Objects.equals(zpp.getInvoiceReferencedIssueDate(), doc.getFormattedIssueDateTime())))
|
||||
{
|
||||
if (doc != null
|
||||
&& (!Objects.equals(zpp.getInvoiceReferencedDocumentID(), doc.getIssuerAssignedID())
|
||||
|| !Objects.equals(zpp.getInvoiceReferencedIssueDate(), doc.getFormattedIssueDateTime()))) {
|
||||
zpp.addInvoiceReferencedDocument(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
zpp.setOwnOrganisationName(extractString("//*[local-name()=\"SellerTradeParty\"]/*[local-name()=\"Name\"]|//*[local-name()=\"AccountingSupplierParty\"]/*[local-name()=\"Party\"]/*[local-name()=\"PartyName\"]").trim());
|
||||
|
||||
String rounding = extractString("//*[local-name()=\"SpecifiedTradeSettlementHeaderMonetarySummation\"]/*[local-name()=\"RoundingAmount\"]|//*[local-name()=\"LegalMonetaryTotal\"]/*[local-name()=\"Party\"]/*[local-name()=\"PayableRoundingAmount\"]");
|
||||
@@ -890,7 +946,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
xpr = xpath.compile("//*[local-name()=\"AttachmentBinaryObject\"]|//*[local-name()=\"EmbeddedDocumentBinaryObject\"]");
|
||||
NodeList attachmentNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
for (int i = 0; i < attachmentNodes.getLength(); i++) {
|
||||
FileAttachment fa = new FileAttachment(attachmentNodes.item(i).getAttributes().getNamedItem("filename").getNodeValue(), attachmentNodes.item(i).getAttributes().getNamedItem("mimeCode").getNodeValue(), "Data", Base64.getDecoder().decode(XMLTools.trimOrNull(attachmentNodes.item(i))));
|
||||
FileAttachment fa = new FileAttachment(attachmentNodes.item(i).getAttributes().getNamedItem("filename").getNodeValue(), attachmentNodes.item(i).getAttributes().getNamedItem("mimeCode").getNodeValue(), "Data", Base64.getMimeDecoder().decode(XMLTools.trimOrNull(attachmentNodes.item(i))));
|
||||
zpp.embedFileInXML(fa);
|
||||
// filename = "Aufmass.png" mimeCode = "image/png"
|
||||
//EmbeddedDocumentBinaryObject cbc:EmbeddedDocumentBinaryObject mimeCode="image/png" filename="Aufmass.png"
|
||||
@@ -976,6 +1032,38 @@ public class ZUGFeRDInvoiceImporter {
|
||||
}
|
||||
|
||||
}
|
||||
xpr = xpath.compile("//*[local-name()=\"ApplicableHeaderTradeSettlement\"]/*[local-name()=\"SpecifiedLogisticsServiceCharge\"]");// UBL unknown
|
||||
chargeNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
for (int i = 0; i < chargeNodes.getLength(); i++) {
|
||||
NodeList chargeNodeChilds = chargeNodes.item(i).getChildNodes();
|
||||
String chargeAmount = null;
|
||||
String taxPercent = null;
|
||||
for (int chargeChildIndex = 0; chargeChildIndex < chargeNodeChilds.getLength(); chargeChildIndex++) {
|
||||
String chargeChildName = chargeNodeChilds.item(chargeChildIndex).getLocalName();
|
||||
if (chargeChildName != null) {
|
||||
if (chargeChildName.equals("AppliedAmount")) {
|
||||
chargeAmount = XMLTools.trimOrNull(chargeNodeChilds.item(chargeChildIndex));
|
||||
} else if (chargeChildName.equals("AppliedTradeTax")) {
|
||||
NodeList taxChilds = chargeNodeChilds.item(chargeChildIndex).getChildNodes();
|
||||
for (int taxChildIndex = 0; taxChildIndex < taxChilds.getLength(); taxChildIndex++) {
|
||||
String taxItemName = taxChilds.item(taxChildIndex).getLocalName();
|
||||
if ((taxItemName != null) && (taxItemName.equals("RateApplicablePercent"))) {
|
||||
taxPercent = XMLTools.trimOrNull(taxChilds.item(taxChildIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//appliedAmount
|
||||
//AppliedTradeTax
|
||||
}
|
||||
if (chargeAmount != null) {
|
||||
Charge c = new Charge(new BigDecimal(chargeAmount));
|
||||
if (taxPercent != null) {
|
||||
c.setTaxPercent(new BigDecimal(taxPercent));
|
||||
}
|
||||
zpp.addCharge(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TransactionCalculator tc = new TransactionCalculator(zpp);
|
||||
@@ -1040,7 +1128,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
} else if (rootNode.equals("Invoice")) {
|
||||
return EStandard.ubl;
|
||||
} else if (rootNode.equals("CreditNote")) {
|
||||
return EStandard.ubl;
|
||||
return EStandard.ubl_creditnote;
|
||||
} else if (rootNode.equals("CrossIndustryInvoice")) {
|
||||
return EStandard.facturx;
|
||||
} else if (rootNode.equals("SCRDMCCBDACIDAMessageStructure")) {
|
||||
@@ -1085,11 +1173,17 @@ public class ZUGFeRDInvoiceImporter {
|
||||
*
|
||||
* @return the file attachments embedded in XML (using base64) decoded as byte array,
|
||||
* for PDF embedded files in FX use getFileAttachmentsPDF()
|
||||
* may return empty array
|
||||
* @deprecated use invoice.getAdditionalReferencedDocuments
|
||||
*/
|
||||
@Deprecated
|
||||
public List<FileAttachment> getFileAttachmentsXML() {
|
||||
return new ArrayList<>(Arrays.asList(importedInvoice.getAdditionalReferencedDocuments()));
|
||||
if (importedInvoice.getAdditionalReferencedDocuments()!=null) {
|
||||
return new ArrayList<>(Arrays.asList(importedInvoice.getAdditionalReferencedDocuments()));
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import com.helger.commons.io.stream.StreamHelper;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.fop.apps.*;
|
||||
import org.apache.fop.apps.io.ResourceResolverFactory;
|
||||
@@ -45,6 +47,9 @@ import javax.xml.transform.stream.StreamSource;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ZUGFeRDVisualizer {
|
||||
|
||||
@@ -87,7 +92,8 @@ public class ZUGFeRDVisualizer {
|
||||
* @param fis inputstream (will be consumed)
|
||||
* @return (facturx = cii)
|
||||
*/
|
||||
private EStandard findOutStandardFromRootNode(InputStream fis) {
|
||||
private EStandard findOutStandardFromRootNode(InputStream fis)
|
||||
throws ParserConfigurationException {
|
||||
|
||||
String zf1Signature = "CrossIndustryDocument";
|
||||
String zf2Signature = "CrossIndustryInvoice";
|
||||
@@ -96,6 +102,22 @@ public class ZUGFeRDVisualizer {
|
||||
String cioSignature = "SCRDMCCBDACIOMessageStructure";
|
||||
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
//REDHAT
|
||||
//https://www.blackhat.com/docs/us-15/materials/us-15-Wang-FileCry-The-New-Age-Of-XXE-java-wp.pdf
|
||||
dbf.setAttribute(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
|
||||
dbf.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
|
||||
|
||||
//OWASP
|
||||
//https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html
|
||||
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||
// Disable external DTDs as well
|
||||
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||
// and these as well, per Timothy Morgan's 2014 paper: "XML Schema, DTD, and Entity Attacks"
|
||||
dbf.setXIncludeAware(false);
|
||||
dbf.setExpandEntityReferences(false);
|
||||
dbf.setNamespaceAware(true);
|
||||
try {
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
@@ -118,12 +140,15 @@ public class ZUGFeRDVisualizer {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String visualize(String xmlFilename, Language lang) throws IOException, TransformerException {
|
||||
FileInputStream fis = new FileInputStream(xmlFilename);
|
||||
return visualize(fis, lang);
|
||||
public String visualize(String xmlFilename, Language lang)
|
||||
throws IOException, TransformerException, ParserConfigurationException {
|
||||
try (FileInputStream fis = new FileInputStream(xmlFilename)) {
|
||||
return visualize(fis, lang);
|
||||
}
|
||||
}
|
||||
|
||||
public String visualize(InputStream inputXml, Language lang) throws IOException, TransformerException {
|
||||
public String visualize(InputStream inputXml, Language lang)
|
||||
throws IOException, TransformerException, ParserConfigurationException {
|
||||
initTemplates(lang);
|
||||
|
||||
String fileContent = new String(IOUtils.toByteArray(inputXml), StandardCharsets.UTF_8);
|
||||
@@ -208,13 +233,15 @@ public class ZUGFeRDVisualizer {
|
||||
}
|
||||
|
||||
protected String toFOP(String xmlFilename)
|
||||
throws IOException, TransformerException {
|
||||
|
||||
FileInputStream fis = new FileInputStream(xmlFilename);
|
||||
EStandard theStandard = findOutStandardFromRootNode(fis);
|
||||
fis = new FileInputStream(xmlFilename);//rewind :-(
|
||||
|
||||
return toFOP(fis, theStandard);
|
||||
throws IOException, TransformerException, ParserConfigurationException {
|
||||
EStandard theStandard;
|
||||
try (FileInputStream fis = new FileInputStream(xmlFilename)) {
|
||||
theStandard = findOutStandardFromRootNode(fis);
|
||||
}
|
||||
|
||||
try (FileInputStream fis = new FileInputStream(xmlFilename)) {
|
||||
return toFOP(fis, theStandard);
|
||||
}
|
||||
}
|
||||
|
||||
protected String toFOP(InputStream is, EStandard theStandard)
|
||||
@@ -254,16 +281,61 @@ public class ZUGFeRDVisualizer {
|
||||
// the writing part
|
||||
File XMLinputFile = new File(xmlFilename);
|
||||
|
||||
String result = null;
|
||||
String fopInput = null;
|
||||
|
||||
/* remove file endings so that tests can also pass after checking
|
||||
out from git with arbitrary options (which may include CSRF changes)
|
||||
*/
|
||||
try {
|
||||
result = this.toFOP(XMLinputFile.getAbsolutePath());
|
||||
} catch (TransformerException | IOException e) {
|
||||
fopInput = this.toFOP(XMLinputFile.getAbsolutePath());
|
||||
} catch (TransformerException | IOException | ParserConfigurationException e) {
|
||||
LOGGER.error("Failed to apply FOP", e);
|
||||
}
|
||||
|
||||
toPDFfromFOP(fopInput, () -> {
|
||||
try {
|
||||
return new FileOutputStream(pdfFilename);
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error("Failed to create PDF", e);
|
||||
}
|
||||
return null;
|
||||
}, (OutputStream out) -> {});
|
||||
}
|
||||
|
||||
public byte[] toPDF(String xmlContent) {
|
||||
|
||||
String fopInput = null;
|
||||
|
||||
/* remove file endings so that tests can also pass after checking
|
||||
out from git with arbitrary options (which may include CSRF changes)
|
||||
*/
|
||||
try {
|
||||
ByteArrayInputStream fis = new ByteArrayInputStream(xmlContent.getBytes(StandardCharsets.UTF_8));
|
||||
EStandard theStandard = findOutStandardFromRootNode(fis);
|
||||
fis = new ByteArrayInputStream(xmlContent.getBytes(StandardCharsets.UTF_8));//rewind :-(
|
||||
|
||||
fopInput = toFOP(fis, theStandard);
|
||||
} catch (TransformerException | IOException | ParserConfigurationException e) {
|
||||
LOGGER.error("Failed to apply FOP", e);
|
||||
}
|
||||
|
||||
AtomicReference<byte[]> byteHolder = new AtomicReference<>();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
toPDFfromFOP(fopInput, () -> new BufferedOutputStream(os), (OutputStream out) -> {
|
||||
|
||||
try {
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Failed to create PDF", e);
|
||||
}
|
||||
byteHolder.set(os.toByteArray());
|
||||
});
|
||||
|
||||
return byteHolder.get();
|
||||
}
|
||||
|
||||
private void toPDFfromFOP(String fopInput, Supplier<OutputStream> outputStreamDelegate, Consumer<OutputStream> consumerDelegate) {
|
||||
|
||||
DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
|
||||
|
||||
Configuration cfg = null;
|
||||
@@ -291,24 +363,27 @@ public class ZUGFeRDVisualizer {
|
||||
// Step 2: Set up output stream.
|
||||
// Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
|
||||
|
||||
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(pdfFilename))) {
|
||||
try (OutputStream out = new BufferedOutputStream(outputStreamDelegate.get())) {
|
||||
|
||||
// Step 3: Construct fop with desired output format
|
||||
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
|
||||
|
||||
// Step 4: Setup JAXP using identity transformer
|
||||
TransformerFactory factory = TransformerFactory.newInstance();
|
||||
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
Transformer transformer = factory.newTransformer(); // identity transformer
|
||||
|
||||
// Step 5: Setup input and output for XSLT transformation
|
||||
// Setup input stream
|
||||
Source src = new StreamSource(new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8)));
|
||||
Source src = new StreamSource(new ByteArrayInputStream(fopInput.getBytes(StandardCharsets.UTF_8)));
|
||||
|
||||
// Resulting SAX events (the generated FO) must be piped through to FOP
|
||||
Result res = new SAXResult(fop.getDefaultHandler());
|
||||
|
||||
// Step 6: Start XSLT transformation and FOP processing
|
||||
transformer.transform(src, res);
|
||||
|
||||
consumerDelegate.accept(out);
|
||||
|
||||
} catch (FOPException | IOException | TransformerException e) {
|
||||
LOGGER.error("Failed to create PDF", e);
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<xsl:apply-templates mode="BG-11"
|
||||
select="./rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty"/>
|
||||
<xsl:apply-templates mode="BG-13"
|
||||
select="./rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty"/>
|
||||
select="./rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery"/>
|
||||
<xsl:apply-templates mode="BG-14"
|
||||
select="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:BillingSpecifiedPeriod"/>
|
||||
<!--Manuell: angepasst für BG-16-->
|
||||
@@ -1146,18 +1146,18 @@
|
||||
</xr:Tax_representative_country_code>
|
||||
</xsl:template>
|
||||
<xsl:template mode="BG-13"
|
||||
match="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty">
|
||||
match="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery">
|
||||
<xsl:variable name="bg-contents"
|
||||
as="item()*"><!--Der Pfad /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty der Instanz in konkreter Syntax wird auf 5 Objekte der EN 16931 abgebildet. -->
|
||||
<xsl:apply-templates mode="BT-70" select="./ram:Name"/>
|
||||
<xsl:apply-templates mode="BT-70" select="ram:ShipToTradeParty/ram:Name"/>
|
||||
<xsl:apply-templates mode="BT-71"
|
||||
select="./ram:ID[empty(following-sibling::ram:GlobalID/@schemeID)]"/>
|
||||
<xsl:apply-templates mode="BT-71" select="./ram:GlobalID[exists(@schemeID)]"/>
|
||||
select="ram:ShipToTradeParty/ram:ID[empty(following-sibling::ram:GlobalID/@schemeID)]"/>
|
||||
<xsl:apply-templates mode="BT-71" select="ram:ShipToTradeParty/ram:GlobalID[exists(@schemeID)]"/>
|
||||
<xsl:apply-templates mode="BT-72"
|
||||
select="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ActualDeliverySupplyChainEvent/ram:OccurrenceDateTime/udt:DateTimeString[@format = '102']"/>
|
||||
select="ram:ActualDeliverySupplyChainEvent/ram:OccurrenceDateTime/udt:DateTimeString[@format='102']"/>
|
||||
<!--<xsl:apply-templates mode="BG-14"
|
||||
select="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:BillingSpecifiedPeriod"/>-->
|
||||
<xsl:apply-templates mode="BG-15" select="./ram:PostalTradeAddress"/>
|
||||
<xsl:apply-templates mode="BG-15" select="ram:ShipToTradeParty/ram:PostalTradeAddress"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="$bg-contents">
|
||||
<xr:DELIVERY_INFORMATION>
|
||||
|
||||
@@ -28,6 +28,14 @@
|
||||
<xsl:text>red</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="xml_result_text">
|
||||
<xsl:if test="/validation/xml/summary/@status = 'valid'">
|
||||
<xsl:text>Das XML ist valide.</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="/validation/xml/summary/@status = 'invalid'">
|
||||
<xsl:text>Das XML ist nicht valide.</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="pdf_result_color">
|
||||
<xsl:if test="/validation/pdf/summary/@status = 'valid'">
|
||||
<xsl:text>green</xsl:text>
|
||||
@@ -37,18 +45,26 @@
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="pdf_result_text">
|
||||
<xsl:if test="/validation/xml/summary/@status = 'valid'">
|
||||
<xsl:if test="/validation/pdf/summary/@status = 'valid'">
|
||||
<xsl:text>Das ZUGFeRD-PDF ist valide.</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="/validation/xml/summary/@status = 'invalid'">
|
||||
<xsl:if test="/validation/pdf/summary/@status = 'invalid'">
|
||||
<xsl:text>Das ZUGFeRD-PDF ist nicht valide.</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="result_color">
|
||||
<xsl:if test="/validation/summary/@status = 'valid'">
|
||||
<xsl:text>green</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="/validation/summary/@status = 'invalid'">
|
||||
<xsl:text>red</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="result_text">
|
||||
<xsl:if test="/validation/xml/summary/@status = 'valid'">
|
||||
<xsl:if test="/validation/summary/@status = 'valid'">
|
||||
<xsl:text>Es wird empfohlen, das Dokument anzunehmen und es weiterzuverarbeiten.</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="/validation/xml/summary/@status = 'invalid'">
|
||||
<xsl:if test="/validation/summary/@status = 'invalid'">
|
||||
<xsl:text>Es wird empfohlen, das Dokument zurückzuweisen.</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
@@ -118,6 +134,7 @@
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
<xsl:apply-templates select="./pdf"/>
|
||||
<xsl:apply-templates select="./xml"/>
|
||||
<!--
|
||||
<xsl:call-template name="SubHeader">
|
||||
<xsl:with-param name="text"
|
||||
@@ -130,7 +147,7 @@
|
||||
<xsl:with-param name="text"
|
||||
select="concat('Bewertung: ', $result_text)"/>
|
||||
<xsl:with-param name="color"
|
||||
select="$xml_result_color"/>
|
||||
select="$result_color"/>
|
||||
</xsl:call-template>
|
||||
<fo:block>Validierungsergebnisse im Detail:</fo:block>
|
||||
<fo:table>
|
||||
@@ -165,8 +182,8 @@
|
||||
page-break-before="auto"
|
||||
page-break-inside="avoid">
|
||||
<xsl:choose>
|
||||
<xsl:when test="./xml/messages">
|
||||
<xsl:apply-templates select="./xml/messages"/>
|
||||
<xsl:when test="./pdf/messages|./xml/messages|./messages">
|
||||
<xsl:apply-templates select="./pdf/messages|./xml/messages|./messages"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<fo:table-row border-style="solid"
|
||||
@@ -185,10 +202,10 @@
|
||||
</fo:page-sequence>
|
||||
</fo:root>
|
||||
</xsl:template>
|
||||
<xsl:template match="notice|warning|error">
|
||||
<xsl:template match="notice|warning|error|exception|fatal">
|
||||
<xsl:variable name="msg_color">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name() = 'error'">
|
||||
<xsl:when test="name() = 'error' or name() = 'exception' or name() = 'fatal'">
|
||||
<xsl:text>red</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="name() = 'warning'">
|
||||
@@ -201,7 +218,7 @@
|
||||
</xsl:variable>
|
||||
<xsl:variable name="msg_label">
|
||||
<xsl:choose>
|
||||
<xsl:when test="name() = 'error'">
|
||||
<xsl:when test="name() = 'error' or name() = 'exception' or name() = 'fatal'">
|
||||
<xsl:text>Fehler</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="name() = 'warning'">
|
||||
@@ -291,7 +308,15 @@
|
||||
<xsl:with-param name="text"
|
||||
select="concat('ZUGFeRD-PDF: ', $pdf_result_text)"/>
|
||||
<xsl:with-param name="color"
|
||||
select="'black'"/>
|
||||
select="$pdf_result_color"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
<xsl:template match="xml">
|
||||
<xsl:call-template name="SubHeader">
|
||||
<xsl:with-param name="text"
|
||||
select="concat('E-Rechnung XML: ', $xml_result_text)"/>
|
||||
<xsl:with-param name="color"
|
||||
select="$xml_result_color"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
<xsl:template name="SubHeader">
|
||||
|
||||
@@ -789,7 +789,7 @@
|
||||
<xsl:apply-templates mode="list-entry" select="xr:DELIVERY_INFORMATION/xr:Deliver_to_location_identifier/@scheme_identifier">
|
||||
<xsl:with-param name="field-mapping-identifier" select="'xr:Deliver_to_location_identifier/@scheme_identifier'"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:apply-templates mode="list-entry" select="xr:DELIVERY_INFORMATION/xr:Actual_delivery_date">
|
||||
<xsl:apply-templates mode="list-entry" select="xr:DELIVERY_INFORMATION/xr:Actual_delivery_date">
|
||||
<xsl:with-param name="value" select="format-date(xr:DELIVERY_INFORMATION/xr:Actual_delivery_date, xrf:_('date-format'))"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:apply-templates mode="list-entry" select="xr:DELIVERY_INFORMATION/xr:Deliver_to_party_name"/>
|
||||
|
||||
@@ -398,7 +398,7 @@
|
||||
<nummer>BT-64</nummer>
|
||||
</xsl:when>
|
||||
<xsl:when test="$identifier = 'xr:Tax_representative_address_line_2'">
|
||||
<label>Postfach</label>
|
||||
<label>Adresszusatz</label>
|
||||
<nummer>BT-65</nummer>
|
||||
</xsl:when>
|
||||
<xsl:when test="$identifier = 'xr:Tax_representative_address_line_3'">
|
||||
@@ -486,7 +486,7 @@
|
||||
<nummer>BT-75</nummer>
|
||||
</xsl:when>
|
||||
<xsl:when test="$identifier = 'xr:Deliver_to_address_line_2'">
|
||||
<label>Postfach</label>
|
||||
<label>Adresszusatz</label>
|
||||
<nummer>BT-76</nummer>
|
||||
</xsl:when>
|
||||
<xsl:when test="$identifier = 'xr:Deliver_to_address_line_3'">
|
||||
|
||||
@@ -1193,7 +1193,7 @@ function downloadData (element_id) {
|
||||
<div id="BT-50" title="BT-50" class="boxdaten wert"><xsl:value-of select="xr:BUYER_POSTAL_ADDRESS/xr:Buyer_address_line_1"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach (BT-51):</div>
|
||||
<div class="boxdaten legende">Adresszusatz (BT-51):</div>
|
||||
<div id="BT-51" title="BT-51" class="boxdaten wert"><xsl:value-of select="xr:BUYER_POSTAL_ADDRESS/xr:Buyer_address_line_2"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
@@ -1258,7 +1258,7 @@ function downloadData (element_id) {
|
||||
<div id="BT-35" title="BT-35" class="boxdaten wert"><xsl:value-of select="xr:SELLER_POSTAL_ADDRESS/xr:Seller_address_line_1"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach (BT-36):</div>
|
||||
<div class="boxdaten legende">Adresszusatz (BT-36):</div>
|
||||
<div id="BT-36" title="BT-36" class="boxdaten wert"><xsl:value-of select="xr:SELLER_POSTAL_ADDRESS/xr:Seller_address_line_2"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
@@ -1998,7 +1998,7 @@ function downloadData (element_id) {
|
||||
<div id="BT-64" title="BT-64" class="boxdaten wert"><xsl:value-of select="xr:SELLER_TAX_REPRESENTATIVE_POSTAL_ADDRESS/xr:Tax_representative_address_line_1"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach (BT-65):</div>
|
||||
<div class="boxdaten legende">Adresszusatz (BT-65):</div>
|
||||
<div id="BT-65" title="BT-65" class="boxdaten wert"><xsl:value-of select="xr:SELLER_TAX_REPRESENTATIVE_POSTAL_ADDRESS/xr:Tax_representative_address_line_2"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
@@ -2111,7 +2111,7 @@ function downloadData (element_id) {
|
||||
<div id="BT-75" title="BT-75" class="boxdaten wert"><xsl:value-of select="xr:DELIVER_TO_ADDRESS/xr:Deliver_to_address_line_1"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach (BT-76):</div>
|
||||
<div class="boxdaten legende">Adresszusatz (BT-76):</div>
|
||||
<div id="BT-76" title="BT-76" class="boxdaten wert"><xsl:value-of select="xr:DELIVER_TO_ADDRESS/xr:Deliver_to_address_line_2"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<xsl:variable name="i18n.recipientInfo" select="'Informationen zum Käufer'"/>
|
||||
<xsl:variable name="i18n.dateOf" select="' vom '"/>
|
||||
<xsl:variable name="i18n.bt50" select="'Straße / Haus-Nr.'"/>
|
||||
<xsl:variable name="i18n.bt51" select="'Postfach'"/>
|
||||
<xsl:variable name="i18n.bt51" select="'Adresszusatz'"/>
|
||||
<xsl:variable name="i18n.bt163" select="'Adresszusatz'"/>
|
||||
<xsl:variable name="i18n.bt53" select="'PLZ'"/>
|
||||
<xsl:variable name="i18n.bt52" select="'Ort'"/>
|
||||
@@ -26,7 +26,7 @@
|
||||
<xsl:variable name="i18n.bt58" select="'E-Mail-Adresse'"/>
|
||||
<xsl:variable name="i18n.bt27" select="'Firmenname'"/>
|
||||
<xsl:variable name="i18n.bt35" select="'Straße / Haus-Nr.'"/>
|
||||
<xsl:variable name="i18n.bt36" select="'Postfach'"/>
|
||||
<xsl:variable name="i18n.bt36" select="'Adresszusatz'"/>
|
||||
<xsl:variable name="i18n.bt162" select="'Adresszusatz'"/>
|
||||
<xsl:variable name="i18n.bt38" select="'PLZ'"/>
|
||||
<xsl:variable name="i18n.bt37" select="'Ort'"/>
|
||||
@@ -166,7 +166,7 @@
|
||||
<xsl:variable name="i18n.bg11" select="'Steuervertreter des Verkäufers'"/>
|
||||
<xsl:variable name="i18n.bt62" select="'Name'"/>
|
||||
<xsl:variable name="i18n.bt64" select="'Straße / Hausnummer'"/>
|
||||
<xsl:variable name="i18n.bt65" select="'Postfach'"/>
|
||||
<xsl:variable name="i18n.bt65" select="'Adresszusatz'"/>
|
||||
<xsl:variable name="i18n.bt164" select="'Adresszusatz'"/>
|
||||
<xsl:variable name="i18n.bt67" select="'PLZ'"/>
|
||||
<xsl:variable name="i18n.bt66" select="'Ort'"/>
|
||||
@@ -189,7 +189,7 @@
|
||||
<xsl:variable name="i18n.bt72" select="'Lieferdatum'"/>
|
||||
<xsl:variable name="i18n.bt70" select="'Name des Empfängers'"/>
|
||||
<xsl:variable name="i18n.bt75" select="'Straße / Haus-Nr.'"/>
|
||||
<xsl:variable name="i18n.bt76" select="'Postfach'"/>
|
||||
<xsl:variable name="i18n.bt76" select="'Adresszusatz'"/>
|
||||
<xsl:variable name="i18n.bt165" select="'Adresszusatz'"/>
|
||||
<xsl:variable name="i18n.bt78" select="'PLZ'"/>
|
||||
<xsl:variable name="i18n.bt77" select="'Ort'"/>
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
<div title="BT-50" class="boxdaten wert"><xsl:value-of select="xr:BUYER_POSTAL_ADDRESS/xr:Buyer_address_line_1"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach:</div>
|
||||
<div class="boxdaten legende">Adresszusatz:</div>
|
||||
<div title="BT-51" class="boxdaten wert"><xsl:value-of select="xr:BUYER_POSTAL_ADDRESS/xr:Buyer_address_line_2"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
@@ -179,7 +179,7 @@
|
||||
<div title="BT-35" class="boxdaten wert"><xsl:value-of select="xr:SELLER_POSTAL_ADDRESS/xr:Seller_address_line_1"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach:</div>
|
||||
<div class="boxdaten legende">Adresszusatz:</div>
|
||||
<div title="BT-36" class="boxdaten wert"><xsl:value-of select="xr:SELLER_POSTAL_ADDRESS/xr:Seller_address_line_2"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
@@ -892,7 +892,7 @@
|
||||
<div title="BT-64" class="boxdaten wert"><xsl:value-of select="xr:SELLER_TAX_REPRESENTATIVE_POSTAL_ADDRESS/xr:Tax_representative_address_line_1"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach:</div>
|
||||
<div class="boxdaten legende">Adresszusatz:</div>
|
||||
<div title="BT-65" class="boxdaten wert"><xsl:value-of select="xr:SELLER_TAX_REPRESENTATIVE_POSTAL_ADDRESS/xr:Tax_representative_address_line_2"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
@@ -998,7 +998,7 @@
|
||||
<div title="BT-75" class="boxdaten wert"><xsl:value-of select="xr:DELIVER_TO_ADDRESS/xr:Deliver_to_address_line_1"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach:</div>
|
||||
<div class="boxdaten legende">Adresszusatz:</div>
|
||||
<div title="BT-76" class="boxdaten wert"><xsl:value-of select="xr:DELIVER_TO_ADDRESS/xr:Deliver_to_address_line_2"/></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
|
||||
@@ -3,20 +3,27 @@ package org.mustangproject.ZUGFeRD;
|
||||
import static java.math.BigDecimal.TEN;
|
||||
import static java.math.BigDecimal.valueOf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mustangproject.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/***
|
||||
* tests the linecalculator and transactioncalculator classes
|
||||
*
|
||||
*/
|
||||
public class CalculationTest {
|
||||
public class CalculationTest extends ResourceCase {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CalculationTest.class);
|
||||
|
||||
@Test
|
||||
@@ -72,6 +79,36 @@ public class CalculationTest {
|
||||
assertEquals(valueOf(314.1184).stripTrailingZeros(), calculator.getItemTotalVATAmount().stripTrailingZeros());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLineCalculatorForeignCurrencyExample() {
|
||||
|
||||
/*
|
||||
File inputCII = getResourceAsFile("Extended_fremdwaehrung.xml");
|
||||
inputCII=new File("C:\\Users\\jstaerk\\workspace\\XMLExamples\\zfdiverses\\20250407\\fremdwaehrung.xml");
|
||||
ZUGFeRDInvoiceImporter zii=new ZUGFeRDInvoiceImporter();
|
||||
Invoice invoice=null;
|
||||
zii.doIgnoreCalculationErrors();
|
||||
boolean hasExceptions=false;
|
||||
try {
|
||||
zii.setInputStream(new FileInputStream(inputCII));
|
||||
|
||||
invoice=zii.extractInvoice();
|
||||
} catch (XPathExpressionException | ParseException e) {
|
||||
// handle Exceptions
|
||||
hasExceptions=true;
|
||||
} catch (FileNotFoundException e) {
|
||||
hasExceptions=true;
|
||||
}
|
||||
assertFalse(hasExceptions);
|
||||
// Reading ZUGFeRD
|
||||
|
||||
final TransactionCalculator calculator = new TransactionCalculator(invoice);
|
||||
|
||||
assertEquals(valueOf(521.91).stripTrailingZeros(), calculator.getGrandTotal().stripTrailingZeros());
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testTotalCalculatorGrandTotalRounding() {
|
||||
|
||||
@@ -21,26 +21,36 @@
|
||||
*/
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.mustangproject.*;
|
||||
import org.mustangproject.ZUGFeRD.model.EventTimeCodeTypeConstants;
|
||||
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.experimental.theories.FromDataPoints;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.mustangproject.Allowance;
|
||||
import org.mustangproject.BankDetails;
|
||||
import org.mustangproject.CalculatedInvoice;
|
||||
import org.mustangproject.CashDiscount;
|
||||
import org.mustangproject.Charge;
|
||||
import org.mustangproject.Contact;
|
||||
import org.mustangproject.Invoice;
|
||||
import org.mustangproject.Item;
|
||||
import org.mustangproject.Product;
|
||||
import org.mustangproject.SchemedID;
|
||||
import org.mustangproject.TradeParty;
|
||||
import org.mustangproject.ZUGFeRD.model.EventTimeCodeTypeConstants;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class DeSerializationTest extends ResourceCase {
|
||||
@@ -223,7 +233,7 @@ public class DeSerializationTest extends ResourceCase {
|
||||
"\n" +
|
||||
" \"number\": \"471102\",\n" +
|
||||
" \"currency\": \"EUR\",\n" +
|
||||
" \"issueDate\": \"2018-03-04T00:00:00.000+01:00\",\n" +
|
||||
" \"issueDate\": \"2018-03-04T00:00:00.000\",\n" +
|
||||
" \"dueDate\": \"2018-03-04T00:00:00.000+01:00\",\n" +
|
||||
" \"deliveryDate\": \"2018-03-04T00:00:00.000+01:00\",\n" +
|
||||
" \"sender\": {\n" +
|
||||
@@ -315,6 +325,83 @@ public class DeSerializationTest extends ResourceCase {
|
||||
assertNull(exText);
|
||||
|
||||
|
||||
}
|
||||
public void testNulledAttachments() {
|
||||
|
||||
String json="{\n" +
|
||||
" \"number\": \"471102\",\n" +
|
||||
" \"currency\": \"EUR\",\n" +
|
||||
" \"issueDate\": \"2018-03-04T00:00:00.000+01:00\",\n" +
|
||||
" \"dueDate\": \"2018-03-04T00:00:00.000+01:00\",\n" +
|
||||
" \"deliveryDate\": \"2018-03-04T00:00:00.000+01:00\",\n" +
|
||||
" \"sender\": {\n" +
|
||||
" \"name\": \"Lieferant GmbH\",\n" +
|
||||
" \"zip\": \"80333\",\n" +
|
||||
" \"street\": \"Lieferantenstraße 20\",\n" +
|
||||
" \"location\": \"München\",\n" +
|
||||
" \"country\": \"DE\",\n" +
|
||||
" \"taxID\": \"201/113/40209\",\n" +
|
||||
" \"vatID\": \"DE123456789\",\n" +
|
||||
" \"globalID\": \"4000001123452\",\n" +
|
||||
" \"globalIDScheme\": \"0088\"\n" +
|
||||
" },\n" +
|
||||
" \"recipient\": {\n" +
|
||||
" \"name\": \"Kunden AG Mitte\",\n" +
|
||||
" \"zip\": \"69876\",\n" +
|
||||
" \"street\": \"Kundenstraße 15\",\n" +
|
||||
" \"location\": \"Frankfurt\",\n" +
|
||||
" \"country\": \"DE\"\n" +
|
||||
" },\n" +
|
||||
"\"additionalReferencedDocuments\":null,"+
|
||||
" \"zfitems\": [\n" +
|
||||
" {\n" +
|
||||
" \"price\": 9.9,\n" +
|
||||
" \"quantity\": 20,\n" +
|
||||
" \"product\": {\n" +
|
||||
" \"unit\": \"H87\",\n" +
|
||||
" \"name\": \"Trennblätter A4\",\n" +
|
||||
" \"description\": \"\",\n" +
|
||||
" \"vatpercent\": 19,\n" +
|
||||
" \"taxCategoryCode\": \"S\"\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"price\": 5.5,\n" +
|
||||
" \"quantity\": 50,\n" +
|
||||
" \"product\": {\n" +
|
||||
" \"unit\": \"H87\",\n" +
|
||||
" \"name\": \"Joghurt Banane\",\n" +
|
||||
" \"description\": \"\",\n" +
|
||||
" \"vatpercent\": 7,\n" +
|
||||
" \"taxCategoryCode\": \"S\"\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
"}\n";
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
boolean exceptions=false;
|
||||
try {
|
||||
Invoice newInvoiceFromJSON = mapper.readValue(json, Invoice.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
exceptions=true;
|
||||
}
|
||||
assertFalse(exceptions);
|
||||
}
|
||||
|
||||
public void testItemAllowances() {
|
||||
|
||||
String json="{\"number\":\"123\",\"currency\":\"EUR\",\"issueDate\":1738935176399,\"dueDate\":1738935176399,\"sender\":{\"name\":\"Test company\",\"zip\":\"55232\",\"street\":\"teststr\",\"location\":\"teststadt\",\"country\":\"DE\",\"taxID\":\"4711\",\"vatID\":\"DE0815\",\"vatid\":\"DE0815\"},\"recipient\":{\"name\":\"Franz Müller\",\"zip\":\"55232\",\"street\":\"teststr.12\",\"location\":\"Entenhausen\",\"country\":\"DE\",\"contact\":{\"name\":\"contact testname\",\"phone\":\"123456\",\"email\":\"contact.testemail@example.org\",\"fax\":\"0911623562\"}},\"zfitems\":[{\"price\":3.00,\"quantity\":1,\"basisQuantity\":1,\"product\":{\"unit\":\"C62\",\"name\":\"Testprodukt\",\"taxCategoryCode\":\"S\",\"vatpercent\":19,\"reverseCharge\":false,\"intraCommunitySupply\":false},\"itemAllowances\":[{\"totalAmount\":0.1,\"categoryCode\":\"S\"}],\"value\":3.00},{\"price\":3.00,\"quantity\":1,\"basisQuantity\":1,\"product\":{\"unit\":\"C62\",\"name\":\"Testprodukt\",\"taxCategoryCode\":\"S\",\"vatpercent\":19,\"reverseCharge\":false,\"intraCommunitySupply\":false},\"itemAllowances\":[{\"percent\":50,\"taxPercent\":0,\"categoryCode\":\"S\"}],\"value\":3.00},{\"price\":3.00,\"quantity\":2,\"basisQuantity\":1,\"product\":{\"unit\":\"C62\",\"name\":\"Testprodukt\",\"taxCategoryCode\":\"S\",\"vatpercent\":19,\"reverseCharge\":false,\"intraCommunitySupply\":false},\"itemCharges\":[{\"totalAmount\":1,\"reason\":\"AnotherReason\",\"reasonCode\":\"ABK\",\"categoryCode\":\"S\"}],\"value\":3.00},{\"price\":3.00,\"quantity\":1,\"basisQuantity\":1,\"product\":{\"unit\":\"C62\",\"name\":\"Testprodukt\",\"taxCategoryCode\":\"S\",\"vatpercent\":19,\"reverseCharge\":false,\"intraCommunitySupply\":false},\"itemAllowances\":[{\"totalAmount\":1,\"categoryCode\":\"S\"}],\"itemCharges\":[{\"totalAmount\":1,\"categoryCode\":\"S\"}],\"value\":3.00}],\"ownStreet\":\"teststr\",\"ownCountry\":\"DE\",\"zfcharges\":[{\"totalAmount\":1,\"taxPercent\":19,\"reason\":\"AReason\",\"reasonCode\":\"ABK\",\"categoryCode\":\"S\"}],\"ownLocation\":\"teststadt\",\"ownTaxID\":\"4711\",\"ownZIP\":\"55232\",\"ownVATID\":\"DE0815\",\"valid\":true}";
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
Invoice newInvoiceFromJSON = mapper.readValue(json, Invoice.class);
|
||||
TransactionCalculator tc=new TransactionCalculator(newInvoiceFromJSON);
|
||||
assertEquals(new BigDecimal("19.52"),tc.getGrandTotal());
|
||||
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void testIssuerAssignedIDRoundtrip() {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.mustangproject.ZUGFeRD.ZUGFeRDVisualizer.Language;
|
||||
@@ -76,9 +77,10 @@ public class VisualizationTest extends ResourceCase {
|
||||
fail("TransformerException should not happen: " + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
fail("IOException should not happen: " + e.getMessage());
|
||||
} catch (ParserConfigurationException e) {
|
||||
fail("ParserConfigurationException should not happen: " + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
assertNotNull(result);
|
||||
/* remove file endings so that tests can also pass after checking
|
||||
out from git with arbitrary options (which may include CSRF changes)
|
||||
|
||||
@@ -52,12 +52,17 @@ public class XRTest extends TestCase {
|
||||
TradeParty recipient = new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE");
|
||||
recipient.setEmail("quack@ducktown.org");
|
||||
Invoice i = createInvoice(recipient);
|
||||
|
||||
String legalOrgID="aCustomSellerLegalOrgId";
|
||||
String sellerID="aSellerTradePartyID";
|
||||
i.getSender().setLegalOrganisation(new LegalOrganisation(legalOrgID));
|
||||
i.getSender().setID(sellerID);
|
||||
ZUGFeRD2PullProvider zf2p = new ZUGFeRD2PullProvider();
|
||||
zf2p.setProfile(Profiles.getByName("XRechnung"));
|
||||
zf2p.generateXML(i);
|
||||
String theXML = new String(zf2p.getXML(), StandardCharsets.UTF_8);
|
||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||
assertTrue(theXML.contains("<ram:ID>"+sellerID+"</ram:ID>"));// must be possible without scheme #
|
||||
assertTrue(theXML.contains("<ram:ID>"+legalOrgID+"</ram:ID>"));// must be possible without scheme #
|
||||
assertThat(theXML).valueByXPath("count(//*[local-name()='IncludedSupplyChainTradeLineItem'])")
|
||||
.asInt()
|
||||
.isEqualTo(1); //2 errors are OK because there is a known bug
|
||||
@@ -88,13 +93,13 @@ public class XRTest extends TestCase {
|
||||
|
||||
FileAttachment fe1 = new FileAttachment("one.pdf", "application/pdf", "Alternative", b);
|
||||
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date())
|
||||
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").setEmail("sender@example.com").addTaxID("DE4711").addVATID("DE0815").setContact(new Contact("Hans Test", "+49123456789", "test@example.org")).addBankDetails(new BankDetails("DE12500105170648489890", "COBADEFXXX")))
|
||||
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").setEmail("sender@example.com").addTaxID("DE4711").addVATID("DE0815").setContact(new Contact("Hans Test", "+49123456789", "test@example.org")).addBankDetails(new BankDetails("DE12500105170648489890", "COBADEFXXX").setAccountName("kontoInhaber")))
|
||||
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setEmail("recipient@sample.org"))
|
||||
.addCashDiscount(new CashDiscount(new BigDecimal(2), 7))
|
||||
.addCashDiscount(new CashDiscount(new BigDecimal(3), 14))
|
||||
.setReferenceNumber("991-01484-64")//leitweg-id
|
||||
// not using any VAT, this is also a test of zero-rated goods:
|
||||
.setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", BigDecimal.ZERO), amount, new BigDecimal(1.0)))
|
||||
.setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", BigDecimal.ZERO).setTaxExemptionReason("Kleinunternehmer"), amount, new BigDecimal(1.0)))
|
||||
.setPayee( new TradeParty().setName("VR Factoring GmbH").setID("DE813838785").setLegalOrganisation(new LegalOrganisation("391200LDDFJDMIPPMZ54", "0199")))
|
||||
.embedFileInXML(fe1);
|
||||
|
||||
@@ -173,6 +178,36 @@ public class XRTest extends TestCase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testTaxExemptionReasonIssue() {
|
||||
String orgname = "Test company";
|
||||
String number = "123";
|
||||
String amountStr = "1.00";
|
||||
BigDecimal amount = new BigDecimal(amountStr);
|
||||
byte[] b = {12, 13};
|
||||
|
||||
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date())
|
||||
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").setEmail("sender@example.com").addTaxID("DE4711").addVATID("DE0815").setContact(new Contact("Hans Test", "+49123456789", "test@example.org")).addBankDetails(new BankDetails("DE12500105170648489890", "COBADEFXXX").setAccountName("kontoInhaber")))
|
||||
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setEmail("recipient@sample.org"))
|
||||
.setReferenceNumber("991-01484-64")//leitweg-id
|
||||
// not using any VAT, this is also a test of zero-rated goods:
|
||||
.setNumber(number)
|
||||
.addItem(new Item(new Product("Testprodukt", "", "C62", BigDecimal.ZERO).setTaxCategoryCode("E").setTaxExemptionReason("Kleinunternehmer"), amount, new BigDecimal(1.0)))
|
||||
.addItem(new Item(new Product("Testprodukt2", "", "C62", BigDecimal.ZERO).setTaxCategoryCode("S"), amount, new BigDecimal(1.0)))
|
||||
.setPayee( new TradeParty().setName("VR Factoring GmbH").setID("DE813838785").setLegalOrganisation(new LegalOrganisation("391200LDDFJDMIPPMZ54", "0199")));
|
||||
|
||||
|
||||
|
||||
ZUGFeRD2PullProvider zf2p = new ZUGFeRD2PullProvider();
|
||||
|
||||
zf2p.setProfile(Profiles.getByName("XRechnung"));
|
||||
zf2p.generateXML(i);
|
||||
String theXML = new String(zf2p.getXML(), StandardCharsets.UTF_8);
|
||||
assertThat(theXML).valueByXPath("count(//*[local-name()='ExemptionReason'])")
|
||||
.asInt()
|
||||
.isEqualTo(1);
|
||||
}
|
||||
|
||||
|
||||
private org.mustangproject.Invoice createInvoice(TradeParty recipient) {
|
||||
String orgname = "Test company";
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.mustangproject.*;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.runners.MethodSorters;
|
||||
@@ -254,7 +255,7 @@ public class ZF2PushTest extends TestCase {
|
||||
// ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
||||
// .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50)))));
|
||||
|
||||
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date())
|
||||
Invoice i=new Invoice().setDueDate(new Date()).setIssueDate(new Date())
|
||||
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID("4711").addVATID("DE0815"))
|
||||
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")
|
||||
.setContact(new Contact("contact testname", "123456", "contact.testemail@example.org").setFax("0911623562")))
|
||||
@@ -263,8 +264,9 @@ public class ZF2PushTest extends TestCase {
|
||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal("0.1"))))
|
||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50))))
|
||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(2.0)).addCharge(new Charge(new BigDecimal(1)).setReasonCode("ABK").setReason("AnotherReason")))
|
||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addCharge(new Charge(new BigDecimal(1))).addAllowance(new Allowance(new BigDecimal("1"))))
|
||||
);
|
||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addCharge(new Charge(new BigDecimal(1))).addAllowance(new Allowance(new BigDecimal("1"))));
|
||||
ze.setTransaction(i);
|
||||
|
||||
|
||||
String theXML = new String(ze.getProvider().getXML());
|
||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||
@@ -531,7 +533,7 @@ public class ZF2PushTest extends TestCase {
|
||||
try {
|
||||
SchemedID gtin = new SchemedID("0160", "2001015001325");
|
||||
SchemedID gln = new SchemedID("0088", "4304171000002");
|
||||
ze.setTransaction(new Invoice().setCurrency("CHF").addNote("document level 1/2").addNote("document level 2/2").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date())
|
||||
ze.setTransaction(new Invoice().setCurrency("CHF").addNote("document level 1/2").addNote("document level 2/2").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setPaymentReference("Verwendungszweck").setDocumentName("Rechnung")
|
||||
.setSellerOrderReferencedDocumentID("9384").setBuyerOrderReferencedDocumentID("28934")
|
||||
.setDetailedDeliveryPeriod(new SimpleDateFormat("yyyyMMdd").parse(occurrenceFrom), new SimpleDateFormat("yyyyMMdd").parse(occurrenceTo))
|
||||
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID(taxID).setEmail("sender@test.org").setID(orgID).addVATID("DE0815"))
|
||||
@@ -583,6 +585,7 @@ public class ZF2PushTest extends TestCase {
|
||||
assertTrue(zi.getUTF8().contains("++49555123456"));
|
||||
assertTrue(zi.getUTF8().contains("Cash Discount")); // default description for cash discounts
|
||||
assertThat(zi.getUTF8()).valueByXPath("//*[local-name()='ApplicableTradeTax']/*[local-name()='DueDateTypeCode']").asString().isEqualTo(EventTimeCodeTypeConstants.PAYMENT_DATE);
|
||||
assertTrue(zi.getUTF8().contains("<ram:Name>Rechnung</ram:Name>"));
|
||||
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(TARGET_PUSHEDGE);
|
||||
try {
|
||||
@@ -592,8 +595,13 @@ public class ZF2PushTest extends TestCase {
|
||||
assertEquals(1, i.getInvoiceReferencedDocuments().size());
|
||||
assertEquals("abcd1234", i.getInvoiceReferencedDocuments().get(0).getIssuerAssignedID());
|
||||
assertEquals("4304171000002", i.getRecipient().getGlobalID());
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd");
|
||||
assertEquals(occurrenceFrom, sdf.format(i.getDetailedDeliveryPeriodFrom()));
|
||||
assertEquals(occurrenceTo, sdf.format(i.getDetailedDeliveryPeriodTo()));
|
||||
assertEquals("2001015001325", i.getZFItems()[0].getProduct().getGlobalID());
|
||||
assertEquals(orgID, i.getSender().getID());
|
||||
assertEquals("Verwendungszweck", i.getPaymentReference());
|
||||
assertEquals("Rechnung", i.getDocumentName());
|
||||
|
||||
} catch (XPathExpressionException e) {
|
||||
fail("XPathExpressionException should not be raised");
|
||||
|
||||
@@ -40,6 +40,7 @@ import java.nio.file.Paths;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -232,6 +233,24 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
|
||||
}
|
||||
|
||||
public void testSpecifiedLogisticsChargeImport() {
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
|
||||
File expectedResult = getResourceAsFile("cii/extended_warenrechnung.xml");
|
||||
|
||||
|
||||
boolean hasExceptions = false;
|
||||
CalculatedInvoice invoice = new CalculatedInvoice();
|
||||
try {
|
||||
zii.setInputStream(new FileInputStream(expectedResult));
|
||||
zii.extractInto(invoice);
|
||||
} catch (XPathExpressionException | ParseException | FileNotFoundException e) {
|
||||
hasExceptions = true;
|
||||
}
|
||||
assertFalse(hasExceptions);
|
||||
TransactionCalculator tc = new TransactionCalculator(invoice);
|
||||
assertEquals(new BigDecimal("518.99"), tc.getGrandTotal());
|
||||
|
||||
}
|
||||
public void testItemAllowancesChargesImport() {
|
||||
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2PushItemChargesAllowances.pdf");
|
||||
@@ -245,7 +264,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
}
|
||||
assertFalse(hasExceptions);
|
||||
TransactionCalculator tc = new TransactionCalculator(invoice);
|
||||
assertEquals(new BigDecimal("18.33"), tc.getGrandTotal());
|
||||
assertEquals(new BigDecimal("19.52"), tc.getGrandTotal());
|
||||
}
|
||||
|
||||
public void testBasisQuantityImport() {
|
||||
@@ -264,6 +283,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
assertEquals(new BigDecimal("337.60"), tc.getGrandTotal());
|
||||
}
|
||||
|
||||
|
||||
public void testAllowancesChargesImport() {
|
||||
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2PushChargesAllowances.pdf");
|
||||
@@ -305,7 +325,6 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
assertFalse(hasExceptions);
|
||||
|
||||
|
||||
|
||||
TransactionCalculator tc = new TransactionCalculator(invoice);
|
||||
assertEquals(new BigDecimal("1.00"), tc.getGrandTotal());
|
||||
|
||||
@@ -314,11 +333,15 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
LineCalculator lc=new LineCalculator(invoice.getZFItems()[0]);
|
||||
assertTrue(new BigDecimal("1").compareTo(lc.getItemTotalNetAmount()) == 0);
|
||||
|
||||
assertEquals("Z", invoice.getZFItems()[0].getProduct().getTaxCategoryCode());
|
||||
assertEquals("Kleinunternehmer", invoice.getZFItems()[0].getProduct().getTaxExemptionReason());
|
||||
|
||||
assertTrue(invoice.getTradeSettlement().length == 1);
|
||||
assertTrue(invoice.getTradeSettlement()[0] instanceof IZUGFeRDTradeSettlementPayment);
|
||||
IZUGFeRDTradeSettlementPayment paym = (IZUGFeRDTradeSettlementPayment) invoice.getTradeSettlement()[0];
|
||||
assertEquals("DE12500105170648489890", paym.getOwnIBAN());
|
||||
assertEquals("COBADEFXXX", paym.getOwnBIC());
|
||||
assertEquals("kontoInhaber",paym.getAccountName());
|
||||
|
||||
|
||||
assertTrue(invoice.getPayee() != null);
|
||||
@@ -333,6 +356,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
|
||||
byte[] fileA = null;
|
||||
byte[] fileB = null;
|
||||
boolean facturXFound=false;
|
||||
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2PushAttachments.pdf");
|
||||
for (FileAttachment fa : zii.getFileAttachmentsPDF()) {
|
||||
@@ -340,24 +364,26 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
fileA = fa.getData();
|
||||
} else if (fa.getFilename().equals("two.pdf")) {
|
||||
fileB = fa.getData();
|
||||
} else if (fa.getFilename().equals("factur-x.xml")) {
|
||||
facturXFound=true;
|
||||
}
|
||||
}
|
||||
byte[] b = {12, 13}; // the sample data that was used to write the files
|
||||
|
||||
assertTrue(facturXFound);
|
||||
assertTrue(Arrays.equals(fileA, b));
|
||||
assertEquals(fileA.length, 2);
|
||||
assertTrue(Arrays.equals(fileB, b));
|
||||
assertEquals(fileB.length, 2);
|
||||
}
|
||||
|
||||
|
||||
public void testImportDebit() {
|
||||
File CIIinputFile = getResourceAsFile("cii/minimalDebit.xml");
|
||||
try {
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(CIIinputFile));
|
||||
Invoice i = zii.extractInvoice();
|
||||
|
||||
assertEquals("DE21860000000086001055", i.getSender().getBankDetails().get(0).getIBAN());
|
||||
assertEquals("DE21860000000086001055", i.getRecipient().getBankDetails().get(0).getIBAN());
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
String jsonArray = mapper.writeValueAsString(i);
|
||||
@@ -416,6 +442,34 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void testImportUBLPeriods() { // Confirm some basics also work with UBL credit notes
|
||||
File ublinputFile = getResourceAsFile("ubl/periods.ubl.xml");
|
||||
try {
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
|
||||
zii.doIgnoreCalculationErrors();
|
||||
zii.setInputStream(new FileInputStream(ublinputFile));
|
||||
|
||||
|
||||
CalculatedInvoice i = new CalculatedInvoice();
|
||||
zii.extractInto(i);
|
||||
assertEquals("123", i.getNumber());
|
||||
assertEquals("1.48", i.getGrandTotal().toString());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
assertEquals("2020-10-01", sdf.format(i.getDetailedDeliveryPeriodFrom()));
|
||||
assertEquals("2020-10-05", sdf.format(i.getDetailedDeliveryPeriodTo()));
|
||||
|
||||
} catch (IOException e) {
|
||||
fail("IOException not expected");
|
||||
} catch (XPathExpressionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -492,6 +546,17 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testItemsBillingSpecifiedPeriod() throws FileNotFoundException, XPathExpressionException, ParseException {
|
||||
File inputFile = getResourceAsFile("factur-x_invoicingPeriod.xml");
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(inputFile));
|
||||
|
||||
CalculatedInvoice invoice = new CalculatedInvoice();
|
||||
zii.extractInto(invoice);
|
||||
assertEquals(3, invoice.getZFItems().length);
|
||||
assertEquals(new Date(2022-1900, 8-1, 29), invoice.getZFItems()[0].getDetailedDeliveryPeriodFrom());
|
||||
assertEquals(new Date(2022-1900, 8-1, 31), invoice.getZFItems()[0].getDetailedDeliveryPeriodTo());
|
||||
}
|
||||
|
||||
public void testImportPositionIncludedNotes() throws FileNotFoundException, XPathExpressionException, ParseException {
|
||||
File inputFile = getResourceAsFile("ZTESTZUGFERD_1_INVDSS_012015738820PDF-1.pdf");
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(inputFile));
|
||||
@@ -520,4 +585,16 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
|
||||
assertEquals("0", zii.importedInvoice.getDuePayable().toPlainString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws FileNotFoundException, XPathExpressionException, ParseException {
|
||||
File inputFile = getResourceAsFile("ORDER-X_EX01_ORDER_FULL_DATA-COMFORTorder-x.xml");
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
|
||||
zii.doIgnoreCalculationErrors();
|
||||
zii.setInputStream(new FileInputStream(inputFile));
|
||||
|
||||
Invoice invoice = zii.extractInvoice();
|
||||
assertEquals(3, invoice.getZFItems().length);
|
||||
assertEquals("BUYER_ACCOUNTING_REF", invoice.getZFItems()[0].getAccountingReference());
|
||||
}
|
||||
}
|
||||
|
||||
345
library/src/test/resources/Extended_fremdwaehrung.xml
Normal file
345
library/src/test/resources/Extended_fremdwaehrung.xml
Normal file
@@ -0,0 +1,345 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- English disclaimer below.-->
|
||||
<!--Nutzungsrechte
|
||||
ZUGFeRD Datenformat Version 2.3.0, 18.09.2024
|
||||
Beispiel Version 18.09.2024
|
||||
|
||||
Zweck des Forums elektronisch Rechnung Deutschland, welches am 31. März 2010 unter der Arbeitsgemeinschaft für
|
||||
wirtschaftliche Verwaltung e. V. gegründet wurde, ist u. a. die Schaffung und Spezifizierung eines offenen Datenformats
|
||||
für strukturierten elektronischen Datenaustausch auf der Grundlage offener und nicht diskriminierender, standardisierter
|
||||
Technologien („ZUGFeRD Datenformat“).
|
||||
|
||||
Das ZUGFeRD Datenformat wird nach Maßgabe des FeRD sowohl Unternehmen als auch der öffentlichen Verwaltung
|
||||
frei zugänglich gemacht. Hierfür bietet FeRD allen Unternehmen und Organisationen der öffentlichen Verwaltung eine
|
||||
Lizenz für die Nutzung des urheberrechtlich geschützten ZUGFeRD-Datenformats zu fairen, sachgerechten und nicht
|
||||
diskriminierenden Bedingungen an.
|
||||
|
||||
Die Spezifikation des FeRD zur Implementierung des ZUGFeRD Datenformats ist in ihrer jeweils geltenden Fassung
|
||||
abrufbar unter www.ferd-net.de.
|
||||
|
||||
Im Einzelnen schließt die Nutzungsgewährung ein:
|
||||
=====================================
|
||||
|
||||
FeRD räumt eine Lizenz für die Nutzung des urheberrechtlich geschützten ZUGFeRD Datenformats in der jeweils
|
||||
geltenden und akzeptierten Fassung (www.ferd-net.de) ein.
|
||||
Die Lizenz beinhaltet ein unwiderrufliches Nutzungsrecht einschließlich des Rechts der Weiterentwicklung,
|
||||
Weiterbearbeitung und Verbindung mit anderen Produkten.
|
||||
Die Lizenz gilt insbesondere für die Entwicklung, die Gestaltung, die Herstellung, den Verkauf, die Nutzung oder
|
||||
anderweitige Verwendung des ZUGFeRD Datenformats für Hardware- und/oder Softwareprodukte sowie sonstige
|
||||
Anwendungen und Dienste.
|
||||
Diese Lizenz schließt nicht die wesentlichen Patente der Mitglieder von FeRD ein. Als wesentliche Patente sind Patente
|
||||
und Patentanmeldungen weltweit zu verstehen, die einen oder mehrere Patentansprüche beinhalten, bei denen es sich um
|
||||
notwendige Ansprüche handelt. Notwendige Ansprüche sind lediglich jene Ansprüche der Wesentlichen Patente, die durch
|
||||
die Implementierung des ZUGFeRD Datenformats notwendigerweise verletzt würden.
|
||||
Der Lizenznehmer ist berechtigt, seinen jeweiligen Konzerngesellschaften ein unbefristetes, weltweites, nicht übertragbares,
|
||||
unwiderrufliches Nutzungsrecht einschließlich des Rechts der Weiterentwicklung, Weiterbearbeitung und Verbindung mit
|
||||
anderen Produkten einzuräumen.
|
||||
|
||||
Die Lizenz wird kostenfrei zur Verfügung gestellt.
|
||||
|
||||
Außer im Falle vorsätzlichen Verschuldens oder grober Fahrlässigkeit haftet FeRD weder für Nutzungsausfall, entgangenen
|
||||
Gewinn, Datenverlust, Kommunikationsverlust, Einnahmeausfall, Vertragseinbußen, Geschäftsausfall oder für Kosten,
|
||||
Schäden, Verluste oder Haftpflichten im Zusammenhang mit einer Unterbrechung der Geschäftstätigkeit, noch für konkrete,
|
||||
beiläufig entstandene, mittelbare Schäden, Straf- oder Folgeschäden und zwar auch dann nicht, wenn die Möglichkeit der
|
||||
Kosten, Verluste bzw. Schäden hätte normalerweise vorhergesehen werden können.-->
|
||||
|
||||
<!--Right of use
|
||||
ZUGFeRD Data format version 2.3.0, September 18th, 2024
|
||||
|
||||
The purpose of the Forum elektronische Rechnung Deutschland (FeRD), which was founded on March 31, 2010 under the
|
||||
umbrella of Arbeitsgemeinschaft für wirtschaftliche Verwaltung e. V., is, among other things, to create and specify an
|
||||
open data format for structured electronic data exchange on the basis of open and non discriminatory, standardised
|
||||
technologies ("ZUGFeRD data format").
|
||||
|
||||
The ZUGFeRD data format is used by both companies and public administration according to the FeRD
|
||||
made freely accessible. For this purpose FeRD offers all companies and organisations of the public administration a
|
||||
License to use the copyrighted ZUGFeRD data format in a fair, appropriate and non
|
||||
discriminatory conditions.
|
||||
|
||||
The specification of the FeRD for the implementation of the ZUGFeRD data format is, in its currently valid version
|
||||
available at www.ferd-net.de.
|
||||
|
||||
In detail, the grant of use includes
|
||||
=====================================
|
||||
|
||||
FeRD grants a license for the use of the copyrighted ZUGFeRD data format in the respective
|
||||
valid and accepted version (www.ferd-net.de).
|
||||
The license includes an irrevocable right of use including the right of further development,
|
||||
Further processing and connection with other products.
|
||||
The license applies in particular to the development, design, production, sale, use or
|
||||
other use of the ZUGFeRD data format for hardware and/or software products and other
|
||||
applications and services.
|
||||
This license does not include the essential patents of the members of FeRD. The essential patents are patents
|
||||
and patent applications worldwide which contain one or more claims that are
|
||||
necessary claims. Necessary claims are only those claims of the essential patents which are
|
||||
the implementation of the ZUGFeRD data format would necessarily be violated.
|
||||
The Licensee is entitled to provide its respective group companies with an unlimited, worldwide, non-transferable,
|
||||
irrevocable right of use including the right of further development, further processing and connection with
|
||||
other products.
|
||||
|
||||
The license is provided free of charge.
|
||||
|
||||
Except in the case of intentional fault or gross negligence, FeRD is not liable for loss of use, loss of
|
||||
Profit, loss of data, loss of communication, loss of revenue, loss of contracts, loss of business or for costs
|
||||
damages, losses or liabilities in connection with an interruption of business, nor for concrete,
|
||||
incidental, indirect, punitive or consequential damages, even if the possibility of
|
||||
costs, losses or damages could normally have been foreseen.-->
|
||||
|
||||
<rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
|
||||
<rsm:ExchangedDocumentContext>
|
||||
<ram:BusinessProcessSpecifiedDocumentContextParameter>
|
||||
<ram:ID>Beispielgeschäftsprozess</ram:ID>
|
||||
</ram:BusinessProcessSpecifiedDocumentContextParameter>
|
||||
<ram:GuidelineSpecifiedDocumentContextParameter>
|
||||
<ram:ID>urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended</ram:ID>
|
||||
</ram:GuidelineSpecifiedDocumentContextParameter>
|
||||
</rsm:ExchangedDocumentContext>
|
||||
<rsm:ExchangedDocument>
|
||||
<ram:ID>47110815</ram:ID>
|
||||
<ram:Name>RECHNUNG</ram:Name>
|
||||
<ram:TypeCode>380</ram:TypeCode>
|
||||
<ram:IssueDateTime>
|
||||
<udt:DateTimeString format="102">20241115</udt:DateTimeString>
|
||||
</ram:IssueDateTime>
|
||||
<ram:IncludedNote>
|
||||
<ram:Content>Mitglieder der Geschäftsleitung
|
||||
H. Meier Geschäftsführer
|
||||
T. Müller Prokurist
|
||||
HRB Braunschweig 12345</ram:Content>
|
||||
<ram:SubjectCode>REG</ram:SubjectCode>
|
||||
</ram:IncludedNote>
|
||||
<ram:IncludedNote>
|
||||
<ram:Content>Vom 17. Dezember 2024 bis 6. Januar 2025 haben wir Betriebsferien.</ram:Content>
|
||||
<ram:SubjectCode>AAI</ram:SubjectCode>
|
||||
</ram:IncludedNote>
|
||||
<ram:IncludedNote>
|
||||
<ram:Content>Aus konzern-internen Gründen wird der Steuerbetrag sowohl in der Rechungswährung (EUR) als auch in der Buchwährung (GBP) ausgegeben.</ram:Content>
|
||||
<ram:SubjectCode>TXD</ram:SubjectCode>
|
||||
</ram:IncludedNote>
|
||||
</rsm:ExchangedDocument>
|
||||
<rsm:SupplyChainTradeTransaction>
|
||||
<ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:AssociatedDocumentLineDocument>
|
||||
<ram:LineID>1</ram:LineID>
|
||||
<ram:IncludedNote>
|
||||
<ram:Content>Materialzertifikat X-234 gem ISO XYZ.
|
||||
Ware bleibt bis zur vollständigen Bezahlung unser Eigentum.
|
||||
</ram:Content>
|
||||
</ram:IncludedNote>
|
||||
</ram:AssociatedDocumentLineDocument>
|
||||
<ram:SpecifiedTradeProduct>
|
||||
<ram:SellerAssignedID>CO-123/V2A</ram:SellerAssignedID>
|
||||
<ram:BuyerAssignedID>Toolbox 0815</ram:BuyerAssignedID>
|
||||
<ram:Name>Stahlcoil</ram:Name>
|
||||
<ram:OriginTradeCountry>
|
||||
<ram:ID>DE</ram:ID>
|
||||
</ram:OriginTradeCountry>
|
||||
</ram:SpecifiedTradeProduct>
|
||||
<ram:SpecifiedLineTradeAgreement>
|
||||
<ram:BuyerOrderReferencedDocument>
|
||||
<ram:IssuerAssignedID>ORDER84359</ram:IssuerAssignedID>
|
||||
<ram:LineID>1</ram:LineID>
|
||||
</ram:BuyerOrderReferencedDocument>
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<ram:ChargeAmount>100.00</ram:ChargeAmount>
|
||||
<ram:BasisQuantity unitCode="H87">1</ram:BasisQuantity>
|
||||
</ram:GrossPriceProductTradePrice>
|
||||
<ram:NetPriceProductTradePrice>
|
||||
<ram:ChargeAmount>100</ram:ChargeAmount>
|
||||
<ram:BasisQuantity unitCode="H87">1</ram:BasisQuantity>
|
||||
</ram:NetPriceProductTradePrice>
|
||||
</ram:SpecifiedLineTradeAgreement>
|
||||
<ram:SpecifiedLineTradeDelivery>
|
||||
<ram:BilledQuantity unitCode="H87">10</ram:BilledQuantity>
|
||||
</ram:SpecifiedLineTradeDelivery>
|
||||
<ram:SpecifiedLineTradeSettlement>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:CalculationPercent>10</ram:CalculationPercent>
|
||||
<ram:BasisAmount>1000</ram:BasisAmount>
|
||||
<ram:ActualAmount>100</ram:ActualAmount>
|
||||
<ram:ReasonCode>64</ram:ReasonCode>
|
||||
<ram:Reason>Lagerware</ram:Reason>
|
||||
</ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:BasisAmount>1000</ram:BasisAmount>
|
||||
<ram:ActualAmount>50</ram:ActualAmount>
|
||||
<ram:ReasonCode>70</ram:ReasonCode>
|
||||
<ram:Reason>Direktbelieferung</ram:Reason>
|
||||
</ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
<ram:LineTotalAmount>850</ram:LineTotalAmount>
|
||||
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
</ram:SpecifiedLineTradeSettlement>
|
||||
</ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:ApplicableHeaderTradeAgreement>
|
||||
<ram:SellerTradeParty>
|
||||
<ram:ID>12345676</ram:ID>
|
||||
<ram:Name>Rohstoff AG Salzgitter</ram:Name>
|
||||
<ram:PostalTradeAddress>
|
||||
<ram:PostcodeCode>38226</ram:PostcodeCode>
|
||||
<ram:LineOne>Marktstr. 153</ram:LineOne>
|
||||
<ram:CityName>Salzgitter</ram:CityName>
|
||||
<ram:CountryID>DE</ram:CountryID>
|
||||
</ram:PostalTradeAddress>
|
||||
<ram:SpecifiedTaxRegistration>
|
||||
<ram:ID schemeID="VA">DE123456789</ram:ID>
|
||||
</ram:SpecifiedTaxRegistration>
|
||||
</ram:SellerTradeParty>
|
||||
<ram:BuyerTradeParty>
|
||||
<ram:ID>75969813</ram:ID>
|
||||
<ram:Name>Metallbau Leipzig GmbH & Co. KG</ram:Name>
|
||||
<ram:PostalTradeAddress>
|
||||
<ram:PostcodeCode>12345</ram:PostcodeCode>
|
||||
<ram:LineOne>Pappelallee 15</ram:LineOne>
|
||||
<ram:LineTwo>Hof 3</ram:LineTwo>
|
||||
<ram:CityName>Leipzig</ram:CityName>
|
||||
<ram:CountryID>DE</ram:CountryID>
|
||||
</ram:PostalTradeAddress>
|
||||
<ram:URIUniversalCommunication>
|
||||
<ram:URIID schemeID="0204">04 0 11 000 - 12345 12345 - 35</ram:URIID>
|
||||
</ram:URIUniversalCommunication>
|
||||
</ram:BuyerTradeParty>
|
||||
<ram:SellerTaxRepresentativeTradeParty>
|
||||
<ram:Name>Global Supplies Financial Services</ram:Name>
|
||||
<ram:PostalTradeAddress>
|
||||
<ram:PostcodeCode>12345</ram:PostcodeCode>
|
||||
<ram:LineOne>Friedrichstraße 165</ram:LineOne>
|
||||
<ram:CityName>Berlin</ram:CityName>
|
||||
<ram:CountryID>DE</ram:CountryID>
|
||||
</ram:PostalTradeAddress>
|
||||
<ram:SpecifiedTaxRegistration>
|
||||
<ram:ID schemeID="VA">DE1334567</ram:ID>
|
||||
</ram:SpecifiedTaxRegistration>
|
||||
</ram:SellerTaxRepresentativeTradeParty>
|
||||
</ram:ApplicableHeaderTradeAgreement>
|
||||
<ram:ApplicableHeaderTradeDelivery>
|
||||
<ram:ShipToTradeParty>
|
||||
<ram:ID>75969815</ram:ID>
|
||||
<ram:Name>Metallbau Leipzig GmbH & Co. KG</ram:Name>
|
||||
<ram:PostalTradeAddress>
|
||||
<ram:PostcodeCode>12347</ram:PostcodeCode>
|
||||
<ram:LineOne>Eichenpromenade 37</ram:LineOne>
|
||||
<ram:LineTwo>Tor 1</ram:LineTwo>
|
||||
<ram:CityName>Metallstadt</ram:CityName>
|
||||
<ram:CountryID>DE</ram:CountryID>
|
||||
</ram:PostalTradeAddress>
|
||||
<ram:URIUniversalCommunication>
|
||||
<ram:URIID schemeID="0060">999999999</ram:URIID>
|
||||
</ram:URIUniversalCommunication>
|
||||
</ram:ShipToTradeParty>
|
||||
<ram:ActualDeliverySupplyChainEvent>
|
||||
<ram:OccurrenceDateTime>
|
||||
<udt:DateTimeString format="102">20241111</udt:DateTimeString>
|
||||
</ram:OccurrenceDateTime>
|
||||
</ram:ActualDeliverySupplyChainEvent>
|
||||
</ram:ApplicableHeaderTradeDelivery>
|
||||
<ram:ApplicableHeaderTradeSettlement>
|
||||
<ram:TaxCurrencyCode>EUR</ram:TaxCurrencyCode>
|
||||
<ram:InvoiceCurrencyCode>GBP</ram:InvoiceCurrencyCode>
|
||||
<ram:PayeeTradeParty>
|
||||
<ram:GlobalID schemeID="0060">432156789</ram:GlobalID>
|
||||
<ram:Name>Global Supplies Financial Services</ram:Name>
|
||||
<ram:PostalTradeAddress>
|
||||
<ram:PostcodeCode>12345</ram:PostcodeCode>
|
||||
<ram:LineOne>Friedrichstraße 165</ram:LineOne>
|
||||
<ram:CityName>Berlin</ram:CityName>
|
||||
<ram:CountryID>DE</ram:CountryID>
|
||||
</ram:PostalTradeAddress>
|
||||
</ram:PayeeTradeParty>
|
||||
<ram:TaxApplicableTradeCurrencyExchange>
|
||||
<ram:SourceCurrencyCode>GBP</ram:SourceCurrencyCode>
|
||||
<ram:TargetCurrencyCode>EUR</ram:TargetCurrencyCode>
|
||||
<ram:ConversionRate>1.12244</ram:ConversionRate>
|
||||
<ram:ConversionRateDateTime>
|
||||
<udt:DateTimeString format="102">20181031</udt:DateTimeString>
|
||||
</ram:ConversionRateDateTime>
|
||||
</ram:TaxApplicableTradeCurrencyExchange>
|
||||
<ram:SpecifiedTradeSettlementPaymentMeans>
|
||||
<ram:TypeCode>58</ram:TypeCode>
|
||||
<ram:PayeePartyCreditorFinancialAccount>
|
||||
<ram:IBANID>DE77 3707 0060 0321 9870 00</ram:IBANID>
|
||||
<ram:AccountName>Global Supplies Financial Services</ram:AccountName>
|
||||
</ram:PayeePartyCreditorFinancialAccount>
|
||||
</ram:SpecifiedTradeSettlementPaymentMeans>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:CalculatedAmount>163.16</ram:CalculatedAmount>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:BasisAmount>858.75</ram:BasisAmount>
|
||||
<ram:LineTotalBasisAmount>850</ram:LineTotalBasisAmount>
|
||||
<ram:AllowanceChargeBasisAmount>8.75</ram:AllowanceChargeBasisAmount>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:BillingSpecifiedPeriod>
|
||||
<ram:StartDateTime>
|
||||
<udt:DateTimeString format="102">20181001</udt:DateTimeString>
|
||||
</ram:StartDateTime>
|
||||
<ram:EndDateTime>
|
||||
<udt:DateTimeString format="102">20181031</udt:DateTimeString>
|
||||
</ram:EndDateTime>
|
||||
</ram:BillingSpecifiedPeriod>
|
||||
<ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>true</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:ActualAmount>30</ram:ActualAmount>
|
||||
<ram:ReasonCode>ABK</ram:ReasonCode>
|
||||
<ram:Reason>Einwegverpackung</ram:Reason>
|
||||
<ram:CategoryTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19</ram:RateApplicablePercent>
|
||||
</ram:CategoryTradeTax>
|
||||
</ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:CalculationPercent>2.5</ram:CalculationPercent>
|
||||
<ram:BasisAmount>850</ram:BasisAmount>
|
||||
<ram:ActualAmount>21.25</ram:ActualAmount>
|
||||
<ram:ReasonCode>102</ram:ReasonCode>
|
||||
<ram:Reason>Stammkundenrabatt</ram:Reason>
|
||||
<ram:CategoryTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19</ram:RateApplicablePercent>
|
||||
</ram:CategoryTradeTax>
|
||||
</ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:SpecifiedTradePaymentTerms>
|
||||
<ram:Description>Zahlbar ohne Abschlag bis </ram:Description>
|
||||
<ram:DueDateDateTime>
|
||||
<udt:DateTimeString format="102">20241201</udt:DateTimeString>
|
||||
</ram:DueDateDateTime>
|
||||
</ram:SpecifiedTradePaymentTerms>
|
||||
<ram:SpecifiedTradePaymentTerms>
|
||||
<ram:Description>Zahlbar mit 2% Skonto bis</ram:Description>
|
||||
<ram:DueDateDateTime>
|
||||
<udt:DateTimeString format="102">20241120</udt:DateTimeString>
|
||||
</ram:DueDateDateTime>
|
||||
</ram:SpecifiedTradePaymentTerms>
|
||||
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||
<ram:LineTotalAmount>850</ram:LineTotalAmount>
|
||||
<ram:ChargeTotalAmount>30</ram:ChargeTotalAmount>
|
||||
<ram:AllowanceTotalAmount>21.25</ram:AllowanceTotalAmount>
|
||||
<ram:TaxBasisTotalAmount>858.75</ram:TaxBasisTotalAmount>
|
||||
<ram:TaxTotalAmount currencyID="GBP">163.16</ram:TaxTotalAmount>
|
||||
<ram:TaxTotalAmount currencyID="EUR">183.14</ram:TaxTotalAmount>
|
||||
<ram:GrandTotalAmount>1021.91</ram:GrandTotalAmount>
|
||||
<ram:TotalPrepaidAmount>500</ram:TotalPrepaidAmount>
|
||||
<ram:DuePayableAmount>521.91</ram:DuePayableAmount>
|
||||
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||
</ram:ApplicableHeaderTradeSettlement>
|
||||
</rsm:SupplyChainTradeTransaction>
|
||||
</rsm:CrossIndustryInvoice>
|
||||
567
library/src/test/resources/cii/extended_warenrechnung.xml
Normal file
567
library/src/test/resources/cii/extended_warenrechnung.xml
Normal file
@@ -0,0 +1,567 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!-- English disclaimer below.-->
|
||||
<!--Nutzungsrechte
|
||||
ZUGFeRD Datenformat Version 2.2.0, 14.02.2022
|
||||
Beispiel Version 14.02.2022
|
||||
|
||||
Zweck des Forums elektronisch Rechnung Deutschland, welches am 31. März 2010 unter der Arbeitsgemeinschaft für
|
||||
wirtschaftliche Verwaltung e. V. gegründet wurde, ist u. a. die Schaffung und Spezifizierung eines offenen Datenformats
|
||||
für strukturierten elektronischen Datenaustausch auf der Grundlage offener und nicht diskriminierender, standardisierter
|
||||
Technologien („ZUGFeRD Datenformat“).
|
||||
|
||||
Das ZUGFeRD Datenformat wird nach Maßgabe des FeRD sowohl Unternehmen als auch der öffentlichen Verwaltung
|
||||
frei zugänglich gemacht. Hierfür bietet FeRD allen Unternehmen und Organisationen der öffentlichen Verwaltung eine
|
||||
Lizenz für die Nutzung des urheberrechtlich geschützten ZUGFeRD-Datenformats zu fairen, sachgerechten und nicht
|
||||
diskriminierenden Bedingungen an.
|
||||
|
||||
Die Spezifikation des FeRD zur Implementierung des ZUGFeRD Datenformats ist in ihrer jeweils geltenden Fassung
|
||||
abrufbar unter www.ferd-net.de.
|
||||
|
||||
Im Einzelnen schließt die Nutzungsgewährung ein:
|
||||
=====================================
|
||||
|
||||
FeRD räumt eine Lizenz für die Nutzung des urheberrechtlich geschützten ZUGFeRD Datenformats in der jeweils
|
||||
geltenden und akzeptierten Fassung (www.ferd-net.de) ein.
|
||||
Die Lizenz beinhaltet ein unwiderrufliches Nutzungsrecht einschließlich des Rechts der Weiterentwicklung,
|
||||
Weiterbearbeitung und Verbindung mit anderen Produkten.
|
||||
Die Lizenz gilt insbesondere für die Entwicklung, die Gestaltung, die Herstellung, den Verkauf, die Nutzung oder
|
||||
anderweitige Verwendung des ZUGFeRD Datenformats für Hardware- und/oder Softwareprodukte sowie sonstige
|
||||
Anwendungen und Dienste.
|
||||
Diese Lizenz schließt nicht die wesentlichen Patente der Mitglieder von FeRD ein. Als wesentliche Patente sind Patente
|
||||
und Patentanmeldungen weltweit zu verstehen, die einen oder mehrere Patentansprüche beinhalten, bei denen es sich um
|
||||
notwendige Ansprüche handelt. Notwendige Ansprüche sind lediglich jene Ansprüche der Wesentlichen Patente, die durch
|
||||
die Implementierung des ZUGFeRD Datenformats notwendigerweise verletzt würden.
|
||||
Der Lizenznehmer ist berechtigt, seinen jeweiligen Konzerngesellschaften ein unbefristetes, weltweites, nicht übertragbares,
|
||||
unwiderrufliches Nutzungsrecht einschließlich des Rechts der Weiterentwicklung, Weiterbearbeitung und Verbindung mit
|
||||
anderen Produkten einzuräumen.
|
||||
|
||||
Die Lizenz wird kostenfrei zur Verfügung gestellt.
|
||||
|
||||
Außer im Falle vorsätzlichen Verschuldens oder grober Fahrlässigkeit haftet FeRD weder für Nutzungsausfall, entgangenen
|
||||
Gewinn, Datenverlust, Kommunikationsverlust, Einnahmeausfall, Vertragseinbußen, Geschäftsausfall oder für Kosten,
|
||||
Schäden, Verluste oder Haftpflichten im Zusammenhang mit einer Unterbrechung der Geschäftstätigkeit, noch für konkrete,
|
||||
beiläufig entstandene, mittelbare Schäden, Straf- oder Folgeschäden und zwar auch dann nicht, wenn die Möglichkeit der
|
||||
Kosten, Verluste bzw. Schäden hätte normalerweise vorhergesehen werden können.-->
|
||||
|
||||
<!--Right of use
|
||||
ZUGFeRD Data format version 2.2.0, February 14th, 2022
|
||||
|
||||
The purpose of the Forum elektronische Rechnung Deutschland (FeRD), which was founded on March 31, 2010 under the
|
||||
umbrella of Arbeitsgemeinschaft für wirtschaftliche Verwaltung e. V., is, among other things, to create and specify an
|
||||
open data format for structured electronic data exchange on the basis of open and non discriminatory, standardised
|
||||
technologies ("ZUGFeRD data format").
|
||||
|
||||
The ZUGFeRD data format is used by both companies and public administration according to the FeRD
|
||||
made freely accessible. For this purpose FeRD offers all companies and organisations of the public administration a
|
||||
License to use the copyrighted ZUGFeRD data format in a fair, appropriate and non
|
||||
discriminatory conditions.
|
||||
|
||||
The specification of the FeRD for the implementation of the ZUGFeRD data format is, in its currently valid version
|
||||
available at www.ferd-net.de.
|
||||
|
||||
In detail, the grant of use includes
|
||||
=====================================
|
||||
|
||||
FeRD grants a license for the use of the copyrighted ZUGFeRD data format in the respective
|
||||
valid and accepted version (www.ferd-net.de).
|
||||
The license includes an irrevocable right of use including the right of further development,
|
||||
Further processing and connection with other products.
|
||||
The license applies in particular to the development, design, production, sale, use or
|
||||
other use of the ZUGFeRD data format for hardware and/or software products and other
|
||||
applications and services.
|
||||
This license does not include the essential patents of the members of FeRD. The essential patents are patents
|
||||
and patent applications worldwide which contain one or more claims that are
|
||||
necessary claims. Necessary claims are only those claims of the essential patents which are
|
||||
the implementation of the ZUGFeRD data format would necessarily be violated.
|
||||
The Licensee is entitled to provide its respective group companies with an unlimited, worldwide, non-transferable,
|
||||
irrevocable right of use including the right of further development, further processing and connection with
|
||||
other products.
|
||||
|
||||
The license is provided free of charge.
|
||||
|
||||
Except in the case of intentional fault or gross negligence, FeRD is not liable for loss of use, loss of
|
||||
Profit, loss of data, loss of communication, loss of revenue, loss of contracts, loss of business or for costs
|
||||
damages, losses or liabilities in connection with an interruption of business, nor for concrete,
|
||||
incidental, indirect, punitive or consequential damages, even if the possibility of
|
||||
costs, losses or damages could normally have been foreseen.-->
|
||||
|
||||
<rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
|
||||
<rsm:ExchangedDocumentContext>
|
||||
<ram:TestIndicator>
|
||||
<udt:Indicator>true</udt:Indicator>
|
||||
</ram:TestIndicator>
|
||||
<ram:GuidelineSpecifiedDocumentContextParameter>
|
||||
<ram:ID>urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended</ram:ID>
|
||||
</ram:GuidelineSpecifiedDocumentContextParameter>
|
||||
</rsm:ExchangedDocumentContext>
|
||||
<rsm:ExchangedDocument>
|
||||
<ram:ID>R87654321012345</ram:ID>
|
||||
<ram:Name>WARENRECHNUNG</ram:Name>
|
||||
<ram:TypeCode>380</ram:TypeCode>
|
||||
<ram:IssueDateTime>
|
||||
<udt:DateTimeString format="102">20180806</udt:DateTimeString>
|
||||
</ram:IssueDateTime>
|
||||
<ram:IncludedNote>
|
||||
<ram:ContentCode>ST3</ram:ContentCode>
|
||||
<ram:Content>Es bestehen Rabatt- oder Bonusvereinbarungen.</ram:Content>
|
||||
<ram:SubjectCode>AAK</ram:SubjectCode>
|
||||
</ram:IncludedNote>
|
||||
<ram:IncludedNote>
|
||||
<ram:ContentCode>EEV</ram:ContentCode>
|
||||
<ram:Content>Der Verkäufer bleibt Eigentümer der Waren bis zu vollständigen Erfüllung der Kaufpreisforderung.</ram:Content>
|
||||
<ram:SubjectCode>AAJ</ram:SubjectCode>
|
||||
</ram:IncludedNote>
|
||||
<ram:IncludedNote>
|
||||
<ram:Content>MUSTERLIEFERANT GMBH
|
||||
BAHNHOFSTRASSE 99
|
||||
99199 MUSTERHAUSEN
|
||||
Geschäftsführung:
|
||||
Max Mustermann
|
||||
USt-IdNr: DE123456789
|
||||
Telefon: +49 932 431 0
|
||||
www.musterlieferant.de
|
||||
HRB Nr. 372876
|
||||
Amtsgericht Musterstadt
|
||||
GLN 4304171000002
|
||||
WEEE-Reg-Nr.: DE87654321
|
||||
</ram:Content>
|
||||
<ram:SubjectCode>REG</ram:SubjectCode>
|
||||
</ram:IncludedNote>
|
||||
<ram:IncludedNote>
|
||||
<ram:Content>Leergutwert: 46,50</ram:Content>
|
||||
</ram:IncludedNote>
|
||||
<ram:IncludedNote>
|
||||
<ram:Content>Wichtige Information: Bei Bestellungen bis zum 19.12. ist die Auslieferung bis spätestens 23.12. garantiert.</ram:Content>
|
||||
</ram:IncludedNote>
|
||||
</rsm:ExchangedDocument>
|
||||
<rsm:SupplyChainTradeTransaction>
|
||||
<ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:AssociatedDocumentLineDocument>
|
||||
<ram:LineID>1</ram:LineID>
|
||||
</ram:AssociatedDocumentLineDocument>
|
||||
<ram:SpecifiedTradeProduct>
|
||||
<ram:GlobalID schemeID="0160">4123456000014</ram:GlobalID>
|
||||
<ram:SellerAssignedID>ZS997</ram:SellerAssignedID>
|
||||
<ram:Name>Zitronensäure 100ml</ram:Name>
|
||||
<ram:ApplicableProductCharacteristic>
|
||||
<ram:Description>Verpackungsart</ram:Description>
|
||||
<ram:Value>BO</ram:Value>
|
||||
</ram:ApplicableProductCharacteristic>
|
||||
</ram:SpecifiedTradeProduct>
|
||||
<ram:SpecifiedLineTradeAgreement>
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<ram:ChargeAmount>1.0000</ram:ChargeAmount>
|
||||
</ram:GrossPriceProductTradePrice>
|
||||
<ram:NetPriceProductTradePrice>
|
||||
<ram:ChargeAmount>1.0000</ram:ChargeAmount>
|
||||
</ram:NetPriceProductTradePrice>
|
||||
</ram:SpecifiedLineTradeAgreement>
|
||||
<ram:SpecifiedLineTradeDelivery>
|
||||
<ram:BilledQuantity unitCode="H87">100.0000</ram:BilledQuantity>
|
||||
<ram:PackageQuantity unitCode="XCT">4.0000</ram:PackageQuantity>
|
||||
</ram:SpecifiedLineTradeDelivery>
|
||||
<ram:SpecifiedLineTradeSettlement>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
<ram:LineTotalAmount>100.00</ram:LineTotalAmount>
|
||||
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
</ram:SpecifiedLineTradeSettlement>
|
||||
</ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:AssociatedDocumentLineDocument>
|
||||
<ram:LineID>2</ram:LineID>
|
||||
</ram:AssociatedDocumentLineDocument>
|
||||
<ram:SpecifiedTradeProduct>
|
||||
<ram:GlobalID schemeID="0160">4123456000021</ram:GlobalID>
|
||||
<ram:SellerAssignedID>GZ250</ram:SellerAssignedID>
|
||||
<ram:Name>Gelierzucker Extra 250g</ram:Name>
|
||||
</ram:SpecifiedTradeProduct>
|
||||
<ram:SpecifiedLineTradeAgreement>
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<ram:ChargeAmount>1.5000</ram:ChargeAmount>
|
||||
<ram:AppliedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:ActualAmount>0.0300</ram:ActualAmount>
|
||||
<ram:Reason>Artikelrabatt 1</ram:Reason>
|
||||
</ram:AppliedTradeAllowanceCharge>
|
||||
<ram:AppliedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:ActualAmount>0.0200</ram:ActualAmount>
|
||||
<ram:Reason>Artikelrabatt 2</ram:Reason>
|
||||
</ram:AppliedTradeAllowanceCharge>
|
||||
</ram:GrossPriceProductTradePrice>
|
||||
<ram:NetPriceProductTradePrice>
|
||||
<ram:ChargeAmount>1.4500</ram:ChargeAmount>
|
||||
</ram:NetPriceProductTradePrice>
|
||||
</ram:SpecifiedLineTradeAgreement>
|
||||
<ram:SpecifiedLineTradeDelivery>
|
||||
<ram:BilledQuantity unitCode="H87">50.0000</ram:BilledQuantity>
|
||||
<ram:PackageQuantity unitCode="XCT">1.0000</ram:PackageQuantity>
|
||||
</ram:SpecifiedLineTradeDelivery>
|
||||
<ram:SpecifiedLineTradeSettlement>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
<ram:LineTotalAmount>72.50</ram:LineTotalAmount>
|
||||
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
</ram:SpecifiedLineTradeSettlement>
|
||||
</ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:AssociatedDocumentLineDocument>
|
||||
<ram:LineID>3</ram:LineID>
|
||||
</ram:AssociatedDocumentLineDocument>
|
||||
<ram:SpecifiedTradeProduct>
|
||||
<ram:GlobalID schemeID="0160">4123456000021</ram:GlobalID>
|
||||
<ram:SellerAssignedID>GZ250</ram:SellerAssignedID>
|
||||
<ram:Name>Gelierzucker Extra 250g</ram:Name>
|
||||
<ram:Description>Artikel wie vereinbart ohne Berechnung</ram:Description>
|
||||
</ram:SpecifiedTradeProduct>
|
||||
<ram:SpecifiedLineTradeAgreement>
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<ram:ChargeAmount>0.0000</ram:ChargeAmount>
|
||||
</ram:GrossPriceProductTradePrice>
|
||||
<ram:NetPriceProductTradePrice>
|
||||
<ram:ChargeAmount>0.0000</ram:ChargeAmount>
|
||||
</ram:NetPriceProductTradePrice>
|
||||
</ram:SpecifiedLineTradeAgreement>
|
||||
<ram:SpecifiedLineTradeDelivery>
|
||||
<ram:BilledQuantity unitCode="H87">10.0000</ram:BilledQuantity>
|
||||
<ram:PackageQuantity unitCode="XCT">1.0000</ram:PackageQuantity>
|
||||
</ram:SpecifiedLineTradeDelivery>
|
||||
<ram:SpecifiedLineTradeSettlement>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
<ram:LineTotalAmount>0.00</ram:LineTotalAmount>
|
||||
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
</ram:SpecifiedLineTradeSettlement>
|
||||
</ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:AssociatedDocumentLineDocument>
|
||||
<ram:LineID>4</ram:LineID>
|
||||
</ram:AssociatedDocumentLineDocument>
|
||||
<ram:SpecifiedTradeProduct>
|
||||
<ram:GlobalID schemeID="0160">4100130013294</ram:GlobalID>
|
||||
<ram:SellerAssignedID>2031</ram:SellerAssignedID>
|
||||
<ram:BuyerAssignedID/>
|
||||
<ram:Name>Bierbrau Pils 20/0500</ram:Name>
|
||||
<ram:Description>EAN-VKE: 4100130913297</ram:Description>
|
||||
<ram:ApplicableProductCharacteristic>
|
||||
<ram:Description>Verpackung</ram:Description>
|
||||
<ram:Value>Kiste</ram:Value>
|
||||
</ram:ApplicableProductCharacteristic>
|
||||
</ram:SpecifiedTradeProduct>
|
||||
<ram:SpecifiedLineTradeAgreement>
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<ram:ChargeAmount>12.0000</ram:ChargeAmount>
|
||||
</ram:GrossPriceProductTradePrice>
|
||||
<ram:NetPriceProductTradePrice>
|
||||
<ram:ChargeAmount>12.0000</ram:ChargeAmount>
|
||||
</ram:NetPriceProductTradePrice>
|
||||
</ram:SpecifiedLineTradeAgreement>
|
||||
<ram:SpecifiedLineTradeDelivery>
|
||||
<ram:BilledQuantity unitCode="XBC">15.0000</ram:BilledQuantity>
|
||||
<ram:PackageQuantity unitCode="XBO">20.0000</ram:PackageQuantity>
|
||||
</ram:SpecifiedLineTradeDelivery>
|
||||
<ram:SpecifiedLineTradeSettlement>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
<ram:LineTotalAmount>180.00</ram:LineTotalAmount>
|
||||
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
</ram:SpecifiedLineTradeSettlement>
|
||||
</ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:AssociatedDocumentLineDocument>
|
||||
<ram:LineID>5</ram:LineID>
|
||||
</ram:AssociatedDocumentLineDocument>
|
||||
<ram:SpecifiedTradeProduct>
|
||||
<ram:GlobalID schemeID="0160">2001015001325</ram:GlobalID>
|
||||
<ram:SellerAssignedID>1805</ram:SellerAssignedID>
|
||||
<ram:BuyerAssignedID/>
|
||||
<ram:Name>Leergutpfand 20 x 0,5l</ram:Name>
|
||||
<ram:ApplicableProductCharacteristic>
|
||||
<ram:Description>Verpackung</ram:Description>
|
||||
<ram:Value>unverpackt</ram:Value>
|
||||
</ram:ApplicableProductCharacteristic>
|
||||
</ram:SpecifiedTradeProduct>
|
||||
<ram:SpecifiedLineTradeAgreement>
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<ram:ChargeAmount>3.1000</ram:ChargeAmount>
|
||||
</ram:GrossPriceProductTradePrice>
|
||||
<ram:NetPriceProductTradePrice>
|
||||
<ram:ChargeAmount>3.1000</ram:ChargeAmount>
|
||||
</ram:NetPriceProductTradePrice>
|
||||
</ram:SpecifiedLineTradeAgreement>
|
||||
<ram:SpecifiedLineTradeDelivery>
|
||||
<ram:BilledQuantity unitCode="C62">15.0000</ram:BilledQuantity>
|
||||
<ram:PackageQuantity unitCode="XBC">1.0000</ram:PackageQuantity>
|
||||
</ram:SpecifiedLineTradeDelivery>
|
||||
<ram:SpecifiedLineTradeSettlement>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
<ram:LineTotalAmount>46.50</ram:LineTotalAmount>
|
||||
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
</ram:SpecifiedLineTradeSettlement>
|
||||
</ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:AssociatedDocumentLineDocument>
|
||||
<ram:LineID>6</ram:LineID>
|
||||
</ram:AssociatedDocumentLineDocument>
|
||||
<ram:SpecifiedTradeProduct>
|
||||
<ram:GlobalID schemeID="0160">4123456000038</ram:GlobalID>
|
||||
<ram:SellerAssignedID>MP107</ram:SellerAssignedID>
|
||||
<ram:Name>Mischpalette Joghurt Karton 3 x 20</ram:Name>
|
||||
<ram:ApplicableProductCharacteristic>
|
||||
<ram:Description>Verpackung</ram:Description>
|
||||
<ram:Value>Karton</ram:Value>
|
||||
</ram:ApplicableProductCharacteristic>
|
||||
<ram:IncludedReferencedProduct>
|
||||
<ram:GlobalID schemeID="0160">4123456001035</ram:GlobalID>
|
||||
<ram:SellerAssignedID>JOG103</ram:SellerAssignedID>
|
||||
<ram:Name>Erdbeer 20 x 150g Becher</ram:Name>
|
||||
<ram:UnitQuantity unitCode="C62">20.0000</ram:UnitQuantity>
|
||||
</ram:IncludedReferencedProduct>
|
||||
<ram:IncludedReferencedProduct>
|
||||
<ram:GlobalID schemeID="0160">4123456002032</ram:GlobalID>
|
||||
<ram:SellerAssignedID>JOG203</ram:SellerAssignedID>
|
||||
<ram:Name>Banane 20 x 150g Becher</ram:Name>
|
||||
<ram:UnitQuantity unitCode="C62">20.0000</ram:UnitQuantity>
|
||||
</ram:IncludedReferencedProduct>
|
||||
<ram:IncludedReferencedProduct>
|
||||
<ram:GlobalID schemeID="0160">4123456003039</ram:GlobalID>
|
||||
<ram:SellerAssignedID>JOG303</ram:SellerAssignedID>
|
||||
<ram:Name>Schoko 20 x 150g Becher</ram:Name>
|
||||
<ram:UnitQuantity unitCode="C62">20.0000</ram:UnitQuantity>
|
||||
</ram:IncludedReferencedProduct>
|
||||
</ram:SpecifiedTradeProduct>
|
||||
<ram:SpecifiedLineTradeAgreement>
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<ram:ChargeAmount>30.0000</ram:ChargeAmount>
|
||||
<ram:AppliedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:ActualAmount>0.9000</ram:ActualAmount>
|
||||
<ram:Reason>Artikelrabatt 1</ram:Reason>
|
||||
</ram:AppliedTradeAllowanceCharge>
|
||||
</ram:GrossPriceProductTradePrice>
|
||||
<ram:NetPriceProductTradePrice>
|
||||
<ram:ChargeAmount>29.1000</ram:ChargeAmount>
|
||||
</ram:NetPriceProductTradePrice>
|
||||
</ram:SpecifiedLineTradeAgreement>
|
||||
<ram:SpecifiedLineTradeDelivery>
|
||||
<ram:BilledQuantity unitCode="C62">2.0000</ram:BilledQuantity>
|
||||
<ram:PackageQuantity unitCode="XPX">1.0000</ram:PackageQuantity>
|
||||
</ram:SpecifiedLineTradeDelivery>
|
||||
<ram:SpecifiedLineTradeSettlement>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
<ram:LineTotalAmount>58.20</ram:LineTotalAmount>
|
||||
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||
</ram:SpecifiedLineTradeSettlement>
|
||||
</ram:IncludedSupplyChainTradeLineItem>
|
||||
<ram:ApplicableHeaderTradeAgreement>
|
||||
<ram:SellerTradeParty>
|
||||
<ram:ID>549910</ram:ID>
|
||||
<ram:GlobalID schemeID="0088">4333741000005</ram:GlobalID>
|
||||
<ram:Name>MUSTERLIEFERANT GMBH</ram:Name>
|
||||
<ram:DefinedTradeContact>
|
||||
<ram:TelephoneUniversalCommunication>
|
||||
<ram:CompleteNumber>+49 932 431 500</ram:CompleteNumber>
|
||||
</ram:TelephoneUniversalCommunication>
|
||||
<ram:EmailURIUniversalCommunication>
|
||||
<ram:URIID>max.mustermann@musterlieferant.de</ram:URIID>
|
||||
</ram:EmailURIUniversalCommunication>
|
||||
</ram:DefinedTradeContact>
|
||||
<ram:PostalTradeAddress>
|
||||
<ram:PostcodeCode>99199</ram:PostcodeCode>
|
||||
<ram:LineOne>BAHNHOFSTRASSE 99</ram:LineOne>
|
||||
<ram:CityName>MUSTERHAUSEN</ram:CityName>
|
||||
<ram:CountryID>DE</ram:CountryID>
|
||||
</ram:PostalTradeAddress>
|
||||
<ram:SpecifiedTaxRegistration>
|
||||
<ram:ID schemeID="VA">DE123456789</ram:ID>
|
||||
</ram:SpecifiedTaxRegistration>
|
||||
</ram:SellerTradeParty>
|
||||
<ram:BuyerTradeParty>
|
||||
<ram:ID>009420</ram:ID>
|
||||
<ram:GlobalID schemeID="0088">4304171000002</ram:GlobalID>
|
||||
<ram:Name>MUSTER-KUNDE GMBH</ram:Name>
|
||||
<ram:PostalTradeAddress>
|
||||
<ram:PostcodeCode>40235</ram:PostcodeCode>
|
||||
<ram:LineOne>KUNDENWEG 88</ram:LineOne>
|
||||
<ram:CityName>DUESSELDORF</ram:CityName>
|
||||
<ram:CountryID>DE</ram:CountryID>
|
||||
</ram:PostalTradeAddress>
|
||||
</ram:BuyerTradeParty>
|
||||
<ram:BuyerOrderReferencedDocument>
|
||||
<ram:IssuerAssignedID>B123456789</ram:IssuerAssignedID>
|
||||
</ram:BuyerOrderReferencedDocument>
|
||||
<ram:AdditionalReferencedDocument>
|
||||
<ram:IssuerAssignedID>A456123</ram:IssuerAssignedID>
|
||||
<ram:TypeCode>130</ram:TypeCode>
|
||||
</ram:AdditionalReferencedDocument>
|
||||
</ram:ApplicableHeaderTradeAgreement>
|
||||
<ram:ApplicableHeaderTradeDelivery>
|
||||
<ram:ShipToTradeParty>
|
||||
<ram:GlobalID schemeID="0088">4304171088093</ram:GlobalID>
|
||||
<ram:Name>MUSTER-MARKT</ram:Name>
|
||||
<ram:DefinedTradeContact>
|
||||
<ram:DepartmentName>8211</ram:DepartmentName>
|
||||
</ram:DefinedTradeContact>
|
||||
<ram:PostalTradeAddress>
|
||||
<ram:PostcodeCode>31157</ram:PostcodeCode>
|
||||
<ram:LineOne>HAUPTSTRASSE 44</ram:LineOne>
|
||||
<ram:CityName>SARSTEDT</ram:CityName>
|
||||
<ram:CountryID>DE</ram:CountryID>
|
||||
</ram:PostalTradeAddress>
|
||||
</ram:ShipToTradeParty>
|
||||
<ram:ActualDeliverySupplyChainEvent>
|
||||
<ram:OccurrenceDateTime>
|
||||
<udt:DateTimeString format="102">20180805</udt:DateTimeString>
|
||||
</ram:OccurrenceDateTime>
|
||||
</ram:ActualDeliverySupplyChainEvent>
|
||||
<ram:DeliveryNoteReferencedDocument>
|
||||
<ram:IssuerAssignedID>L87654321012345</ram:IssuerAssignedID>
|
||||
</ram:DeliveryNoteReferencedDocument>
|
||||
</ram:ApplicableHeaderTradeDelivery>
|
||||
<ram:ApplicableHeaderTradeSettlement>
|
||||
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
|
||||
<ram:InvoiceeTradeParty>
|
||||
<ram:ID>009420</ram:ID>
|
||||
<ram:GlobalID schemeID="0088">4304171000002</ram:GlobalID>
|
||||
<ram:Name>MUSTER-KUNDE GMBH</ram:Name>
|
||||
<ram:PostalTradeAddress>
|
||||
<ram:PostcodeCode>40235</ram:PostcodeCode>
|
||||
<ram:LineOne>KUNDENWEG 88</ram:LineOne>
|
||||
<ram:CityName>DUESSELDORF</ram:CityName>
|
||||
<ram:CountryID>DE</ram:CountryID>
|
||||
</ram:PostalTradeAddress>
|
||||
</ram:InvoiceeTradeParty>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:CalculatedAmount>61.07</ram:CalculatedAmount>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:BasisAmount>321.40</ram:BasisAmount>
|
||||
<ram:LineTotalBasisAmount>326.50</ram:LineTotalBasisAmount>
|
||||
<ram:AllowanceChargeBasisAmount>-5.10</ram:AllowanceChargeBasisAmount>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:ApplicableTradeTax>
|
||||
<ram:CalculatedAmount>8.93</ram:CalculatedAmount>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:BasisAmount>127.59</ram:BasisAmount>
|
||||
<ram:LineTotalBasisAmount>130.70</ram:LineTotalBasisAmount>
|
||||
<ram:AllowanceChargeBasisAmount>-3.11</ram:AllowanceChargeBasisAmount>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>
|
||||
</ram:ApplicableTradeTax>
|
||||
<ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:CalculationPercent>2.00</ram:CalculationPercent>
|
||||
<ram:BasisAmount>280.00</ram:BasisAmount>
|
||||
<ram:ActualAmount>5.60</ram:ActualAmount>
|
||||
<ram:Reason>Rechnungsrabatt 1</ram:Reason>
|
||||
<ram:CategoryTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||
</ram:CategoryTradeTax>
|
||||
</ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:CalculationPercent>2.00</ram:CalculationPercent>
|
||||
<ram:BasisAmount>130.70</ram:BasisAmount>
|
||||
<ram:ActualAmount>2.61</ram:ActualAmount>
|
||||
<ram:Reason>Rechnungsrabatt 1</ram:Reason>
|
||||
<ram:CategoryTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>
|
||||
</ram:CategoryTradeTax>
|
||||
</ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:BasisAmount>280.00</ram:BasisAmount>
|
||||
<ram:ActualAmount>2.50</ram:ActualAmount>
|
||||
<ram:Reason>Rechnungsrabatt 2</ram:Reason>
|
||||
<ram:CategoryTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||
</ram:CategoryTradeTax>
|
||||
</ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:ChargeIndicator>
|
||||
<udt:Indicator>false</udt:Indicator>
|
||||
</ram:ChargeIndicator>
|
||||
<ram:BasisAmount>130.70</ram:BasisAmount>
|
||||
<ram:ActualAmount>0.50</ram:ActualAmount>
|
||||
<ram:Reason>Rechnungsrabatt 2</ram:Reason>
|
||||
<ram:CategoryTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>
|
||||
</ram:CategoryTradeTax>
|
||||
</ram:SpecifiedTradeAllowanceCharge>
|
||||
<ram:SpecifiedLogisticsServiceCharge>
|
||||
<ram:Description>Transportkosten</ram:Description>
|
||||
<ram:AppliedAmount>3.00</ram:AppliedAmount>
|
||||
<ram:AppliedTradeTax>
|
||||
<ram:TypeCode>VAT</ram:TypeCode>
|
||||
<ram:CategoryCode>S</ram:CategoryCode>
|
||||
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||
</ram:AppliedTradeTax>
|
||||
</ram:SpecifiedLogisticsServiceCharge>
|
||||
<ram:SpecifiedTradePaymentTerms>
|
||||
<ram:Description>Bei Zahlung innerhalb 14 Tagen gewähren wir 2,0% Skonto.</ram:Description>
|
||||
<ram:ApplicableTradePaymentDiscountTerms>
|
||||
<ram:BasisPeriodMeasure unitCode="DAY">14</ram:BasisPeriodMeasure>
|
||||
<ram:CalculationPercent>2.00</ram:CalculationPercent>
|
||||
</ram:ApplicableTradePaymentDiscountTerms>
|
||||
</ram:SpecifiedTradePaymentTerms>
|
||||
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||
<ram:LineTotalAmount>457.20</ram:LineTotalAmount>
|
||||
<ram:ChargeTotalAmount>3.00</ram:ChargeTotalAmount>
|
||||
<ram:AllowanceTotalAmount>11.21</ram:AllowanceTotalAmount>
|
||||
<ram:TaxBasisTotalAmount>448.99</ram:TaxBasisTotalAmount>
|
||||
<ram:TaxTotalAmount currencyID="EUR">70.00</ram:TaxTotalAmount>
|
||||
<ram:GrandTotalAmount>518.99</ram:GrandTotalAmount>
|
||||
<ram:TotalPrepaidAmount>0.00</ram:TotalPrepaidAmount>
|
||||
<ram:DuePayableAmount>518.99</ram:DuePayableAmount>
|
||||
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||
</ram:ApplicableHeaderTradeSettlement>
|
||||
</rsm:SupplyChainTradeTransaction>
|
||||
</rsm:CrossIndustryInvoice>
|
||||
@@ -762,7 +762,7 @@
|
||||
<div id="BT-50" title="BT-50" class="boxdaten wert">KUNDENWEG 88</div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach:</div>
|
||||
<div class="boxdaten legende">Adresszusatz:</div>
|
||||
<div id="BT-51" title="BT-51" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
@@ -826,7 +826,7 @@
|
||||
<div id="BT-35" title="BT-35" class="boxdaten wert">BAHNHOFSTRASSE 99</div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach:</div>
|
||||
<div class="boxdaten legende">Adresszusatz:</div>
|
||||
<div id="BT-36" title="BT-36" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
@@ -2203,7 +2203,7 @@
|
||||
<div id="BT-75" title="BT-75" class="boxdaten wert">HAUPTSTRASSE 44</div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Postfach:</div>
|
||||
<div class="boxdaten legende">Adresszusatz:</div>
|
||||
<div id="BT-76" title="BT-76" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
|
||||
@@ -1905,6 +1905,55 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxabstand"></div>
|
||||
<div id="zusaetzeLieferung" class="box boxZweispaltig">
|
||||
<div id="BG-13" title="BG-13" class="boxtitel">Informations de livraison</div>
|
||||
<div class="boxtabelle boxinhalt borderSpacing">
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Identification du lieu de livraison:</div>
|
||||
<div id="BT-71" title="BT-71" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Schéma de l'Identifiant:</div>
|
||||
<div id="BT-71-scheme-id" title="BT-71-scheme-id" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Date de livraison:</div>
|
||||
<div id="BT-72" title="BT-72" class="boxdaten wert">10.11.2020</div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Nom du destinataire:</div>
|
||||
<div id="BT-70" title="BT-70" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Rue / Numéro de maison:</div>
|
||||
<div id="BT-75" title="BT-75" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Boîte postale:</div>
|
||||
<div id="BT-76" title="BT-76" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Supplément d'adresse:</div>
|
||||
<div title="BT-165" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Code postal:</div>
|
||||
<div id="BT-78" title="BT-78" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Lieu:</div>
|
||||
<div id="BT-77" title="BT-77" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Région:</div>
|
||||
<div id="BT-79" title="BT-79" class="boxdaten wert"></div>
|
||||
</div>
|
||||
<div class="boxzeile">
|
||||
<div class="boxdaten legende">Pays:</div>
|
||||
<div id="BT-80" title="BT-80" class="boxdaten wert"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxtabelle boxabstandtop boxtabelleZweispaltig">
|
||||
@@ -2120,4 +2169,4 @@ function downloadData (element_id) {
|
||||
});
|
||||
//
|
||||
|
||||
</script></html>
|
||||
</script></html>
|
||||
197
library/src/test/resources/ubl/periods.ubl.xml
Normal file
197
library/src/test/resources/ubl/periods.ubl.xml
Normal file
@@ -0,0 +1,197 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2" xmlns:udt="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended</cbc:CustomizationID>
|
||||
<cbc:ID>123</cbc:ID>
|
||||
<cbc:IssueDate>2025-02-10</cbc:IssueDate>
|
||||
<cbc:DueDate>2025-02-10</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:Note>document level 1/2</cbc:Note>
|
||||
<cbc:Note>document level 2/2</cbc:Note>
|
||||
<cbc:DocumentCurrencyCode>CHF</cbc:DocumentCurrencyCode>
|
||||
<cac:InvoicePeriod>
|
||||
<cbc:StartDate>2020-10-01</cbc:StartDate>
|
||||
<cbc:EndDate>2020-10-05</cbc:EndDate>
|
||||
<cbc:DescriptionCode>432</cbc:DescriptionCode>
|
||||
</cac:InvoicePeriod>
|
||||
<cac:OrderReference>
|
||||
<cbc:ID>28934</cbc:ID>
|
||||
<cbc:SalesOrderID>9384</cbc:SalesOrderID>
|
||||
</cac:OrderReference>
|
||||
<cac:BillingReference>
|
||||
<cac:InvoiceDocumentReference>
|
||||
<cbc:ID>abc123</cbc:ID>
|
||||
</cac:InvoiceDocumentReference>
|
||||
</cac:BillingReference>
|
||||
<cac:ContractDocumentReference>
|
||||
<cbc:ID>376zreurzu0983</cbc:ID>
|
||||
</cac:ContractDocumentReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cbc:EndpointID schemeID="EM">sender@test.org</cbc:EndpointID>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID>0009845</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>teststr</cbc:StreetName>
|
||||
<cbc:CityName>teststadt</cbc:CityName>
|
||||
<cbc:PostalZone>55232</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>DE0815</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>9990815</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>NOVAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
<cbc:RegistrationName>Test company</cbc:RegistrationName>
|
||||
</cac:PartyLegalEntity>
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cbc:EndpointID schemeID="EM">recipient@test.org</cbc:EndpointID>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID>0088:4304171000002</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>teststr.12</cbc:StreetName>
|
||||
<cbc:AdditionalStreetName>Hinterhaus 3</cbc:AdditionalStreetName>
|
||||
<cbc:CityName>Entenhausen</cbc:CityName>
|
||||
<cbc:PostalZone>55232</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>DE4711</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
<cbc:RegistrationName>Franz Müller</cbc:RegistrationName>
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
<cbc:Telephone>01779999999</cbc:Telephone>
|
||||
<cbc:ElectronicMail>franz@mueller.de</cbc:ElectronicMail>
|
||||
</cac:Contact>
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
<cac:Delivery>
|
||||
<cbc:ActualDeliveryDate>2020-11-02</cbc:ActualDeliveryDate>
|
||||
<cac:DeliveryLocation>
|
||||
<cac:Address>
|
||||
<cbc:StreetName>teststr.12a</cbc:StreetName>
|
||||
<cbc:CityName>Entenhausen</cbc:CityName>
|
||||
<cbc:PostalZone>55232</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:Address>
|
||||
</cac:DeliveryLocation>
|
||||
<cac:DeliveryParty>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>just the other side of the street</cbc:Name>
|
||||
</cac:PartyName>
|
||||
</cac:DeliveryParty>
|
||||
</cac:Delivery>
|
||||
<cac:PaymentMeans>
|
||||
<cbc:PaymentID>Verwendungszweck</cbc:PaymentID>
|
||||
</cac:PaymentMeans>
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Please remit until 10.02.2025</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="CHF">0.20</cbc:Amount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>16.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>quick delivery charge</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="CHF">0.50</cbc:Amount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>16.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="CHF">0.20</cbc:TaxAmount>
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount currencyID="CHF">1.28</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount currencyID="CHF">0.20</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>16.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</cac:TaxTotal>
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="CHF">0.98</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="CHF">1.28</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="CHF">1.48</cbc:TaxInclusiveAmount>
|
||||
<cbc:AllowanceTotalAmount currencyID="CHF">0.20</cbc:AllowanceTotalAmount>
|
||||
<cbc:ChargeTotalAmount currencyID="CHF">0.50</cbc:ChargeTotalAmount>
|
||||
<cbc:PayableAmount currencyID="CHF">1.48</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>a123</cbc:ID>
|
||||
<cbc:Note>item level 1/1</cbc:Note>
|
||||
<cbc:InvoicedQuantity unitCode="H87">1.00000000</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="CHF">0.98</cbc:LineExtensionAmount>
|
||||
<cac:InvoicePeriod>
|
||||
<cbc:StartDate>2020-01-13</cbc:StartDate>
|
||||
<cbc:EndDate>2020-01-15</cbc:EndDate>
|
||||
</cac:InvoicePeriod>
|
||||
<cac:OrderLineReference>
|
||||
<cbc:LineID>xxx</cbc:LineID>
|
||||
</cac:OrderLineReference>
|
||||
<cac:Item>
|
||||
<cbc:Name>Testprodukt</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>4711</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="0160">2001015001325</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>16.00</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="CHF">0.98</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="H87">1.00</cbc:BaseQuantity>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:Amount currencyID="CHF">0.0200</cbc:Amount>
|
||||
<cbc:BaseAmount currencyID="CHF">1.0000</cbc:BaseAmount>
|
||||
</cac:AllowanceCharge>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
||||
Reference in New Issue
Block a user