@@ -24,20 +24,22 @@ public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
default String getSettlementXML() {
|
||||
|
||||
|
||||
|
||||
String xml = " <ram:SpecifiedTradeSettlementPaymentMeans>\n"
|
||||
+ " <ram:TypeCode>59</ram:TypeCode>\n"
|
||||
+ " <ram:PayerPartyDebtorFinancialAccount>\n"
|
||||
+ " <ram:IBANID>"+XMLTools.encodeXML(getIBAN())+"</ram:IBANID>\n"
|
||||
+ " </ram:PayerPartyDebtorFinancialAccount>\n";
|
||||
String xml = "<ram:SpecifiedTradeSettlementPaymentMeans>"
|
||||
+ "<ram:TypeCode>59</ram:TypeCode>"
|
||||
+ "<ram:PayerPartyDebtorFinancialAccount>"
|
||||
+ "<ram:IBANID>"+XMLTools.encodeXML(getIBAN())+"</ram:IBANID>"
|
||||
+ "</ram:PayerPartyDebtorFinancialAccount>";
|
||||
|
||||
xml = xml + " </ram:SpecifiedTradeSettlementPaymentMeans>\n";
|
||||
xml += "</ram:SpecifiedTradeSettlementPaymentMeans>";
|
||||
return xml;
|
||||
}
|
||||
|
||||
@Override
|
||||
default String getPaymentXML() {
|
||||
return "<ram:DirectDebitMandateID>"+XMLTools.encodeXML(getMandate())+"</ram:DirectDebitMandateID>";
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.mustangproject.XMLTools;
|
||||
|
||||
public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement {
|
||||
@@ -60,26 +58,27 @@ public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement
|
||||
default String getAccountName() { return null; }
|
||||
|
||||
|
||||
default String getSettlementXML() {
|
||||
@Override
|
||||
default String getSettlementXML() {
|
||||
String accountNameStr="";
|
||||
if (getAccountName()!=null) {
|
||||
accountNameStr="<ram:AccountName>" + XMLTools.encodeXML(getAccountName()) + "</ram:AccountName>\n";
|
||||
accountNameStr="<ram:AccountName>" + XMLTools.encodeXML(getAccountName()) + "</ram:AccountName>";
|
||||
|
||||
}
|
||||
|
||||
String xml = " <ram:SpecifiedTradeSettlementPaymentMeans>\n"
|
||||
+ " <ram:TypeCode>58</ram:TypeCode>\n"
|
||||
+ " <ram:Information>SEPA credit transfer</ram:Information>\n"
|
||||
+ " <ram:PayeePartyCreditorFinancialAccount>\n"
|
||||
+ " <ram:IBANID>" + XMLTools.encodeXML(getOwnIBAN()) + "</ram:IBANID>\n";
|
||||
String xml = "<ram:SpecifiedTradeSettlementPaymentMeans>"
|
||||
+ "<ram:TypeCode>58</ram:TypeCode>"
|
||||
+ "<ram:Information>SEPA credit transfer</ram:Information>"
|
||||
+ "<ram:PayeePartyCreditorFinancialAccount>"
|
||||
+ "<ram:IBANID>" + XMLTools.encodeXML(getOwnIBAN()) + "</ram:IBANID>";
|
||||
xml+= accountNameStr;
|
||||
xml+= " </ram:PayeePartyCreditorFinancialAccount>\n"
|
||||
+ " <ram:PayeeSpecifiedCreditorFinancialInstitution>\n"
|
||||
+ " <ram:BICID>" + XMLTools.encodeXML(getOwnBIC()) + "</ram:BICID>\n"
|
||||
// + " <ram:Name>"+trans.getOwnBankName()+"</ram:Name>\n"
|
||||
xml+= "</ram:PayeePartyCreditorFinancialAccount>"
|
||||
+ "<ram:PayeeSpecifiedCreditorFinancialInstitution>"
|
||||
+ "<ram:BICID>" + XMLTools.encodeXML(getOwnBIC()) + "</ram:BICID>"
|
||||
// + " <ram:Name>"+trans.getOwnBankName()+"</ram:Name>"
|
||||
//
|
||||
+ " </ram:PayeeSpecifiedCreditorFinancialInstitution>\n"
|
||||
+ " </ram:SpecifiedTradeSettlementPaymentMeans>\n";
|
||||
+ "</ram:PayeeSpecifiedCreditorFinancialInstitution>"
|
||||
+ "</ram:SpecifiedTradeSettlementPaymentMeans>";
|
||||
return xml;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,17 +20,10 @@
|
||||
*/
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
import org.mustangproject.EStandard;
|
||||
import org.mustangproject.FileAttachment;
|
||||
import org.mustangproject.XMLTools;
|
||||
import static org.mustangproject.ZUGFeRD.ZUGFeRDDateFormat.DATE;
|
||||
import static org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants.CORRECTEDINVOICE;
|
||||
import static org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants.CATEGORY_CODES_WITH_EXEMPTION_REASON;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -40,9 +33,9 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static org.mustangproject.ZUGFeRD.ZUGFeRDDateFormat.DATE;
|
||||
import static org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants.CORRECTEDINVOICE;
|
||||
import static org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants.CATEGORY_CODES_WITH_EXEMPTION_REASON;
|
||||
import org.mustangproject.EStandard;
|
||||
import org.mustangproject.FileAttachment;
|
||||
import org.mustangproject.XMLTools;
|
||||
|
||||
public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
@@ -60,7 +53,7 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
boolean hasDueDate = false;
|
||||
final SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
|
||||
String exemptionReason = "";
|
||||
final String exemptionReason = "";
|
||||
|
||||
if (trans.getPaymentTermDescription() != null) {
|
||||
paymentTermsDescription = trans.getPaymentTermDescription();
|
||||
@@ -73,73 +66,73 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
|
||||
String senderReg = "";
|
||||
if (trans.getOwnOrganisationFullPlaintextInfo() != null) {
|
||||
senderReg = "" + "<ram:IncludedNote>\n" + " <ram:Content>\n"
|
||||
+ XMLTools.encodeXML(trans.getOwnOrganisationFullPlaintextInfo()) + " </ram:Content>\n"
|
||||
+ "<ram:SubjectCode>REG</ram:SubjectCode>\n" + "</ram:IncludedNote>\n";
|
||||
senderReg = "<ram:IncludedNote><ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getOwnOrganisationFullPlaintextInfo()) + "</ram:Content>"
|
||||
+ "<ram:SubjectCode>REG</ram:SubjectCode></ram:IncludedNote>";
|
||||
|
||||
}
|
||||
|
||||
String rebateAgreement = "";
|
||||
if (trans.rebateAgreementExists()) {
|
||||
rebateAgreement = "<ram:IncludedNote>\n" + " <ram:Content>"
|
||||
+ "Es bestehen Rabatt- und Bonusvereinbarungen.</ram:Content>\n"
|
||||
+ "<ram:SubjectCode>AAK</ram:SubjectCode>\n" + "</ram:IncludedNote>\n";
|
||||
rebateAgreement = "<ram:IncludedNote><ram:Content>"
|
||||
+ "Es bestehen Rabatt- und Bonusvereinbarungen.</ram:Content>"
|
||||
+ "<ram:SubjectCode>AAK</ram:SubjectCode></ram:IncludedNote>";
|
||||
}
|
||||
|
||||
String subjectNote = "";
|
||||
if (trans.getSubjectNote() != null) {
|
||||
subjectNote = "<ram:IncludedNote>\n" + " <ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getSubjectNote()) + "</ram:Content>\n"
|
||||
+ "</ram:IncludedNote>\n";
|
||||
subjectNote = "<ram:IncludedNote><ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getSubjectNote()) + "</ram:Content>"
|
||||
+ "</ram:IncludedNote>";
|
||||
}
|
||||
|
||||
String typecode = "220";
|
||||
final String typecode = "220";
|
||||
/*if (trans.getDocumentCode() != null) {
|
||||
typecode = trans.getDocumentCode();
|
||||
}*/
|
||||
String notes = "";
|
||||
if (trans.getNotes() != null) {
|
||||
for (final String currentNote : trans.getNotes()) {
|
||||
notes = notes + "<ram:IncludedNote><ram:Content>" + XMLTools.encodeXML(currentNote) + "</ram:Content></ram:IncludedNote>";
|
||||
notes += "<ram:IncludedNote><ram:Content>" + XMLTools.encodeXML(currentNote) + "</ram:Content></ram:IncludedNote>";
|
||||
|
||||
}
|
||||
}
|
||||
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||
|
||||
+ "<rsm:SCRDMCCBDACIOMessageStructure\n" +
|
||||
"xmlns:rsm=\"urn:un:unece:uncefact:data:SCRDMCCBDACIOMessageStructure:100\"\n" +
|
||||
"xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:128\"\n" +
|
||||
"xmlns:qdt=\"urn:un:unece:uncefact:data:standard:QualifiedDataType:128\"\n" +
|
||||
"xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:128\"\n" +
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n"
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
|
||||
// + "
|
||||
// xsi:schemaLocation=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100
|
||||
// ../Schema/ZUGFeRD1p0.xsd\""
|
||||
+ " <rsm:ExchangedDocumentContext>\n"
|
||||
+ "<rsm:ExchangedDocumentContext>"
|
||||
// + "
|
||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>\n"
|
||||
//
|
||||
+ "<ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
|
||||
+ "<ram:ID>A1</ram:ID>\n"
|
||||
+ "</ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
|
||||
+ " <ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
+ " <ram:ID>" + getProfile().getID() + "</ram:ID>\n"
|
||||
+ " </ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
+ " </rsm:ExchangedDocumentContext>\n"
|
||||
+ " <rsm:ExchangedDocument>\n"
|
||||
+ " <ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>\n"
|
||||
// + " <ram:Name>RECHNUNG</ram:Name>\n"
|
||||
// + " <ram:TypeCode>380</ram:TypeCode>\n"
|
||||
+ " <ram:TypeCode>" + typecode + "</ram:TypeCode>\n"
|
||||
+ " <ram:IssueDateTime>"
|
||||
+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>\n" // date
|
||||
+ "<ram:BusinessProcessSpecifiedDocumentContextParameter>"
|
||||
+ "<ram:ID>A1</ram:ID>"
|
||||
+ "</ram:BusinessProcessSpecifiedDocumentContextParameter>"
|
||||
+ "<ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||
+ "<ram:ID>" + getProfile().getID() + "</ram:ID>"
|
||||
+ "</ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||
+ "</rsm:ExchangedDocumentContext>"
|
||||
+ "<rsm:ExchangedDocument>"
|
||||
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>"
|
||||
// + " <ram:Name>RECHNUNG</ram:Name>"
|
||||
// + "<ram:TypeCode>380</ram:TypeCode>"
|
||||
+ "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
|
||||
+ "<ram:IssueDateTime>"
|
||||
+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
|
||||
+ notes
|
||||
+ subjectNote
|
||||
+ rebateAgreement
|
||||
+ senderReg
|
||||
|
||||
+ " </rsm:ExchangedDocument>\n"
|
||||
+ " <rsm:SupplyChainTradeTransaction>\n";
|
||||
+ "</rsm:ExchangedDocument>"
|
||||
+ "<rsm:SupplyChainTradeTransaction>";
|
||||
int lineID = 0;
|
||||
for (final IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
||||
lineID++;
|
||||
@@ -154,21 +147,21 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
}
|
||||
}
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
xml = xml + " <ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:AssociatedDocumentLineDocument>\n"
|
||||
+ " <ram:LineID>" + lineID + "</ram:LineID>\n"
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
"<ram:AssociatedDocumentLineDocument>"
|
||||
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
||||
+ notes
|
||||
+ " </ram:AssociatedDocumentLineDocument>\n"
|
||||
+ "</ram:AssociatedDocumentLineDocument>"
|
||||
|
||||
+ " <ram:SpecifiedTradeProduct>\n";
|
||||
// + " <GlobalID schemeID=\"0160\">4012345001235</GlobalID>\n"
|
||||
+ "<ram:SpecifiedTradeProduct>";
|
||||
// + " <GlobalID schemeID=\"0160\">4012345001235</GlobalID>"
|
||||
if (currentItem.getProduct().getSellerAssignedID() != null) {
|
||||
xml = xml + " <ram:SellerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>\n";
|
||||
xml += "<ram:SellerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>";
|
||||
}
|
||||
if (currentItem.getProduct().getBuyerAssignedID() != null) {
|
||||
xml = xml + " <ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>\n";
|
||||
xml += "<ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
}
|
||||
String allowanceChargeStr = "";
|
||||
if (currentItem.getItemAllowances() != null && currentItem.getItemAllowances().length > 0) {
|
||||
@@ -184,15 +177,15 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
}
|
||||
|
||||
|
||||
xml = xml + " <ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>\n"
|
||||
+ " <ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||
+ "</ram:Description>\n"
|
||||
+ " </ram:SpecifiedTradeProduct>\n"
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>"
|
||||
+ "<ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||
+ "</ram:Description>"
|
||||
+ "</ram:SpecifiedTradeProduct>"
|
||||
|
||||
+ " <ram:SpecifiedLineTradeAgreement>\n";
|
||||
+ "<ram:SpecifiedLineTradeAgreement>";
|
||||
/* if (currentItem.getReferencedDocuments() != null) {
|
||||
for (IReferencedDocument currentReferencedDocument : currentItem.getReferencedDocuments()) {
|
||||
xml = xml + "<ram:AdditionalReferencedDocument>\n" +
|
||||
xml += "<ram:AdditionalReferencedDocument>\n" +
|
||||
"<ram:IssuerAssignedID>" + XMLTools.encodeXML(currentReferencedDocument.getIssuerAssignedID()) + "</ram:IssuerAssignedID>\n" +
|
||||
"<ram:TypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getTypeCode()) + "</ram:TypeCode>\n" +
|
||||
"<ram:ReferenceTypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getReferenceTypeCode()) + "</ram:ReferenceTypeCode>\n" +
|
||||
@@ -203,136 +196,136 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
|
||||
}*/
|
||||
if (currentItem.getBuyerOrderReferencedDocumentLineID() != null) {
|
||||
xml = xml + " <ram:BuyerOrderReferencedDocument> \n"
|
||||
+ " <ram:LineID>" + XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID()) + "</ram:LineID>\n"
|
||||
+ " </ram:BuyerOrderReferencedDocument>\n";
|
||||
xml += "<ram:BuyerOrderReferencedDocument> \n"
|
||||
+ "<ram:LineID>" + XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID()) + "</ram:LineID>"
|
||||
+ "</ram:BuyerOrderReferencedDocument>";
|
||||
|
||||
}
|
||||
xml = xml + " <ram:GrossPriceProductTradePrice>\n"
|
||||
+ " <ram:ChargeAmount>" + priceFormat(lc.getPriceGross())
|
||||
+ "</ram:ChargeAmount>\n" //currencyID=\"EUR\"
|
||||
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>\n"
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
|
||||
+ allowanceChargeStr
|
||||
// + " <AppliedTradeAllowanceCharge>\n"
|
||||
// + " <ChargeIndicator>false</ChargeIndicator>\n"
|
||||
// + " <ActualAmount currencyID=\"EUR\">0.6667</ActualAmount>\n"
|
||||
// + " <Reason>Rabatt</Reason>\n"
|
||||
// + " </AppliedTradeAllowanceCharge>\n"
|
||||
+ " </ram:GrossPriceProductTradePrice>\n"
|
||||
+ " <ram:NetPriceProductTradePrice>\n"
|
||||
+ " <ram:ChargeAmount>" + priceFormat(lc.getPrice())
|
||||
+ "</ram:ChargeAmount>\n" // currencyID=\"EUR\"
|
||||
+ " <ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>\n"
|
||||
+ " </ram:NetPriceProductTradePrice>\n"
|
||||
+ " </ram:SpecifiedLineTradeAgreement>\n"
|
||||
+ "</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>\n"
|
||||
+ " <ram:RequestedQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
|
||||
+ quantityFormat(currentItem.getQuantity()) + "</ram:RequestedQuantity>\n"
|
||||
+ " </ram:SpecifiedLineTradeDelivery>\n"
|
||||
+ " <ram:SpecifiedLineTradeSettlement>\n"
|
||||
+ " <ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||
+ "<ram:SpecifiedLineTradeDelivery>"
|
||||
+ "<ram:RequestedQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
|
||||
+ quantityFormat(currentItem.getQuantity()) + "</ram:RequestedQuantity>"
|
||||
+ "</ram:SpecifiedLineTradeDelivery>"
|
||||
+ "<ram:SpecifiedLineTradeSettlement>"
|
||||
+ "<ram:ApplicableTradeTax>"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
||||
+ exemptionReason
|
||||
+ " <ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>\n"
|
||||
+ "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>"
|
||||
|
||||
+ " <ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>\n"
|
||||
+ " </ram:ApplicableTradeTax>\n";
|
||||
+ "<ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>"
|
||||
+ "</ram:ApplicableTradeTax>";
|
||||
if ((currentItem.getDetailedDeliveryPeriodFrom() != null) || (currentItem.getDetailedDeliveryPeriodTo() != null)) {
|
||||
xml = xml + "<ram:BillingSpecifiedPeriod>";
|
||||
xml += "<ram:BillingSpecifiedPeriod>";
|
||||
if (currentItem.getDetailedDeliveryPeriodFrom() != null) {
|
||||
xml = xml + "<ram:StartDateTime>" + DATE.udtFormat(currentItem.getDetailedDeliveryPeriodFrom()) + "</ram:StartDateTime>";
|
||||
xml += "<ram:StartDateTime>" + DATE.udtFormat(currentItem.getDetailedDeliveryPeriodFrom()) + "</ram:StartDateTime>";
|
||||
}
|
||||
if (currentItem.getDetailedDeliveryPeriodTo() != null) {
|
||||
xml = xml + "<ram:EndDateTime>" + DATE.udtFormat(currentItem.getDetailedDeliveryPeriodTo()) + "</ram:EndDateTime>";
|
||||
xml += "<ram:EndDateTime>" + DATE.udtFormat(currentItem.getDetailedDeliveryPeriodTo()) + "</ram:EndDateTime>";
|
||||
}
|
||||
xml = xml + "</ram:BillingSpecifiedPeriod>";
|
||||
xml += "</ram:BillingSpecifiedPeriod>";
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeSettlementLineMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>\n" // currencyID=\"EUR\"
|
||||
+ " </ram:SpecifiedTradeSettlementLineMonetarySummation>\n";
|
||||
xml += "<ram:SpecifiedTradeSettlementLineMonetarySummation>"
|
||||
+ "<ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>" // currencyID=\"EUR\"
|
||||
+ "</ram:SpecifiedTradeSettlementLineMonetarySummation>";
|
||||
/* if (currentItem.getAdditionalReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:AdditionalReferencedDocument><ram:IssuerAssignedID>" + currentItem.getAdditionalReferencedDocumentID() + "</ram:IssuerAssignedID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>\n";
|
||||
xml += "<ram:AdditionalReferencedDocument><ram:IssuerAssignedID>" + currentItem.getAdditionalReferencedDocumentID() + "</ram:IssuerAssignedID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>";
|
||||
|
||||
}*/
|
||||
xml = xml + " </ram:SpecifiedLineTradeSettlement>\n"
|
||||
+ " </ram:IncludedSupplyChainTradeLineItem>\n";
|
||||
xml += "</ram:SpecifiedLineTradeSettlement>"
|
||||
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:ApplicableHeaderTradeAgreement>\n";
|
||||
xml += "<ram:ApplicableHeaderTradeAgreement>";
|
||||
if (trans.getReferenceNumber() != null) {
|
||||
xml = xml + " <ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>\n";
|
||||
xml += "<ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>";
|
||||
|
||||
}
|
||||
xml = xml + " <ram:SellerTradeParty>\n"
|
||||
xml += "<ram:SellerTradeParty>"
|
||||
+ getTradePartyAsXML(trans.getSender(), true, false)
|
||||
+ " </ram:SellerTradeParty>\n"
|
||||
+ " <ram:BuyerTradeParty>\n";
|
||||
// + " <ID>GE2020211</ID>\n"
|
||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
||||
+ "</ram:SellerTradeParty>"
|
||||
+ "<ram:BuyerTradeParty>";
|
||||
// + " <ID>GE2020211</ID>"
|
||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>"
|
||||
|
||||
xml += getTradePartyAsXML(trans.getRecipient(), false, false);
|
||||
xml += " </ram:BuyerTradeParty>\n";
|
||||
xml += "</ram:BuyerTradeParty>";
|
||||
|
||||
if (trans.getSellerOrderReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:SellerOrderReferencedDocument>\n"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>\n"
|
||||
+ " </ram:SellerOrderReferencedDocument>\n";
|
||||
xml += "<ram:SellerOrderReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ "</ram:SellerOrderReferencedDocument>";
|
||||
}
|
||||
if (trans.getBuyerOrderReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:BuyerOrderReferencedDocument>\n"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>\n"
|
||||
+ " </ram:BuyerOrderReferencedDocument>\n";
|
||||
xml += "<ram:BuyerOrderReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ "</ram:BuyerOrderReferencedDocument>";
|
||||
}
|
||||
if (trans.getContractReferencedDocument() != null) {
|
||||
xml = xml + " <ram:ContractReferencedDocument>\n"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>\n"
|
||||
+ " </ram:ContractReferencedDocument>\n";
|
||||
xml += "<ram:ContractReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>"
|
||||
+ "</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 = xml + " <ram:AdditionalReferencedDocument>\n"
|
||||
+ " <ram:IssuerAssignedID>" + f.getFilename() + "</ram:IssuerAssignedID>\n"
|
||||
+ " <ram:TypeCode>916</ram:TypeCode>\n"
|
||||
+ " <ram:Name>" + f.getDescription() + "</ram:Name>\n"
|
||||
+ " <ram:AttachmentBinaryObject mimeCode=\"" + f.getMimetype() + "\"\n"
|
||||
+ " filename=\"" + f.getFilename() + "\">" + documentContent + "</ram:AttachmentBinaryObject>\n"
|
||||
+ " </ram:AdditionalReferencedDocument>\n";
|
||||
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 = xml + " <ram:SpecifiedProcuringProject>\n"
|
||||
+ " <ram:ID>"
|
||||
+ XMLTools.encodeXML(trans.getSpecifiedProcuringProjectID()) + "</ram:ID>\n";
|
||||
xml += "<ram:SpecifiedProcuringProject>"
|
||||
+ "<ram:ID>"
|
||||
+ XMLTools.encodeXML(trans.getSpecifiedProcuringProjectID()) + "</ram:ID>";
|
||||
if (trans.getSpecifiedProcuringProjectName() != null) {
|
||||
xml += " <ram:Name >" + XMLTools.encodeXML(trans.getSpecifiedProcuringProjectName()) + "</ram:Name>\n";
|
||||
xml += "<ram:Name >" + XMLTools.encodeXML(trans.getSpecifiedProcuringProjectName()) + "</ram:Name>";
|
||||
}
|
||||
xml += " </ram:SpecifiedProcuringProject>\n";
|
||||
xml += "</ram:SpecifiedProcuringProject>";
|
||||
}
|
||||
xml = xml + " </ram:ApplicableHeaderTradeAgreement>\n"
|
||||
+ " <ram:ApplicableHeaderTradeDelivery>\n";
|
||||
xml += "</ram:ApplicableHeaderTradeAgreement>"
|
||||
+ "<ram:ApplicableHeaderTradeDelivery>";
|
||||
if (this.trans.getDeliveryAddress() != null) {
|
||||
xml += "<ram:ShipToTradeParty>" +
|
||||
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
|
||||
"</ram:ShipToTradeParty>";
|
||||
}
|
||||
/*
|
||||
xml += " <ram:ActualDeliverySupplyChainEvent>\n"
|
||||
+ " <ram:OccurrenceDateTime>";
|
||||
xml += "<ram:ActualDeliverySupplyChainEvent>"
|
||||
+ "<ram:OccurrenceDateTime>";
|
||||
|
||||
if (trans.getDeliveryDate() != null) {
|
||||
xml += DATE.udtFormat(trans.getDeliveryDate());
|
||||
@@ -340,18 +333,18 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
throw new IllegalStateException("No delivery date provided");
|
||||
}
|
||||
xml += "</ram:OccurrenceDateTime>\n";
|
||||
xml += " </ram:ActualDeliverySupplyChainEvent>\n"
|
||||
xml += "</ram:ActualDeliverySupplyChainEvent>\n"
|
||||
|
||||
*/
|
||||
/*
|
||||
* + " <DeliveryNoteReferencedDocument>\n" +
|
||||
* " <IssueDateTime format=\"102\">20130603</IssueDateTime>\n" +
|
||||
* " <ID>2013-51112</ID>\n" +
|
||||
* " </DeliveryNoteReferencedDocument>\n"
|
||||
* + "<DeliveryNoteReferencedDocument>\n" +
|
||||
* "<IssueDateTime format=\"102\">20130603</IssueDateTime>\n" +
|
||||
* "<ID>2013-51112</ID>\n" +
|
||||
* "</DeliveryNoteReferencedDocument>\n"
|
||||
*/
|
||||
xml+= " </ram:ApplicableHeaderTradeDelivery>\n" + " <ram:ApplicableHeaderTradeSettlement>\n"
|
||||
// + " <ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>\n"
|
||||
+ " <ram:OrderCurrencyCode>" + trans.getCurrency() + "</ram:OrderCurrencyCode>\n";
|
||||
xml+= "</ram:ApplicableHeaderTradeDelivery>\n<ram:ApplicableHeaderTradeSettlement>"
|
||||
// + "<ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>"
|
||||
+ "<ram:OrderCurrencyCode>" + trans.getCurrency() + "</ram:OrderCurrencyCode>";
|
||||
|
||||
if (trans.getTradeSettlementPayment() != null) {
|
||||
for (final IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
|
||||
@@ -381,28 +374,28 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
if (amount != null) {
|
||||
final String amountCategoryCode = amount.getCategoryCode();
|
||||
final boolean displayExemptionReason = CATEGORY_CODES_WITH_EXEMPTION_REASON.contains(amountCategoryCode);
|
||||
/* xml += " <ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
|
||||
/* xml += "<ram:ApplicableTradeTax>\n"
|
||||
+ "<ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
|
||||
+ "</ram:CalculatedAmount>\n" //currencyID=\"EUR\"
|
||||
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||
+ (displayExemptionReason ? exemptionReason : "")
|
||||
+ " <ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
|
||||
+ " <ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>\n"
|
||||
+ " <ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n";
|
||||
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
|
||||
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>\n"
|
||||
+ "<ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" + "</ram:ApplicableTradeTax>\n";
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
if ((trans.getDetailedDeliveryPeriodFrom() != null) || (trans.getDetailedDeliveryPeriodTo() != null)) {
|
||||
xml = xml + "<ram:BillingSpecifiedPeriod>";
|
||||
xml += "<ram:BillingSpecifiedPeriod>";
|
||||
if (trans.getDetailedDeliveryPeriodFrom() != null) {
|
||||
xml = xml + "<ram:StartDateTime>" + DATE.udtFormat(trans.getDetailedDeliveryPeriodFrom()) + "</ram:StartDateTime>";
|
||||
xml += "<ram:StartDateTime>" + DATE.udtFormat(trans.getDetailedDeliveryPeriodFrom()) + "</ram:StartDateTime>";
|
||||
}
|
||||
if (trans.getDetailedDeliveryPeriodTo() != null) {
|
||||
xml = xml + "<ram:EndDateTime>" + DATE.udtFormat(trans.getDetailedDeliveryPeriodTo()) + "</ram:EndDateTime>";
|
||||
xml += "<ram:EndDateTime>" + DATE.udtFormat(trans.getDetailedDeliveryPeriodTo()) + "</ram:EndDateTime>";
|
||||
}
|
||||
xml = xml + "</ram:BillingSpecifiedPeriod>";
|
||||
xml += "</ram:BillingSpecifiedPeriod>";
|
||||
|
||||
|
||||
}
|
||||
@@ -413,18 +406,18 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
if (calc.getChargesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
||||
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeAllowanceCharge>\n" +
|
||||
" <ram:ChargeIndicator>\n" +
|
||||
" <udt:Indicator>true</udt:Indicator>\n" +
|
||||
" </ram:ChargeIndicator>\n" +
|
||||
" <ram:ActualAmount>" + currencyFormat(calc.getChargesForPercent(currentTaxPercent)) + "</ram:ActualAmount>\n" +
|
||||
" <ram:Reason>" + XMLTools.encodeXML(calc.getChargeReasonForPercent(currentTaxPercent)) + "</ram:Reason>\n" +
|
||||
" <ram:CategoryTradeTax>\n" +
|
||||
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
" <ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>\n" +
|
||||
" <ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" +
|
||||
" </ram:CategoryTradeTax>\n" +
|
||||
" </ram:SpecifiedTradeAllowanceCharge> \n";
|
||||
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>";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -434,28 +427,28 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
if ((trans.getZFAllowances() != null) && (trans.getZFAllowances().length > 0)) {
|
||||
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||
if (calc.getAllowancesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
||||
xml = xml + " <ram:SpecifiedTradeAllowanceCharge>\n" +
|
||||
" <ram:ChargeIndicator>\n" +
|
||||
" <udt:Indicator>false</udt:Indicator>\n" +
|
||||
" </ram:ChargeIndicator>\n" +
|
||||
" <ram:ActualAmount>" + currencyFormat(calc.getAllowancesForPercent(currentTaxPercent)) + "</ram:ActualAmount>\n" +
|
||||
" <ram:Reason>" + XMLTools.encodeXML(calc.getAllowanceReasonForPercent(currentTaxPercent)) + "</ram:Reason>\n" +
|
||||
" <ram:CategoryTradeTax>\n" +
|
||||
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
" <ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>\n" +
|
||||
" <ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" +
|
||||
" </ram:CategoryTradeTax>\n" +
|
||||
" </ram:SpecifiedTradeAllowanceCharge> \n";
|
||||
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> \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((trans.getPaymentTerms() == null) && ((paymentTermsDescription != null) || (trans.getTradeSettlement() != null) || (hasDueDate))) {
|
||||
xml = xml + "<ram:SpecifiedTradePaymentTerms>\n";
|
||||
xml += "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
if (paymentTermsDescription != null) {
|
||||
xml = xml + "<ram:Description>" + paymentTermsDescription + "</ram:Description>\n";
|
||||
xml += "<ram:Description>" + paymentTermsDescription + "</ram:Description>";
|
||||
}
|
||||
|
||||
if (trans.getTradeSettlement() != null) {
|
||||
@@ -467,14 +460,14 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
}
|
||||
|
||||
if (hasDueDate && (trans.getDueDate() != null)) {
|
||||
xml = xml + " <ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
+ DATE.udtFormat(trans.getDueDate())
|
||||
+ "</ram:DueDateDateTime>\n";// 20130704
|
||||
+ "</ram:DueDateDateTime>";// 20130704
|
||||
|
||||
}
|
||||
xml = xml + " </ram:SpecifiedTradePaymentTerms>\n";
|
||||
xml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
} else {
|
||||
xml = xml + buildPaymentTermsXml();
|
||||
xml += buildPaymentTermsXml();
|
||||
}
|
||||
|
||||
|
||||
@@ -482,44 +475,44 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
|
||||
final String chargesTotalLine = "<ram:ChargeTotalAmount>" + currencyFormat(calc.getChargesForPercent(null)) + "</ram:ChargeTotalAmount>";
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount>" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>\n"
|
||||
xml += "<ram:SpecifiedTradeSettlementHeaderMonetarySummation>"
|
||||
+ "<ram:LineTotalAmount>" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>"
|
||||
+ chargesTotalLine
|
||||
+ allowanceTotalLine
|
||||
+ " <ram:TaxBasisTotalAmount>" + currencyFormat(calc.getTaxBasis()) + "</ram:TaxBasisTotalAmount>\n"
|
||||
+ "<ram:TaxBasisTotalAmount>" + currencyFormat(calc.getTaxBasis()) + "</ram:TaxBasisTotalAmount>"
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ " <ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
||||
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTaxBasis())) + "</ram:TaxTotalAmount>\n"
|
||||
+ " <ram:GrandTotalAmount>" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>\n"
|
||||
+ "<ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
||||
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTaxBasis())) + "</ram:TaxTotalAmount>"
|
||||
+ "<ram:GrandTotalAmount>" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>"
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
//+ " <ram:TotalPrepaidAmount>" + currencyFormat(calc.getTotalPrepaid()) + "</ram:TotalPrepaidAmount>\n"
|
||||
//+ " <ram:DuePayableAmount>" + currencyFormat(calc.getGrandTotal().subtract(calc.getTotalPrepaid())) + "</ram:DuePayableAmount>\n"
|
||||
+ " </ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n";
|
||||
//+ "<ram:TotalPrepaidAmount>" + currencyFormat(calc.getTotalPrepaid()) + "</ram:TotalPrepaidAmount>"
|
||||
//+ "<ram:DuePayableAmount>" + currencyFormat(calc.getGrandTotal().subtract(calc.getTotalPrepaid())) + "</ram:DuePayableAmount>"
|
||||
+ "</ram:SpecifiedTradeSettlementHeaderMonetarySummation>";
|
||||
if (trans.getInvoiceReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:InvoiceReferencedDocument>\n"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getInvoiceReferencedDocumentID()) + "</ram:IssuerAssignedID>\n";
|
||||
xml += "<ram:InvoiceReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getInvoiceReferencedDocumentID()) + "</ram:IssuerAssignedID>";
|
||||
if (trans.getInvoiceReferencedIssueDate() != null) {
|
||||
xml += "<ram:FormattedIssueDateTime>"
|
||||
+ DATE.qdtFormat(trans.getInvoiceReferencedIssueDate())
|
||||
+ "</ram:FormattedIssueDateTime>\n";
|
||||
+ "</ram:FormattedIssueDateTime>";
|
||||
}
|
||||
xml += " </ram:InvoiceReferencedDocument>\n";
|
||||
xml += "</ram:InvoiceReferencedDocument>";
|
||||
}
|
||||
|
||||
xml = xml + " </ram:ApplicableHeaderTradeSettlement>\n";
|
||||
// + " <IncludedSupplyChainTradeLineItem>\n"
|
||||
// + " <AssociatedDocumentLineDocument>\n"
|
||||
// + " <IncludedNote>\n"
|
||||
xml += "</ram:ApplicableHeaderTradeSettlement>";
|
||||
// + " <IncludedSupplyChainTradeLineItem>"
|
||||
// + " <AssociatedDocumentLineDocument>"
|
||||
// + " <IncludedNote>"
|
||||
// + " <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";
|
||||
|
||||
xml = xml + " </rsm:SupplyChainTradeTransaction>\n"
|
||||
xml += "</rsm:SupplyChainTradeTransaction>"
|
||||
+ "</rsm:SCRDMCCBDACIOMessageStructure>";
|
||||
|
||||
final byte[] zugferdRaw;
|
||||
|
||||
@@ -25,8 +25,8 @@ import static org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants.CATE
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -57,19 +57,23 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
||||
public void setTest() {
|
||||
}
|
||||
|
||||
protected String vatFormat(BigDecimal value) {
|
||||
@Override
|
||||
protected String vatFormat(BigDecimal value) {
|
||||
return XMLTools.nDigitFormat(value, 2);
|
||||
}
|
||||
|
||||
protected String currencyFormat(BigDecimal value) {
|
||||
@Override
|
||||
protected String currencyFormat(BigDecimal value) {
|
||||
return XMLTools.nDigitFormat(value, 2);
|
||||
}
|
||||
|
||||
protected String priceFormat(BigDecimal value) {
|
||||
@Override
|
||||
protected String priceFormat(BigDecimal value) {
|
||||
return XMLTools.nDigitFormat(value, 4);
|
||||
}
|
||||
|
||||
protected String quantityFormat(BigDecimal value) {
|
||||
@Override
|
||||
protected String quantityFormat(BigDecimal value) {
|
||||
return XMLTools.nDigitFormat(value, 4);
|
||||
}
|
||||
|
||||
@@ -127,52 +131,52 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
||||
|
||||
String senderReg = "";
|
||||
if (trans.getOwnOrganisationFullPlaintextInfo() != null) {
|
||||
senderReg = "" + "<ram:IncludedNote>\n" + " <ram:Content>\n"
|
||||
+ XMLTools.encodeXML(trans.getOwnOrganisationFullPlaintextInfo()) + " </ram:Content>\n"
|
||||
+ "<ram:SubjectCode>REG</ram:SubjectCode>\n" + "</ram:IncludedNote>\n";
|
||||
senderReg = "<ram:IncludedNote><ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getOwnOrganisationFullPlaintextInfo()) + "</ram:Content>"
|
||||
+ "<ram:SubjectCode>REG</ram:SubjectCode></ram:IncludedNote>";
|
||||
|
||||
}
|
||||
|
||||
String rebateAgreement = "";
|
||||
if (trans.rebateAgreementExists()) {
|
||||
rebateAgreement = "<ram:IncludedNote>\n" + " <ram:Content>"
|
||||
+ "Es bestehen Rabatt- und Bonusvereinbarungen.</ram:Content>\n"
|
||||
+ "<ram:SubjectCode>AAK</ram:SubjectCode>\n" + "</ram:IncludedNote>\n";
|
||||
rebateAgreement = "<ram:IncludedNote><ram:Content>"
|
||||
+ "Es bestehen Rabatt- und Bonusvereinbarungen.</ram:Content>"
|
||||
+ "<ram:SubjectCode>AAK</ram:SubjectCode></ram:IncludedNote>";
|
||||
}
|
||||
|
||||
String subjectNote = "";
|
||||
if (trans.getSubjectNote() != null) {
|
||||
subjectNote = "<ram:IncludedNote>\n" + " <ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getSubjectNote()) + "</ram:Content>\n"
|
||||
+ "</ram:IncludedNote>\n";
|
||||
subjectNote = "<ram:IncludedNote><ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getSubjectNote()) + "</ram:Content>"
|
||||
+ "</ram:IncludedNote>";
|
||||
}
|
||||
String typecode = "380";
|
||||
if (trans.getDocumentCode() != null) {
|
||||
typecode = trans.getDocumentCode();
|
||||
}
|
||||
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||
|
||||
+ "<rsm:CrossIndustryDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:ferd:CrossIndustryDocument:invoice:1p0\""
|
||||
// + "
|
||||
// xsi:schemaLocation=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100
|
||||
// ../Schema/ZUGFeRD1p0.xsd\""
|
||||
+ " xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12\""
|
||||
+ " xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15\">\n"
|
||||
+ "<!-- generated by: mustangproject.org v" + ZUGFeRD1PullProvider.class.getPackage().getImplementationVersion() + "-->\n"
|
||||
+ " <rsm:SpecifiedExchangedDocumentContext>\n"
|
||||
+ " xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15\">"
|
||||
+ "<!-- generated by: mustangproject.org v" + ZUGFeRD1PullProvider.class.getPackage().getImplementationVersion() + "-->"
|
||||
+ "<rsm:SpecifiedExchangedDocumentContext>"
|
||||
// + "
|
||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>\n"
|
||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>"
|
||||
//
|
||||
+ " <ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
+ " <ram:ID>" + getProfile().getID() + "</ram:ID>\n"
|
||||
+ " </ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
+ " </rsm:SpecifiedExchangedDocumentContext>\n"
|
||||
+ " <rsm:HeaderExchangedDocument>\n"
|
||||
+ " <ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>\n"
|
||||
+ " <ram:Name>RECHNUNG</ram:Name>\n"
|
||||
+ " <ram:TypeCode>" + typecode + "</ram:TypeCode>\n"
|
||||
+ " <ram:IssueDateTime>"
|
||||
+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>\n" // date
|
||||
+ "<ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||
+ "<ram:ID>" + getProfile().getID() + "</ram:ID>"
|
||||
+ "</ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||
+ "</rsm:SpecifiedExchangedDocumentContext>"
|
||||
+ "<rsm:HeaderExchangedDocument>"
|
||||
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>"
|
||||
+ "<ram:Name>RECHNUNG</ram:Name>"
|
||||
+ "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
|
||||
+ "<ram:IssueDateTime>"
|
||||
+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
|
||||
// format
|
||||
// was
|
||||
// 20130605
|
||||
@@ -180,68 +184,68 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
||||
+ rebateAgreement
|
||||
+ senderReg
|
||||
|
||||
+ " </rsm:HeaderExchangedDocument>\n"
|
||||
+ " <rsm:SpecifiedSupplyChainTradeTransaction>\n";
|
||||
xml = xml + " <ram:ApplicableSupplyChainTradeAgreement>\n";
|
||||
+ "</rsm:HeaderExchangedDocument>"
|
||||
+ "<rsm:SpecifiedSupplyChainTradeTransaction>";
|
||||
xml += "<ram:ApplicableSupplyChainTradeAgreement>";
|
||||
if (trans.getReferenceNumber() != null) {
|
||||
xml = xml + " <ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>\n";
|
||||
xml += "<ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>";
|
||||
|
||||
}
|
||||
xml = xml + " <ram:SellerTradeParty>\n";
|
||||
xml += "<ram:SellerTradeParty>";
|
||||
xml += getTradePartyAsXML(trans.getSender(), true, false);
|
||||
xml += " </ram:SellerTradeParty>\n"
|
||||
+ " <ram:BuyerTradeParty>\n";
|
||||
// + " <ID>GE2020211</ID>\n"
|
||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
||||
xml += "</ram:SellerTradeParty>"
|
||||
+ "<ram:BuyerTradeParty>";
|
||||
// + " <ID>GE2020211</ID>"
|
||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>"
|
||||
|
||||
xml += getTradePartyAsXML(trans.getRecipient(), false, false);
|
||||
if ((trans.getOwnVATID() != null) && (trans.getOwnOrganisationName() != null)) {
|
||||
xml = xml + " <ram:SpecifiedTaxRegistration>\n" + " <ram:ID schemeID=\"VA\">"
|
||||
+ XMLTools.encodeXML(trans.getOwnVATID()) + "</ram:ID>\n"
|
||||
+ " </ram:SpecifiedTaxRegistration>";
|
||||
xml += "<ram:SpecifiedTaxRegistration><ram:ID schemeID=\"VA\">"
|
||||
+ XMLTools.encodeXML(trans.getOwnVATID()) + "</ram:ID>"
|
||||
+ "</ram:SpecifiedTaxRegistration>";
|
||||
}
|
||||
|
||||
xml += " </ram:BuyerTradeParty>\n";
|
||||
xml += "</ram:BuyerTradeParty>";
|
||||
|
||||
if (trans.getSellerOrderReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:SellerOrderReferencedDocument>\n"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>\n"
|
||||
+ " </ram:SellerOrderReferencedDocument>\n";
|
||||
xml += "<ram:SellerOrderReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ "</ram:SellerOrderReferencedDocument>";
|
||||
}
|
||||
if (trans.getBuyerOrderReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:BuyerOrderReferencedDocument>\n"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>\n"
|
||||
+ " </ram:BuyerOrderReferencedDocument>\n";
|
||||
xml += "<ram:BuyerOrderReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ "</ram:BuyerOrderReferencedDocument>";
|
||||
}
|
||||
xml = xml + " </ram:ApplicableSupplyChainTradeAgreement>\n"
|
||||
+ " <ram:ApplicableSupplyChainTradeDelivery>\n";
|
||||
xml += "</ram:ApplicableSupplyChainTradeAgreement>"
|
||||
+ "<ram:ApplicableSupplyChainTradeDelivery>";
|
||||
if (this.trans.getDeliveryAddress() != null) {
|
||||
xml += "<ram:ShipToTradeParty>" +
|
||||
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
|
||||
"</ram:ShipToTradeParty>";
|
||||
}
|
||||
|
||||
xml += " <ram:ActualDeliverySupplyChainEvent>\n"
|
||||
+ " <ram:OccurrenceDateTime>";
|
||||
xml += "<ram:ActualDeliverySupplyChainEvent>"
|
||||
+ "<ram:OccurrenceDateTime>";
|
||||
|
||||
if (trans.getDeliveryDate() != null) {
|
||||
xml += DATE.udtFormat(trans.getDeliveryDate());
|
||||
} else {
|
||||
throw new IllegalStateException("No delivery date provided");
|
||||
}
|
||||
xml += "</ram:OccurrenceDateTime>\n";
|
||||
xml += " </ram:ActualDeliverySupplyChainEvent>\n"
|
||||
xml += "</ram:OccurrenceDateTime>";
|
||||
xml += "</ram:ActualDeliverySupplyChainEvent>"
|
||||
/*
|
||||
* + " <DeliveryNoteReferencedDocument>\n" +
|
||||
* " <IssueDateTime format=\"102\">20130603</IssueDateTime>\n" +
|
||||
* " <ID>2013-51112</ID>\n" +
|
||||
* " </DeliveryNoteReferencedDocument>\n"
|
||||
* + "<DeliveryNoteReferencedDocument>" +
|
||||
* "<IssueDateTime format=\"102\">20130603</IssueDateTime>" +
|
||||
* "<ID>2013-51112</ID>" +
|
||||
* "</DeliveryNoteReferencedDocument>"
|
||||
*/
|
||||
+ " </ram:ApplicableSupplyChainTradeDelivery>\n" + " <ram:ApplicableSupplyChainTradeSettlement>\n"
|
||||
+ " <ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>\n"
|
||||
+ " <ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>\n";
|
||||
+ "</ram:ApplicableSupplyChainTradeDelivery><ram:ApplicableSupplyChainTradeSettlement>"
|
||||
+ "<ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>"
|
||||
+ "<ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>";
|
||||
|
||||
if (trans.getTradeSettlementPayment() != null) {
|
||||
for (final IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
|
||||
@@ -268,21 +272,21 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
||||
if (amount != null) {
|
||||
final String amountCategoryCode = amount.getCategoryCode();
|
||||
final boolean displayExemptionReason = CATEGORY_CODES_WITH_EXEMPTION_REASON.contains(amountCategoryCode);
|
||||
xml += " <ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:CalculatedAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(amount.getCalculated())
|
||||
+ "</ram:CalculatedAmount>\n" //currencyID=\"EUR\"
|
||||
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||
xml += "<ram:ApplicableTradeTax>"
|
||||
+ "<ram:CalculatedAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(amount.getCalculated())
|
||||
+ "</ram:CalculatedAmount>" //currencyID=\"EUR\"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
||||
+ (displayExemptionReason ? exemptionReason : "")
|
||||
+ " <ram:BasisAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
|
||||
+ " <ram:CategoryCode>" + amount.getCategoryCode() + "</ram:CategoryCode>\n"
|
||||
+ " <ram:ApplicablePercent>" + vatFormat(currentTaxPercent)
|
||||
+ "</ram:ApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n";
|
||||
+ "<ram:BasisAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
||||
+ "<ram:CategoryCode>" + amount.getCategoryCode() + "</ram:CategoryCode>"
|
||||
+ "<ram:ApplicablePercent>" + vatFormat(currentTaxPercent)
|
||||
+ "</ram:ApplicablePercent></ram:ApplicableTradeTax>";
|
||||
}
|
||||
}
|
||||
|
||||
if (trans.getPaymentTerms() == null) {
|
||||
xml = xml + " <ram:SpecifiedTradePaymentTerms>\n"
|
||||
+ " <ram:Description>" + paymentTermsDescription + "</ram:Description>\n";
|
||||
xml += "<ram:SpecifiedTradePaymentTerms>"
|
||||
+ "<ram:Description>" + paymentTermsDescription + "</ram:Description>";
|
||||
|
||||
if (trans.getTradeSettlement() != null) {
|
||||
for (final IZUGFeRDTradeSettlement payment : trans.getTradeSettlement()) {
|
||||
@@ -293,38 +297,38 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
||||
}
|
||||
|
||||
if (hasDueDate && (trans.getDueDate() != null)) {
|
||||
xml = xml + " <ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
+ DATE.udtFormat(trans.getDueDate())
|
||||
+ "</ram:DueDateDateTime>\n";// 20130704
|
||||
+ "</ram:DueDateDateTime>";// 20130704
|
||||
|
||||
}
|
||||
xml = xml + " </ram:SpecifiedTradePaymentTerms>\n";
|
||||
xml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
} else {
|
||||
xml = xml + buildPaymentTermsXml();
|
||||
xml += buildPaymentTermsXml();
|
||||
}
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeSettlementMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>\n"
|
||||
xml += "<ram:SpecifiedTradeSettlementMonetarySummation>"
|
||||
+ "<ram:LineTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>"
|
||||
// currencyID=\"EUR\"
|
||||
+ " <ram:ChargeTotalAmount currencyID=\"" + trans.getCurrency() + "\">0.00</ram:ChargeTotalAmount>\n" // currencyID=\"EUR\"
|
||||
+ " <ram:AllowanceTotalAmount currencyID=\"" + trans.getCurrency() + "\">0.00</ram:AllowanceTotalAmount>\n" //
|
||||
+ "<ram:ChargeTotalAmount currencyID=\"" + trans.getCurrency() + "\">0.00</ram:ChargeTotalAmount>" // currencyID=\"EUR\"
|
||||
+ "<ram:AllowanceTotalAmount currencyID=\"" + trans.getCurrency() + "\">0.00</ram:AllowanceTotalAmount>" //
|
||||
// currencyID=\"EUR\"
|
||||
// + " <ChargeTotalAmount currencyID=\"EUR\">5.80</ChargeTotalAmount>\n"
|
||||
// + " <AllowanceTotalAmount currencyID=\"EUR\">14.73</AllowanceTotalAmount>\n"
|
||||
+ " <ram:TaxBasisTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getTotal()) + "</ram:TaxBasisTotalAmount>\n"
|
||||
// + " <ChargeTotalAmount currencyID=\"EUR\">5.80</ChargeTotalAmount>"
|
||||
// + " <AllowanceTotalAmount currencyID=\"EUR\">14.73</AllowanceTotalAmount>"
|
||||
+ "<ram:TaxBasisTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getTotal()) + "</ram:TaxBasisTotalAmount>"
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ " <ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
||||
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTotal())) + "</ram:TaxTotalAmount>\n"
|
||||
+ " <ram:GrandTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>\n"
|
||||
+ "<ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
||||
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTotal())) + "</ram:TaxTotalAmount>"
|
||||
+ "<ram:GrandTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>"
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ " <ram:TotalPrepaidAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getTotalPrepaid()) + "</ram:TotalPrepaidAmount>\n"
|
||||
+ " <ram:DuePayableAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getGrandTotal().subtract(calc.getTotalPrepaid())) + "</ram:DuePayableAmount>\n"
|
||||
+ "<ram:TotalPrepaidAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getTotalPrepaid()) + "</ram:TotalPrepaidAmount>"
|
||||
+ "<ram:DuePayableAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getGrandTotal().subtract(calc.getTotalPrepaid())) + "</ram:DuePayableAmount>"
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ " </ram:SpecifiedTradeSettlementMonetarySummation>\n"
|
||||
+ " </ram:ApplicableSupplyChainTradeSettlement>\n";
|
||||
+ "</ram:SpecifiedTradeSettlementMonetarySummation>"
|
||||
+ "</ram:ApplicableSupplyChainTradeSettlement>";
|
||||
|
||||
|
||||
int lineID = 0;
|
||||
@@ -336,70 +340,68 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
||||
|
||||
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
xml = xml + " <ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:AssociatedDocumentLineDocument>\n"
|
||||
+ " <ram:LineID>" + lineID + "</ram:LineID>\n"
|
||||
+ " </ram:AssociatedDocumentLineDocument>\n"
|
||||
+ " <ram:SpecifiedSupplyChainTradeAgreement>\n"
|
||||
+ " <ram:GrossPriceProductTradePrice>\n"
|
||||
+ " <ram:ChargeAmount currencyID=\"" + trans.getCurrency() + "\">" + priceFormat(lc.getPriceGross())
|
||||
+ "</ram:ChargeAmount>\n"
|
||||
+ " <ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>\n"
|
||||
// + " <AppliedTradeAllowanceCharge>\n"
|
||||
// + " <ChargeIndicator>false</ChargeIndicator>\n"
|
||||
// + " <ActualAmount currencyID=\"EUR\">0.6667</ActualAmount>\n"
|
||||
// + " <Reason>Rabatt</Reason>\n"
|
||||
// + " </AppliedTradeAllowanceCharge>\n"
|
||||
+ " </ram:GrossPriceProductTradePrice>\n"
|
||||
+ " <ram:NetPriceProductTradePrice>\n"
|
||||
+ " <ram:ChargeAmount currencyID=\"" + trans.getCurrency() + "\">" + priceFormat(currentItem.getPrice())
|
||||
+ "</ram:ChargeAmount>\n"
|
||||
+ " <ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>\n"
|
||||
+ " </ram:NetPriceProductTradePrice>\n"
|
||||
+ " </ram:SpecifiedSupplyChainTradeAgreement>\n"
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
"<ram:AssociatedDocumentLineDocument>"
|
||||
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
||||
+ "</ram:AssociatedDocumentLineDocument>"
|
||||
+ "<ram:SpecifiedSupplyChainTradeAgreement>"
|
||||
+ "<ram:GrossPriceProductTradePrice>"
|
||||
+ "<ram:ChargeAmount currencyID=\"" + trans.getCurrency() + "\">" + priceFormat(lc.getPriceGross())
|
||||
+ "</ram:ChargeAmount>"
|
||||
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
|
||||
// + " <AppliedTradeAllowanceCharge>"
|
||||
// + " <ChargeIndicator>false</ChargeIndicator>"
|
||||
// + " <ActualAmount currencyID=\"EUR\">0.6667</ActualAmount>"
|
||||
// + " <Reason>Rabatt</Reason>"
|
||||
// + " </AppliedTradeAllowanceCharge>"
|
||||
+ "</ram:GrossPriceProductTradePrice>"
|
||||
+ "<ram:NetPriceProductTradePrice>"
|
||||
+ "<ram:ChargeAmount currencyID=\"" + trans.getCurrency() + "\">" + priceFormat(currentItem.getPrice())
|
||||
+ "</ram:ChargeAmount>"
|
||||
+ "<ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
|
||||
+ "</ram:NetPriceProductTradePrice>"
|
||||
+ "</ram:SpecifiedSupplyChainTradeAgreement>"
|
||||
|
||||
|
||||
+ " <ram:SpecifiedSupplyChainTradeDelivery>\n"
|
||||
+ " <ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
|
||||
+ quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>\n"
|
||||
+ " </ram:SpecifiedSupplyChainTradeDelivery>\n"
|
||||
+ " <ram:SpecifiedSupplyChainTradeSettlement>\n"
|
||||
+ " <ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||
+ "<ram:SpecifiedSupplyChainTradeDelivery>"
|
||||
+ "<ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
|
||||
+ quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>"
|
||||
+ "</ram:SpecifiedSupplyChainTradeDelivery>"
|
||||
+ "<ram:SpecifiedSupplyChainTradeSettlement>"
|
||||
+ "<ram:ApplicableTradeTax>"
|
||||
+ "<ram:TypeCode>VAT</ram:TypeCode>"
|
||||
+ exemptionReason
|
||||
+ " <ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>\n"
|
||||
+ "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>"
|
||||
|
||||
+ " <ram:ApplicablePercent>"
|
||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:ApplicablePercent>\n"
|
||||
+ " </ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:SpecifiedTradeSettlementMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>\n"
|
||||
+ " </ram:SpecifiedTradeSettlementMonetarySummation>\n";
|
||||
+ "<ram:ApplicablePercent>"
|
||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:ApplicablePercent>"
|
||||
+ "</ram:ApplicableTradeTax>"
|
||||
+ "<ram:SpecifiedTradeSettlementMonetarySummation>"
|
||||
+ "<ram:LineTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>"
|
||||
+ "</ram:SpecifiedTradeSettlementMonetarySummation>";
|
||||
if (currentItem.getAdditionalReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:AdditionalReferencedDocument><ram:ID>" + currentItem.getAdditionalReferencedDocumentID() + "</ram:ID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>\n";
|
||||
xml += "<ram:AdditionalReferencedDocument><ram:ID>" + currentItem.getAdditionalReferencedDocumentID() + "</ram:ID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>";
|
||||
|
||||
}
|
||||
xml = xml + " </ram:SpecifiedSupplyChainTradeSettlement>\n"
|
||||
+ " <ram:SpecifiedTradeProduct>\n";
|
||||
// + " <GlobalID schemeID=\"0160\">4012345001235</GlobalID>\n"
|
||||
xml += "</ram:SpecifiedSupplyChainTradeSettlement>"
|
||||
+ "<ram:SpecifiedTradeProduct>";
|
||||
// + " <GlobalID schemeID=\"0160\">4012345001235</GlobalID>"
|
||||
if (currentItem.getProduct().getSellerAssignedID() != null) {
|
||||
xml = xml + " <ram:SellerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>\n";
|
||||
xml += "<ram:SellerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>";
|
||||
}
|
||||
if (currentItem.getProduct().getBuyerAssignedID() != null) {
|
||||
xml = xml + " <ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>\n";
|
||||
xml += "<ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
}
|
||||
xml = xml + " <ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>\n"
|
||||
+ " <ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||
+ "</ram:Description>\n"
|
||||
+ " </ram:SpecifiedTradeProduct>\n"
|
||||
|
||||
+ " </ram:IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>"
|
||||
+ "<ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||
+ "</ram:Description>"
|
||||
+ "</ram:SpecifiedTradeProduct>"
|
||||
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
||||
}
|
||||
|
||||
// + " <IncludedSupplyChainTradeLineItem>\n"
|
||||
@@ -411,17 +413,13 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
||||
// + " </AssociatedDocumentLineDocument>\n"
|
||||
// + " </IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
xml = xml + " </rsm:SpecifiedSupplyChainTradeTransaction>\n"
|
||||
xml += "</rsm:SpecifiedSupplyChainTradeTransaction>"
|
||||
+ "</rsm:CrossIndustryDocument>";
|
||||
|
||||
final byte[] zugferdRaw;
|
||||
try {
|
||||
zugferdRaw = xml.getBytes("UTF-8");
|
||||
zugferdData = XMLTools.removeBOM(zugferdRaw);
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
Logger.getLogger(ZUGFeRD1PullProvider.class.getName()).log(Level.SEVERE, null, e);
|
||||
}
|
||||
}
|
||||
zugferdRaw = xml.getBytes(StandardCharsets.UTF_8);
|
||||
zugferdData = XMLTools.removeBOM(zugferdRaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfile(Profile p) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
@@ -92,7 +93,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
format.setTrimText(false);
|
||||
final XMLWriter writer = new XMLWriter(sw, format);
|
||||
writer.write(document);
|
||||
res = sw.toString().getBytes("UTF-8");
|
||||
res = sw.toString().getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
} catch (final IOException e) {
|
||||
Logger.getLogger(ZUGFeRD2PullProvider.class.getName()).log(Level.SEVERE, null, e);
|
||||
@@ -123,12 +124,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
// According EN16931 either GlobalID or seller assigned ID might be present for BuyerTradeParty
|
||||
// and ShipToTradeParty, but not both. Prefer seller assigned ID for now.
|
||||
if (party.getID() != null) {
|
||||
xml += " <ram:ID>" + XMLTools.encodeXML(party.getID()) + "</ram:ID>\n";
|
||||
xml += "<ram:ID>" + XMLTools.encodeXML(party.getID()) + "</ram:ID>";
|
||||
} else if ((party.getGlobalIDScheme() != null) && (party.getGlobalID() != null)) {
|
||||
xml = xml + " <ram:GlobalID schemeID=\"" + XMLTools.encodeXML(party.getGlobalIDScheme()) + "\">"
|
||||
+ XMLTools.encodeXML(party.getGlobalID()) + "</ram:GlobalID>\n";
|
||||
xml += "<ram:GlobalID schemeID=\"" + XMLTools.encodeXML(party.getGlobalIDScheme()) + "\">"
|
||||
+ XMLTools.encodeXML(party.getGlobalID()) + "</ram:GlobalID>";
|
||||
}
|
||||
xml += " <ram:Name>" + XMLTools.encodeXML(party.getName()) + "</ram:Name>\n";
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(party.getName()) + "</ram:Name>";
|
||||
|
||||
if (party.getLegalOrganisation() != null) {
|
||||
xml += "<ram:SpecifiedLegalOrganization> ";
|
||||
@@ -137,60 +138,60 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
if ((party.getContact() != null) && (isSender || profile == Profiles.getByName("Extended") || profile == Profiles.getByName("XRechnung"))) {
|
||||
xml = xml + "<ram:DefinedTradeContact>\n";
|
||||
xml += "<ram:DefinedTradeContact>";
|
||||
if (party.getContact().getName() != null) {
|
||||
xml = xml + "<ram:PersonName>" + XMLTools.encodeXML(party.getContact().getName())
|
||||
+ "</ram:PersonName>\n";
|
||||
xml += "<ram:PersonName>" + XMLTools.encodeXML(party.getContact().getName())
|
||||
+ "</ram:PersonName>";
|
||||
}
|
||||
if (party.getContact().getPhone() != null) {
|
||||
|
||||
xml = xml + " <ram:TelephoneUniversalCommunication>\n" + " <ram:CompleteNumber>"
|
||||
+ XMLTools.encodeXML(party.getContact().getPhone()) + "</ram:CompleteNumber>\n"
|
||||
+ " </ram:TelephoneUniversalCommunication>\n";
|
||||
xml += "<ram:TelephoneUniversalCommunication><ram:CompleteNumber>"
|
||||
+ XMLTools.encodeXML(party.getContact().getPhone()) + "</ram:CompleteNumber>"
|
||||
+ "</ram:TelephoneUniversalCommunication>";
|
||||
}
|
||||
|
||||
if ((party.getContact().getFax() != null) && (profile == Profiles.getByName("Extended"))) {
|
||||
xml = xml + " <ram:FaxUniversalCommunication>\n" + " <ram:CompleteNumber>"
|
||||
+ XMLTools.encodeXML(party.getContact().getFax()) + "</ram:CompleteNumber>\n"
|
||||
+ " </ram:FaxUniversalCommunication>\n";
|
||||
xml += "<ram:FaxUniversalCommunication><ram:CompleteNumber>"
|
||||
+ XMLTools.encodeXML(party.getContact().getFax()) + "</ram:CompleteNumber>"
|
||||
+ "</ram:FaxUniversalCommunication>";
|
||||
}
|
||||
if (party.getContact().getEMail() != null) {
|
||||
|
||||
xml = xml + " <ram:EmailURIUniversalCommunication>\n" + " <ram:URIID>"
|
||||
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>\n"
|
||||
+ " </ram:EmailURIUniversalCommunication>\n";
|
||||
xml += "<ram:EmailURIUniversalCommunication><ram:URIID>"
|
||||
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>"
|
||||
+ "</ram:EmailURIUniversalCommunication>";
|
||||
}
|
||||
|
||||
xml = xml + " </ram:DefinedTradeContact>";
|
||||
xml += "</ram:DefinedTradeContact>";
|
||||
|
||||
}
|
||||
xml += " <ram:PostalTradeAddress>\n"
|
||||
+ " <ram:PostcodeCode>" + XMLTools.encodeXML(party.getZIP())
|
||||
+ "</ram:PostcodeCode>\n";
|
||||
xml += "<ram:PostalTradeAddress>"
|
||||
+ "<ram:PostcodeCode>" + XMLTools.encodeXML(party.getZIP())
|
||||
+ "</ram:PostcodeCode>";
|
||||
if (party.getStreet() != null) {
|
||||
xml += " <ram:LineOne>" + XMLTools.encodeXML(party.getStreet())
|
||||
+ "</ram:LineOne>\n";
|
||||
xml += "<ram:LineOne>" + XMLTools.encodeXML(party.getStreet())
|
||||
+ "</ram:LineOne>";
|
||||
}
|
||||
if (party.getAdditionalAddress() != null) {
|
||||
xml += " <ram:LineTwo>" + XMLTools.encodeXML(party.getAdditionalAddress())
|
||||
+ "</ram:LineTwo>\n";
|
||||
xml += "<ram:LineTwo>" + XMLTools.encodeXML(party.getAdditionalAddress())
|
||||
+ "</ram:LineTwo>";
|
||||
}
|
||||
xml += " <ram:CityName>" + XMLTools.encodeXML(party.getLocation())
|
||||
+ "</ram:CityName>\n"
|
||||
+ " <ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
|
||||
+ "</ram:CountryID>\n"
|
||||
+ " </ram:PostalTradeAddress>\n";
|
||||
xml += "<ram:CityName>" + XMLTools.encodeXML(party.getLocation())
|
||||
+ "</ram:CityName>"
|
||||
+ "<ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
|
||||
+ "</ram:CountryID>"
|
||||
+ "</ram:PostalTradeAddress>";
|
||||
if ((party.getVATID() != null) && (!isShipToTradeParty)) {
|
||||
xml += " <ram:SpecifiedTaxRegistration>\n"
|
||||
+ " <ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(party.getVATID())
|
||||
+ "</ram:ID>\n"
|
||||
+ " </ram:SpecifiedTaxRegistration>\n";
|
||||
xml += "<ram:SpecifiedTaxRegistration>"
|
||||
+ "<ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(party.getVATID())
|
||||
+ "</ram:ID>"
|
||||
+ "</ram:SpecifiedTaxRegistration>";
|
||||
}
|
||||
if ((party.getTaxID() != null) && (!isShipToTradeParty)) {
|
||||
xml += " <ram:SpecifiedTaxRegistration>\n"
|
||||
+ " <ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(party.getTaxID())
|
||||
+ "</ram:ID>\n"
|
||||
+ " </ram:SpecifiedTaxRegistration>\n";
|
||||
xml += "<ram:SpecifiedTaxRegistration>"
|
||||
+ "<ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(party.getTaxID())
|
||||
+ "</ram:ID>"
|
||||
+ "</ram:SpecifiedTaxRegistration>";
|
||||
|
||||
}
|
||||
return xml;
|
||||
@@ -249,24 +250,24 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
String senderReg = "";
|
||||
if (trans.getOwnOrganisationFullPlaintextInfo() != null) {
|
||||
senderReg = "" + "<ram:IncludedNote>\n" + " <ram:Content>\n"
|
||||
+ XMLTools.encodeXML(trans.getOwnOrganisationFullPlaintextInfo()) + " </ram:Content>\n"
|
||||
+ "<ram:SubjectCode>REG</ram:SubjectCode>\n" + "</ram:IncludedNote>\n";
|
||||
senderReg = "<ram:IncludedNote><ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getOwnOrganisationFullPlaintextInfo()) + "</ram:Content>"
|
||||
+ "<ram:SubjectCode>REG</ram:SubjectCode></ram:IncludedNote>";
|
||||
|
||||
}
|
||||
|
||||
String rebateAgreement = "";
|
||||
if (trans.rebateAgreementExists()) {
|
||||
rebateAgreement = "<ram:IncludedNote>\n" + " <ram:Content>"
|
||||
+ "Es bestehen Rabatt- und Bonusvereinbarungen.</ram:Content>\n"
|
||||
+ "<ram:SubjectCode>AAK</ram:SubjectCode>\n" + "</ram:IncludedNote>\n";
|
||||
rebateAgreement = "<ram:IncludedNote><ram:Content>"
|
||||
+ "Es bestehen Rabatt- und Bonusvereinbarungen.</ram:Content>"
|
||||
+ "<ram:SubjectCode>AAK</ram:SubjectCode></ram:IncludedNote>";
|
||||
}
|
||||
|
||||
String subjectNote = "";
|
||||
if (trans.getSubjectNote() != null) {
|
||||
subjectNote = "<ram:IncludedNote>\n" + " <ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getSubjectNote()) + "</ram:Content>\n"
|
||||
+ "</ram:IncludedNote>\n";
|
||||
subjectNote = "<ram:IncludedNote><ram:Content>"
|
||||
+ XMLTools.encodeXML(trans.getSubjectNote()) + "</ram:Content>"
|
||||
+ "</ram:IncludedNote>";
|
||||
}
|
||||
|
||||
String typecode = "380";
|
||||
@@ -280,7 +281,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
}
|
||||
}
|
||||
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
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\""
|
||||
// + "
|
||||
@@ -288,30 +289,30 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
// ../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\">\n"
|
||||
+ "<!-- generated by: mustangproject.org v" + ZUGFeRD2PullProvider.class.getPackage().getImplementationVersion() + "-->\n"
|
||||
+ " <rsm:ExchangedDocumentContext>\n"
|
||||
+ " 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>\n"
|
||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>"
|
||||
//
|
||||
+ " <ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
+ " <ram:ID>" + getProfile().getID() + "</ram:ID>\n"
|
||||
+ " </ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||
+ " </rsm:ExchangedDocumentContext>\n"
|
||||
+ " <rsm:ExchangedDocument>\n"
|
||||
+ " <ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>\n"
|
||||
// + " <ram:Name>RECHNUNG</ram:Name>\n"
|
||||
// + " <ram:TypeCode>380</ram:TypeCode>\n"
|
||||
+ " <ram:TypeCode>" + typecode + "</ram:TypeCode>\n"
|
||||
+ " <ram:IssueDateTime>"
|
||||
+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>\n" // date
|
||||
+ "<ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||
+ "<ram:ID>" + getProfile().getID() + "</ram:ID>"
|
||||
+ "</ram:GuidelineSpecifiedDocumentContextParameter>"
|
||||
+ "</rsm:ExchangedDocumentContext>"
|
||||
+ "<rsm:ExchangedDocument>"
|
||||
+ "<ram:ID>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:ID>"
|
||||
// + " <ram:Name>RECHNUNG</ram:Name>"
|
||||
// + "<ram:TypeCode>380</ram:TypeCode>"
|
||||
+ "<ram:TypeCode>" + typecode + "</ram:TypeCode>"
|
||||
+ "<ram:IssueDateTime>"
|
||||
+ DATE.udtFormat(trans.getIssueDate()) + "</ram:IssueDateTime>" // date
|
||||
+ notes
|
||||
+ subjectNote
|
||||
+ rebateAgreement
|
||||
+ senderReg
|
||||
|
||||
+ " </rsm:ExchangedDocument>\n"
|
||||
+ " <rsm:SupplyChainTradeTransaction>\n";
|
||||
+ "</rsm:ExchangedDocument>"
|
||||
+ "<rsm:SupplyChainTradeTransaction>";
|
||||
int lineID = 0;
|
||||
for (final IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
||||
lineID++;
|
||||
@@ -326,21 +327,21 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
}
|
||||
final LineCalculator lc = new LineCalculator(currentItem);
|
||||
xml = xml + " <ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:AssociatedDocumentLineDocument>\n"
|
||||
+ " <ram:LineID>" + lineID + "</ram:LineID>\n"
|
||||
xml += "<ram:IncludedSupplyChainTradeLineItem>" +
|
||||
"<ram:AssociatedDocumentLineDocument>"
|
||||
+ "<ram:LineID>" + lineID + "</ram:LineID>"
|
||||
+ notes
|
||||
+ " </ram:AssociatedDocumentLineDocument>\n"
|
||||
+ "</ram:AssociatedDocumentLineDocument>"
|
||||
|
||||
+ " <ram:SpecifiedTradeProduct>\n";
|
||||
// + " <GlobalID schemeID=\"0160\">4012345001235</GlobalID>\n"
|
||||
+ "<ram:SpecifiedTradeProduct>";
|
||||
// + " <GlobalID schemeID=\"0160\">4012345001235</GlobalID>"
|
||||
if (currentItem.getProduct().getSellerAssignedID() != null) {
|
||||
xml = xml + " <ram:SellerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>\n";
|
||||
xml += "<ram:SellerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getSellerAssignedID()) + "</ram:SellerAssignedID>";
|
||||
}
|
||||
if (currentItem.getProduct().getBuyerAssignedID() != null) {
|
||||
xml = xml + " <ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>\n";
|
||||
xml += "<ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
}
|
||||
String allowanceChargeStr = "";
|
||||
if (currentItem.getItemAllowances() != null && currentItem.getItemAllowances().length > 0) {
|
||||
@@ -356,169 +357,165 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
|
||||
xml = xml + " <ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>\n"
|
||||
+ " <ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||
+ "</ram:Description>\n"
|
||||
+ " </ram:SpecifiedTradeProduct>\n"
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>"
|
||||
+ "<ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||
+ "</ram:Description>"
|
||||
+ "</ram:SpecifiedTradeProduct>"
|
||||
|
||||
+ " <ram:SpecifiedLineTradeAgreement>\n";
|
||||
+ "<ram:SpecifiedLineTradeAgreement>";
|
||||
if (currentItem.getReferencedDocuments() != null) {
|
||||
for (IReferencedDocument currentReferencedDocument : currentItem.getReferencedDocuments()) {
|
||||
xml = xml + "<ram:AdditionalReferencedDocument>\n" +
|
||||
"<ram:IssuerAssignedID>" + XMLTools.encodeXML(currentReferencedDocument.getIssuerAssignedID()) + "</ram:IssuerAssignedID>\n" +
|
||||
"<ram:TypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getTypeCode()) + "</ram:TypeCode>\n" +
|
||||
"<ram:ReferenceTypeCode>" + XMLTools.encodeXML(currentReferencedDocument.getReferenceTypeCode()) + "</ram:ReferenceTypeCode>\n" +
|
||||
"</ram:AdditionalReferencedDocument>\n";
|
||||
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>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (currentItem.getBuyerOrderReferencedDocumentLineID() != null) {
|
||||
xml = xml + " <ram:BuyerOrderReferencedDocument> \n"
|
||||
+ " <ram:LineID>" + XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID()) + "</ram:LineID>\n"
|
||||
+ " </ram:BuyerOrderReferencedDocument>\n";
|
||||
xml += "<ram:BuyerOrderReferencedDocument> "
|
||||
+ "<ram:LineID>" + XMLTools.encodeXML(currentItem.getBuyerOrderReferencedDocumentLineID()) + "</ram:LineID>"
|
||||
+ "</ram:BuyerOrderReferencedDocument>";
|
||||
|
||||
}
|
||||
xml = xml + " <ram:GrossPriceProductTradePrice>\n"
|
||||
+ " <ram:ChargeAmount>" + priceFormat(lc.getPriceGross())
|
||||
+ "</ram:ChargeAmount>\n" //currencyID=\"EUR\"
|
||||
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>\n"
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>"
|
||||
+ allowanceChargeStr
|
||||
// + " <AppliedTradeAllowanceCharge>\n"
|
||||
// + " <ChargeIndicator>false</ChargeIndicator>\n"
|
||||
// + " <ActualAmount currencyID=\"EUR\">0.6667</ActualAmount>\n"
|
||||
// + " <Reason>Rabatt</Reason>\n"
|
||||
// + " </AppliedTradeAllowanceCharge>\n"
|
||||
+ " </ram:GrossPriceProductTradePrice>\n"
|
||||
+ " <ram:NetPriceProductTradePrice>\n"
|
||||
+ " <ram:ChargeAmount>" + priceFormat(lc.getPrice())
|
||||
+ "</ram:ChargeAmount>\n" // currencyID=\"EUR\"
|
||||
+ " <ram:BasisQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit())
|
||||
+ "\">" + quantityFormat(currentItem.getBasisQuantity()) + "</ram:BasisQuantity>\n"
|
||||
+ " </ram:NetPriceProductTradePrice>\n"
|
||||
+ " </ram:SpecifiedLineTradeAgreement>\n"
|
||||
|
||||
+ " <ram:SpecifiedLineTradeDelivery>\n"
|
||||
+ " <ram:BilledQuantity unitCode=\"" + XMLTools.encodeXML(currentItem.getProduct().getUnit()) + "\">"
|
||||
+ quantityFormat(currentItem.getQuantity()) + "</ram:BilledQuantity>\n"
|
||||
+ " </ram:SpecifiedLineTradeDelivery>\n"
|
||||
+ " <ram:SpecifiedLineTradeSettlement>\n"
|
||||
+ " <ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||
// + " <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>\n"
|
||||
|
||||
+ " <ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>\n"
|
||||
+ " </ram:ApplicableTradeTax>\n";
|
||||
+ "<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 = xml + "<ram:BillingSpecifiedPeriod>";
|
||||
xml += "<ram:BillingSpecifiedPeriod>";
|
||||
if (currentItem.getDetailedDeliveryPeriodFrom() != null) {
|
||||
xml = xml + "<ram:StartDateTime>" + DATE.udtFormat(currentItem.getDetailedDeliveryPeriodFrom()) + "</ram:StartDateTime>";
|
||||
xml += "<ram:StartDateTime>" + DATE.udtFormat(currentItem.getDetailedDeliveryPeriodFrom()) + "</ram:StartDateTime>";
|
||||
}
|
||||
if (currentItem.getDetailedDeliveryPeriodTo() != null) {
|
||||
xml = xml + "<ram:EndDateTime>" + DATE.udtFormat(currentItem.getDetailedDeliveryPeriodTo()) + "</ram:EndDateTime>";
|
||||
xml += "<ram:EndDateTime>" + DATE.udtFormat(currentItem.getDetailedDeliveryPeriodTo()) + "</ram:EndDateTime>";
|
||||
}
|
||||
xml = xml + "</ram:BillingSpecifiedPeriod>";
|
||||
|
||||
xml += "</ram:BillingSpecifiedPeriod>";
|
||||
}
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeSettlementLineMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>\n" // currencyID=\"EUR\"
|
||||
+ " </ram:SpecifiedTradeSettlementLineMonetarySummation>\n";
|
||||
xml += "<ram:SpecifiedTradeSettlementLineMonetarySummation>"
|
||||
+ "<ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>" // currencyID=\"EUR\"
|
||||
+ "</ram:SpecifiedTradeSettlementLineMonetarySummation>";
|
||||
if (currentItem.getAdditionalReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:AdditionalReferencedDocument><ram:IssuerAssignedID>" + currentItem.getAdditionalReferencedDocumentID() + "</ram:IssuerAssignedID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>\n";
|
||||
xml += "<ram:AdditionalReferencedDocument><ram:IssuerAssignedID>" + currentItem.getAdditionalReferencedDocumentID() + "</ram:IssuerAssignedID><ram:TypeCode>130</ram:TypeCode></ram:AdditionalReferencedDocument>";
|
||||
|
||||
}
|
||||
xml = xml + " </ram:SpecifiedLineTradeSettlement>\n"
|
||||
+ " </ram:IncludedSupplyChainTradeLineItem>\n";
|
||||
xml += "</ram:SpecifiedLineTradeSettlement>"
|
||||
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:ApplicableHeaderTradeAgreement>\n";
|
||||
xml += "<ram:ApplicableHeaderTradeAgreement>";
|
||||
if (trans.getReferenceNumber() != null) {
|
||||
xml = xml + " <ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>\n";
|
||||
xml += "<ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>";
|
||||
|
||||
}
|
||||
xml = xml + " <ram:SellerTradeParty>\n"
|
||||
xml += "<ram:SellerTradeParty>"
|
||||
+ getTradePartyAsXML(trans.getSender(), true, false)
|
||||
+ " </ram:SellerTradeParty>\n"
|
||||
+ " <ram:BuyerTradeParty>\n";
|
||||
// + " <ID>GE2020211</ID>\n"
|
||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
||||
+ "</ram:SellerTradeParty>"
|
||||
+ "<ram:BuyerTradeParty>";
|
||||
// + " <ID>GE2020211</ID>"
|
||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>"
|
||||
|
||||
xml += getTradePartyAsXML(trans.getRecipient(), false, false);
|
||||
xml += " </ram:BuyerTradeParty>\n";
|
||||
xml += "</ram:BuyerTradeParty>";
|
||||
|
||||
if (trans.getSellerOrderReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:SellerOrderReferencedDocument>\n"
|
||||
xml += " <ram:SellerOrderReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>\n"
|
||||
+ " </ram:SellerOrderReferencedDocument>\n";
|
||||
+ XMLTools.encodeXML(trans.getSellerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:SellerOrderReferencedDocument>";
|
||||
}
|
||||
if (trans.getBuyerOrderReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:BuyerOrderReferencedDocument>\n"
|
||||
xml += " <ram:BuyerOrderReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>\n"
|
||||
+ " </ram:BuyerOrderReferencedDocument>\n";
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ " </ram:BuyerOrderReferencedDocument>";
|
||||
}
|
||||
if (trans.getContractReferencedDocument() != null) {
|
||||
xml = xml + " <ram:ContractReferencedDocument>\n"
|
||||
xml += " <ram:ContractReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>\n"
|
||||
+ " </ram:ContractReferencedDocument>\n";
|
||||
+ XMLTools.encodeXML(trans.getContractReferencedDocument()) + "</ram:IssuerAssignedID>"
|
||||
+ " </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 = xml + " <ram:AdditionalReferencedDocument>\n"
|
||||
+ " <ram:IssuerAssignedID>" + f.getFilename() + "</ram:IssuerAssignedID>\n"
|
||||
+ " <ram:TypeCode>916</ram:TypeCode>\n"
|
||||
+ " <ram:Name>" + f.getDescription() + "</ram:Name>\n"
|
||||
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>\n"
|
||||
+ " </ram:AdditionalReferencedDocument>\n";
|
||||
+ " filename=\"" + f.getFilename() + "\">" + documentContent + "</ram:AttachmentBinaryObject>"
|
||||
+ " </ram:AdditionalReferencedDocument>";
|
||||
}
|
||||
}
|
||||
|
||||
if (trans.getSpecifiedProcuringProjectID() != null) {
|
||||
xml = xml + " <ram:SpecifiedProcuringProject>\n"
|
||||
xml += " <ram:SpecifiedProcuringProject>"
|
||||
+ " <ram:ID>"
|
||||
+ XMLTools.encodeXML(trans.getSpecifiedProcuringProjectID()) + "</ram:ID>\n";
|
||||
+ XMLTools.encodeXML(trans.getSpecifiedProcuringProjectID()) + "</ram:ID>";
|
||||
if (trans.getSpecifiedProcuringProjectName() != null) {
|
||||
xml += " <ram:Name >" + XMLTools.encodeXML(trans.getSpecifiedProcuringProjectName()) + "</ram:Name>\n";
|
||||
xml += " <ram:Name >" + XMLTools.encodeXML(trans.getSpecifiedProcuringProjectName()) + "</ram:Name>";
|
||||
}
|
||||
xml += " </ram:SpecifiedProcuringProject>\n";
|
||||
xml += " </ram:SpecifiedProcuringProject>";
|
||||
}
|
||||
xml = xml + " </ram:ApplicableHeaderTradeAgreement>\n"
|
||||
+ " <ram:ApplicableHeaderTradeDelivery>\n";
|
||||
xml += "</ram:ApplicableHeaderTradeAgreement>"
|
||||
+ "<ram:ApplicableHeaderTradeDelivery>";
|
||||
if (this.trans.getDeliveryAddress() != null) {
|
||||
xml += "<ram:ShipToTradeParty>" +
|
||||
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
|
||||
"</ram:ShipToTradeParty>";
|
||||
}
|
||||
|
||||
xml += " <ram:ActualDeliverySupplyChainEvent>\n"
|
||||
+ " <ram:OccurrenceDateTime>";
|
||||
xml += "<ram:ActualDeliverySupplyChainEvent>"
|
||||
+ "<ram:OccurrenceDateTime>";
|
||||
|
||||
if (trans.getDeliveryDate() != null) {
|
||||
xml += DATE.udtFormat(trans.getDeliveryDate());
|
||||
} else {
|
||||
throw new IllegalStateException("No delivery date provided");
|
||||
}
|
||||
xml += "</ram:OccurrenceDateTime>\n";
|
||||
xml += " </ram:ActualDeliverySupplyChainEvent>\n";
|
||||
|
||||
xml += "</ram:OccurrenceDateTime>";
|
||||
xml += " </ram:ActualDeliverySupplyChainEvent>";
|
||||
/*
|
||||
* + " <DeliveryNoteReferencedDocument>\n" +
|
||||
* " <IssueDateTime format=\"102\">20130603</IssueDateTime>\n" +
|
||||
* " <ID>2013-51112</ID>\n" +
|
||||
* " </DeliveryNoteReferencedDocument>\n"
|
||||
* + "<DeliveryNoteReferencedDocument>" +
|
||||
* "<IssueDateTime format=\"102\">20130603</IssueDateTime>" +
|
||||
* "<ID>2013-51112</ID>" +
|
||||
* "</DeliveryNoteReferencedDocument>"
|
||||
*/
|
||||
if (trans.getDespatchAdviceReferencedDocumentID() != null) {
|
||||
xml += "<ram:DespatchAdviceReferencedDocument>";
|
||||
@@ -526,9 +523,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
xml += "</ram:DespatchAdviceReferencedDocument>";
|
||||
|
||||
}
|
||||
xml += " </ram:ApplicableHeaderTradeDelivery>\n" + " <ram:ApplicableHeaderTradeSettlement>\n"
|
||||
+ " <ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>\n"
|
||||
+ " <ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>\n";
|
||||
xml += " </ram:ApplicableHeaderTradeDelivery> <ram:ApplicableHeaderTradeSettlement>"
|
||||
+ " <ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>"
|
||||
+ " <ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>";
|
||||
|
||||
if (trans.getTradeSettlementPayment() != null) {
|
||||
for (final IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
|
||||
@@ -558,26 +555,26 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
if (amount != null) {
|
||||
final String amountCategoryCode = amount.getCategoryCode();
|
||||
final boolean displayExemptionReason = CATEGORY_CODES_WITH_EXEMPTION_REASON.contains(amountCategoryCode);
|
||||
xml += " <ram:ApplicableTradeTax>\n"
|
||||
+ " <ram:CalculatedAmount>" + currencyFormat(amount.getCalculated())
|
||||
+ "</ram:CalculatedAmount>\n" //currencyID=\"EUR\"
|
||||
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
|
||||
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>\n" // currencyID=\"EUR\"
|
||||
+ " <ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>\n"
|
||||
+ " <ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n";
|
||||
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
||||
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>"
|
||||
+ "<ram:RateApplicablePercent>"
|
||||
+ vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent></ram:ApplicableTradeTax>";
|
||||
}
|
||||
}
|
||||
if ((trans.getDetailedDeliveryPeriodFrom() != null) || (trans.getDetailedDeliveryPeriodTo() != null)) {
|
||||
xml = xml + "<ram:BillingSpecifiedPeriod>";
|
||||
xml += "<ram:BillingSpecifiedPeriod>";
|
||||
if (trans.getDetailedDeliveryPeriodFrom() != null) {
|
||||
xml = xml + "<ram:StartDateTime>" + DATE.udtFormat(trans.getDetailedDeliveryPeriodFrom()) + "</ram:StartDateTime>";
|
||||
xml += "<ram:StartDateTime>" + DATE.udtFormat(trans.getDetailedDeliveryPeriodFrom()) + "</ram:StartDateTime>";
|
||||
}
|
||||
if (trans.getDetailedDeliveryPeriodTo() != null) {
|
||||
xml = xml + "<ram:EndDateTime>" + DATE.udtFormat(trans.getDetailedDeliveryPeriodTo()) + "</ram:EndDateTime>";
|
||||
xml += "<ram:EndDateTime>" + DATE.udtFormat(trans.getDetailedDeliveryPeriodTo()) + "</ram:EndDateTime>";
|
||||
}
|
||||
xml = xml + "</ram:BillingSpecifiedPeriod>";
|
||||
xml += "</ram:BillingSpecifiedPeriod>";
|
||||
|
||||
|
||||
}
|
||||
@@ -586,51 +583,47 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
for (final BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||
if (calc.getChargesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO) != 0) {
|
||||
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeAllowanceCharge>\n" +
|
||||
" <ram:ChargeIndicator>\n" +
|
||||
" <udt:Indicator>true</udt:Indicator>\n" +
|
||||
" </ram:ChargeIndicator>\n" +
|
||||
" <ram:ActualAmount>" + currencyFormat(calc.getChargesForPercent(currentTaxPercent)) + "</ram:ActualAmount>\n" +
|
||||
" <ram:Reason>" + XMLTools.encodeXML(calc.getChargeReasonForPercent(currentTaxPercent)) + "</ram:Reason>\n" +
|
||||
" <ram:CategoryTradeTax>\n" +
|
||||
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
" <ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>\n" +
|
||||
" <ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" +
|
||||
" </ram:CategoryTradeTax>\n" +
|
||||
" </ram:SpecifiedTradeAllowanceCharge> \n";
|
||||
|
||||
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) {
|
||||
xml = xml + " <ram:SpecifiedTradeAllowanceCharge>\n" +
|
||||
" <ram:ChargeIndicator>\n" +
|
||||
" <udt:Indicator>false</udt:Indicator>\n" +
|
||||
" </ram:ChargeIndicator>\n" +
|
||||
" <ram:ActualAmount>" + currencyFormat(calc.getAllowancesForPercent(currentTaxPercent)) + "</ram:ActualAmount>\n" +
|
||||
" <ram:Reason>" + XMLTools.encodeXML(calc.getAllowanceReasonForPercent(currentTaxPercent)) + "</ram:Reason>\n" +
|
||||
" <ram:CategoryTradeTax>\n" +
|
||||
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
" <ram:CategoryCode>" + VATPercentAmountMap.get(currentTaxPercent).getCategoryCode() + "</ram:CategoryCode>\n" +
|
||||
" <ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) + "</ram:RateApplicablePercent>\n" +
|
||||
" </ram:CategoryTradeTax>\n" +
|
||||
" </ram:SpecifiedTradeAllowanceCharge> \n";
|
||||
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> ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((trans.getPaymentTerms() == null) && ((paymentTermsDescription != null) || (trans.getTradeSettlement() != null) || (hasDueDate))) {
|
||||
xml = xml + "<ram:SpecifiedTradePaymentTerms>\n";
|
||||
xml += "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
if (paymentTermsDescription != null) {
|
||||
xml = xml + "<ram:Description>" + paymentTermsDescription + "</ram:Description>\n";
|
||||
xml += "<ram:Description>" + paymentTermsDescription + "</ram:Description>";
|
||||
}
|
||||
|
||||
if (trans.getTradeSettlement() != null) {
|
||||
@@ -642,14 +635,14 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
if (hasDueDate && (trans.getDueDate() != null)) {
|
||||
xml = xml + " <ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
+ DATE.udtFormat(trans.getDueDate())
|
||||
+ "</ram:DueDateDateTime>\n";// 20130704
|
||||
+ "</ram:DueDateDateTime>";// 20130704
|
||||
|
||||
}
|
||||
xml = xml + " </ram:SpecifiedTradePaymentTerms>\n";
|
||||
xml += "</ram:SpecifiedTradePaymentTerms>";
|
||||
} else {
|
||||
xml = xml + buildPaymentTermsXml();
|
||||
xml += buildPaymentTermsXml();
|
||||
}
|
||||
|
||||
|
||||
@@ -657,34 +650,34 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
final String chargesTotalLine = "<ram:ChargeTotalAmount>" + currencyFormat(calc.getChargesForPercent(null)) + "</ram:ChargeTotalAmount>";
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount>" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>\n"
|
||||
xml += "<ram:SpecifiedTradeSettlementHeaderMonetarySummation>"
|
||||
+ "<ram:LineTotalAmount>" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>"
|
||||
+ chargesTotalLine
|
||||
+ allowanceTotalLine
|
||||
+ " <ram:TaxBasisTotalAmount>" + currencyFormat(calc.getTaxBasis()) + "</ram:TaxBasisTotalAmount>\n"
|
||||
+ "<ram:TaxBasisTotalAmount>" + currencyFormat(calc.getTaxBasis()) + "</ram:TaxBasisTotalAmount>"
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ " <ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
||||
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTaxBasis())) + "</ram:TaxTotalAmount>\n"
|
||||
+ " <ram:GrandTotalAmount>" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>\n"
|
||||
+ "<ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
|
||||
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTaxBasis())) + "</ram:TaxTotalAmount>"
|
||||
+ "<ram:GrandTotalAmount>" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>"
|
||||
// //
|
||||
// currencyID=\"EUR\"
|
||||
+ " <ram:TotalPrepaidAmount>" + currencyFormat(calc.getTotalPrepaid()) + "</ram:TotalPrepaidAmount>\n"
|
||||
+ " <ram:DuePayableAmount>" + currencyFormat(calc.getGrandTotal().subtract(calc.getTotalPrepaid())) + "</ram:DuePayableAmount>\n"
|
||||
+ " </ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n";
|
||||
+ " <ram:TotalPrepaidAmount>" + currencyFormat(calc.getTotalPrepaid()) + "</ram:TotalPrepaidAmount>"
|
||||
+ "<ram:DuePayableAmount>" + currencyFormat(calc.getGrandTotal().subtract(calc.getTotalPrepaid())) + "</ram:DuePayableAmount>"
|
||||
+ "</ram:SpecifiedTradeSettlementHeaderMonetarySummation>";
|
||||
if (trans.getInvoiceReferencedDocumentID() != null) {
|
||||
xml = xml + " <ram:InvoiceReferencedDocument>\n"
|
||||
xml += " <ram:InvoiceReferencedDocument>"
|
||||
+ " <ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getInvoiceReferencedDocumentID()) + "</ram:IssuerAssignedID>\n";
|
||||
+ XMLTools.encodeXML(trans.getInvoiceReferencedDocumentID()) + "</ram:IssuerAssignedID>";
|
||||
if (trans.getInvoiceReferencedIssueDate() != null) {
|
||||
xml += "<ram:FormattedIssueDateTime>"
|
||||
+ DATE.qdtFormat(trans.getInvoiceReferencedIssueDate())
|
||||
+ "</ram:FormattedIssueDateTime>\n";
|
||||
+ "</ram:FormattedIssueDateTime>";
|
||||
}
|
||||
xml += " </ram:InvoiceReferencedDocument>\n";
|
||||
xml += " </ram:InvoiceReferencedDocument>";
|
||||
}
|
||||
|
||||
xml = xml + " </ram:ApplicableHeaderTradeSettlement>\n";
|
||||
xml += "</ram:ApplicableHeaderTradeSettlement>";
|
||||
// + " <IncludedSupplyChainTradeLineItem>\n"
|
||||
// + " <AssociatedDocumentLineDocument>\n"
|
||||
// + " <IncludedNote>\n"
|
||||
@@ -694,7 +687,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
// + " </AssociatedDocumentLineDocument>\n"
|
||||
// + " </IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
xml = xml + " </rsm:SupplyChainTradeTransaction>\n"
|
||||
xml += "</rsm:SupplyChainTradeTransaction>"
|
||||
+ "</rsm:CrossIndustryInvoice>";
|
||||
|
||||
final byte[] zugferdRaw;
|
||||
|
||||
@@ -67,194 +67,194 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
||||
* */
|
||||
String ownZUGFeRDXML = new String(UTF8ByteOrderMark, StandardCharsets.UTF_8) + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||
"<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\">\n" +
|
||||
" <rsm:ExchangedDocumentContext>\n" +
|
||||
" <ram:TestIndicator><udt:Indicator>false</udt:Indicator></ram:TestIndicator>\n" +
|
||||
" <ram:GuidelineSpecifiedDocumentContextParameter>\n" +
|
||||
" <ram:ID>urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:extended</ram:ID>\n" +
|
||||
" </ram:GuidelineSpecifiedDocumentContextParameter>\n" +
|
||||
" </rsm:ExchangedDocumentContext>\n" +
|
||||
" <rsm:ExchangedDocument>\n" +
|
||||
" <ram:ID>RE-20171118/506</ram:ID>\n" +
|
||||
" <ram:Name>RECHNUNG</ram:Name>\n" +
|
||||
" <ram:TypeCode>380</ram:TypeCode>\n" +
|
||||
" <ram:IssueDateTime><udt:DateTimeString format=\"102\">20171118</udt:DateTimeString></ram:IssueDateTime>\n" +
|
||||
" </rsm:ExchangedDocument>\n" +
|
||||
" <rsm:SupplyChainTradeTransaction>\n" +
|
||||
" <ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:AssociatedDocumentLineDocument>\n" +
|
||||
" <ram:LineID>1</ram:LineID>\n" +
|
||||
" </ram:AssociatedDocumentLineDocument>\n" +
|
||||
" <ram:SpecifiedTradeProduct>\n" +
|
||||
" <ram:Name>Künstlerische Gestaltung (Stunde): Einer Beispielrechnung</ram:Name>\n" +
|
||||
" <ram:Description></ram:Description>\n" +
|
||||
" </ram:SpecifiedTradeProduct>\n" +
|
||||
" <ram:SpecifiedLineTradeAgreement>\n" +
|
||||
" <ram:GrossPriceProductTradePrice>\n" +
|
||||
" <ram:ChargeAmount currencyID=\"EUR\">160.0000</ram:ChargeAmount>\n" +
|
||||
" <ram:BasisQuantity unitCode=\"HUR\">1.0000</ram:BasisQuantity>\n" +
|
||||
" </ram:GrossPriceProductTradePrice>\n" +
|
||||
" <ram:NetPriceProductTradePrice>\n" +
|
||||
" <ram:ChargeAmount currencyID=\"EUR\">160.0000</ram:ChargeAmount>\n" +
|
||||
" <ram:BasisQuantity unitCode=\"HUR\">1.0000</ram:BasisQuantity>\n" +
|
||||
" </ram:NetPriceProductTradePrice>\n" +
|
||||
" </ram:SpecifiedLineTradeAgreement>\n" +
|
||||
" <ram:SpecifiedLineTradeDelivery>\n" +
|
||||
" <ram:BilledQuantity unitCode=\"HUR\">1.0000</ram:BilledQuantity>\n" +
|
||||
" </ram:SpecifiedLineTradeDelivery>\n" +
|
||||
" <ram:SpecifiedLineTradeSettlement>\n" +
|
||||
" <ram:ApplicableTradeTax>\n" +
|
||||
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
" <ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>\n" +
|
||||
" </ram:ApplicableTradeTax>\n" +
|
||||
" <ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
" <ram:LineTotalAmount currencyID=\"EUR\">160.00</ram:LineTotalAmount>\n" +
|
||||
" </ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
" </ram:SpecifiedLineTradeSettlement>\n" +
|
||||
" </ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:AssociatedDocumentLineDocument>\n" +
|
||||
" <ram:LineID>2</ram:LineID>\n" +
|
||||
" </ram:AssociatedDocumentLineDocument>\n" +
|
||||
" <ram:SpecifiedTradeProduct>\n" +
|
||||
" <ram:Name>Luftballon: Bunt, ca. 500ml</ram:Name>\n" +
|
||||
" <ram:Description></ram:Description>\n" +
|
||||
" </ram:SpecifiedTradeProduct>\n" +
|
||||
" <ram:SpecifiedLineTradeAgreement>\n" +
|
||||
" <ram:GrossPriceProductTradePrice>\n" +
|
||||
" <ram:ChargeAmount currencyID=\"EUR\">0.7900</ram:ChargeAmount>\n" +
|
||||
" <ram:BasisQuantity unitCode=\"C62\">1.0000</ram:BasisQuantity>\n" +
|
||||
" </ram:GrossPriceProductTradePrice>\n" +
|
||||
" <ram:NetPriceProductTradePrice>\n" +
|
||||
" <ram:ChargeAmount currencyID=\"EUR\">0.7900</ram:ChargeAmount>\n" +
|
||||
" <ram:BasisQuantity unitCode=\"C62\">1.0000</ram:BasisQuantity>\n" +
|
||||
" </ram:NetPriceProductTradePrice>\n" +
|
||||
" </ram:SpecifiedLineTradeAgreement>\n" +
|
||||
" <ram:SpecifiedLineTradeDelivery>\n" +
|
||||
" <ram:BilledQuantity unitCode=\"C62\">400.0000</ram:BilledQuantity>\n" +
|
||||
" </ram:SpecifiedLineTradeDelivery>\n" +
|
||||
" <ram:SpecifiedLineTradeSettlement>\n" +
|
||||
" <ram:ApplicableTradeTax>\n" +
|
||||
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
" <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
|
||||
" </ram:ApplicableTradeTax>\n" +
|
||||
" <ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
" <ram:LineTotalAmount currencyID=\"EUR\">316.00</ram:LineTotalAmount>\n" +
|
||||
" </ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
" </ram:SpecifiedLineTradeSettlement>\n" +
|
||||
" </ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:AssociatedDocumentLineDocument>\n" +
|
||||
" <ram:LineID>3</ram:LineID>\n" +
|
||||
" </ram:AssociatedDocumentLineDocument>\n" +
|
||||
" <ram:SpecifiedTradeProduct>\n" +
|
||||
" <ram:Name>Heiße Luft pro Liter</ram:Name>\n" +
|
||||
" <ram:Description></ram:Description>\n" +
|
||||
" </ram:SpecifiedTradeProduct>\n" +
|
||||
" <ram:SpecifiedLineTradeAgreement>\n" +
|
||||
" <ram:GrossPriceProductTradePrice>\n" +
|
||||
" <ram:ChargeAmount currencyID=\"EUR\">0.1000</ram:ChargeAmount>\n" +
|
||||
" <ram:BasisQuantity unitCode=\"LTR\">1.0000</ram:BasisQuantity>\n" +
|
||||
" </ram:GrossPriceProductTradePrice>\n" +
|
||||
" <ram:NetPriceProductTradePrice>\n" +
|
||||
" <ram:ChargeAmount currencyID=\"EUR\">0.1000</ram:ChargeAmount>\n" +
|
||||
" <ram:BasisQuantity unitCode=\"LTR\">1.0000</ram:BasisQuantity>\n" +
|
||||
" </ram:NetPriceProductTradePrice>\n" +
|
||||
" </ram:SpecifiedLineTradeAgreement>\n" +
|
||||
" <ram:SpecifiedLineTradeDelivery>\n" +
|
||||
" <ram:BilledQuantity unitCode=\"LTR\">200.0000</ram:BilledQuantity>\n" +
|
||||
" </ram:SpecifiedLineTradeDelivery>\n" +
|
||||
" <ram:SpecifiedLineTradeSettlement>\n" +
|
||||
" <ram:ApplicableTradeTax>\n" +
|
||||
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
" <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
|
||||
" </ram:ApplicableTradeTax>\n" +
|
||||
" <ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
" <ram:LineTotalAmount currencyID=\"EUR\">20.00</ram:LineTotalAmount>\n" +
|
||||
" </ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
" </ram:SpecifiedLineTradeSettlement>\n" +
|
||||
" </ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
" <ram:ApplicableHeaderTradeAgreement>\n" +
|
||||
" <ram:SellerTradeParty>\n" +
|
||||
" <ram:Name>Bei Spiel GmbH</ram:Name>\n" +
|
||||
" <ram:PostalTradeAddress>\n" +
|
||||
" <ram:PostcodeCode>12345</ram:PostcodeCode>\n" +
|
||||
" <ram:LineOne>Ecke 12</ram:LineOne>\n" +
|
||||
" <ram:CityName>Stadthausen</ram:CityName>\n" +
|
||||
" <ram:CountryID>DE</ram:CountryID>\n" +
|
||||
" </ram:PostalTradeAddress>\n" +
|
||||
" <ram:SpecifiedTaxRegistration>\n" +
|
||||
" <ram:ID schemeID=\"FC\">22/815/0815/4</ram:ID>\n" +
|
||||
" </ram:SpecifiedTaxRegistration>\n" +
|
||||
" <ram:SpecifiedTaxRegistration>\n" +
|
||||
" <ram:ID schemeID=\"VA\">DE136695976</ram:ID>\n" +
|
||||
" </ram:SpecifiedTaxRegistration>\n" +
|
||||
" </ram:SellerTradeParty>\n" +
|
||||
" <ram:BuyerTradeParty>\n" +
|
||||
" <ram:Name>Theodor Est</ram:Name>\n" +
|
||||
" <ram:PostalTradeAddress>\n" +
|
||||
" <ram:PostcodeCode>88802</ram:PostcodeCode>\n" +
|
||||
" <ram:LineOne>Bahnstr. 42</ram:LineOne>\n" +
|
||||
" <ram:CityName>Spielkreis</ram:CityName>\n" +
|
||||
" <ram:CountryID>DE</ram:CountryID>\n" +
|
||||
" </ram:PostalTradeAddress>\n" +
|
||||
" <ram:SpecifiedTaxRegistration>\n" +
|
||||
" <ram:ID schemeID=\"VA\">DE999999999</ram:ID>\n" +
|
||||
" </ram:SpecifiedTaxRegistration>\n" +
|
||||
" </ram:BuyerTradeParty>\n" +
|
||||
" </ram:ApplicableHeaderTradeAgreement>\n" +
|
||||
" <ram:ApplicableHeaderTradeDelivery>\n" +
|
||||
" <ram:ActualDeliverySupplyChainEvent>\n" +
|
||||
" <ram:OccurrenceDateTime><udt:DateTimeString format=\"102\">20171117</udt:DateTimeString></ram:OccurrenceDateTime>\n" +
|
||||
" </ram:ActualDeliverySupplyChainEvent>\n" +
|
||||
" </ram:ApplicableHeaderTradeDelivery>\n" +
|
||||
" <ram:ApplicableHeaderTradeSettlement>\n" +
|
||||
" <ram:PaymentReference>RE-20171118/506</ram:PaymentReference>\n" +
|
||||
" <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>\n" +
|
||||
" <ram:SpecifiedTradeSettlementPaymentMeans>\n" +
|
||||
" <ram:TypeCode>42</ram:TypeCode>\n" +
|
||||
" <ram:Information>Überweisung</ram:Information>\n" +
|
||||
" <ram:PayeePartyCreditorFinancialAccount>\n" +
|
||||
" <ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>\n" +
|
||||
" <ram:ProprietaryID>44421800</ram:ProprietaryID>\n" +
|
||||
" </ram:PayeePartyCreditorFinancialAccount>\n" +
|
||||
" <ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
|
||||
" <ram:BICID>COBADEFFXXX</ram:BICID>\n" +
|
||||
" <ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>\n" +
|
||||
" <ram:Name>Commerzbank</ram:Name>\n" +
|
||||
" </ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
|
||||
" </ram:SpecifiedTradeSettlementPaymentMeans>\n" +
|
||||
" <ram:ApplicableTradeTax>\n" +
|
||||
" <ram:CalculatedAmount currencyID=\"EUR\">11.20</ram:CalculatedAmount>\n" +
|
||||
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
" <ram:BasisAmount currencyID=\"EUR\">160.00</ram:BasisAmount>\n" +
|
||||
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
" <ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>\n" +
|
||||
" </ram:ApplicableTradeTax>\n" +
|
||||
" <ram:ApplicableTradeTax>\n" +
|
||||
" <ram:CalculatedAmount currencyID=\"EUR\">63.84</ram:CalculatedAmount>\n" +
|
||||
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
" <ram:BasisAmount currencyID=\"EUR\">336.00</ram:BasisAmount>\n" +
|
||||
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
" <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
|
||||
" </ram:ApplicableTradeTax>\n" +
|
||||
" <ram:SpecifiedTradePaymentTerms>\n" +
|
||||
" <ram:Description>Zahlbar ohne Abzug bis 09.12.2017</ram:Description>\n" +
|
||||
" <ram:DueDateDateTime><udt:DateTimeString format=\"102\">20171209</udt:DateTimeString></ram:DueDateDateTime>\n" +
|
||||
" </ram:SpecifiedTradePaymentTerms>\n" +
|
||||
" <ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n" +
|
||||
" <ram:LineTotalAmount currencyID=\"EUR\">496.00</ram:LineTotalAmount>\n" +
|
||||
" <ram:ChargeTotalAmount currencyID=\"EUR\">0.00</ram:ChargeTotalAmount>\n" +
|
||||
" <ram:AllowanceTotalAmount currencyID=\"EUR\">0.00</ram:AllowanceTotalAmount>\n" +
|
||||
" <ram:TaxBasisTotalAmount currencyID=\"EUR\">496.00</ram:TaxBasisTotalAmount>\n" +
|
||||
" <ram:TaxTotalAmount currencyID=\"EUR\">75.04</ram:TaxTotalAmount>\n" +
|
||||
" <ram:GrandTotalAmount currencyID=\"EUR\">571.04</ram:GrandTotalAmount>\n" +
|
||||
" <ram:DuePayableAmount currencyID=\"EUR\">571.04</ram:DuePayableAmount>\n" +
|
||||
" </ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n" +
|
||||
" </ram:ApplicableHeaderTradeSettlement>\n" +
|
||||
" </rsm:SupplyChainTradeTransaction>\n" +
|
||||
"<rsm:ExchangedDocumentContext>\n" +
|
||||
"<ram:TestIndicator><udt:Indicator>false</udt:Indicator></ram:TestIndicator>\n" +
|
||||
"<ram:GuidelineSpecifiedDocumentContextParameter>\n" +
|
||||
"<ram:ID>urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:extended</ram:ID>\n" +
|
||||
"</ram:GuidelineSpecifiedDocumentContextParameter>\n" +
|
||||
"</rsm:ExchangedDocumentContext>\n" +
|
||||
"<rsm:ExchangedDocument>\n" +
|
||||
"<ram:ID>RE-20171118/506</ram:ID>\n" +
|
||||
"<ram:Name>RECHNUNG</ram:Name>\n" +
|
||||
"<ram:TypeCode>380</ram:TypeCode>\n" +
|
||||
"<ram:IssueDateTime><udt:DateTimeString format=\"102\">20171118</udt:DateTimeString></ram:IssueDateTime>\n" +
|
||||
"</rsm:ExchangedDocument>\n" +
|
||||
"<rsm:SupplyChainTradeTransaction>\n" +
|
||||
"<ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
"<ram:AssociatedDocumentLineDocument>\n" +
|
||||
"<ram:LineID>1</ram:LineID>\n" +
|
||||
"</ram:AssociatedDocumentLineDocument>\n" +
|
||||
"<ram:SpecifiedTradeProduct>\n" +
|
||||
"<ram:Name>Künstlerische Gestaltung (Stunde): Einer Beispielrechnung</ram:Name>\n" +
|
||||
"<ram:Description></ram:Description>\n" +
|
||||
"</ram:SpecifiedTradeProduct>\n" +
|
||||
"<ram:SpecifiedLineTradeAgreement>\n" +
|
||||
"<ram:GrossPriceProductTradePrice>\n" +
|
||||
"<ram:ChargeAmount currencyID=\"EUR\">160.0000</ram:ChargeAmount>\n" +
|
||||
"<ram:BasisQuantity unitCode=\"HUR\">1.0000</ram:BasisQuantity>\n" +
|
||||
"</ram:GrossPriceProductTradePrice>\n" +
|
||||
"<ram:NetPriceProductTradePrice>\n" +
|
||||
"<ram:ChargeAmount currencyID=\"EUR\">160.0000</ram:ChargeAmount>\n" +
|
||||
"<ram:BasisQuantity unitCode=\"HUR\">1.0000</ram:BasisQuantity>\n" +
|
||||
"</ram:NetPriceProductTradePrice>\n" +
|
||||
"</ram:SpecifiedLineTradeAgreement>\n" +
|
||||
"<ram:SpecifiedLineTradeDelivery>\n" +
|
||||
"<ram:BilledQuantity unitCode=\"HUR\">1.0000</ram:BilledQuantity>\n" +
|
||||
"</ram:SpecifiedLineTradeDelivery>\n" +
|
||||
"<ram:SpecifiedLineTradeSettlement>\n" +
|
||||
"<ram:ApplicableTradeTax>\n" +
|
||||
"<ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
"<ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
"<ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>\n" +
|
||||
"</ram:ApplicableTradeTax>\n" +
|
||||
"<ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
"<ram:LineTotalAmount currencyID=\"EUR\">160.00</ram:LineTotalAmount>\n" +
|
||||
"</ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
"</ram:SpecifiedLineTradeSettlement>\n" +
|
||||
"</ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
"<ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
"<ram:AssociatedDocumentLineDocument>\n" +
|
||||
"<ram:LineID>2</ram:LineID>\n" +
|
||||
"</ram:AssociatedDocumentLineDocument>\n" +
|
||||
"<ram:SpecifiedTradeProduct>\n" +
|
||||
"<ram:Name>Luftballon: Bunt, ca. 500ml</ram:Name>\n" +
|
||||
"<ram:Description></ram:Description>\n" +
|
||||
"</ram:SpecifiedTradeProduct>\n" +
|
||||
"<ram:SpecifiedLineTradeAgreement>\n" +
|
||||
"<ram:GrossPriceProductTradePrice>\n" +
|
||||
"<ram:ChargeAmount currencyID=\"EUR\">0.7900</ram:ChargeAmount>\n" +
|
||||
"<ram:BasisQuantity unitCode=\"C62\">1.0000</ram:BasisQuantity>\n" +
|
||||
"</ram:GrossPriceProductTradePrice>\n" +
|
||||
"<ram:NetPriceProductTradePrice>\n" +
|
||||
"<ram:ChargeAmount currencyID=\"EUR\">0.7900</ram:ChargeAmount>\n" +
|
||||
"<ram:BasisQuantity unitCode=\"C62\">1.0000</ram:BasisQuantity>\n" +
|
||||
"</ram:NetPriceProductTradePrice>\n" +
|
||||
"</ram:SpecifiedLineTradeAgreement>\n" +
|
||||
"<ram:SpecifiedLineTradeDelivery>\n" +
|
||||
"<ram:BilledQuantity unitCode=\"C62\">400.0000</ram:BilledQuantity>\n" +
|
||||
"</ram:SpecifiedLineTradeDelivery>\n" +
|
||||
"<ram:SpecifiedLineTradeSettlement>\n" +
|
||||
"<ram:ApplicableTradeTax>\n" +
|
||||
"<ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
"<ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
"<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
|
||||
"</ram:ApplicableTradeTax>\n" +
|
||||
"<ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
"<ram:LineTotalAmount currencyID=\"EUR\">316.00</ram:LineTotalAmount>\n" +
|
||||
"</ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
"</ram:SpecifiedLineTradeSettlement>\n" +
|
||||
"</ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
"<ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
"<ram:AssociatedDocumentLineDocument>\n" +
|
||||
"<ram:LineID>3</ram:LineID>\n" +
|
||||
"</ram:AssociatedDocumentLineDocument>\n" +
|
||||
"<ram:SpecifiedTradeProduct>\n" +
|
||||
"<ram:Name>Heiße Luft pro Liter</ram:Name>\n" +
|
||||
"<ram:Description></ram:Description>\n" +
|
||||
"</ram:SpecifiedTradeProduct>\n" +
|
||||
"<ram:SpecifiedLineTradeAgreement>\n" +
|
||||
"<ram:GrossPriceProductTradePrice>\n" +
|
||||
"<ram:ChargeAmount currencyID=\"EUR\">0.1000</ram:ChargeAmount>\n" +
|
||||
"<ram:BasisQuantity unitCode=\"LTR\">1.0000</ram:BasisQuantity>\n" +
|
||||
"</ram:GrossPriceProductTradePrice>\n" +
|
||||
"<ram:NetPriceProductTradePrice>\n" +
|
||||
"<ram:ChargeAmount currencyID=\"EUR\">0.1000</ram:ChargeAmount>\n" +
|
||||
"<ram:BasisQuantity unitCode=\"LTR\">1.0000</ram:BasisQuantity>\n" +
|
||||
"</ram:NetPriceProductTradePrice>\n" +
|
||||
"</ram:SpecifiedLineTradeAgreement>\n" +
|
||||
"<ram:SpecifiedLineTradeDelivery>\n" +
|
||||
"<ram:BilledQuantity unitCode=\"LTR\">200.0000</ram:BilledQuantity>\n" +
|
||||
"</ram:SpecifiedLineTradeDelivery>\n" +
|
||||
"<ram:SpecifiedLineTradeSettlement>\n" +
|
||||
"<ram:ApplicableTradeTax>\n" +
|
||||
"<ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
"<ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
"<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
|
||||
"</ram:ApplicableTradeTax>\n" +
|
||||
"<ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
"<ram:LineTotalAmount currencyID=\"EUR\">20.00</ram:LineTotalAmount>\n" +
|
||||
"</ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
|
||||
"</ram:SpecifiedLineTradeSettlement>\n" +
|
||||
"</ram:IncludedSupplyChainTradeLineItem>\n" +
|
||||
"<ram:ApplicableHeaderTradeAgreement>\n" +
|
||||
"<ram:SellerTradeParty>\n" +
|
||||
"<ram:Name>Bei Spiel GmbH</ram:Name>\n" +
|
||||
"<ram:PostalTradeAddress>\n" +
|
||||
"<ram:PostcodeCode>12345</ram:PostcodeCode>\n" +
|
||||
"<ram:LineOne>Ecke 12</ram:LineOne>\n" +
|
||||
"<ram:CityName>Stadthausen</ram:CityName>\n" +
|
||||
"<ram:CountryID>DE</ram:CountryID>\n" +
|
||||
"</ram:PostalTradeAddress>\n" +
|
||||
"<ram:SpecifiedTaxRegistration>\n" +
|
||||
"<ram:ID schemeID=\"FC\">22/815/0815/4</ram:ID>\n" +
|
||||
"</ram:SpecifiedTaxRegistration>\n" +
|
||||
"<ram:SpecifiedTaxRegistration>\n" +
|
||||
"<ram:ID schemeID=\"VA\">DE136695976</ram:ID>\n" +
|
||||
"</ram:SpecifiedTaxRegistration>\n" +
|
||||
"</ram:SellerTradeParty>\n" +
|
||||
"<ram:BuyerTradeParty>\n" +
|
||||
"<ram:Name>Theodor Est</ram:Name>\n" +
|
||||
"<ram:PostalTradeAddress>\n" +
|
||||
"<ram:PostcodeCode>88802</ram:PostcodeCode>\n" +
|
||||
"<ram:LineOne>Bahnstr. 42</ram:LineOne>\n" +
|
||||
"<ram:CityName>Spielkreis</ram:CityName>\n" +
|
||||
"<ram:CountryID>DE</ram:CountryID>\n" +
|
||||
"</ram:PostalTradeAddress>\n" +
|
||||
"<ram:SpecifiedTaxRegistration>\n" +
|
||||
"<ram:ID schemeID=\"VA\">DE999999999</ram:ID>\n" +
|
||||
"</ram:SpecifiedTaxRegistration>\n" +
|
||||
"</ram:BuyerTradeParty>\n" +
|
||||
"</ram:ApplicableHeaderTradeAgreement>\n" +
|
||||
"<ram:ApplicableHeaderTradeDelivery>\n" +
|
||||
"<ram:ActualDeliverySupplyChainEvent>\n" +
|
||||
"<ram:OccurrenceDateTime><udt:DateTimeString format=\"102\">20171117</udt:DateTimeString></ram:OccurrenceDateTime>\n" +
|
||||
"</ram:ActualDeliverySupplyChainEvent>\n" +
|
||||
"</ram:ApplicableHeaderTradeDelivery>\n" +
|
||||
"<ram:ApplicableHeaderTradeSettlement>\n" +
|
||||
"<ram:PaymentReference>RE-20171118/506</ram:PaymentReference>\n" +
|
||||
"<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>\n" +
|
||||
"<ram:SpecifiedTradeSettlementPaymentMeans>\n" +
|
||||
"<ram:TypeCode>42</ram:TypeCode>\n" +
|
||||
"<ram:Information>Überweisung</ram:Information>\n" +
|
||||
"<ram:PayeePartyCreditorFinancialAccount>\n" +
|
||||
"<ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>\n" +
|
||||
"<ram:ProprietaryID>44421800</ram:ProprietaryID>\n" +
|
||||
"</ram:PayeePartyCreditorFinancialAccount>\n" +
|
||||
"<ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
|
||||
"<ram:BICID>COBADEFFXXX</ram:BICID>\n" +
|
||||
"<ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>\n" +
|
||||
"<ram:Name>Commerzbank</ram:Name>\n" +
|
||||
"</ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
|
||||
"</ram:SpecifiedTradeSettlementPaymentMeans>\n" +
|
||||
"<ram:ApplicableTradeTax>\n" +
|
||||
"<ram:CalculatedAmount currencyID=\"EUR\">11.20</ram:CalculatedAmount>\n" +
|
||||
"<ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
"<ram:BasisAmount currencyID=\"EUR\">160.00</ram:BasisAmount>\n" +
|
||||
"<ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
"<ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>\n" +
|
||||
"</ram:ApplicableTradeTax>\n" +
|
||||
"<ram:ApplicableTradeTax>\n" +
|
||||
"<ram:CalculatedAmount currencyID=\"EUR\">63.84</ram:CalculatedAmount>\n" +
|
||||
"<ram:TypeCode>VAT</ram:TypeCode>\n" +
|
||||
"<ram:BasisAmount currencyID=\"EUR\">336.00</ram:BasisAmount>\n" +
|
||||
"<ram:CategoryCode>S</ram:CategoryCode>\n" +
|
||||
"<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
|
||||
"</ram:ApplicableTradeTax>\n" +
|
||||
"<ram:SpecifiedTradePaymentTerms>\n" +
|
||||
"<ram:Description>Zahlbar ohne Abzug bis 09.12.2017</ram:Description>\n" +
|
||||
"<ram:DueDateDateTime><udt:DateTimeString format=\"102\">20171209</udt:DateTimeString></ram:DueDateDateTime>\n" +
|
||||
"</ram:SpecifiedTradePaymentTerms>\n" +
|
||||
"<ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n" +
|
||||
"<ram:LineTotalAmount currencyID=\"EUR\">496.00</ram:LineTotalAmount>\n" +
|
||||
"<ram:ChargeTotalAmount currencyID=\"EUR\">0.00</ram:ChargeTotalAmount>\n" +
|
||||
"<ram:AllowanceTotalAmount currencyID=\"EUR\">0.00</ram:AllowanceTotalAmount>\n" +
|
||||
"<ram:TaxBasisTotalAmount currencyID=\"EUR\">496.00</ram:TaxBasisTotalAmount>\n" +
|
||||
"<ram:TaxTotalAmount currencyID=\"EUR\">75.04</ram:TaxTotalAmount>\n" +
|
||||
"<ram:GrandTotalAmount currencyID=\"EUR\">571.04</ram:GrandTotalAmount>\n" +
|
||||
"<ram:DuePayableAmount currencyID=\"EUR\">571.04</ram:DuePayableAmount>\n" +
|
||||
"</ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n" +
|
||||
"</ram:ApplicableHeaderTradeSettlement>\n" +
|
||||
"</rsm:SupplyChainTradeTransaction>\n" +
|
||||
"</rsm:CrossIndustryInvoice>";
|
||||
zea1.setXML(ownZUGFeRDXML.getBytes("UTF-8"));
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
@@ -3,11 +3,6 @@ package org.mustangproject.validator;
|
||||
import static org.xmlunit.assertj.XmlAssert.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
@@ -21,9 +16,9 @@ public class XMLValidatorTest extends ResourceCase {
|
||||
// ignored for the
|
||||
// time being
|
||||
|
||||
ValidationContext ctx = new ValidationContext(null);
|
||||
XMLValidator xv = new XMLValidator(ctx);
|
||||
XPathEngine xpath = new JAXPXPathEngine();
|
||||
final ValidationContext ctx = new ValidationContext(null);
|
||||
final XMLValidator xv = new XMLValidator(ctx);
|
||||
final XPathEngine xpath = new JAXPXPathEngine();
|
||||
File tempFile = getResourceAsFile("invalidV2.xml");
|
||||
Source source;
|
||||
String content;
|
||||
@@ -38,31 +33,31 @@ public class XMLValidatorTest extends ResourceCase {
|
||||
* assertEquals(true, xv.getXMLResult().
|
||||
* contains("<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"(ram:LineTotalAmount)\">\n"
|
||||
* +
|
||||
* " Eine Rechnung (INVOICE) muss die Summe der Rechnungspositionen-Nettobeträge „Sum of Invoice line net amount“ (BT-106) enthalten.</error>\n"
|
||||
* "Eine Rechnung (INVOICE) muss die Summe der Rechnungspositionen-Nettobeträge „Sum of Invoice line net amount“ (BT-106) enthalten.</error>\n"
|
||||
* +
|
||||
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"(ram:TaxBasisTotalAmount = ram:LineTotalAmount - ram:AllowanceTotalAmount + ram:ChargeTotalAmount) or ((ram:TaxBasisTotalAmount = ram:LineTotalAmount - ram:AllowanceTotalAmount) and not (ram:ChargeTotalAmount)) or ((ram:TaxBasisTotalAmount = ram:LineTotalAmount + ram:ChargeTotalAmount) and not (ram:AllowanceTotalAmount)) or ((ram:TaxBasisTotalAmount = ram:LineTotalAmount) and not (ram:ChargeTotalAmount) and not (ram:AllowanceTotalAmount))\">\n"
|
||||
* +
|
||||
* " Der Inhalt des Elementes „Invoice total amount without VAT“ (BT-109) entspricht der Summe aller Inhalte der Elemente „Invoice line net amount“ (BT-131) abzüglich der Summe aller in der Rechnung enthaltenen Nachlässe der Dokumentenebene „Sum of allowances on document level“ (BT-107) zuzüglich der Summe aller in der Rechnung enthaltenen Abgaben der Dokumentenebene „Sum of charges on document level“ (BT-108).</error>\n"
|
||||
* "Der Inhalt des Elementes „Invoice total amount without VAT“ (BT-109) entspricht der Summe aller Inhalte der Elemente „Invoice line net amount“ (BT-131) abzüglich der Summe aller in der Rechnung enthaltenen Nachlässe der Dokumentenebene „Sum of allowances on document level“ (BT-107) zuzüglich der Summe aller in der Rechnung enthaltenen Abgaben der Dokumentenebene „Sum of charges on document level“ (BT-108).</error>\n"
|
||||
* +
|
||||
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"(ram:GrandTotalAmount = round(ram:TaxBasisTotalAmount*100 + ram:TaxTotalAmount[@currencyID=/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceCurrencyCode]*100 +0) div 100) or ((ram:GrandTotalAmount = ram:TaxBasisTotalAmount) and not (ram:TaxTotalAmount[@currencyID=/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceCurrencyCode]))\">\n"
|
||||
* +
|
||||
* " Der Inhalt des Elementes „Invoice total amount with VAT“ (BT-112) entspricht der Summe des Inhalts des Elementes „Invoice total amount without VAT“ (BT-109) und des Elementes „Invoice total VAT amount“ (BT-110).</error>\n"
|
||||
* "Der Inhalt des Elementes „Invoice total amount with VAT“ (BT-112) entspricht der Summe des Inhalts des Elementes „Invoice total amount without VAT“ (BT-109) und des Elementes „Invoice total VAT amount“ (BT-110).</error>\n"
|
||||
* +
|
||||
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"ram:LineTotalAmount = (round(sum(../../ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount) * 10 * 10)div 100)\">\n"
|
||||
* +
|
||||
* " Der Inhalt des Elementes „Sum of Invoice line net amount“ (BT-106) entspricht der Summe aller Inhalte der Elemente „Invoice line net amount“ (BT-131).</error>\n"
|
||||
* "Der Inhalt des Elementes „Sum of Invoice line net amount“ (BT-106) entspricht der Summe aller Inhalte der Elemente „Invoice line net amount“ (BT-131).</error>\n"
|
||||
* +
|
||||
* "<error location=\"/*[local-name()='CrossIndustryInvoice']\" criterion=\"(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:Name!='')\">\n"
|
||||
* +
|
||||
* " Eine Rechnung (INVOICE) muss den Erwerbernamen „Buyer name“ (BT-44) enthalten.</error>\n"
|
||||
* "Eine Rechnung (INVOICE) muss den Erwerbernamen „Buyer name“ (BT-44) enthalten.</error>\n"
|
||||
* +
|
||||
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeAgreement']/*[local-name()='BuyerTradeParty']\" criterion=\"count(ram:Name)=1\">\n"
|
||||
* + " Das Element 'ram:Name' muss genau 1 mal auftreten.</error>\n" +
|
||||
* + "Das Element 'ram:Name' muss genau 1 mal auftreten.</error>\n" +
|
||||
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"count(ram:LineTotalAmount)=1\">\n"
|
||||
* + " Das Element 'ram:LineTotalAmount' muss genau 1 mal auftreten.</error>\n"
|
||||
* + "Das Element 'ram:LineTotalAmount' muss genau 1 mal auftreten.</error>\n"
|
||||
* +
|
||||
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='IncludedSupplyChainTradeLineItem'][2]/*[local-name()='SpecifiedLineTradeDelivery']/*[local-name()='BilledQuantity']\" criterion=\"document('zugferd2p0_extended_codedb.xml')//cl[@id=7]/enumeration[@value=$codeValue7]\">\n"
|
||||
* + " Wert von '@unitCode' ist unzulässig.</error>\n" +
|
||||
* + "Wert von '@unitCode' ist unzulässig.</error>\n" +
|
||||
* "</messages><summary status='invalid'/>"));
|
||||
*
|
||||
*/
|
||||
@@ -72,7 +67,7 @@ public class XMLValidatorTest extends ResourceCase {
|
||||
xv.setFilename(tempFile.getAbsolutePath());
|
||||
|
||||
xv.validate();
|
||||
} catch (IrrecoverableValidationError e) {
|
||||
} catch (final IrrecoverableValidationError e) {
|
||||
noException = false; //expecting a fatal error, i.e. an exception
|
||||
}
|
||||
assertFalse(noException);
|
||||
@@ -87,10 +82,10 @@ public class XMLValidatorTest extends ResourceCase {
|
||||
xv.setFilename(tempFile.getAbsolutePath());
|
||||
|
||||
xv.validate();
|
||||
} catch (IrrecoverableValidationError e) {
|
||||
} catch (final IrrecoverableValidationError e) {
|
||||
noException = false;
|
||||
}
|
||||
String res = xv.getXMLResult();
|
||||
final String res = xv.getXMLResult();
|
||||
/*OutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(new File("return.xml"));
|
||||
@@ -166,7 +161,7 @@ public class XMLValidatorTest extends ResourceCase {
|
||||
source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
|
||||
content = xpath.evaluate("/validation/summary/@status", source);
|
||||
assertEquals("invalid", content);
|
||||
} catch (IrrecoverableValidationError e) {
|
||||
} catch (final IrrecoverableValidationError e) {
|
||||
// ignore, will be in XML output anyway
|
||||
noException = false;
|
||||
}
|
||||
@@ -177,7 +172,7 @@ public class XMLValidatorTest extends ResourceCase {
|
||||
xv.setFilename(tempFile.getAbsolutePath());
|
||||
xv.validate();
|
||||
|
||||
} catch (IrrecoverableValidationError e) {
|
||||
} catch (final IrrecoverableValidationError e) {
|
||||
// do expect this!
|
||||
noException = false;
|
||||
}
|
||||
@@ -187,8 +182,8 @@ public class XMLValidatorTest extends ResourceCase {
|
||||
}
|
||||
|
||||
public void testZF1XMLValidation() {
|
||||
ValidationContext ctx = new ValidationContext(null);
|
||||
XMLValidator xv = new XMLValidator(ctx);
|
||||
final ValidationContext ctx = new ValidationContext(null);
|
||||
final XMLValidator xv = new XMLValidator(ctx);
|
||||
File tempFile = getResourceAsFile("validV1.xml");
|
||||
try {
|
||||
xv.setFilename(tempFile.getAbsolutePath());
|
||||
@@ -205,16 +200,16 @@ public class XMLValidatorTest extends ResourceCase {
|
||||
xv.validate();
|
||||
assertEquals(true, xv.getXMLResult().contains("<error type=\"26\""));
|
||||
|
||||
} catch (IrrecoverableValidationError e) {
|
||||
} catch (final IrrecoverableValidationError e) {
|
||||
// ignore, will be in XML output anyway
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testXRValidation() {
|
||||
ValidationContext ctx = new ValidationContext(null);
|
||||
XMLValidator xv = new XMLValidator(ctx);
|
||||
XPathEngine xpath = new JAXPXPathEngine();
|
||||
final ValidationContext ctx = new ValidationContext(null);
|
||||
final XMLValidator xv = new XMLValidator(ctx);
|
||||
final XPathEngine xpath = new JAXPXPathEngine();
|
||||
|
||||
File tempFile = getResourceAsFile("validXRv2.xml");
|
||||
try {
|
||||
@@ -234,7 +229,7 @@ public class XMLValidatorTest extends ResourceCase {
|
||||
assertEquals("invalid", content);
|
||||
|
||||
|
||||
} catch (IrrecoverableValidationError e) {
|
||||
} catch (final IrrecoverableValidationError e) {
|
||||
// ignore, will be in XML output anyway
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user