Merge branch 'master' of github.com:ZUGFeRD/mustangproject
# Conflicts: # Mustang-CLI/pom.xml # library/pom.xml # validator/pom.xml
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
- #420
|
||||||
|
- Enhance Charges/Allowances with reasonCode. #432
|
||||||
|
- Fix build warnings from editing and building. #415
|
||||||
|
- ZUGFeRDVisualizer.toPDF(): generate PDF/A-3b. #400
|
||||||
|
|
||||||
2.12.0
|
2.12.0
|
||||||
=======
|
=======
|
||||||
2024-07-20
|
2024-07-20
|
||||||
|
|||||||
@@ -6,16 +6,13 @@
|
|||||||
<version>2.13.0-SNAPSHOT</version>
|
<version>2.13.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject</groupId>
|
|
||||||
<artifactId>Mustang-CLI</artifactId>
|
<artifactId>Mustang-CLI</artifactId>
|
||||||
<name>e-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation
|
<name>e-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation
|
||||||
should also work for XRechnung/CII.
|
should also work for XRechnung/CII.
|
||||||
</name>
|
</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>2.13.0-SNAPSHOT</version>
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
|
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
@@ -110,18 +107,6 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<archive>
|
|
||||||
<manifest>
|
|
||||||
<addClasspath>true</addClasspath>
|
|
||||||
<mainClass>org.mustangproject.commandline.main</mainClass>
|
|
||||||
</manifest>
|
|
||||||
</archive>
|
|
||||||
<descriptorRefs>
|
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
|
||||||
</descriptorRefs>
|
|
||||||
<!-- http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
|
|
||||||
mvn clean compile assembly:single -->
|
|
||||||
<!-- or whatever version you use -->
|
|
||||||
<source>11</source>
|
<source>11</source>
|
||||||
<target>11</target>
|
<target>11</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -148,24 +133,12 @@
|
|||||||
<exclude>META-INF/*.RSA</exclude>
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
<filter>
|
|
||||||
<artifact>log4j:log4j</artifact>
|
|
||||||
<includes>
|
|
||||||
<include>**</include>
|
|
||||||
</includes>
|
|
||||||
</filter>
|
|
||||||
<filter>
|
<filter>
|
||||||
<artifact>commons-logging:commons-logging</artifact>
|
<artifact>commons-logging:commons-logging</artifact>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**</include>
|
<include>**</include>
|
||||||
</includes>
|
</includes>
|
||||||
</filter>
|
</filter>
|
||||||
<filter>
|
|
||||||
<artifact>com.sun.xml.bind:jaxb-impl</artifact>
|
|
||||||
<includes>
|
|
||||||
<include>**</include>
|
|
||||||
</includes>
|
|
||||||
</filter>
|
|
||||||
</filters>
|
</filters>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
@@ -176,7 +149,7 @@
|
|||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<excludes />
|
<excludes/>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
|||||||
@@ -127,14 +127,10 @@ The whole settings.xml then looks e.g. like this
|
|||||||
<offline/>
|
<offline/>
|
||||||
<pluginGroups/>
|
<pluginGroups/>
|
||||||
<servers>
|
<servers>
|
||||||
<server>
|
|
||||||
<id>github</id>
|
|
||||||
<password>TOKEN</password>
|
|
||||||
</server>
|
|
||||||
<server>
|
<server>
|
||||||
<id>ossrh</id>
|
<id>ossrh</id>
|
||||||
<username>jstaerk</username>
|
<username>SONATYPE TOKEN USER</username>
|
||||||
<password>JIRA-PASSWORD</password>
|
<password>SONATYPE TOKEN PASSWORD</password>
|
||||||
</server>
|
</server>
|
||||||
|
|
||||||
</servers>
|
</servers>
|
||||||
|
|||||||
@@ -7,9 +7,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject</groupId>
|
|
||||||
<artifactId>library</artifactId>
|
<artifactId>library</artifactId>
|
||||||
<version>2.13.0-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>Library to write, read and validate e-invoices (Factur-X, ZUGFeRD, Order-X, XRechnung/CII)</name>
|
<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
|
<description>FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT
|
||||||
@@ -46,11 +44,9 @@
|
|||||||
<github.global.server>github</github.global.server>
|
<github.global.server>github</github.global.server>
|
||||||
<additionalparam>-Xdoclint:none</additionalparam>
|
<additionalparam>-Xdoclint:none</additionalparam>
|
||||||
<!-- Skip error check for javadoc -->
|
<!-- Skip error check for javadoc -->
|
||||||
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
|
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<maven.deploy.skip>true
|
<maven.deploy.skip>true</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
|
||||||
</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
|
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -169,12 +165,6 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.13.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptorRefs>
|
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
|
||||||
</descriptorRefs>
|
|
||||||
<!-- http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
|
|
||||||
mvn clean compile assembly:single -->
|
|
||||||
<!-- or whatever version you use -->
|
|
||||||
<source>11</source>
|
<source>11</source>
|
||||||
<target>11</target>
|
<target>11</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -233,10 +223,8 @@
|
|||||||
<version>3.5.3</version>
|
<version>3.5.3</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||||
<minimizeJar>false
|
<minimizeJar>false</minimizeJar><!-- no longer java 11 compatible if set to true because it removes e.g. javax/xml/bind/annotation/XmlSchema-->
|
||||||
</minimizeJar><!-- no longer java 11 compatible if set to true because it removes e.g. javax/xml/bind/annotation/XmlSchema-->
|
|
||||||
<filters>
|
<filters>
|
||||||
|
|
||||||
<filter>
|
<filter>
|
||||||
<artifact>*:*</artifact>
|
<artifact>*:*</artifact>
|
||||||
<excludes>
|
<excludes>
|
||||||
@@ -245,12 +233,6 @@
|
|||||||
<exclude>META-INF/*.RSA</exclude>
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
<filter>
|
|
||||||
<artifact>log4j:log4j</artifact>
|
|
||||||
<includes>
|
|
||||||
<include>**</include>
|
|
||||||
</includes>
|
|
||||||
</filter>
|
|
||||||
<filter>
|
<filter>
|
||||||
<artifact>commons-logging:commons-logging</artifact>
|
<artifact>commons-logging:commons-logging</artifact>
|
||||||
<includes>
|
<includes>
|
||||||
@@ -268,9 +250,6 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<excludes>
|
<excludes>
|
||||||
<!--exclude>classworlds:classworlds</exclude> <exclude>junit:junit</exclude>
|
|
||||||
<exclude>jmock:*</exclude> <exclude>*:xml-apis</exclude> <exclude>org.apache.maven:lib:tests</exclude>
|
|
||||||
<exclude>log4j:log4j:jar:</exclude -->
|
|
||||||
</excludes>
|
</excludes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
|||||||
* a simple human readable description
|
* a simple human readable description
|
||||||
*/
|
*/
|
||||||
protected String reason;
|
protected String reason;
|
||||||
|
/**
|
||||||
|
* Code from list UNTDID 5189
|
||||||
|
*/
|
||||||
|
protected String reasonCode;
|
||||||
/**
|
/**
|
||||||
* the category ID why this charge has been applied
|
* the category ID why this charge has been applied
|
||||||
*/
|
*/
|
||||||
@@ -94,6 +98,22 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getReasonCode() {
|
||||||
|
return reasonCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Reason code for the charge
|
||||||
|
* @param reasonCode from list UNTDID 5189
|
||||||
|
* @return fluid setter
|
||||||
|
*/
|
||||||
|
public Charge setReasonCode(String reasonCode) {
|
||||||
|
this.reasonCode = reasonCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal getTotalAmount(IAbsoluteValueProvider currentItem) {
|
public BigDecimal getTotalAmount(IAbsoluteValueProvider currentItem) {
|
||||||
if (totalAmount!=null) {
|
if (totalAmount!=null) {
|
||||||
@@ -137,7 +157,7 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
|||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* machine readable reason for this allowance/charge
|
* the category ID why this has been applied
|
||||||
* @param categoryCode usually S
|
* @param categoryCode usually S
|
||||||
* @return fluid setter
|
* @return fluid setter
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
String vatPercent = null;
|
String vatPercent = null;
|
||||||
String lineTotal = "0";
|
String lineTotal = "0";
|
||||||
String unitCode = "0";
|
String unitCode = "0";
|
||||||
|
String referencedLineID = null;
|
||||||
|
|
||||||
ArrayList<ReferencedDocument> rdocs = null;
|
ArrayList<ReferencedDocument> rdocs = null;
|
||||||
|
|
||||||
@@ -142,6 +143,16 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((tradeLineChilds.item(tradeLineChildIndex).getLocalName() != null) && tradeLineChilds.item(tradeLineChildIndex).getLocalName().equals("BuyerOrderReferencedDocument")) {
|
||||||
|
NodeList docChilds = tradeLineChilds.item(tradeLineChildIndex).getChildNodes();
|
||||||
|
for (int docIndex = 0; docIndex < docChilds.getLength(); docIndex++) {
|
||||||
|
String localName = docChilds.item(docIndex).getLocalName();
|
||||||
|
if ((localName != null) && (localName.equals("LineID"))) {
|
||||||
|
referencedLineID = docChilds.item(docIndex).getTextContent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((tradeLineChilds.item(tradeLineChildIndex).getLocalName() != null) && tradeLineChilds
|
if ((tradeLineChilds.item(tradeLineChildIndex).getLocalName() != null) && tradeLineChilds
|
||||||
.item(tradeLineChildIndex).getLocalName().equals("NetPriceProductTradePrice")) {
|
.item(tradeLineChildIndex).getLocalName().equals("NetPriceProductTradePrice")) {
|
||||||
NodeList netChilds = tradeLineChilds.item(tradeLineChildIndex).getChildNodes();
|
NodeList netChilds = tradeLineChilds.item(tradeLineChildIndex).getChildNodes();
|
||||||
@@ -263,6 +274,7 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
addReferencedDocument(rdoc);
|
addReferencedDocument(rdoc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
addReferencedLineID( referencedLineID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* describes a product, good or service used in an invoice item line
|
* describes a product, good or service used in an invoice item line
|
||||||
@@ -15,6 +16,8 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
protected boolean isReverseCharge = false;
|
protected boolean isReverseCharge = false;
|
||||||
protected boolean isIntraCommunitySupply = false;
|
protected boolean isIntraCommunitySupply = false;
|
||||||
protected SchemedID globalId = null;
|
protected SchemedID globalId = null;
|
||||||
|
protected String countryOfOrigin = null;
|
||||||
|
protected HashMap<String, String> attributes = null;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* default constructor
|
* default constructor
|
||||||
@@ -63,6 +66,7 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getSellerAssignedID() {
|
public String getSellerAssignedID() {
|
||||||
return sellerAssignedID;
|
return sellerAssignedID;
|
||||||
}
|
}
|
||||||
@@ -77,6 +81,7 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getBuyerAssignedID() {
|
public String getBuyerAssignedID() {
|
||||||
return buyerAssignedID;
|
return buyerAssignedID;
|
||||||
}
|
}
|
||||||
@@ -183,4 +188,32 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
this.VATPercent = VATPercent;
|
this.VATPercent = VATPercent;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCountryOfOrigin() {
|
||||||
|
return this.countryOfOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product setCountryOfOrigin(String countryOfOrigin) {
|
||||||
|
this.countryOfOrigin = countryOfOrigin;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<String, String> getAttributes() {
|
||||||
|
return this.attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product setAttributes(HashMap<String, String> attributes) {
|
||||||
|
this.attributes = attributes;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product addAttribute(String name, String value ) {
|
||||||
|
if ( this.attributes == null ) {
|
||||||
|
this.attributes = new HashMap<>();
|
||||||
|
}
|
||||||
|
this.attributes.put(name, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ public interface IZUGFeRDAllowanceCharge {
|
|||||||
*/
|
*/
|
||||||
String getReason();
|
String getReason();
|
||||||
|
|
||||||
|
/***
|
||||||
|
* get the code for the allowance/charge
|
||||||
|
* @return the code
|
||||||
|
*/
|
||||||
|
String getReasonCode();
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* get the applicable tax percentage for the allowance/charge
|
* get the applicable tax percentage for the allowance/charge
|
||||||
* @return the percentage
|
* @return the percentage
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
|
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
|
||||||
|
|
||||||
@@ -156,4 +157,12 @@ public interface IZUGFeRDExportableProduct {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default String getCountryOfOrigin() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
default HashMap<String, String> getAttributes() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import java.util.Base64;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
|
|
||||||
if (party.getLegalOrganisation() != null) {
|
if (party.getLegalOrganisation() != null) {
|
||||||
xml += "<ram:SpecifiedLegalOrganization> ";
|
xml += "<ram:SpecifiedLegalOrganization> ";
|
||||||
xml += " <ram:ID schemeID=\"" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemeID()) + "\">" + XMLTools.encodeXML(party.getLegalOrganisation().getID()) + "</ram:ID>";
|
xml += "<ram:ID schemeID=\"" + XMLTools.encodeXML(party.getLegalOrganisation().getSchemeID()) + "\">" + XMLTools.encodeXML(party.getLegalOrganisation().getID()) + "</ram:ID>";
|
||||||
xml += "</ram:SpecifiedLegalOrganization>";
|
xml += "</ram:SpecifiedLegalOrganization>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,10 +244,16 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
// only in extended profile
|
// only in extended profile
|
||||||
reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
||||||
}
|
}
|
||||||
|
String reasonCode = "";
|
||||||
|
if ((allowance.getReasonCode() != null) && (profile == Profiles.getByName("XRechnung"))) {
|
||||||
|
// only in XRechnung profile
|
||||||
|
reasonCode = "<ram:ReasonCode>" + allowance.getReasonCode() + "</ram:ReasonCode>";
|
||||||
|
}
|
||||||
final String allowanceChargeStr = "<ram:AppliedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
|
final String allowanceChargeStr = "<ram:AppliedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
|
||||||
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
||||||
"<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
"<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
||||||
reason +
|
reason +
|
||||||
|
reasonCode +
|
||||||
"</ram:AppliedTradeAllowanceCharge>";
|
"</ram:AppliedTradeAllowanceCharge>";
|
||||||
return allowanceChargeStr;
|
return allowanceChargeStr;
|
||||||
}
|
}
|
||||||
@@ -268,10 +275,21 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
chargeIndicator = "true";
|
chargeIndicator = "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String reason = "";
|
||||||
|
if ((allowance.getReason() != null) && (profile == Profiles.getByName("Extended"))) {
|
||||||
|
// only in extended profile
|
||||||
|
reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
||||||
|
}
|
||||||
|
String reasonCode = "";
|
||||||
|
if ((allowance.getReasonCode() != null) && (profile == Profiles.getByName("XRechnung"))) {
|
||||||
|
// only in XRechnung profile
|
||||||
|
reasonCode = "<ram:ReasonCode>" + allowance.getReasonCode() + "</ram:ReasonCode>";
|
||||||
|
}
|
||||||
final String itemTotalAllowanceChargeStr = "<ram:SpecifiedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
|
final String itemTotalAllowanceChargeStr = "<ram:SpecifiedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
|
||||||
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
||||||
"<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
"<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
||||||
"<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>" +
|
reason +
|
||||||
|
reasonCode +
|
||||||
"</ram:SpecifiedTradeAllowanceCharge>";
|
"</ram:SpecifiedTradeAllowanceCharge>";
|
||||||
return itemTotalAllowanceChargeStr;
|
return itemTotalAllowanceChargeStr;
|
||||||
}
|
}
|
||||||
@@ -324,9 +342,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
//
|
//
|
||||||
|
|
||||||
if (getProfile() == Profiles.getByName("XRechnung")) {
|
if (getProfile() == Profiles.getByName("XRechnung")) {
|
||||||
xml += " <ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
|
xml += "<ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
|
||||||
+ " <ram:ID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</ram:ID>\n"
|
+ "<ram:ID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</ram:ID>\n"
|
||||||
+ " </ram:BusinessProcessSpecifiedDocumentContextParameter>\n";
|
+ "</ram:BusinessProcessSpecifiedDocumentContextParameter>\n";
|
||||||
}
|
}
|
||||||
xml +=
|
xml +=
|
||||||
"<ram:GuidelineSpecifiedDocumentContextParameter>"
|
"<ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||||
@@ -335,7 +353,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ "</rsm:ExchangedDocumentContext>"
|
+ "</rsm:ExchangedDocumentContext>"
|
||||||
+ "<rsm:ExchangedDocument>"
|
+ "<rsm:ExchangedDocument>"
|
||||||
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>"
|
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>"
|
||||||
// + " <ram:Name>RECHNUNG</ram:Name>"
|
// + "<ram:Name>RECHNUNG</ram:Name>"
|
||||||
// + "<ram:TypeCode>380</ram:TypeCode>"
|
// + "<ram:TypeCode>380</ram:TypeCode>"
|
||||||
+ "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
|
+ "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
|
||||||
+ "<ram:IssueDateTime>"
|
+ "<ram:IssueDateTime>"
|
||||||
@@ -397,6 +415,19 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
|
XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
|
||||||
"</ram:Description>";
|
"</ram:Description>";
|
||||||
}
|
}
|
||||||
|
if (currentItem.getProduct().getAttributes() != null) {
|
||||||
|
for ( Entry<String, String> entry : currentItem.getProduct().getAttributes().entrySet() ) {
|
||||||
|
xml += "<ram:ApplicableProductCharacteristic>" +
|
||||||
|
"<ram:Description>" + XMLTools.encodeXML(entry.getKey()) + "</ram:Description>" +
|
||||||
|
"<ram:Value>" + XMLTools.encodeXML(entry.getValue()) + "</ram:Value>" +
|
||||||
|
"</ram:ApplicableProductCharacteristic>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentItem.getProduct().getCountryOfOrigin() != null) {
|
||||||
|
xml += "<ram:OriginTradeCountry><ram:ID>" +
|
||||||
|
XMLTools.encodeXML(currentItem.getProduct().getCountryOfOrigin()) +
|
||||||
|
"</ram:ID></ram:OriginTradeCountry>";
|
||||||
|
}
|
||||||
xml += "</ram:SpecifiedTradeProduct>"
|
xml += "</ram:SpecifiedTradeProduct>"
|
||||||
|
|
||||||
+ "<ram:SpecifiedLineTradeAgreement>";
|
+ "<ram:SpecifiedLineTradeAgreement>";
|
||||||
@@ -422,11 +453,11 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
|
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
|
||||||
+ allowanceChargeStr
|
+ allowanceChargeStr
|
||||||
// + " <AppliedTradeAllowanceCharge>"
|
// + "<AppliedTradeAllowanceCharge>"
|
||||||
// + " <ChargeIndicator>false</ChargeIndicator>"
|
// + "<ChargeIndicator>false</ChargeIndicator>"
|
||||||
// + " <ActualAmount currencyID=\"EUR\">0.6667</ActualAmount>"
|
// + "<ActualAmount currencyID=\"EUR\">0.6667</ActualAmount>"
|
||||||
// + " <Reason>Rabatt</Reason>"
|
// + "<Reason>Rabatt</Reason>"
|
||||||
// + " </AppliedTradeAllowanceCharge>"
|
// + "</AppliedTradeAllowanceCharge>"
|
||||||
+ "</ram:GrossPriceProductTradePrice>";
|
+ "</ram:GrossPriceProductTradePrice>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,53 +516,53 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ getTradePartyAsXML(trans.getSender(), true, false)
|
+ getTradePartyAsXML(trans.getSender(), true, false)
|
||||||
+ "</ram:SellerTradeParty>"
|
+ "</ram:SellerTradeParty>"
|
||||||
+ "<ram:BuyerTradeParty>";
|
+ "<ram:BuyerTradeParty>";
|
||||||
// + " <ID>GE2020211</ID>"
|
// + "<ID>GE2020211</ID>"
|
||||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>"
|
// + "<GlobalID schemeID=\"0088\">4000001987658</GlobalID>"
|
||||||
|
|
||||||
xml += getTradePartyAsXML(trans.getRecipient(), false, false);
|
xml += getTradePartyAsXML(trans.getRecipient(), false, false);
|
||||||
xml += "</ram:BuyerTradeParty>";
|
xml += "</ram:BuyerTradeParty>";
|
||||||
|
|
||||||
if (trans.getSellerOrderReferencedDocumentID() != null) {
|
if (trans.getSellerOrderReferencedDocumentID() != null) {
|
||||||
xml += " <ram:SellerOrderReferencedDocument>"
|
xml += "<ram:SellerOrderReferencedDocument>"
|
||||||
+ " <ram:IssuerAssignedID>"
|
+ "<ram:IssuerAssignedID>"
|
||||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||||
+ " </ram:SellerOrderReferencedDocument>";
|
+ "</ram:SellerOrderReferencedDocument>";
|
||||||
}
|
}
|
||||||
if (trans.getBuyerOrderReferencedDocumentID() != null) {
|
if (trans.getBuyerOrderReferencedDocumentID() != null) {
|
||||||
xml += " <ram:BuyerOrderReferencedDocument>"
|
xml += "<ram:BuyerOrderReferencedDocument>"
|
||||||
+ " <ram:IssuerAssignedID>"
|
+ "<ram:IssuerAssignedID>"
|
||||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||||
+ " </ram:BuyerOrderReferencedDocument>";
|
+ "</ram:BuyerOrderReferencedDocument>";
|
||||||
}
|
}
|
||||||
if (trans.getContractReferencedDocument() != null) {
|
if (trans.getContractReferencedDocument() != null) {
|
||||||
xml += " <ram:ContractReferencedDocument>"
|
xml += "<ram:ContractReferencedDocument>"
|
||||||
+ " <ram:IssuerAssignedID>"
|
+ "<ram:IssuerAssignedID>"
|
||||||
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>"
|
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>"
|
||||||
+ " </ram:ContractReferencedDocument>";
|
+ "</ram:ContractReferencedDocument>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additional Documents of XRechnung (Rechnungsbegruendende Unterlagen - BG-24 XRechnung)
|
// Additional Documents of XRechnung (Rechnungsbegruendende Unterlagen - BG-24 XRechnung)
|
||||||
if (trans.getAdditionalReferencedDocuments() != null) {
|
if (trans.getAdditionalReferencedDocuments() != null) {
|
||||||
for (final FileAttachment f : trans.getAdditionalReferencedDocuments()) {
|
for (final FileAttachment f : trans.getAdditionalReferencedDocuments()) {
|
||||||
final String documentContent = new String(Base64.getEncoder().encodeToString(f.getData()));
|
final String documentContent = new String(Base64.getEncoder().encodeToString(f.getData()));
|
||||||
xml += " <ram:AdditionalReferencedDocument>"
|
xml += "<ram:AdditionalReferencedDocument>"
|
||||||
+ " <ram:IssuerAssignedID>" + f.getFilename() + "</ram:IssuerAssignedID>"
|
+ "<ram:IssuerAssignedID>" + f.getFilename() + "</ram:IssuerAssignedID>"
|
||||||
+ " <ram:TypeCode>916</ram:TypeCode>"
|
+ "<ram:TypeCode>916</ram:TypeCode>"
|
||||||
+ " <ram:Name>" + f.getDescription() + "</ram:Name>"
|
+ "<ram:Name>" + f.getDescription() + "</ram:Name>"
|
||||||
+ " <ram:AttachmentBinaryObject mimeCode=\"" + f.getMimetype() + "\"\n"
|
+ "<ram:AttachmentBinaryObject mimeCode=\"" + f.getMimetype() + "\"\n"
|
||||||
+ " filename=\"" + f.getFilename() + "\">" + documentContent + "</ram:AttachmentBinaryObject>"
|
+ "filename=\"" + f.getFilename() + "\">" + documentContent + "</ram:AttachmentBinaryObject>"
|
||||||
+ " </ram:AdditionalReferencedDocument>";
|
+ "</ram:AdditionalReferencedDocument>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trans.getSpecifiedProcuringProjectID() != null) {
|
if (trans.getSpecifiedProcuringProjectID() != null) {
|
||||||
xml += " <ram:SpecifiedProcuringProject>"
|
xml += "<ram:SpecifiedProcuringProject>"
|
||||||
+ " <ram:ID>"
|
+ "<ram:ID>"
|
||||||
+ XMLTools.encodeXML(trans.getSpecifiedProcuringProjectID()) + "</ram:ID>";
|
+ XMLTools.encodeXML(trans.getSpecifiedProcuringProjectID()) + "</ram:ID>";
|
||||||
if (trans.getSpecifiedProcuringProjectName() != null) {
|
if (trans.getSpecifiedProcuringProjectName() != null) {
|
||||||
xml += " <ram:Name >" + XMLTools.encodeXML(trans.getSpecifiedProcuringProjectName()) + "</ram:Name>";
|
xml += "<ram:Name>" + XMLTools.encodeXML(trans.getSpecifiedProcuringProjectName()) + "</ram:Name>";
|
||||||
}
|
}
|
||||||
xml += " </ram:SpecifiedProcuringProject>";
|
xml += "</ram:SpecifiedProcuringProject>";
|
||||||
}
|
}
|
||||||
xml += "</ram:ApplicableHeaderTradeAgreement>";
|
xml += "</ram:ApplicableHeaderTradeAgreement>";
|
||||||
xml += "<ram:ApplicableHeaderTradeDelivery>";
|
xml += "<ram:ApplicableHeaderTradeDelivery>";
|
||||||
@@ -548,7 +579,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ "<ram:OccurrenceDateTime>";
|
+ "<ram:OccurrenceDateTime>";
|
||||||
xml += DATE.udtFormat(trans.getDeliveryDate());
|
xml += DATE.udtFormat(trans.getDeliveryDate());
|
||||||
xml += "</ram:OccurrenceDateTime>";
|
xml += "</ram:OccurrenceDateTime>";
|
||||||
xml += " </ram:ActualDeliverySupplyChainEvent>";
|
xml += "</ram:ActualDeliverySupplyChainEvent>";
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -567,9 +598,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
xml += "</ram:ApplicableHeaderTradeDelivery>";
|
xml += "</ram:ApplicableHeaderTradeDelivery>";
|
||||||
xml += "<ram:ApplicableHeaderTradeSettlement>";
|
xml += "<ram:ApplicableHeaderTradeSettlement>";
|
||||||
if ((trans.getNumber() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
|
if ((trans.getNumber() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
|
||||||
xml += " <ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>";
|
xml += "<ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>";
|
||||||
}
|
}
|
||||||
xml += " <ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>";
|
xml += "<ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>";
|
||||||
|
|
||||||
if (trans.getTradeSettlementPayment() != null) {
|
if (trans.getTradeSettlementPayment() != null) {
|
||||||
for (final IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
|
for (final IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
|
||||||
@@ -631,40 +662,87 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((trans.getZFCharges() != null) && (trans.getZFCharges().length > 0)) {
|
if ((trans.getZFCharges() != null) && (trans.getZFCharges().length > 0)) {
|
||||||
|
if (profile == Profiles.getByName("XRechnung")) {
|
||||||
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
for(IZUGFeRDAllowanceCharge charge : trans.getZFCharges()) {
|
||||||
if (calc.getChargesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
||||||
xml += " <ram:SpecifiedTradeAllowanceCharge>" +
|
|
||||||
"<ram:ChargeIndicator>" +
|
"<ram:ChargeIndicator>" +
|
||||||
"<udt:Indicator>true</udt:Indicator>" +
|
"<udt:Indicator>true</udt:Indicator>" +
|
||||||
"</ram:ChargeIndicator>" +
|
"</ram:ChargeIndicator>" +
|
||||||
"<ram:ActualAmount>" + currencyFormat(calc.getChargesForPercent(currentTaxPercent)) + "</ram:ActualAmount>" +
|
"<ram:ActualAmount>" + currencyFormat(charge.getTotalAmount(calc)) + "</ram:ActualAmount>";
|
||||||
"<ram:Reason>" + XMLTools.encodeXML(calc.getChargeReasonForPercent(currentTaxPercent)) + "</ram:Reason>" +
|
if (charge.getReason() != null) {
|
||||||
"<ram:CategoryTradeTax>" +
|
xml += "<ram:Reason>" + XMLTools.encodeXML(charge.getReason()) + "</ram:Reason>";
|
||||||
|
}
|
||||||
|
if (charge.getReasonCode() != null) {
|
||||||
|
xml += "<ram:ReasonCode>" + charge.getReasonCode() + "</ram:ReasonCode>";
|
||||||
|
}
|
||||||
|
xml += "<ram:CategoryTradeTax>" +
|
||||||
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
||||||
"<ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
"<ram:CategoryCode>" + charge.getCategoryCode() + "</ram:CategoryCode>";
|
||||||
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
if (charge.getTaxPercent() != null) {
|
||||||
"</ram:CategoryTradeTax>" +
|
xml += "<ram:RateApplicablePercent>" + vatFormat(charge.getTaxPercent()) + "</ram:RateApplicablePercent>";
|
||||||
"</ram:SpecifiedTradeAllowanceCharge> ";
|
}
|
||||||
|
xml += "</ram:CategoryTradeTax>" +
|
||||||
|
"</ram:SpecifiedTradeAllowanceCharge>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||||
|
if (calc.getChargesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
||||||
|
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
||||||
|
"<ram:ChargeIndicator>" +
|
||||||
|
"<udt:Indicator>true</udt:Indicator>" +
|
||||||
|
"</ram:ChargeIndicator>" +
|
||||||
|
"<ram:ActualAmount>" + currencyFormat(calc.getChargesForPercent(currentTaxPercent)) + "</ram:ActualAmount>" +
|
||||||
|
"<ram:Reason>" + XMLTools.encodeXML(calc.getChargeReasonForPercent(currentTaxPercent)) + "</ram:Reason>" +
|
||||||
|
"<ram:CategoryTradeTax>" +
|
||||||
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
||||||
|
"<ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
||||||
|
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
||||||
|
"</ram:CategoryTradeTax>" +
|
||||||
|
"</ram:SpecifiedTradeAllowanceCharge>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((trans.getZFAllowances() != null) && (trans.getZFAllowances().length > 0)) {
|
if ((trans.getZFAllowances() != null) && (trans.getZFAllowances().length > 0)) {
|
||||||
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
if (profile == Profiles.getByName("XRechnung")) {
|
||||||
if (calc.getAllowancesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
for(IZUGFeRDAllowanceCharge allowance : trans.getZFAllowances()) {
|
||||||
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
||||||
"<ram:ChargeIndicator>" +
|
"<ram:ChargeIndicator>" +
|
||||||
"<udt:Indicator>false</udt:Indicator>" +
|
"<udt:Indicator>false</udt:Indicator>" +
|
||||||
"</ram:ChargeIndicator>" +
|
"</ram:ChargeIndicator>" +
|
||||||
"<ram:ActualAmount>" + currencyFormat(calc.getAllowancesForPercent(currentTaxPercent)) + "</ram:ActualAmount>" +
|
"<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(calc)) + "</ram:ActualAmount>";
|
||||||
"<ram:Reason>" + XMLTools.encodeXML(calc.getAllowanceReasonForPercent(currentTaxPercent)) + "</ram:Reason>" +
|
if (allowance.getReason() != null) {
|
||||||
"<ram:CategoryTradeTax>" +
|
xml += "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
||||||
|
}
|
||||||
|
if (allowance.getReasonCode() != null) {
|
||||||
|
xml += "<ram:ReasonCode>" + allowance.getReasonCode() + "</ram:ReasonCode>";
|
||||||
|
}
|
||||||
|
xml += "<ram:CategoryTradeTax>" +
|
||||||
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
||||||
"<ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
"<ram:CategoryCode>" + allowance.getCategoryCode() + "</ram:CategoryCode>";
|
||||||
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
if (allowance.getTaxPercent() != null) {
|
||||||
"</ram:CategoryTradeTax>" +
|
xml += "<ram:RateApplicablePercent>" + vatFormat(allowance.getTaxPercent()) + "</ram:RateApplicablePercent>";
|
||||||
"</ram:SpecifiedTradeAllowanceCharge> ";
|
}
|
||||||
|
xml += "</ram:CategoryTradeTax>" +
|
||||||
|
"</ram:SpecifiedTradeAllowanceCharge>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||||
|
if (calc.getAllowancesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
||||||
|
xml += "<ram:SpecifiedTradeAllowanceCharge>" +
|
||||||
|
"<ram:ChargeIndicator>" +
|
||||||
|
"<udt:Indicator>false</udt:Indicator>" +
|
||||||
|
"</ram:ChargeIndicator>" +
|
||||||
|
"<ram:ActualAmount>" + currencyFormat(calc.getAllowancesForPercent(currentTaxPercent)) + "</ram:ActualAmount>" +
|
||||||
|
"<ram:Reason>" + XMLTools.encodeXML(calc.getAllowanceReasonForPercent(currentTaxPercent)) + "</ram:Reason>" +
|
||||||
|
"<ram:CategoryTradeTax>" +
|
||||||
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
||||||
|
"<ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
||||||
|
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
||||||
|
"</ram:CategoryTradeTax>" +
|
||||||
|
"</ram:SpecifiedTradeAllowanceCharge>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -722,31 +800,31 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
// //
|
// //
|
||||||
// currencyID=\"EUR\"
|
// currencyID=\"EUR\"
|
||||||
if (getProfile() != Profiles.getByName("Minimum")) {
|
if (getProfile() != Profiles.getByName("Minimum")) {
|
||||||
xml += " <ram:TotalPrepaidAmount>" + currencyFormat(calc.getTotalPrepaid()) + "</ram:TotalPrepaidAmount>";
|
xml += "<ram:TotalPrepaidAmount>" + currencyFormat(calc.getTotalPrepaid()) + "</ram:TotalPrepaidAmount>";
|
||||||
}
|
}
|
||||||
xml += "<ram:DuePayableAmount>" + currencyFormat(calc.getGrandTotal().subtract(calc.getTotalPrepaid())) + "</ram:DuePayableAmount>"
|
xml += "<ram:DuePayableAmount>" + currencyFormat(calc.getGrandTotal().subtract(calc.getTotalPrepaid())) + "</ram:DuePayableAmount>"
|
||||||
+ "</ram:SpecifiedTradeSettlementHeaderMonetarySummation>";
|
+ "</ram:SpecifiedTradeSettlementHeaderMonetarySummation>";
|
||||||
if (trans.getInvoiceReferencedDocumentID() != null) {
|
if (trans.getInvoiceReferencedDocumentID() != null) {
|
||||||
xml += " <ram:InvoiceReferencedDocument>"
|
xml += "<ram:InvoiceReferencedDocument>"
|
||||||
+ " <ram:IssuerAssignedID>"
|
+ "<ram:IssuerAssignedID>"
|
||||||
+ XMLTools.encodeXML(trans.getInvoiceReferencedDocumentID()) + "</ram:IssuerAssignedID>";
|
+ XMLTools.encodeXML(trans.getInvoiceReferencedDocumentID()) + "</ram:IssuerAssignedID>";
|
||||||
if (trans.getInvoiceReferencedIssueDate() != null) {
|
if (trans.getInvoiceReferencedIssueDate() != null) {
|
||||||
xml += "<ram:FormattedIssueDateTime>"
|
xml += "<ram:FormattedIssueDateTime>"
|
||||||
+ DATE.qdtFormat(trans.getInvoiceReferencedIssueDate())
|
+ DATE.qdtFormat(trans.getInvoiceReferencedIssueDate())
|
||||||
+ "</ram:FormattedIssueDateTime>";
|
+ "</ram:FormattedIssueDateTime>";
|
||||||
}
|
}
|
||||||
xml += " </ram:InvoiceReferencedDocument>";
|
xml += "</ram:InvoiceReferencedDocument>";
|
||||||
}
|
}
|
||||||
|
|
||||||
xml += "</ram:ApplicableHeaderTradeSettlement>";
|
xml += "</ram:ApplicableHeaderTradeSettlement>";
|
||||||
// + " <IncludedSupplyChainTradeLineItem>\n"
|
// + "<IncludedSupplyChainTradeLineItem>\n"
|
||||||
// + " <AssociatedDocumentLineDocument>\n"
|
// + "<AssociatedDocumentLineDocument>\n"
|
||||||
// + " <IncludedNote>\n"
|
// + "<IncludedNote>\n"
|
||||||
// + " <Content>Wir erlauben uns Ihnen folgende Positionen aus der Lieferung Nr.
|
// + "<Content>Wir erlauben uns Ihnen folgende Positionen aus der Lieferung Nr.
|
||||||
// 2013-51112 in Rechnung zu stellen:</Content>\n"
|
// 2013-51112 in Rechnung zu stellen:</Content>\n"
|
||||||
// + " </IncludedNote>\n"
|
// + "</IncludedNote>\n"
|
||||||
// + " </AssociatedDocumentLineDocument>\n"
|
// + "</AssociatedDocumentLineDocument>\n"
|
||||||
// + " </IncludedSupplyChainTradeLineItem>\n";
|
// + "</IncludedSupplyChainTradeLineItem>\n";
|
||||||
|
|
||||||
xml += "</rsm:SupplyChainTradeTransaction>"
|
xml += "</rsm:SupplyChainTradeTransaction>"
|
||||||
+ "</rsm:CrossIndustryInvoice>";
|
+ "</rsm:CrossIndustryInvoice>";
|
||||||
|
|||||||
@@ -357,6 +357,7 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
|||||||
boolean isCharge = true;
|
boolean isCharge = true;
|
||||||
String chargeAmount = null;
|
String chargeAmount = null;
|
||||||
String reason = null;
|
String reason = null;
|
||||||
|
String reasonCode = null;
|
||||||
String taxPercent = null;
|
String taxPercent = null;
|
||||||
for (int chargeChildIndex = 0; chargeChildIndex < chargeNodeChilds.getLength(); chargeChildIndex++) {
|
for (int chargeChildIndex = 0; chargeChildIndex < chargeNodeChilds.getLength(); chargeChildIndex++) {
|
||||||
String chargeChildName = chargeNodeChilds.item(chargeChildIndex).getLocalName();
|
String chargeChildName = chargeNodeChilds.item(chargeChildIndex).getLocalName();
|
||||||
@@ -377,6 +378,8 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
|||||||
chargeAmount = chargeNodeChilds.item(chargeChildIndex).getTextContent();
|
chargeAmount = chargeNodeChilds.item(chargeChildIndex).getTextContent();
|
||||||
} else if (chargeChildName.equals("Reason")) {
|
} else if (chargeChildName.equals("Reason")) {
|
||||||
reason = chargeNodeChilds.item(chargeChildIndex).getTextContent();
|
reason = chargeNodeChilds.item(chargeChildIndex).getTextContent();
|
||||||
|
} else if (chargeChildName.equals("ReasonCode")) {
|
||||||
|
reasonCode = chargeNodeChilds.item(chargeChildIndex).getTextContent();
|
||||||
} else if (chargeChildName.equals("CategoryTradeTax")) {
|
} else if (chargeChildName.equals("CategoryTradeTax")) {
|
||||||
NodeList taxChilds = chargeNodeChilds.item(chargeChildIndex).getChildNodes();
|
NodeList taxChilds = chargeNodeChilds.item(chargeChildIndex).getChildNodes();
|
||||||
for (int taxChildIndex = 0; taxChildIndex < taxChilds.getLength(); taxChildIndex++) {
|
for (int taxChildIndex = 0; taxChildIndex < taxChilds.getLength(); taxChildIndex++) {
|
||||||
@@ -395,16 +398,21 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
|||||||
if (reason != null) {
|
if (reason != null) {
|
||||||
c.setReason(reason);
|
c.setReason(reason);
|
||||||
}
|
}
|
||||||
|
if (reasonCode != null) {
|
||||||
|
c.setReasonCode(reasonCode);
|
||||||
|
}
|
||||||
if (taxPercent != null) {
|
if (taxPercent != null) {
|
||||||
c.setTaxPercent(new BigDecimal(taxPercent));
|
c.setTaxPercent(new BigDecimal(taxPercent));
|
||||||
}
|
}
|
||||||
|
|
||||||
zpp.addCharge(c);
|
zpp.addCharge(c);
|
||||||
} else {
|
} else {
|
||||||
Allowance a = new Allowance(new BigDecimal(chargeAmount));
|
Allowance a = new Allowance(new BigDecimal(chargeAmount));
|
||||||
if (reason != null) {
|
if (reason != null) {
|
||||||
a.setReason(reason);
|
a.setReason(reason);
|
||||||
}
|
}
|
||||||
|
if (reasonCode != null) {
|
||||||
|
a.setReasonCode(reasonCode);
|
||||||
|
}
|
||||||
if (taxPercent != null) {
|
if (taxPercent != null) {
|
||||||
a.setTaxPercent(new BigDecimal(taxPercent));
|
a.setTaxPercent(new BigDecimal(taxPercent));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ public class ZUGFeRDVisualizer {
|
|||||||
|
|
||||||
FOUserAgent userAgent = fopFactory.newFOUserAgent();
|
FOUserAgent userAgent = fopFactory.newFOUserAgent();
|
||||||
|
|
||||||
userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");
|
userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-3b");
|
||||||
|
|
||||||
// Step 2: Set up output stream.
|
// Step 2: Set up output stream.
|
||||||
// Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
|
// Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.math.BigDecimal;
|
|||||||
public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
|
public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
private String reason;
|
private String reason;
|
||||||
|
private String reasonCode;
|
||||||
private BigDecimal taxPercent;
|
private BigDecimal taxPercent;
|
||||||
boolean isCharge=true;
|
boolean isCharge=true;
|
||||||
|
|
||||||
@@ -36,6 +37,11 @@ public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
|
|||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getReasonCode() {
|
||||||
|
return reasonCode;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal getTaxPercent() {
|
public BigDecimal getTaxPercent() {
|
||||||
return taxPercent;
|
return taxPercent;
|
||||||
@@ -61,6 +67,11 @@ public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDAllowanceChargeImpl setReasonCode(String reasonCode) {
|
||||||
|
this.reasonCode = reasonCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public IZUGFeRDAllowanceChargeImpl setTaxPercent(BigDecimal taxPercent) {
|
public IZUGFeRDAllowanceChargeImpl setTaxPercent(BigDecimal taxPercent) {
|
||||||
this.taxPercent = taxPercent;
|
this.taxPercent = taxPercent;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
8
pom.xml
8
pom.xml
@@ -63,8 +63,7 @@
|
|||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>3.0.0-M1</version>
|
<version>3.0.0-M1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo
|
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
|
||||||
</altDeploymentRepository>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
@@ -82,6 +81,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>3.3.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<runOrder>alphabetical</runOrder>
|
<runOrder>alphabetical</runOrder>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -90,9 +90,6 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<version>3.2.1</version>
|
<version>3.2.1</version>
|
||||||
<configuration>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>attach-javadoc</id>
|
<id>attach-javadoc</id>
|
||||||
@@ -118,7 +115,6 @@
|
|||||||
<github.global.server>github</github.global.server>
|
<github.global.server>github</github.global.server>
|
||||||
<additionalparam>-Xdoclint:none</additionalparam>
|
<additionalparam>-Xdoclint:none</additionalparam>
|
||||||
<!-- Skip error check for javadoc -->
|
<!-- Skip error check for javadoc -->
|
||||||
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
|
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<maven.deploy.skip>true</maven.deploy.skip><!-- prevent this to be deployed to maven central as "core",
|
<maven.deploy.skip>true</maven.deploy.skip><!-- prevent this to be deployed to maven central as "core",
|
||||||
|
|||||||
@@ -6,12 +6,10 @@
|
|||||||
<version>2.13.0-SNAPSHOT</version>
|
<version>2.13.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject</groupId>
|
|
||||||
<artifactId>validator</artifactId>
|
<artifactId>validator</artifactId>
|
||||||
<name>Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung)</name>
|
<name>Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung)</name>
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>2.13.0-SNAPSHOT</version>
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<!-- for jargs -->
|
<!-- for jargs -->
|
||||||
@@ -27,18 +25,15 @@
|
|||||||
</repositories>
|
</repositories>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.deploy.skip>false
|
<maven.deploy.skip>false</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
|
||||||
</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
|
|
||||||
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
|
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>library</artifactId>
|
<artifactId>library</artifactId>
|
||||||
<version>2.13.0-SNAPSHOT</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.xml.bind</groupId>
|
<groupId>jakarta.xml.bind</groupId>
|
||||||
@@ -134,12 +129,6 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptorRefs>
|
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
|
||||||
</descriptorRefs>
|
|
||||||
<!-- http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
|
|
||||||
mvn clean compile assembly:single -->
|
|
||||||
<!-- or whatever version you use -->
|
|
||||||
<source>11</source>
|
<source>11</source>
|
||||||
<target>11</target>
|
<target>11</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -163,24 +152,12 @@
|
|||||||
<exclude>META-INF/*.RSA</exclude>
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
<filter>
|
|
||||||
<artifact>log4j:log4j</artifact>
|
|
||||||
<includes>
|
|
||||||
<include>**</include>
|
|
||||||
</includes>
|
|
||||||
</filter>
|
|
||||||
<filter>
|
<filter>
|
||||||
<artifact>commons-logging:commons-logging</artifact>
|
<artifact>commons-logging:commons-logging</artifact>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**</include>
|
<include>**</include>
|
||||||
</includes>
|
</includes>
|
||||||
</filter>
|
</filter>
|
||||||
<filter>
|
|
||||||
<artifact>com.sun.xml.bind:jaxb-impl</artifact>
|
|
||||||
<includes>
|
|
||||||
<include>**</include>
|
|
||||||
</includes>
|
|
||||||
</filter>
|
|
||||||
</filters>
|
</filters>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
|||||||
Reference in New Issue
Block a user