|
|
|
@@ -134,7 +134,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((party.getGlobalIDScheme() != null) && (party.getGlobalID() != null)) {
|
|
|
|
if ((party.getGlobalIDScheme() != null) && (party.getGlobalID() != null)) {
|
|
|
|
xml += "<ram:GlobalID schemeID=\"" + XMLTools.encodeXML(party.getGlobalIDScheme()) + "\">"
|
|
|
|
xml += "<ram:GlobalID schemeID=\"" + XMLTools.encodeXML(party.getGlobalIDScheme()) + "\">"
|
|
|
|
+ XMLTools.encodeXML(party.getGlobalID()) + "</ram:GlobalID>";
|
|
|
|
+ XMLTools.encodeXML(party.getGlobalID()) + "</ram:GlobalID>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xml += "<ram:Name>" + XMLTools.encodeXML(party.getName()) + "</ram:Name>";
|
|
|
|
xml += "<ram:Name>" + XMLTools.encodeXML(party.getName()) + "</ram:Name>";
|
|
|
|
|
|
|
|
|
|
|
|
@@ -148,24 +148,24 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
xml += "<ram:DefinedTradeContact>";
|
|
|
|
xml += "<ram:DefinedTradeContact>";
|
|
|
|
if (party.getContact().getName() != null) {
|
|
|
|
if (party.getContact().getName() != null) {
|
|
|
|
xml += "<ram:PersonName>" + XMLTools.encodeXML(party.getContact().getName())
|
|
|
|
xml += "<ram:PersonName>" + XMLTools.encodeXML(party.getContact().getName())
|
|
|
|
+ "</ram:PersonName>";
|
|
|
|
+ "</ram:PersonName>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (party.getContact().getPhone() != null) {
|
|
|
|
if (party.getContact().getPhone() != null) {
|
|
|
|
|
|
|
|
|
|
|
|
xml += "<ram:TelephoneUniversalCommunication><ram:CompleteNumber>"
|
|
|
|
xml += "<ram:TelephoneUniversalCommunication><ram:CompleteNumber>"
|
|
|
|
+ XMLTools.encodeXML(party.getContact().getPhone()) + "</ram:CompleteNumber>"
|
|
|
|
+ XMLTools.encodeXML(party.getContact().getPhone()) + "</ram:CompleteNumber>"
|
|
|
|
+ "</ram:TelephoneUniversalCommunication>";
|
|
|
|
+ "</ram:TelephoneUniversalCommunication>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((party.getContact().getFax() != null) && (profile == Profiles.getByName("Extended"))) {
|
|
|
|
if ((party.getContact().getFax() != null) && (profile == Profiles.getByName("Extended"))) {
|
|
|
|
xml += "<ram:FaxUniversalCommunication><ram:CompleteNumber>"
|
|
|
|
xml += "<ram:FaxUniversalCommunication><ram:CompleteNumber>"
|
|
|
|
+ XMLTools.encodeXML(party.getContact().getFax()) + "</ram:CompleteNumber>"
|
|
|
|
+ XMLTools.encodeXML(party.getContact().getFax()) + "</ram:CompleteNumber>"
|
|
|
|
+ "</ram:FaxUniversalCommunication>";
|
|
|
|
+ "</ram:FaxUniversalCommunication>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (party.getContact().getEMail() != null) {
|
|
|
|
if (party.getContact().getEMail() != null) {
|
|
|
|
xml += "<ram:EmailURIUniversalCommunication><ram:URIID>"
|
|
|
|
xml += "<ram:EmailURIUniversalCommunication><ram:URIID>"
|
|
|
|
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>"
|
|
|
|
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>"
|
|
|
|
+ "</ram:EmailURIUniversalCommunication>";
|
|
|
|
+ "</ram:EmailURIUniversalCommunication>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xml += "</ram:DefinedTradeContact>";
|
|
|
|
xml += "</ram:DefinedTradeContact>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -173,47 +173,47 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
xml += "<ram:PostalTradeAddress>";
|
|
|
|
xml += "<ram:PostalTradeAddress>";
|
|
|
|
if (party.getZIP() != null) {
|
|
|
|
if (party.getZIP() != null) {
|
|
|
|
xml += "<ram:PostcodeCode>" + XMLTools.encodeXML(party.getZIP())
|
|
|
|
xml += "<ram:PostcodeCode>" + XMLTools.encodeXML(party.getZIP())
|
|
|
|
+ "</ram:PostcodeCode>";
|
|
|
|
+ "</ram:PostcodeCode>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (party.getStreet() != null) {
|
|
|
|
if (party.getStreet() != null) {
|
|
|
|
xml += "<ram:LineOne>" + XMLTools.encodeXML(party.getStreet())
|
|
|
|
xml += "<ram:LineOne>" + XMLTools.encodeXML(party.getStreet())
|
|
|
|
+ "</ram:LineOne>";
|
|
|
|
+ "</ram:LineOne>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (party.getAdditionalAddress() != null) {
|
|
|
|
if (party.getAdditionalAddress() != null) {
|
|
|
|
xml += "<ram:LineTwo>" + XMLTools.encodeXML(party.getAdditionalAddress())
|
|
|
|
xml += "<ram:LineTwo>" + XMLTools.encodeXML(party.getAdditionalAddress())
|
|
|
|
+ "</ram:LineTwo>";
|
|
|
|
+ "</ram:LineTwo>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (party.getAdditionalAddressExtension() != null) {
|
|
|
|
if (party.getAdditionalAddressExtension() != null) {
|
|
|
|
xml += "<ram:LineThree>" + XMLTools.encodeXML(party.getAdditionalAddressExtension())
|
|
|
|
xml += "<ram:LineThree>" + XMLTools.encodeXML(party.getAdditionalAddressExtension())
|
|
|
|
+ "</ram:LineThree>";
|
|
|
|
+ "</ram:LineThree>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (party.getLocation() != null) {
|
|
|
|
if (party.getLocation() != null) {
|
|
|
|
xml += "<ram:CityName>" + XMLTools.encodeXML(party.getLocation())
|
|
|
|
xml += "<ram:CityName>" + XMLTools.encodeXML(party.getLocation())
|
|
|
|
+ "</ram:CityName>";
|
|
|
|
+ "</ram:CityName>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//country IS mandatory
|
|
|
|
//country IS mandatory
|
|
|
|
xml += "<ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
|
|
|
|
xml += "<ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
|
|
|
|
+ "</ram:CountryID>"
|
|
|
|
+ "</ram:CountryID>"
|
|
|
|
+ "</ram:PostalTradeAddress>";
|
|
|
|
+ "</ram:PostalTradeAddress>";
|
|
|
|
if (party.getUriUniversalCommunicationID() != null && party.getUriUniversalCommunicationIDScheme()!=null) {
|
|
|
|
if (party.getUriUniversalCommunicationID() != null && party.getUriUniversalCommunicationIDScheme() != null) {
|
|
|
|
xml += "<ram:URIUniversalCommunication>" +
|
|
|
|
xml += "<ram:URIUniversalCommunication>" +
|
|
|
|
"<ram:URIID schemeID=\"" + party.getUriUniversalCommunicationIDScheme() + "\">" +
|
|
|
|
"<ram:URIID schemeID=\"" + party.getUriUniversalCommunicationIDScheme() + "\">" +
|
|
|
|
XMLTools.encodeXML(party.getUriUniversalCommunicationID())
|
|
|
|
XMLTools.encodeXML(party.getUriUniversalCommunicationID())
|
|
|
|
+ "</ram:URIID></ram:URIUniversalCommunication>";
|
|
|
|
+ "</ram:URIID></ram:URIUniversalCommunication>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((party.getVATID() != null) && (!isShipToTradeParty)) {
|
|
|
|
if ((party.getVATID() != null) && (!isShipToTradeParty)) {
|
|
|
|
xml += "<ram:SpecifiedTaxRegistration>"
|
|
|
|
xml += "<ram:SpecifiedTaxRegistration>"
|
|
|
|
+ "<ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(party.getVATID())
|
|
|
|
+ "<ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(party.getVATID())
|
|
|
|
+ "</ram:ID>"
|
|
|
|
+ "</ram:ID>"
|
|
|
|
+ "</ram:SpecifiedTaxRegistration>";
|
|
|
|
+ "</ram:SpecifiedTaxRegistration>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((party.getTaxID() != null) && (!isShipToTradeParty)) {
|
|
|
|
if ((party.getTaxID() != null) && (!isShipToTradeParty)) {
|
|
|
|
xml += "<ram:SpecifiedTaxRegistration>"
|
|
|
|
xml += "<ram:SpecifiedTaxRegistration>"
|
|
|
|
+ "<ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(party.getTaxID())
|
|
|
|
+ "<ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(party.getTaxID())
|
|
|
|
+ "</ram:ID>"
|
|
|
|
+ "</ram:ID>"
|
|
|
|
+ "</ram:SpecifiedTaxRegistration>";
|
|
|
|
+ "</ram:SpecifiedTaxRegistration>";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return xml;
|
|
|
|
return xml;
|
|
|
|
@@ -244,10 +244,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
|
|
|
reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 +
|
|
|
|
"</ram:AppliedTradeAllowanceCharge>";
|
|
|
|
"</ram:AppliedTradeAllowanceCharge>";
|
|
|
|
return allowanceChargeStr;
|
|
|
|
return allowanceChargeStr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -269,10 +269,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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>" +
|
|
|
|
"<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>" +
|
|
|
|
"</ram:SpecifiedTradeAllowanceCharge>";
|
|
|
|
"</ram:SpecifiedTradeAllowanceCharge>";
|
|
|
|
return itemTotalAllowanceChargeStr;
|
|
|
|
return itemTotalAllowanceChargeStr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -299,20 +299,27 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
if (trans.getDocumentCode() != null) {
|
|
|
|
if (trans.getDocumentCode() != null) {
|
|
|
|
typecode = trans.getDocumentCode();
|
|
|
|
typecode = trans.getDocumentCode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
|
|
|
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
|
|
|
+ "<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\""
|
|
|
|
+ "<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\""
|
|
|
|
// + "
|
|
|
|
// + "
|
|
|
|
// xsi:schemaLocation=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100
|
|
|
|
// xsi:schemaLocation=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100
|
|
|
|
// ../Schema/ZUGFeRD1p0.xsd\""
|
|
|
|
// ../Schema/ZUGFeRD1p0.xsd\""
|
|
|
|
+ " xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\""
|
|
|
|
+ " xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\""
|
|
|
|
+ " xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\""
|
|
|
|
+ " xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\""
|
|
|
|
+ " xmlns:qdt=\"urn:un:unece:uncefact:data:standard:QualifiedDataType:100\">"
|
|
|
|
+ " xmlns:qdt=\"urn:un:unece:uncefact:data:standard:QualifiedDataType:100\">"
|
|
|
|
+ "<!-- generated by: mustangproject.org v" + ZUGFeRD2PullProvider.class.getPackage().getImplementationVersion() + "-->"
|
|
|
|
+ "<!-- generated by: mustangproject.org v" + ZUGFeRD2PullProvider.class.getPackage().getImplementationVersion() + "-->"
|
|
|
|
+ "<rsm:ExchangedDocumentContext>"
|
|
|
|
+ "<rsm:ExchangedDocumentContext>\n";
|
|
|
|
// + "
|
|
|
|
// + "
|
|
|
|
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>"
|
|
|
|
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>"
|
|
|
|
//
|
|
|
|
//
|
|
|
|
+ "<ram:GuidelineSpecifiedDocumentContextParameter>"
|
|
|
|
|
|
|
|
|
|
|
|
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:GuidelineSpecifiedDocumentContextParameter>"
|
|
|
|
+ "<ram:ID>" + getProfile().getID() + "</ram:ID>"
|
|
|
|
+ "<ram:ID>" + getProfile().getID() + "</ram:ID>"
|
|
|
|
+ "</ram:GuidelineSpecifiedDocumentContextParameter>"
|
|
|
|
+ "</ram:GuidelineSpecifiedDocumentContextParameter>"
|
|
|
|
+ "</rsm:ExchangedDocumentContext>"
|
|
|
|
+ "</rsm:ExchangedDocumentContext>"
|
|
|
|
@@ -334,25 +341,25 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
exemptionReason = "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
|
|
|
exemptionReason = "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
final LineCalculator lc = new LineCalculator(currentItem);
|
|
|
|
final LineCalculator lc = new LineCalculator(currentItem);
|
|
|
|
if ((getProfile() != Profiles.getByName("Minimum")) && (getProfile() != Profiles.getByName("BasicWL"))) {
|
|
|
|
if ((getProfile() != Profiles.getByName("Minimum")) && (getProfile() != Profiles.getByName("BasicWL"))) {
|
|
|
|
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
|
|
|
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
|
|
|
"<ram:AssociatedDocumentLineDocument>"
|
|
|
|
"<ram:AssociatedDocumentLineDocument>"
|
|
|
|
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
|
|
|
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
|
|
|
+ buildItemNotes(currentItem)
|
|
|
|
+ buildItemNotes(currentItem)
|
|
|
|
+ "</ram:AssociatedDocumentLineDocument>"
|
|
|
|
+ "</ram:AssociatedDocumentLineDocument>"
|
|
|
|
|
|
|
|
|
|
|
|
+ "<ram:SpecifiedTradeProduct>";
|
|
|
|
+ "<ram:SpecifiedTradeProduct>";
|
|
|
|
if ((currentItem.getProduct().getGlobalIDScheme() != null) && (currentItem.getProduct().getGlobalID() != null)) {
|
|
|
|
if ((currentItem.getProduct().getGlobalIDScheme() != null) && (currentItem.getProduct().getGlobalID() != null)) {
|
|
|
|
xml += "<ram:GlobalID schemeID=\"" + XMLTools.encodeXML(currentItem.getProduct().getGlobalIDScheme()) + "\">" + XMLTools.encodeXML(currentItem.getProduct().getGlobalID()) + "</ram:GlobalID>";
|
|
|
|
xml += "<ram:GlobalID schemeID=\"" + XMLTools.encodeXML(currentItem.getProduct().getGlobalIDScheme()) + "\">" + XMLTools.encodeXML(currentItem.getProduct().getGlobalID()) + "</ram:GlobalID>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (currentItem.getProduct().getSellerAssignedID() != null) {
|
|
|
|
if (currentItem.getProduct().getSellerAssignedID() != null) {
|
|
|
|
xml += "<ram:SellerAssignedID>"
|
|
|
|
xml += "<ram:SellerAssignedID>"
|
|
|
|
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>";
|
|
|
|
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentItem.getProduct().getBuyerAssignedID() != null) {
|
|
|
|
if (currentItem.getProduct().getBuyerAssignedID() != null) {
|
|
|
|
xml += "<ram:BuyerAssignedID>"
|
|
|
|
xml += "<ram:BuyerAssignedID>"
|
|
|
|
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
|
|
|
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String allowanceChargeStr = "";
|
|
|
|
String allowanceChargeStr = "";
|
|
|
|
if (currentItem.getItemAllowances() != null && currentItem.getItemAllowances().length > 0) {
|
|
|
|
if (currentItem.getItemAllowances() != null && currentItem.getItemAllowances().length > 0) {
|
|
|
|
@@ -374,57 +381,60 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>"
|
|
|
|
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>";
|
|
|
|
+ "<ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
|
|
|
if (currentItem.getProduct().getDescription().length() > 0) {
|
|
|
|
+ "</ram:Description>"
|
|
|
|
xml += "<ram:Description>" +
|
|
|
|
+ "</ram:SpecifiedTradeProduct>"
|
|
|
|
XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
|
|
|
|
|
|
|
|
"</ram:Description>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
xml += "</ram:SpecifiedTradeProduct>"
|
|
|
|
|
|
|
|
|
|
|
|
+ "<ram:SpecifiedLineTradeAgreement>";
|
|
|
|
+ "<ram:SpecifiedLineTradeAgreement>";
|
|
|
|
if (currentItem.getReferencedDocuments() != null) {
|
|
|
|
if (currentItem.getReferencedDocuments() != null) {
|
|
|
|
for (final IReferencedDocument currentReferencedDocument : currentItem.getReferencedDocuments()) {
|
|
|
|
for (final IReferencedDocument currentReferencedDocument : currentItem.getReferencedDocuments()) {
|
|
|
|
xml += "<ram:AdditionalReferencedDocument>" +
|
|
|
|
xml += "<ram:AdditionalReferencedDocument>" +
|
|
|
|
"<ram:IssuerAssignedID>" + XMLTools.encodeXML(currentReferencedDocument.getIssuerAssignedID()) + "</ram:IssuerAssignedID>" +
|
|
|
|
"<ram:IssuerAssignedID>" + XMLTools.encodeXML(currentReferencedDocument.getIssuerAssignedID()) + "</ram:IssuerAssignedID>" +
|
|
|
|
"<ram:TypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getTypeCode()) + "</ram:TypeCode>" +
|
|
|
|
"<ram:TypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getTypeCode()) + "</ram:TypeCode>" +
|
|
|
|
"<ram:ReferenceTypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getReferenceTypeCode()) + "</ram:ReferenceTypeCode>" +
|
|
|
|
"<ram:ReferenceTypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getReferenceTypeCode()) + "</ram:ReferenceTypeCode>" +
|
|
|
|
"</ram:AdditionalReferencedDocument>";
|
|
|
|
"</ram:AdditionalReferencedDocument>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentItem.getBuyerOrderReferencedDocumentLineID() != null) {
|
|
|
|
if (currentItem.getBuyerOrderReferencedDocumentLineID() != null) {
|
|
|
|
xml += "<ram:BuyerOrderReferencedDocument> "
|
|
|
|
xml += "<ram:BuyerOrderReferencedDocument> "
|
|
|
|
+ "<ram:LineID>" + XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID()) + "</ram:LineID>"
|
|
|
|
+ "<ram:LineID>" + XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID()) + "</ram:LineID>"
|
|
|
|
+ "</ram:BuyerOrderReferencedDocument>";
|
|
|
|
+ "</ram:BuyerOrderReferencedDocument>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xml += "<ram:GrossPriceProductTradePrice>"
|
|
|
|
xml += "<ram:GrossPriceProductTradePrice>"
|
|
|
|
+ "<ram:ChargeAmount>" + priceFormat(lc.getPriceGross())
|
|
|
|
+ "<ram:ChargeAmount>" + priceFormat(lc.getPriceGross())
|
|
|
|
+ "</ram:ChargeAmount>" //currencyID=\"EUR\"
|
|
|
|
+ "</ram:ChargeAmount>" //currencyID=\"EUR\"
|
|
|
|
+ "<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>"
|
|
|
|
+ "<ram:NetPriceProductTradePrice>"
|
|
|
|
+ "<ram:NetPriceProductTradePrice>"
|
|
|
|
+ "<ram:ChargeAmount>" + priceFormat(lc.getPrice())
|
|
|
|
+ "<ram:ChargeAmount>" + priceFormat(lc.getPrice())
|
|
|
|
+ "</ram:ChargeAmount>" // currencyID=\"EUR\"
|
|
|
|
+ "</ram:ChargeAmount>" // currencyID=\"EUR\"
|
|
|
|
+ "<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>"
|
|
|
|
+ "</ram:NetPriceProductTradePrice>"
|
|
|
|
+ "</ram:NetPriceProductTradePrice>"
|
|
|
|
+ "</ram:SpecifiedLineTradeAgreement>"
|
|
|
|
+ "</ram:SpecifiedLineTradeAgreement>"
|
|
|
|
+ "<ram:SpecifiedLineTradeDelivery>"
|
|
|
|
+ "<ram:SpecifiedLineTradeDelivery>"
|
|
|
|
+ "<ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
|
|
|
|
+ "<ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
|
|
|
|
+ quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>"
|
|
|
|
+ quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>"
|
|
|
|
+ "</ram:SpecifiedLineTradeDelivery>"
|
|
|
|
+ "</ram:SpecifiedLineTradeDelivery>"
|
|
|
|
+ "<ram:SpecifiedLineTradeSettlement>"
|
|
|
|
+ "<ram:SpecifiedLineTradeSettlement>"
|
|
|
|
+ "<ram:ApplicableTradeTax>"
|
|
|
|
+ "<ram:ApplicableTradeTax>"
|
|
|
|
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
|
|
|
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
|
|
|
+ exemptionReason
|
|
|
|
+ exemptionReason
|
|
|
|
+ "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>"
|
|
|
|
+ "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>"
|
|
|
|
+ "<ram:RateApplicablePercent>"
|
|
|
|
+ "<ram:RateApplicablePercent>"
|
|
|
|
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>"
|
|
|
|
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>"
|
|
|
|
+ "</ram:ApplicableTradeTax>";
|
|
|
|
+ "</ram:ApplicableTradeTax>";
|
|
|
|
if ((currentItem.getDetailedDeliveryPeriodFrom() != null) || (currentItem.getDetailedDeliveryPeriodTo() != null)) {
|
|
|
|
if ((currentItem.getDetailedDeliveryPeriodFrom() != null) || (currentItem.getDetailedDeliveryPeriodTo() != null)) {
|
|
|
|
xml += "<ram:BillingSpecifiedPeriod>";
|
|
|
|
xml += "<ram:BillingSpecifiedPeriod>";
|
|
|
|
if (currentItem.getDetailedDeliveryPeriodFrom() != null) {
|
|
|
|
if (currentItem.getDetailedDeliveryPeriodFrom() != null) {
|
|
|
|
@@ -439,15 +449,15 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
xml += itemTotalAllowanceChargeStr;
|
|
|
|
xml += itemTotalAllowanceChargeStr;
|
|
|
|
|
|
|
|
|
|
|
|
xml += "<ram:SpecifiedTradeSettlementLineMonetarySummation>"
|
|
|
|
xml += "<ram:SpecifiedTradeSettlementLineMonetarySummation>"
|
|
|
|
+ "<ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
|
|
|
+ "<ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
|
|
|
+ "</ram:LineTotalAmount>" // currencyID=\"EUR\"
|
|
|
|
+ "</ram:LineTotalAmount>" // currencyID=\"EUR\"
|
|
|
|
+ "</ram:SpecifiedTradeSettlementLineMonetarySummation>";
|
|
|
|
+ "</ram:SpecifiedTradeSettlementLineMonetarySummation>";
|
|
|
|
if (currentItem.getAdditionalReferencedDocumentID() != null) {
|
|
|
|
if (currentItem.getAdditionalReferencedDocumentID() != null) {
|
|
|
|
xml += "<ram:AdditionalReferencedDocument><ram:IssuerAssignedID>" + currentItem.getAdditionalReferencedDocumentID() + "</ram:IssuerAssignedID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>";
|
|
|
|
xml += "<ram:AdditionalReferencedDocument><ram:IssuerAssignedID>" + currentItem.getAdditionalReferencedDocumentID() + "</ram:IssuerAssignedID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xml += "</ram:SpecifiedLineTradeSettlement>"
|
|
|
|
xml += "</ram:SpecifiedLineTradeSettlement>"
|
|
|
|
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
|
|
|
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -458,9 +468,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xml += "<ram:SellerTradeParty>"
|
|
|
|
xml += "<ram:SellerTradeParty>"
|
|
|
|
+ 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>"
|
|
|
|
|
|
|
|
|
|
|
|
@@ -469,21 +479,21 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
@@ -491,19 +501,19 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
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>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -514,20 +524,20 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.trans.getDeliveryAddress() != null) {
|
|
|
|
if (this.trans.getDeliveryAddress() != null) {
|
|
|
|
xml += "<ram:ShipToTradeParty>" +
|
|
|
|
xml += "<ram:ShipToTradeParty>" +
|
|
|
|
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
|
|
|
|
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
|
|
|
|
"</ram:ShipToTradeParty>";
|
|
|
|
"</ram:ShipToTradeParty>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (trans.getDeliveryDate() != null) {
|
|
|
|
if (trans.getDeliveryDate() != null) {
|
|
|
|
xml += "<ram:ActualDeliverySupplyChainEvent>"
|
|
|
|
xml += "<ram:ActualDeliverySupplyChainEvent>"
|
|
|
|
+ "<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>";
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if ((trans.getDocumentCode() != DocumentCodeTypeConstants.CREDITNOTE)&&(getProfile() != Profiles.getByName("Minimum"))) {
|
|
|
|
if ((trans.getDocumentCode() != DocumentCodeTypeConstants.CREDITNOTE) && (getProfile() != Profiles.getByName("Minimum"))) {
|
|
|
|
throw new IllegalStateException("No delivery date provided");
|
|
|
|
throw new IllegalStateException("No delivery date provided");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -587,15 +597,15 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
if (getProfile() != Profiles.getByName("Minimum")) {
|
|
|
|
if (getProfile() != Profiles.getByName("Minimum")) {
|
|
|
|
|
|
|
|
|
|
|
|
xml += "<ram:ApplicableTradeTax>"
|
|
|
|
xml += "<ram:ApplicableTradeTax>"
|
|
|
|
+ "<ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
|
|
|
|
+ "<ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
|
|
|
|
+ "</ram:CalculatedAmount>" //currencyID=\"EUR\"
|
|
|
|
+ "</ram:CalculatedAmount>" //currencyID=\"EUR\"
|
|
|
|
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
|
|
|
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
|
|
|
+ (displayExemptionReason ? exemptionReason : "")
|
|
|
|
+ (displayExemptionReason ? exemptionReason : "")
|
|
|
|
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
|
|
|
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
|
|
|
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>"
|
|
|
|
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>"
|
|
|
|
+ (amountDueDateTypeCode != null ? "<ram:DueDateTypeCode>" + amountDueDateTypeCode + "</ram:DueDateTypeCode>" : "")
|
|
|
|
+ (amountDueDateTypeCode != null ? "<ram:DueDateTypeCode>" + amountDueDateTypeCode + "</ram:DueDateTypeCode>" : "")
|
|
|
|
+ "<ram:RateApplicablePercent>"
|
|
|
|
+ "<ram:RateApplicablePercent>"
|
|
|
|
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent></ram:ApplicableTradeTax>";
|
|
|
|
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent></ram:ApplicableTradeTax>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -615,17 +625,17 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
|
|
|
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
|
|
|
if (calc.getChargesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
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(calc.getChargesForPercent(currentTaxPercent)) + "</ram:ActualAmount>" +
|
|
|
|
"<ram:Reason>" + XMLTools.encodeXML(calc.getChargeReasonForPercent(currentTaxPercent)) + "</ram:Reason>" +
|
|
|
|
"<ram:Reason>" + XMLTools.encodeXML(calc.getChargeReasonForPercent(currentTaxPercent)) + "</ram:Reason>" +
|
|
|
|
"<ram:CategoryTradeTax>" +
|
|
|
|
"<ram:CategoryTradeTax>" +
|
|
|
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
|
|
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
|
|
|
"<ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
|
|
|
"<ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
|
|
|
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
|
|
|
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
|
|
|
"</ram:CategoryTradeTax>" +
|
|
|
|
"</ram:CategoryTradeTax>" +
|
|
|
|
"</ram:SpecifiedTradeAllowanceCharge> ";
|
|
|
|
"</ram:SpecifiedTradeAllowanceCharge> ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -634,17 +644,17 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
|
|
|
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
|
|
|
if (calc.getAllowancesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
if (calc.getAllowancesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
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(calc.getAllowancesForPercent(currentTaxPercent)) + "</ram:ActualAmount>" +
|
|
|
|
"<ram:Reason>" + XMLTools.encodeXML(calc.getAllowanceReasonForPercent(currentTaxPercent)) + "</ram:Reason>" +
|
|
|
|
"<ram:Reason>" + XMLTools.encodeXML(calc.getAllowanceReasonForPercent(currentTaxPercent)) + "</ram:Reason>" +
|
|
|
|
"<ram:CategoryTradeTax>" +
|
|
|
|
"<ram:CategoryTradeTax>" +
|
|
|
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
|
|
|
"<ram:TypeCode>VAT</ram:TypeCode>" +
|
|
|
|
"<ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
|
|
|
"<ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>" +
|
|
|
|
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
|
|
|
"<ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>" +
|
|
|
|
"</ram:CategoryTradeTax>" +
|
|
|
|
"</ram:CategoryTradeTax>" +
|
|
|
|
"</ram:SpecifiedTradeAllowanceCharge> ";
|
|
|
|
"</ram:SpecifiedTradeAllowanceCharge> ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -667,8 +677,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
|
|
|
|
|
|
|
|
if (hasDueDate && (trans.getDueDate() != null)) {
|
|
|
|
if (hasDueDate && (trans.getDueDate() != null)) {
|
|
|
|
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
|
|
|
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
|
|
|
+ DATE.udtFormat(trans.getDueDate())
|
|
|
|
+ DATE.udtFormat(trans.getDueDate())
|
|
|
|
+ "</ram:DueDateDateTime>";// 20130704
|
|
|
|
+ "</ram:DueDateDateTime>";// 20130704
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xml += "</ram:SpecifiedTradePaymentTerms>";
|
|
|
|
xml += "</ram:SpecifiedTradePaymentTerms>";
|
|
|
|
@@ -685,29 +695,29 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
if (getProfile() != Profiles.getByName("Minimum")) {
|
|
|
|
if (getProfile() != Profiles.getByName("Minimum")) {
|
|
|
|
xml += "<ram:LineTotalAmount>" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>";
|
|
|
|
xml += "<ram:LineTotalAmount>" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>";
|
|
|
|
xml += chargesTotalLine
|
|
|
|
xml += chargesTotalLine
|
|
|
|
+ allowanceTotalLine;
|
|
|
|
+ allowanceTotalLine;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
xml += "<ram:TaxBasisTotalAmount>" + currencyFormat(calc.getTaxBasis()) + "</ram:TaxBasisTotalAmount>"
|
|
|
|
xml += "<ram:TaxBasisTotalAmount>" + currencyFormat(calc.getTaxBasis()) + "</ram:TaxBasisTotalAmount>"
|
|
|
|
// //
|
|
|
|
// //
|
|
|
|
// currencyID=\"EUR\"
|
|
|
|
// currencyID=\"EUR\"
|
|
|
|
+ "<ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
|
|
|
+ "<ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
|
|
|
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTaxBasis())) + "</ram:TaxTotalAmount>"
|
|
|
|
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTaxBasis())) + "</ram:TaxTotalAmount>"
|
|
|
|
+ "<ram:GrandTotalAmount>" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>";
|
|
|
|
+ "<ram:GrandTotalAmount>" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>";
|
|
|
|
// //
|
|
|
|
// //
|
|
|
|
// 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>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -723,7 +733,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
// + " </IncludedSupplyChainTradeLineItem>\n";
|
|
|
|
// + " </IncludedSupplyChainTradeLineItem>\n";
|
|
|
|
|
|
|
|
|
|
|
|
xml += "</rsm:SupplyChainTradeTransaction>"
|
|
|
|
xml += "</rsm:SupplyChainTradeTransaction>"
|
|
|
|
+ "</rsm:CrossIndustryInvoice>";
|
|
|
|
+ "</rsm:CrossIndustryInvoice>";
|
|
|
|
|
|
|
|
|
|
|
|
final byte[] zugferdRaw;
|
|
|
|
final byte[] zugferdRaw;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
@@ -735,37 +745,37 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected String buildItemNotes(IZUGFeRDExportableItem currentItem) {
|
|
|
|
protected String buildItemNotes(IZUGFeRDExportableItem currentItem) {
|
|
|
|
if (currentItem.getNotes() == null) {
|
|
|
|
if (currentItem.getNotes() == null) {
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Arrays.stream(currentItem.getNotes())
|
|
|
|
return Arrays.stream(currentItem.getNotes())
|
|
|
|
.map(IncludedNote::unspecifiedNote)
|
|
|
|
.map(IncludedNote::unspecifiedNote)
|
|
|
|
.map(IncludedNote::toCiiXml)
|
|
|
|
.map(IncludedNote::toCiiXml)
|
|
|
|
.collect(Collectors.joining());
|
|
|
|
.collect(Collectors.joining());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected String buildNotes(IExportableTransaction exportableTransaction) {
|
|
|
|
protected String buildNotes(IExportableTransaction exportableTransaction) {
|
|
|
|
final List<IncludedNote> includedNotes = Optional.ofNullable(exportableTransaction.getNotesWithSubjectCode())
|
|
|
|
final List<IncludedNote> includedNotes = Optional.ofNullable(exportableTransaction.getNotesWithSubjectCode())
|
|
|
|
.orElse(new ArrayList<>());
|
|
|
|
.orElse(new ArrayList<>());
|
|
|
|
if (exportableTransaction.getNotes() != null) {
|
|
|
|
if (exportableTransaction.getNotes() != null) {
|
|
|
|
for (final String currentNote : exportableTransaction.getNotes()) {
|
|
|
|
for (final String currentNote : exportableTransaction.getNotes()) {
|
|
|
|
includedNotes.add(IncludedNote.unspecifiedNote(currentNote));
|
|
|
|
includedNotes.add(IncludedNote.unspecifiedNote(currentNote));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (exportableTransaction.rebateAgreementExists()) {
|
|
|
|
if (exportableTransaction.rebateAgreementExists()) {
|
|
|
|
includedNotes.add(IncludedNote.discountBonusNote("Es bestehen Rabatt- und Bonusvereinbarungen."));
|
|
|
|
includedNotes.add(IncludedNote.discountBonusNote("Es bestehen Rabatt- und Bonusvereinbarungen."));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Optional.ofNullable(exportableTransaction.getOwnOrganisationFullPlaintextInfo())
|
|
|
|
Optional.ofNullable(exportableTransaction.getOwnOrganisationFullPlaintextInfo())
|
|
|
|
.ifPresent(info -> includedNotes.add(IncludedNote.regulatoryNote(info)));
|
|
|
|
.ifPresent(info -> includedNotes.add(IncludedNote.regulatoryNote(info)));
|
|
|
|
|
|
|
|
|
|
|
|
Optional.ofNullable(exportableTransaction.getSubjectNote())
|
|
|
|
Optional.ofNullable(exportableTransaction.getSubjectNote())
|
|
|
|
.ifPresent(note -> includedNotes.add(IncludedNote.unspecifiedNote(note)));
|
|
|
|
.ifPresent(note -> includedNotes.add(IncludedNote.unspecifiedNote(note)));
|
|
|
|
|
|
|
|
|
|
|
|
return includedNotes.stream().map(IncludedNote::toCiiXml).collect(Collectors.joining(""));
|
|
|
|
return includedNotes.stream().map(IncludedNote::toCiiXml).collect(Collectors.joining(""));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void setProfile(Profile p) {
|
|
|
|
public void setProfile(Profile p) {
|
|
|
|
profile = p;
|
|
|
|
profile = p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -781,7 +791,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
final Date dueDate = paymentTerms.getDueDate();
|
|
|
|
final Date dueDate = paymentTerms.getDueDate();
|
|
|
|
if (dueDate != null && discountTerms != null && discountTerms.getBaseDate() != null) {
|
|
|
|
if (dueDate != null && discountTerms != null && discountTerms.getBaseDate() != null) {
|
|
|
|
throw new IllegalStateException(
|
|
|
|
throw new IllegalStateException(
|
|
|
|
"if paymentTerms.dueDate is specified, paymentTerms.discountTerms.baseDate has not to be specified");
|
|
|
|
"if paymentTerms.dueDate is specified, paymentTerms.discountTerms.baseDate has not to be specified");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
paymentTermsXml += "<ram:Description>" + paymentTerms.getDescription() + "</ram:Description>";
|
|
|
|
paymentTermsXml += "<ram:Description>" + paymentTerms.getDescription() + "</ram:Description>";
|
|
|
|
|
|
|
|
|
|
|
|
@@ -805,7 +815,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
final String basisAmount = currencyFormat(calc.getGrandTotal());
|
|
|
|
final String basisAmount = currencyFormat(calc.getGrandTotal());
|
|
|
|
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
|
|
|
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
|
|
|
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
|
|
|
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
|
|
|
+ "</ram:CalculationPercent>";
|
|
|
|
+ "</ram:CalculationPercent>";
|
|
|
|
|
|
|
|
|
|
|
|
if (discountTerms.getBaseDate() != null) {
|
|
|
|
if (discountTerms.getBaseDate() != null) {
|
|
|
|
final Date baseDate = discountTerms.getBaseDate();
|
|
|
|
final Date baseDate = discountTerms.getBaseDate();
|
|
|
|
@@ -814,7 +824,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|
|
|
paymentTermsXml += "</ram:BasisDateTime>";
|
|
|
|
paymentTermsXml += "</ram:BasisDateTime>";
|
|
|
|
|
|
|
|
|
|
|
|
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
|
|
|
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
|
|
|
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
|
|
|
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
|
|
|
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
|
|
|
|