working on #343
This commit is contained in:
@@ -31,7 +31,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
protected Contact contact = null;
|
||||
protected LegalOrganisation legalOrg = null;
|
||||
protected SchemedID globalId=null;
|
||||
protected SchemedID uriUniversalCommunicationId=null;
|
||||
protected SchemedID uriUniversalCommunicationId=null; //e.g. the email address of the organization
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
@@ -411,7 +411,31 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* sets the email of the organization (not the one of the contact person)
|
||||
* @return fluent setter
|
||||
*/
|
||||
public TradeParty setEmail(String eMail) {
|
||||
SchemedID theSchemedID=new SchemedID("EM", eMail);
|
||||
addUriUniversalCommunicationID(theSchemedID);
|
||||
return this;
|
||||
}
|
||||
|
||||
/***
|
||||
* gets the email of the organization (not the one of the contact person)
|
||||
* will return null if not set or if the provided UriUniversalCommunicationID
|
||||
* is not a email address
|
||||
*
|
||||
* @return String the email, or null
|
||||
*/
|
||||
public String getEmail() {
|
||||
if (uriUniversalCommunicationId.getScheme().equals("EM")) {
|
||||
return uriUniversalCommunicationId.getID();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* if it's a customer, this can e.g. be the customer ID
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Profiles {
|
||||
{"BASIC", new Profile("BASIC", "urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic")},
|
||||
{"EN16931", new Profile("EN16931", "urn:cen.eu:en16931:2017")},
|
||||
{"EXTENDED", new Profile("EXTENDED", "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended")},
|
||||
{"XRECHNUNG", new Profile("XRECHNUNG", "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.3")} // up next: urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0
|
||||
{"XRECHNUNG", new Profile("XRECHNUNG", "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0")} // up next: urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0
|
||||
|
||||
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
|
||||
static Map<String, Profile> zf1Map = Stream.of(new Object[][]{
|
||||
|
||||
@@ -134,7 +134,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
if ((party.getGlobalIDScheme() != null) && (party.getGlobalID() != null)) {
|
||||
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>";
|
||||
|
||||
@@ -148,24 +148,24 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
xml += "<ram:DefinedTradeContact>";
|
||||
if (party.getContact().getName() != null) {
|
||||
xml += "<ram:PersonName>" + XMLTools.encodeXML(party.getContact().getName())
|
||||
+ "</ram:PersonName>";
|
||||
+ "</ram:PersonName>";
|
||||
}
|
||||
if (party.getContact().getPhone() != null) {
|
||||
|
||||
xml += "<ram:TelephoneUniversalCommunication><ram:CompleteNumber>"
|
||||
+ XMLTools.encodeXML(party.getContact().getPhone()) + "</ram:CompleteNumber>"
|
||||
+ "</ram:TelephoneUniversalCommunication>";
|
||||
+ XMLTools.encodeXML(party.getContact().getPhone()) + "</ram:CompleteNumber>"
|
||||
+ "</ram:TelephoneUniversalCommunication>";
|
||||
}
|
||||
|
||||
if ((party.getContact().getFax() != null) && (profile == Profiles.getByName("Extended"))) {
|
||||
xml += "<ram:FaxUniversalCommunication><ram:CompleteNumber>"
|
||||
+ XMLTools.encodeXML(party.getContact().getFax()) + "</ram:CompleteNumber>"
|
||||
+ "</ram:FaxUniversalCommunication>";
|
||||
+ XMLTools.encodeXML(party.getContact().getFax()) + "</ram:CompleteNumber>"
|
||||
+ "</ram:FaxUniversalCommunication>";
|
||||
}
|
||||
if (party.getContact().getEMail() != null) {
|
||||
xml += "<ram:EmailURIUniversalCommunication><ram:URIID>"
|
||||
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>"
|
||||
+ "</ram:EmailURIUniversalCommunication>";
|
||||
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>"
|
||||
+ "</ram:EmailURIUniversalCommunication>";
|
||||
}
|
||||
xml += "</ram:DefinedTradeContact>";
|
||||
}
|
||||
@@ -173,47 +173,47 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
xml += "<ram:PostalTradeAddress>";
|
||||
if (party.getZIP() != null) {
|
||||
xml += "<ram:PostcodeCode>" + XMLTools.encodeXML(party.getZIP())
|
||||
+ "</ram:PostcodeCode>";
|
||||
+ "</ram:PostcodeCode>";
|
||||
}
|
||||
if (party.getStreet() != null) {
|
||||
xml += "<ram:LineOne>" + XMLTools.encodeXML(party.getStreet())
|
||||
+ "</ram:LineOne>";
|
||||
+ "</ram:LineOne>";
|
||||
}
|
||||
if (party.getAdditionalAddress() != null) {
|
||||
xml += "<ram:LineTwo>" + XMLTools.encodeXML(party.getAdditionalAddress())
|
||||
+ "</ram:LineTwo>";
|
||||
+ "</ram:LineTwo>";
|
||||
}
|
||||
if (party.getAdditionalAddressExtension() != null) {
|
||||
xml += "<ram:LineThree>" + XMLTools.encodeXML(party.getAdditionalAddressExtension())
|
||||
+ "</ram:LineThree>";
|
||||
+ "</ram:LineThree>";
|
||||
}
|
||||
if (party.getLocation() != null) {
|
||||
xml += "<ram:CityName>" + XMLTools.encodeXML(party.getLocation())
|
||||
+ "</ram:CityName>";
|
||||
+ "</ram:CityName>";
|
||||
}
|
||||
|
||||
|
||||
//country IS mandatory
|
||||
xml += "<ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
|
||||
+ "</ram:CountryID>"
|
||||
+ "</ram:PostalTradeAddress>";
|
||||
if (party.getUriUniversalCommunicationID() != null && party.getUriUniversalCommunicationIDScheme()!=null) {
|
||||
xml += "<ram:URIUniversalCommunication>" +
|
||||
"<ram:URIID schemeID=\"" + party.getUriUniversalCommunicationIDScheme() + "\">" +
|
||||
XMLTools.encodeXML(party.getUriUniversalCommunicationID())
|
||||
+ "</ram:URIID></ram:URIUniversalCommunication>";
|
||||
}
|
||||
+ "</ram:CountryID>"
|
||||
+ "</ram:PostalTradeAddress>";
|
||||
if (party.getUriUniversalCommunicationID() != null && party.getUriUniversalCommunicationIDScheme() != null) {
|
||||
xml += "<ram:URIUniversalCommunication>" +
|
||||
"<ram:URIID schemeID=\"" + party.getUriUniversalCommunicationIDScheme() + "\">" +
|
||||
XMLTools.encodeXML(party.getUriUniversalCommunicationID())
|
||||
+ "</ram:URIID></ram:URIUniversalCommunication>";
|
||||
}
|
||||
|
||||
if ((party.getVATID() != null) && (!isShipToTradeParty)) {
|
||||
xml += "<ram:SpecifiedTaxRegistration>"
|
||||
+ "<ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(party.getVATID())
|
||||
+ "</ram:ID>"
|
||||
+ "</ram:SpecifiedTaxRegistration>";
|
||||
+ "<ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(party.getVATID())
|
||||
+ "</ram:ID>"
|
||||
+ "</ram:SpecifiedTaxRegistration>";
|
||||
}
|
||||
if ((party.getTaxID() != null) && (!isShipToTradeParty)) {
|
||||
xml += "<ram:SpecifiedTaxRegistration>"
|
||||
+ "<ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(party.getTaxID())
|
||||
+ "</ram:ID>"
|
||||
+ "</ram:SpecifiedTaxRegistration>";
|
||||
+ "<ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(party.getTaxID())
|
||||
+ "</ram:ID>"
|
||||
+ "</ram:SpecifiedTaxRegistration>";
|
||||
|
||||
}
|
||||
return xml;
|
||||
@@ -244,10 +244,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
reason = "<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>";
|
||||
}
|
||||
final String allowanceChargeStr = "<ram:AppliedTradeAllowanceCharge><ram:ChargeIndicator><udt:Indicator>" +
|
||||
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
||||
"<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
||||
reason +
|
||||
"</ram:AppliedTradeAllowanceCharge>";
|
||||
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
||||
"<ram:ActualAmount>" + priceFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
||||
reason +
|
||||
"</ram:AppliedTradeAllowanceCharge>";
|
||||
return allowanceChargeStr;
|
||||
}
|
||||
|
||||
@@ -269,10 +269,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
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>" +
|
||||
"</ram:SpecifiedTradeAllowanceCharge>";
|
||||
chargeIndicator + "</udt:Indicator></ram:ChargeIndicator>" + percentage +
|
||||
"<ram:ActualAmount>" + currencyFormat(allowance.getTotalAmount(item)) + "</ram:ActualAmount>" +
|
||||
"<ram:Reason>" + XMLTools.encodeXML(allowance.getReason()) + "</ram:Reason>" +
|
||||
"</ram:SpecifiedTradeAllowanceCharge>";
|
||||
return itemTotalAllowanceChargeStr;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
boolean hasDueDate = false;
|
||||
final SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
|
||||
|
||||
String exemptionReason = "";
|
||||
|
||||
if (trans.getPaymentTermDescription() != null) {
|
||||
@@ -294,25 +294,32 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
paymentTermsDescription = "Zahlbar ohne Abzug bis " + germanDateFormat.format(trans.getDueDate());
|
||||
|
||||
}
|
||||
|
||||
|
||||
String typecode = "380";
|
||||
if (trans.getDocumentCode() != null) {
|
||||
typecode = trans.getDocumentCode();
|
||||
}
|
||||
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\""
|
||||
// + "
|
||||
// xsi:schemaLocation=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100
|
||||
// ../Schema/ZUGFeRD1p0.xsd\""
|
||||
+ " xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\""
|
||||
+ " xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\""
|
||||
+ " xmlns:qdt=\"urn:un:unece:uncefact:data:standard:QualifiedDataType:100\">"
|
||||
+ "<!-- generated by: mustangproject.org v" + ZUGFeRD2PullProvider.class.getPackage().getImplementationVersion() + "-->"
|
||||
+ "<rsm:ExchangedDocumentContext>"
|
||||
// + "
|
||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>"
|
||||
//
|
||||
+ "<ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||
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\""
|
||||
// + "
|
||||
// xsi:schemaLocation=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100
|
||||
// ../Schema/ZUGFeRD1p0.xsd\""
|
||||
+ " xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\""
|
||||
+ " xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\""
|
||||
+ " xmlns:qdt=\"urn:un:unece:uncefact:data:standard:QualifiedDataType:100\">"
|
||||
+ "<!-- generated by: mustangproject.org v" + ZUGFeRD2PullProvider.class.getPackage().getImplementationVersion() + "-->"
|
||||
+ "<rsm:ExchangedDocumentContext>\n";
|
||||
// + "
|
||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>"
|
||||
//
|
||||
|
||||
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:GuidelineSpecifiedDocumentContextParameter>"
|
||||
+ "</rsm:ExchangedDocumentContext>"
|
||||
@@ -334,25 +341,25 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
exemptionReason = "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
||||
}
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
if ((getProfile() != Profiles.getByName("Minimum")) && (getProfile() != Profiles.getByName("BasicWL"))) {
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
"<ram:AssociatedDocumentLineDocument>"
|
||||
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
||||
+ buildItemNotes(currentItem)
|
||||
+ "</ram:AssociatedDocumentLineDocument>"
|
||||
if ((getProfile() != Profiles.getByName("Minimum")) && (getProfile() != Profiles.getByName("BasicWL"))) {
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
"<ram:AssociatedDocumentLineDocument>"
|
||||
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
||||
+ buildItemNotes(currentItem)
|
||||
+ "</ram:AssociatedDocumentLineDocument>"
|
||||
|
||||
+ "<ram:SpecifiedTradeProduct>";
|
||||
+ "<ram:SpecifiedTradeProduct>";
|
||||
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>";
|
||||
}
|
||||
|
||||
if (currentItem.getProduct().getSellerAssignedID() != null) {
|
||||
xml += "<ram:SellerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>";
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>";
|
||||
}
|
||||
if (currentItem.getProduct().getBuyerAssignedID() != null) {
|
||||
xml += "<ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
}
|
||||
String allowanceChargeStr = "";
|
||||
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>"
|
||||
+ "<ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||
+ "</ram:Description>"
|
||||
+ "</ram:SpecifiedTradeProduct>"
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>";
|
||||
if (currentItem.getProduct().getDescription().length() > 0) {
|
||||
xml += "<ram:Description>" +
|
||||
XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
|
||||
"</ram:Description>";
|
||||
}
|
||||
xml += "</ram:SpecifiedTradeProduct>"
|
||||
|
||||
+ "<ram:SpecifiedLineTradeAgreement>";
|
||||
+ "<ram:SpecifiedLineTradeAgreement>";
|
||||
if (currentItem.getReferencedDocuments() != null) {
|
||||
for (final IReferencedDocument currentReferencedDocument : currentItem.getReferencedDocuments()) {
|
||||
xml += "<ram:AdditionalReferencedDocument>" +
|
||||
"<ram:IssuerAssignedID>" + XMLTools.encodeXML(currentReferencedDocument.getIssuerAssignedID()) + "</ram:IssuerAssignedID>" +
|
||||
"<ram:TypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getTypeCode()) + "</ram:TypeCode>" +
|
||||
"<ram:ReferenceTypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getReferenceTypeCode()) + "</ram:ReferenceTypeCode>" +
|
||||
"</ram:AdditionalReferencedDocument>";
|
||||
"<ram:IssuerAssignedID>" + XMLTools.encodeXML(currentReferencedDocument.getIssuerAssignedID()) + "</ram:IssuerAssignedID>" +
|
||||
"<ram:TypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getTypeCode()) + "</ram:TypeCode>" +
|
||||
"<ram:ReferenceTypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getReferenceTypeCode()) + "</ram:ReferenceTypeCode>" +
|
||||
"</ram:AdditionalReferencedDocument>";
|
||||
}
|
||||
}
|
||||
if (currentItem.getBuyerOrderReferencedDocumentLineID() != null) {
|
||||
xml += "<ram:BuyerOrderReferencedDocument> "
|
||||
+ "<ram:LineID>" + XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID()) + "</ram:LineID>"
|
||||
+ "</ram:BuyerOrderReferencedDocument>";
|
||||
+ "<ram:LineID>" + XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID()) + "</ram:LineID>"
|
||||
+ "</ram:BuyerOrderReferencedDocument>";
|
||||
}
|
||||
xml += "<ram:GrossPriceProductTradePrice>"
|
||||
+ "<ram:ChargeAmount>" + priceFormat(lc.getPriceGross())
|
||||
+ "</ram:ChargeAmount>" //currencyID=\"EUR\"
|
||||
+ "<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>"
|
||||
+ "</ram:GrossPriceProductTradePrice>"
|
||||
+ "<ram:NetPriceProductTradePrice>"
|
||||
+ "<ram:ChargeAmount>" + priceFormat(lc.getPrice())
|
||||
+ "</ram:ChargeAmount>" // currencyID=\"EUR\"
|
||||
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
|
||||
+ "</ram:NetPriceProductTradePrice>"
|
||||
+ "</ram:SpecifiedLineTradeAgreement>"
|
||||
+ "<ram:SpecifiedLineTradeDelivery>"
|
||||
+ "<ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
|
||||
+ quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>"
|
||||
+ "</ram:SpecifiedLineTradeDelivery>"
|
||||
+ "<ram:SpecifiedLineTradeSettlement>"
|
||||
+ "<ram:ApplicableTradeTax>"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
||||
+ exemptionReason
|
||||
+ "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>"
|
||||
+ "<ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>"
|
||||
+ "</ram:ApplicableTradeTax>";
|
||||
+ "<ram:ChargeAmount>" + priceFormat(lc.getPriceGross())
|
||||
+ "</ram:ChargeAmount>" //currencyID=\"EUR\"
|
||||
+ "<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>"
|
||||
+ "</ram:GrossPriceProductTradePrice>"
|
||||
+ "<ram:NetPriceProductTradePrice>"
|
||||
+ "<ram:ChargeAmount>" + priceFormat(lc.getPrice())
|
||||
+ "</ram:ChargeAmount>" // currencyID=\"EUR\"
|
||||
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
|
||||
+ "</ram:NetPriceProductTradePrice>"
|
||||
+ "</ram:SpecifiedLineTradeAgreement>"
|
||||
+ "<ram:SpecifiedLineTradeDelivery>"
|
||||
+ "<ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
|
||||
+ quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>"
|
||||
+ "</ram:SpecifiedLineTradeDelivery>"
|
||||
+ "<ram:SpecifiedLineTradeSettlement>"
|
||||
+ "<ram:ApplicableTradeTax>"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
||||
+ exemptionReason
|
||||
+ "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>"
|
||||
+ "<ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>"
|
||||
+ "</ram:ApplicableTradeTax>";
|
||||
if ((currentItem.getDetailedDeliveryPeriodFrom() != null) || (currentItem.getDetailedDeliveryPeriodTo() != null)) {
|
||||
xml += "<ram:BillingSpecifiedPeriod>";
|
||||
if (currentItem.getDetailedDeliveryPeriodFrom() != null) {
|
||||
@@ -439,15 +449,15 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
xml += itemTotalAllowanceChargeStr;
|
||||
|
||||
xml += "<ram:SpecifiedTradeSettlementLineMonetarySummation>"
|
||||
+ "<ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>" // currencyID=\"EUR\"
|
||||
+ "</ram:SpecifiedTradeSettlementLineMonetarySummation>";
|
||||
+ "<ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>" // currencyID=\"EUR\"
|
||||
+ "</ram:SpecifiedTradeSettlementLineMonetarySummation>";
|
||||
if (currentItem.getAdditionalReferencedDocumentID() != null) {
|
||||
xml += "<ram:AdditionalReferencedDocument><ram:IssuerAssignedID>" + currentItem.getAdditionalReferencedDocumentID() + "</ram:IssuerAssignedID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>";
|
||||
|
||||
}
|
||||
xml += "</ram:SpecifiedLineTradeSettlement>"
|
||||
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
||||
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -458,9 +468,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
}
|
||||
xml += "<ram:SellerTradeParty>"
|
||||
+ getTradePartyAsXML(trans.getSender(), true, false)
|
||||
+ "</ram:SellerTradeParty>"
|
||||
+ "<ram:BuyerTradeParty>";
|
||||
+ getTradePartyAsXML(trans.getSender(), true, false)
|
||||
+ "</ram:SellerTradeParty>"
|
||||
+ "<ram:BuyerTradeParty>";
|
||||
// + " <ID>GE2020211</ID>"
|
||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>"
|
||||
|
||||
@@ -469,21 +479,21 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
if (trans.getSellerOrderReferencedDocumentID() != null) {
|
||||
xml += " <ram:SellerOrderReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:SellerOrderReferencedDocument>";
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:SellerOrderReferencedDocument>";
|
||||
}
|
||||
if (trans.getBuyerOrderReferencedDocumentID() != null) {
|
||||
xml += " <ram:BuyerOrderReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:BuyerOrderReferencedDocument>";
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:BuyerOrderReferencedDocument>";
|
||||
}
|
||||
if (trans.getContractReferencedDocument() != null) {
|
||||
xml += " <ram:ContractReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:ContractReferencedDocument>";
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:ContractReferencedDocument>";
|
||||
}
|
||||
|
||||
// Additional Documents of XRechnung (Rechnungsbegruendende Unterlagen - BG-24 XRechnung)
|
||||
@@ -491,19 +501,19 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
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>";
|
||||
+ " <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>"
|
||||
+ XMLTools.encodeXML(trans.getSpecifiedProcuringProjectID()) + "</ram:ID>";
|
||||
+ " <ram:ID>"
|
||||
+ XMLTools.encodeXML(trans.getSpecifiedProcuringProjectID()) + "</ram:ID>";
|
||||
if (trans.getSpecifiedProcuringProjectName() != null) {
|
||||
xml += " <ram:Name >" + XMLTools.encodeXML(trans.getSpecifiedProcuringProjectName()) + "</ram:Name>";
|
||||
}
|
||||
@@ -514,20 +524,20 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
if (this.trans.getDeliveryAddress() != null) {
|
||||
xml += "<ram:ShipToTradeParty>" +
|
||||
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
|
||||
"</ram:ShipToTradeParty>";
|
||||
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
|
||||
"</ram:ShipToTradeParty>";
|
||||
}
|
||||
|
||||
|
||||
if (trans.getDeliveryDate() != null) {
|
||||
xml += "<ram:ActualDeliverySupplyChainEvent>"
|
||||
+ "<ram:OccurrenceDateTime>";
|
||||
+ "<ram:OccurrenceDateTime>";
|
||||
xml += DATE.udtFormat(trans.getDeliveryDate());
|
||||
xml += "</ram:OccurrenceDateTime>";
|
||||
xml += " </ram:ActualDeliverySupplyChainEvent>";
|
||||
|
||||
} 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");
|
||||
}
|
||||
}
|
||||
@@ -587,15 +597,15 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
if (getProfile() != Profiles.getByName("Minimum")) {
|
||||
|
||||
xml += "<ram:ApplicableTradeTax>"
|
||||
+ "<ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
|
||||
+ "</ram:CalculatedAmount>" //currencyID=\"EUR\"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
||||
+ (displayExemptionReason ? exemptionReason : "")
|
||||
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
||||
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>"
|
||||
+ (amountDueDateTypeCode != null ? "<ram:DueDateTypeCode>" + amountDueDateTypeCode + "</ram:DueDateTypeCode>" : "")
|
||||
+ "<ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent></ram:ApplicableTradeTax>";
|
||||
+ "<ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
|
||||
+ "</ram:CalculatedAmount>" //currencyID=\"EUR\"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
||||
+ (displayExemptionReason ? exemptionReason : "")
|
||||
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
||||
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>"
|
||||
+ (amountDueDateTypeCode != null ? "<ram:DueDateTypeCode>" + amountDueDateTypeCode + "</ram:DueDateTypeCode>" : "")
|
||||
+ "<ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent></ram:ApplicableTradeTax>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -615,17 +625,17 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
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> ";
|
||||
"<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> ";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -634,17 +644,17 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
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> ";
|
||||
"<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> ";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -667,8 +677,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
if (hasDueDate && (trans.getDueDate() != null)) {
|
||||
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
+ DATE.udtFormat(trans.getDueDate())
|
||||
+ "</ram:DueDateDateTime>";// 20130704
|
||||
+ DATE.udtFormat(trans.getDueDate())
|
||||
+ "</ram:DueDateDateTime>";// 20130704
|
||||
|
||||
}
|
||||
xml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
@@ -685,29 +695,29 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
if (getProfile() != Profiles.getByName("Minimum")) {
|
||||
xml += "<ram:LineTotalAmount>" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>";
|
||||
xml += chargesTotalLine
|
||||
+ allowanceTotalLine;
|
||||
+ allowanceTotalLine;
|
||||
}
|
||||
xml += "<ram:TaxBasisTotalAmount>" + currencyFormat(calc.getTaxBasis()) + "</ram:TaxBasisTotalAmount>"
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ "<ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
||||
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTaxBasis())) + "</ram:TaxTotalAmount>"
|
||||
+ "<ram:GrandTotalAmount>" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>";
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
if (getProfile() != Profiles.getByName("Minimum")) {
|
||||
xml+=" <ram:TotalPrepaidAmount>" + currencyFormat(calc.getTotalPrepaid()) + "</ram:TotalPrepaidAmount>";
|
||||
}
|
||||
xml+= "<ram:DuePayableAmount>" + currencyFormat(calc.getGrandTotal().subtract(calc.getTotalPrepaid())) + "</ram:DuePayableAmount>"
|
||||
+ "</ram:SpecifiedTradeSettlementHeaderMonetarySummation>";
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ "<ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
||||
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTaxBasis())) + "</ram:TaxTotalAmount>"
|
||||
+ "<ram:GrandTotalAmount>" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>";
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
if (getProfile() != Profiles.getByName("Minimum")) {
|
||||
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>"
|
||||
+ XMLTools.encodeXML(trans.getInvoiceReferencedDocumentID()) + "</ram:IssuerAssignedID>";
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getInvoiceReferencedDocumentID()) + "</ram:IssuerAssignedID>";
|
||||
if (trans.getInvoiceReferencedIssueDate() != null) {
|
||||
xml += "<ram:FormattedIssueDateTime>"
|
||||
+ DATE.qdtFormat(trans.getInvoiceReferencedIssueDate())
|
||||
+ "</ram:FormattedIssueDateTime>";
|
||||
+ DATE.qdtFormat(trans.getInvoiceReferencedIssueDate())
|
||||
+ "</ram:FormattedIssueDateTime>";
|
||||
}
|
||||
xml += " </ram:InvoiceReferencedDocument>";
|
||||
}
|
||||
@@ -723,7 +733,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
// + " </IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
xml += "</rsm:SupplyChainTradeTransaction>"
|
||||
+ "</rsm:CrossIndustryInvoice>";
|
||||
+ "</rsm:CrossIndustryInvoice>";
|
||||
|
||||
final byte[] zugferdRaw;
|
||||
try {
|
||||
@@ -735,37 +745,37 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
}
|
||||
|
||||
protected String buildItemNotes(IZUGFeRDExportableItem currentItem) {
|
||||
if (currentItem.getNotes() == null) {
|
||||
return "";
|
||||
}
|
||||
return Arrays.stream(currentItem.getNotes())
|
||||
.map(IncludedNote::unspecifiedNote)
|
||||
.map(IncludedNote::toCiiXml)
|
||||
.collect(Collectors.joining());
|
||||
}
|
||||
protected String buildItemNotes(IZUGFeRDExportableItem currentItem) {
|
||||
if (currentItem.getNotes() == null) {
|
||||
return "";
|
||||
}
|
||||
return Arrays.stream(currentItem.getNotes())
|
||||
.map(IncludedNote::unspecifiedNote)
|
||||
.map(IncludedNote::toCiiXml)
|
||||
.collect(Collectors.joining());
|
||||
}
|
||||
|
||||
protected String buildNotes(IExportableTransaction exportableTransaction) {
|
||||
final List<IncludedNote> includedNotes = Optional.ofNullable(exportableTransaction.getNotesWithSubjectCode())
|
||||
.orElse(new ArrayList<>());
|
||||
if (exportableTransaction.getNotes() != null) {
|
||||
for (final String currentNote : exportableTransaction.getNotes()) {
|
||||
includedNotes.add(IncludedNote.unspecifiedNote(currentNote));
|
||||
}
|
||||
}
|
||||
if (exportableTransaction.rebateAgreementExists()) {
|
||||
includedNotes.add(IncludedNote.discountBonusNote("Es bestehen Rabatt- und Bonusvereinbarungen."));
|
||||
}
|
||||
Optional.ofNullable(exportableTransaction.getOwnOrganisationFullPlaintextInfo())
|
||||
.ifPresent(info -> includedNotes.add(IncludedNote.regulatoryNote(info)));
|
||||
protected String buildNotes(IExportableTransaction exportableTransaction) {
|
||||
final List<IncludedNote> includedNotes = Optional.ofNullable(exportableTransaction.getNotesWithSubjectCode())
|
||||
.orElse(new ArrayList<>());
|
||||
if (exportableTransaction.getNotes() != null) {
|
||||
for (final String currentNote : exportableTransaction.getNotes()) {
|
||||
includedNotes.add(IncludedNote.unspecifiedNote(currentNote));
|
||||
}
|
||||
}
|
||||
if (exportableTransaction.rebateAgreementExists()) {
|
||||
includedNotes.add(IncludedNote.discountBonusNote("Es bestehen Rabatt- und Bonusvereinbarungen."));
|
||||
}
|
||||
Optional.ofNullable(exportableTransaction.getOwnOrganisationFullPlaintextInfo())
|
||||
.ifPresent(info -> includedNotes.add(IncludedNote.regulatoryNote(info)));
|
||||
|
||||
Optional.ofNullable(exportableTransaction.getSubjectNote())
|
||||
.ifPresent(note -> includedNotes.add(IncludedNote.unspecifiedNote(note)));
|
||||
|
||||
return includedNotes.stream().map(IncludedNote::toCiiXml).collect(Collectors.joining(""));
|
||||
}
|
||||
Optional.ofNullable(exportableTransaction.getSubjectNote())
|
||||
.ifPresent(note -> includedNotes.add(IncludedNote.unspecifiedNote(note)));
|
||||
|
||||
@Override
|
||||
return includedNotes.stream().map(IncludedNote::toCiiXml).collect(Collectors.joining(""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfile(Profile p) {
|
||||
profile = p;
|
||||
}
|
||||
@@ -781,7 +791,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
final Date dueDate = paymentTerms.getDueDate();
|
||||
if (dueDate != null && discountTerms != null && discountTerms.getBaseDate() != null) {
|
||||
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>";
|
||||
|
||||
@@ -805,7 +815,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
final String basisAmount = currencyFormat(calc.getGrandTotal());
|
||||
paymentTermsXml += "<ram:BasisAmount currencyID=\"" + currency + "\">" + basisAmount + "</ram:BasisAmount>";
|
||||
paymentTermsXml += "<ram:CalculationPercent>" + discountTerms.getCalculationPercentage().toString()
|
||||
+ "</ram:CalculationPercent>";
|
||||
+ "</ram:CalculationPercent>";
|
||||
|
||||
if (discountTerms.getBaseDate() != null) {
|
||||
final Date baseDate = discountTerms.getBaseDate();
|
||||
@@ -814,7 +824,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
paymentTermsXml += "</ram:BasisDateTime>";
|
||||
|
||||
paymentTermsXml += "<ram:BasisPeriodMeasure unitCode=\"" + discountTerms.getBasePeriodUnitCode() + "\">"
|
||||
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
||||
+ discountTerms.getBasePeriodMeasure() + "</ram:BasisPeriodMeasure>";
|
||||
}
|
||||
|
||||
paymentTermsXml += "</ram:ApplicableTradePaymentDiscountTerms>";
|
||||
|
||||
Reference in New Issue
Block a user