Merge branch 'master' of github.com:ZUGFeRD/mustangproject
# Conflicts: # Mustang-CLI/pom.xml # library/pom.xml # validator/pom.xml
This commit is contained in:
@@ -7,9 +7,7 @@
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>library</artifactId>
|
||||
<version>2.13.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
|
||||
@@ -46,11 +44,9 @@
|
||||
<github.global.server>github</github.global.server>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
<!-- Skip error check for javadoc -->
|
||||
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<maven.deploy.skip>true
|
||||
</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
|
||||
<maven.deploy.skip>true</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
|
||||
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -169,12 +165,6 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<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>
|
||||
<target>11</target>
|
||||
</configuration>
|
||||
@@ -233,10 +223,8 @@
|
||||
<version>3.5.3</version>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<minimizeJar>false
|
||||
</minimizeJar><!-- no longer java 11 compatible if set to true because it removes e.g. javax/xml/bind/annotation/XmlSchema-->
|
||||
<minimizeJar>false</minimizeJar><!-- no longer java 11 compatible if set to true because it removes e.g. javax/xml/bind/annotation/XmlSchema-->
|
||||
<filters>
|
||||
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
@@ -245,12 +233,6 @@
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>log4j:log4j</artifact>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>commons-logging:commons-logging</artifact>
|
||||
<includes>
|
||||
@@ -268,9 +250,6 @@
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<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>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
|
||||
@@ -26,6 +26,10 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
||||
* a simple human readable description
|
||||
*/
|
||||
protected String reason;
|
||||
/**
|
||||
* Code from list UNTDID 5189
|
||||
*/
|
||||
protected String reasonCode;
|
||||
/**
|
||||
* 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
|
||||
public BigDecimal getTotalAmount(IAbsoluteValueProvider currentItem) {
|
||||
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
|
||||
* @return fluid setter
|
||||
*/
|
||||
|
||||
@@ -60,6 +60,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
String vatPercent = null;
|
||||
String lineTotal = "0";
|
||||
String unitCode = "0";
|
||||
String referencedLineID = 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
|
||||
.item(tradeLineChildIndex).getLocalName().equals("NetPriceProductTradePrice")) {
|
||||
NodeList netChilds = tradeLineChilds.item(tradeLineChildIndex).getChildNodes();
|
||||
@@ -263,6 +274,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
addReferencedDocument(rdoc);
|
||||
}
|
||||
}
|
||||
addReferencedLineID( referencedLineID );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
/***
|
||||
* 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 isIntraCommunitySupply = false;
|
||||
protected SchemedID globalId = null;
|
||||
protected String countryOfOrigin = null;
|
||||
protected HashMap<String, String> attributes = null;
|
||||
|
||||
/***
|
||||
* default constructor
|
||||
@@ -63,6 +66,7 @@ public class Product implements IZUGFeRDExportableProduct {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getSellerAssignedID() {
|
||||
return sellerAssignedID;
|
||||
}
|
||||
@@ -77,6 +81,7 @@ public class Product implements IZUGFeRDExportableProduct {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBuyerAssignedID() {
|
||||
return buyerAssignedID;
|
||||
}
|
||||
@@ -183,4 +188,32 @@ public class Product implements IZUGFeRDExportableProduct {
|
||||
this.VATPercent = VATPercent;
|
||||
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();
|
||||
|
||||
/***
|
||||
* get the code for the allowance/charge
|
||||
* @return the code
|
||||
*/
|
||||
String getReasonCode();
|
||||
|
||||
/***
|
||||
* get the applicable tax percentage for the allowance/charge
|
||||
* @return the percentage
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
|
||||
|
||||
@@ -156,4 +157,12 @@ public interface IZUGFeRDExportableProduct {
|
||||
}
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -140,7 +141,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
if (party.getLegalOrganisation() != null) {
|
||||
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>";
|
||||
}
|
||||
|
||||
@@ -243,10 +244,16 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
// 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 allowanceChargeStr = "<ram:AppliedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
|
||||
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
||||
"<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
||||
reason +
|
||||
reasonCode +
|
||||
"</ram:AppliedTradeAllowanceCharge>";
|
||||
return allowanceChargeStr;
|
||||
}
|
||||
@@ -268,10 +275,21 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
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>" +
|
||||
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
||||
"<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
||||
"<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>" +
|
||||
reason +
|
||||
reasonCode +
|
||||
"</ram:SpecifiedTradeAllowanceCharge>";
|
||||
return itemTotalAllowanceChargeStr;
|
||||
}
|
||||
@@ -324,9 +342,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
//
|
||||
|
||||
if (getProfile() == Profiles.getByName("XRechnung")) {
|
||||
xml += " <ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
|
||||
+ " <ram:ID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</ram:ID>\n"
|
||||
+ " </ram:BusinessProcessSpecifiedDocumentContextParameter>\n";
|
||||
xml += "<ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
|
||||
+ "<ram:ID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</ram:ID>\n"
|
||||
+ "</ram:BusinessProcessSpecifiedDocumentContextParameter>\n";
|
||||
}
|
||||
xml +=
|
||||
"<ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||
@@ -335,7 +353,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ "</rsm:ExchangedDocumentContext>"
|
||||
+ "<rsm:ExchangedDocument>"
|
||||
+ "<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>" + typecode + "</ram:TypeCode>"
|
||||
+ "<ram:IssueDateTime>"
|
||||
@@ -397,6 +415,19 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
|
||||
"</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>"
|
||||
|
||||
+ "<ram:SpecifiedLineTradeAgreement>";
|
||||
@@ -422,11 +453,11 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
|
||||
+ allowanceChargeStr
|
||||
// + " <AppliedTradeAllowanceCharge>"
|
||||
// + " <ChargeIndicator>false</ChargeIndicator>"
|
||||
// + " <ActualAmount currencyID=\"EUR\">0.6667</ActualAmount>"
|
||||
// + " <Reason>Rabatt</Reason>"
|
||||
// + " </AppliedTradeAllowanceCharge>"
|
||||
// + "<AppliedTradeAllowanceCharge>"
|
||||
// + "<ChargeIndicator>false</ChargeIndicator>"
|
||||
// + "<ActualAmount currencyID=\"EUR\">0.6667</ActualAmount>"
|
||||
// + "<Reason>Rabatt</Reason>"
|
||||
// + "</AppliedTradeAllowanceCharge>"
|
||||
+ "</ram:GrossPriceProductTradePrice>";
|
||||
}
|
||||
|
||||
@@ -485,53 +516,53 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ getTradePartyAsXML(trans.getSender(), true, false)
|
||||
+ "</ram:SellerTradeParty>"
|
||||
+ "<ram:BuyerTradeParty>";
|
||||
// + " <ID>GE2020211</ID>"
|
||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>"
|
||||
// + "<ID>GE2020211</ID>"
|
||||
// + "<GlobalID schemeID=\"0088\">4000001987658</GlobalID>"
|
||||
|
||||
xml += getTradePartyAsXML(trans.getRecipient(), false, false);
|
||||
xml += "</ram:BuyerTradeParty>";
|
||||
|
||||
if (trans.getSellerOrderReferencedDocumentID() != null) {
|
||||
xml += " <ram:SellerOrderReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
xml += "<ram:SellerOrderReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:SellerOrderReferencedDocument>";
|
||||
+ "</ram:SellerOrderReferencedDocument>";
|
||||
}
|
||||
if (trans.getBuyerOrderReferencedDocumentID() != null) {
|
||||
xml += " <ram:BuyerOrderReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
xml += "<ram:BuyerOrderReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:BuyerOrderReferencedDocument>";
|
||||
+ "</ram:BuyerOrderReferencedDocument>";
|
||||
}
|
||||
if (trans.getContractReferencedDocument() != null) {
|
||||
xml += " <ram:ContractReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
xml += "<ram:ContractReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:ContractReferencedDocument>";
|
||||
+ "</ram:ContractReferencedDocument>";
|
||||
}
|
||||
|
||||
// Additional Documents of XRechnung (Rechnungsbegruendende Unterlagen - BG-24 XRechnung)
|
||||
if (trans.getAdditionalReferencedDocuments() != null) {
|
||||
for (final FileAttachment f : trans.getAdditionalReferencedDocuments()) {
|
||||
final String documentContent = new String(Base64.getEncoder().encodeToString(f.getData()));
|
||||
xml += " <ram:AdditionalReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>" + f.getFilename() + "</ram:IssuerAssignedID>"
|
||||
+ " <ram:TypeCode>916</ram:TypeCode>"
|
||||
+ " <ram:Name>" + f.getDescription() + "</ram:Name>"
|
||||
+ " <ram:AttachmentBinaryObject mimeCode=\"" + f.getMimetype() + "\"\n"
|
||||
+ " filename=\"" + f.getFilename() + "\">" + documentContent + "</ram:AttachmentBinaryObject>"
|
||||
+ " </ram:AdditionalReferencedDocument>";
|
||||
xml += "<ram:AdditionalReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>" + f.getFilename() + "</ram:IssuerAssignedID>"
|
||||
+ "<ram:TypeCode>916</ram:TypeCode>"
|
||||
+ "<ram:Name>" + f.getDescription() + "</ram:Name>"
|
||||
+ "<ram:AttachmentBinaryObject mimeCode=\"" + f.getMimetype() + "\"\n"
|
||||
+ "filename=\"" + f.getFilename() + "\">" + documentContent + "</ram:AttachmentBinaryObject>"
|
||||
+ "</ram:AdditionalReferencedDocument>";
|
||||
}
|
||||
}
|
||||
|
||||
if (trans.getSpecifiedProcuringProjectID() != null) {
|
||||
xml += " <ram:SpecifiedProcuringProject>"
|
||||
+ " <ram:ID>"
|
||||
xml += "<ram:SpecifiedProcuringProject>"
|
||||
+ "<ram:ID>"
|
||||
+ XMLTools.encodeXML(trans.getSpecifiedProcuringProjectID()) + "</ram:ID>";
|
||||
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:ApplicableHeaderTradeDelivery>";
|
||||
@@ -548,7 +579,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ "<ram:OccurrenceDateTime>";
|
||||
xml += DATE.udtFormat(trans.getDeliveryDate());
|
||||
xml += "</ram:OccurrenceDateTime>";
|
||||
xml += " </ram:ActualDeliverySupplyChainEvent>";
|
||||
xml += "</ram:ActualDeliverySupplyChainEvent>";
|
||||
|
||||
}
|
||||
/*
|
||||
@@ -567,9 +598,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
xml += "</ram:ApplicableHeaderTradeDelivery>";
|
||||
xml += "<ram:ApplicableHeaderTradeSettlement>";
|
||||
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) {
|
||||
for (final IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
|
||||
@@ -631,40 +662,87 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
if ((trans.getZFCharges() != null) && (trans.getZFCharges().length > 0)) {
|
||||
|
||||
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||
if (calc.getChargesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
||||
xml += " <ram:SpecifiedTradeAllowanceCharge>" +
|
||||
if (profile == Profiles.getByName("XRechnung")) {
|
||||
for(IZUGFeRDAllowanceCharge charge : trans.getZFCharges()) {
|
||||
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:ActualAmount>" + currencyFormat(charge.getTotalAmount(calc)) + "</ram:ActualAmount>";
|
||||
if (charge.getReason() != null) {
|
||||
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:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
||||
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
||||
"</ram:CategoryTradeTax>" +
|
||||
"</ram:SpecifiedTradeAllowanceCharge> ";
|
||||
"<ram:CategoryCode>" + charge.getCategoryCode() + "</ram:CategoryCode>";
|
||||
if (charge.getTaxPercent() != null) {
|
||||
xml += "<ram:RateApplicablePercent>" + vatFormat(charge.getTaxPercent()) + "</ram:RateApplicablePercent>";
|
||||
}
|
||||
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)) {
|
||||
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||
if (calc.getAllowancesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
||||
if (profile == Profiles.getByName("XRechnung")) {
|
||||
for(IZUGFeRDAllowanceCharge allowance : trans.getZFAllowances()) {
|
||||
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:ActualAmount>" + currencyFormat(allowance.getTotalAmount(calc)) + "</ram:ActualAmount>";
|
||||
if (allowance.getReason() != null) {
|
||||
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:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
||||
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
||||
"</ram:CategoryTradeTax>" +
|
||||
"</ram:SpecifiedTradeAllowanceCharge> ";
|
||||
"<ram:CategoryCode>" + allowance.getCategoryCode() + "</ram:CategoryCode>";
|
||||
if (allowance.getTaxPercent() != null) {
|
||||
xml += "<ram:RateApplicablePercent>" + vatFormat(allowance.getTaxPercent()) + "</ram:RateApplicablePercent>";
|
||||
}
|
||||
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\"
|
||||
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>"
|
||||
+ "</ram:SpecifiedTradeSettlementHeaderMonetarySummation>";
|
||||
if (trans.getInvoiceReferencedDocumentID() != null) {
|
||||
xml += " <ram:InvoiceReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
xml += "<ram:InvoiceReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getInvoiceReferencedDocumentID()) + "</ram:IssuerAssignedID>";
|
||||
if (trans.getInvoiceReferencedIssueDate() != null) {
|
||||
xml += "<ram:FormattedIssueDateTime>"
|
||||
+ DATE.qdtFormat(trans.getInvoiceReferencedIssueDate())
|
||||
+ "</ram:FormattedIssueDateTime>";
|
||||
}
|
||||
xml += " </ram:InvoiceReferencedDocument>";
|
||||
xml += "</ram:InvoiceReferencedDocument>";
|
||||
}
|
||||
|
||||
xml += "</ram:ApplicableHeaderTradeSettlement>";
|
||||
// + " <IncludedSupplyChainTradeLineItem>\n"
|
||||
// + " <AssociatedDocumentLineDocument>\n"
|
||||
// + " <IncludedNote>\n"
|
||||
// + " <Content>Wir erlauben uns Ihnen folgende Positionen aus der Lieferung Nr.
|
||||
// + "<IncludedSupplyChainTradeLineItem>\n"
|
||||
// + "<AssociatedDocumentLineDocument>\n"
|
||||
// + "<IncludedNote>\n"
|
||||
// + "<Content>Wir erlauben uns Ihnen folgende Positionen aus der Lieferung Nr.
|
||||
// 2013-51112 in Rechnung zu stellen:</Content>\n"
|
||||
// + " </IncludedNote>\n"
|
||||
// + " </AssociatedDocumentLineDocument>\n"
|
||||
// + " </IncludedSupplyChainTradeLineItem>\n";
|
||||
// + "</IncludedNote>\n"
|
||||
// + "</AssociatedDocumentLineDocument>\n"
|
||||
// + "</IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
xml += "</rsm:SupplyChainTradeTransaction>"
|
||||
+ "</rsm:CrossIndustryInvoice>";
|
||||
|
||||
@@ -357,6 +357,7 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
||||
boolean isCharge = true;
|
||||
String chargeAmount = null;
|
||||
String reason = null;
|
||||
String reasonCode = null;
|
||||
String taxPercent = null;
|
||||
for (int chargeChildIndex = 0; chargeChildIndex < chargeNodeChilds.getLength(); chargeChildIndex++) {
|
||||
String chargeChildName = chargeNodeChilds.item(chargeChildIndex).getLocalName();
|
||||
@@ -377,6 +378,8 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
||||
chargeAmount = chargeNodeChilds.item(chargeChildIndex).getTextContent();
|
||||
} else if (chargeChildName.equals("Reason")) {
|
||||
reason = chargeNodeChilds.item(chargeChildIndex).getTextContent();
|
||||
} else if (chargeChildName.equals("ReasonCode")) {
|
||||
reasonCode = chargeNodeChilds.item(chargeChildIndex).getTextContent();
|
||||
} else if (chargeChildName.equals("CategoryTradeTax")) {
|
||||
NodeList taxChilds = chargeNodeChilds.item(chargeChildIndex).getChildNodes();
|
||||
for (int taxChildIndex = 0; taxChildIndex < taxChilds.getLength(); taxChildIndex++) {
|
||||
@@ -395,16 +398,21 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
||||
if (reason != null) {
|
||||
c.setReason(reason);
|
||||
}
|
||||
if (reasonCode != null) {
|
||||
c.setReasonCode(reasonCode);
|
||||
}
|
||||
if (taxPercent != null) {
|
||||
c.setTaxPercent(new BigDecimal(taxPercent));
|
||||
}
|
||||
|
||||
zpp.addCharge(c);
|
||||
} else {
|
||||
Allowance a = new Allowance(new BigDecimal(chargeAmount));
|
||||
if (reason != null) {
|
||||
a.setReason(reason);
|
||||
}
|
||||
if (reasonCode != null) {
|
||||
a.setReasonCode(reasonCode);
|
||||
}
|
||||
if (taxPercent != null) {
|
||||
a.setTaxPercent(new BigDecimal(taxPercent));
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public class ZUGFeRDVisualizer {
|
||||
|
||||
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.
|
||||
// Note: Using BufferedOutputStream for performance reasons (helpful with FileOutputStreams).
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.math.BigDecimal;
|
||||
public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
|
||||
private BigDecimal totalAmount;
|
||||
private String reason;
|
||||
private String reasonCode;
|
||||
private BigDecimal taxPercent;
|
||||
boolean isCharge=true;
|
||||
|
||||
@@ -36,6 +37,11 @@ public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
|
||||
return reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReasonCode() {
|
||||
return reasonCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getTaxPercent() {
|
||||
return taxPercent;
|
||||
@@ -61,6 +67,11 @@ public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
|
||||
return this;
|
||||
}
|
||||
|
||||
public IZUGFeRDAllowanceChargeImpl setReasonCode(String reasonCode) {
|
||||
this.reasonCode = reasonCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IZUGFeRDAllowanceChargeImpl setTaxPercent(BigDecimal taxPercent) {
|
||||
this.taxPercent = taxPercent;
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user