Remove \n behind xml tags
This commit is contained in:
@@ -28,13 +28,13 @@ public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {
|
||||
|
||||
|
||||
|
||||
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 = xml + "</ram:SpecifiedTradeSettlementPaymentMeans>";
|
||||
return xml;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = 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 = 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 = xml + "<ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
}
|
||||
String allowanceChargeStr = "";
|
||||
if (currentItem.getItemAllowances() != null && currentItem.getItemAllowances().length > 0) {
|
||||
@@ -184,12 +177,12 @@ 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 = 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" +
|
||||
@@ -203,44 +196,44 @@ 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 = 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 = 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>\n"
|
||||
+ "<ram:NetPriceProductTradePrice>\n"
|
||||
+ "<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>";
|
||||
if (currentItem.getDetailedDeliveryPeriodFrom() != null) {
|
||||
@@ -253,86 +246,86 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeSettlementLineMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>\n" // currencyID=\"EUR\"
|
||||
+ " </ram:SpecifiedTradeSettlementLineMonetarySummation>\n";
|
||||
xml = 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 = 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 = xml + "</ram:SpecifiedLineTradeSettlement>"
|
||||
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:ApplicableHeaderTradeAgreement>\n";
|
||||
xml = xml + "<ram:ApplicableHeaderTradeAgreement>";
|
||||
if (trans.getReferenceNumber() != null) {
|
||||
xml = xml + " <ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>\n";
|
||||
xml = xml + "<ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>";
|
||||
|
||||
}
|
||||
xml = xml + " <ram:SellerTradeParty>\n"
|
||||
xml = 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 = 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 = 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 = 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 = 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 = 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 = 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,15 +374,15 @@ 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";
|
||||
|
||||
*/
|
||||
}
|
||||
@@ -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 = 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> \n";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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 = 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 = xml + "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
if (paymentTermsDescription != null) {
|
||||
xml = xml + "<ram:Description>" + paymentTermsDescription + "</ram:Description>\n";
|
||||
xml = xml + "<ram:Description>" + paymentTermsDescription + "</ram:Description>";
|
||||
}
|
||||
|
||||
if (trans.getTradeSettlement() != null) {
|
||||
@@ -467,12 +460,12 @@ public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider
|
||||
}
|
||||
|
||||
if (hasDueDate && (trans.getDueDate() != null)) {
|
||||
xml = xml + " <ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
xml = xml + "<ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
+ DATE.udtFormat(trans.getDueDate())
|
||||
+ "</ram:DueDateDateTime>\n";// 20130704
|
||||
+ "</ram:DueDateDateTime>";// 20130704
|
||||
|
||||
}
|
||||
xml = xml + " </ram:SpecifiedTradePaymentTerms>\n";
|
||||
xml = xml + "</ram:SpecifiedTradePaymentTerms>";
|
||||
} else {
|
||||
xml = 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 = 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 = 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 = 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 = xml + "</rsm:SupplyChainTradeTransaction>"
|
||||
+ "</rsm:SCRDMCCBDACIOMessageStructure>";
|
||||
|
||||
final byte[] zugferdRaw;
|
||||
|
||||
@@ -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 = xml + "<ram:ApplicableSupplyChainTradeAgreement>";
|
||||
if (trans.getReferenceNumber() != null) {
|
||||
xml = xml + " <ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>\n";
|
||||
xml = xml + "<ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>";
|
||||
|
||||
}
|
||||
xml = xml + " <ram:SellerTradeParty>\n";
|
||||
xml = 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 = xml + "<ram:SpecifiedTaxRegistration>\n<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 = 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 = xml + "<ram:BuyerOrderReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
+ XMLTools.encodeXML(trans.getBuyerOrderReferencedDocumentID()) + "</ram:IssuerAssignedID>"
|
||||
+ "</ram:BuyerOrderReferencedDocument>";
|
||||
}
|
||||
xml = xml + " </ram:ApplicableSupplyChainTradeAgreement>\n"
|
||||
+ " <ram:ApplicableSupplyChainTradeDelivery>\n";
|
||||
xml = 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>\n<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>\n</ram:ApplicableTradeTax>";
|
||||
}
|
||||
}
|
||||
|
||||
if (trans.getPaymentTerms() == null) {
|
||||
xml = xml + " <ram:SpecifiedTradePaymentTerms>\n"
|
||||
+ " <ram:Description>" + paymentTermsDescription + "</ram:Description>\n";
|
||||
xml = 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 = xml + "<ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
+ DATE.udtFormat(trans.getDueDate())
|
||||
+ "</ram:DueDateDateTime>\n";// 20130704
|
||||
+ "</ram:DueDateDateTime>";// 20130704
|
||||
|
||||
}
|
||||
xml = xml + " </ram:SpecifiedTradePaymentTerms>\n";
|
||||
xml = xml + "</ram:SpecifiedTradePaymentTerms>";
|
||||
} else {
|
||||
xml = xml + buildPaymentTermsXml();
|
||||
}
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeSettlementMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(calc.getTotal()) + "</ram:LineTotalAmount>\n"
|
||||
xml = 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,69 +340,69 @@ 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 = 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 = 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 = 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 = 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 = 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"
|
||||
xml = xml + "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>"
|
||||
+ "<ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription())
|
||||
+ "</ram:Description>"
|
||||
+ "</ram:SpecifiedTradeProduct>"
|
||||
|
||||
+ " </ram:IncludedSupplyChainTradeLineItem>\n";
|
||||
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
||||
|
||||
}
|
||||
|
||||
@@ -411,7 +415,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
||||
// + " </AssociatedDocumentLineDocument>\n"
|
||||
// + " </IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
xml = xml + " </rsm:SpecifiedSupplyChainTradeTransaction>\n"
|
||||
xml = xml + "</rsm:SpecifiedSupplyChainTradeTransaction>"
|
||||
+ "</rsm:CrossIndustryDocument>";
|
||||
|
||||
final byte[] zugferdRaw;
|
||||
|
||||
@@ -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 = 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 = xml + "<ram:DefinedTradeContact>";
|
||||
if (party.getContact().getName() != null) {
|
||||
xml = xml + "<ram:PersonName>" + XMLTools.encodeXML(party.getContact().getName())
|
||||
+ "</ram:PersonName>\n";
|
||||
+ "</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 = 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 = 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 = xml + "<ram:EmailURIUniversalCommunication><ram:URIID>"
|
||||
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>"
|
||||
+ "</ram:EmailURIUniversalCommunication>";
|
||||
}
|
||||
|
||||
xml = xml + " </ram:DefinedTradeContact>";
|
||||
xml = 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>\n</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>\n<ram:Content>"
|
||||
+ "Es bestehen Rabatt- und Bonusvereinbarungen.</ram:Content>"
|
||||
+ "<ram:SubjectCode>AAK</ram:SubjectCode>\n</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>\n<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 = 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 = 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 = xml + "<ram:BuyerAssignedID>"
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
}
|
||||
String allowanceChargeStr = "";
|
||||
if (currentItem.getItemAllowances() != null && currentItem.getItemAllowances().length > 0) {
|
||||
@@ -356,63 +357,63 @@ 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 = 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 = 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 = 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 = 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"
|
||||
// + " <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>\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"
|
||||
+ "<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: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>";
|
||||
if (currentItem.getDetailedDeliveryPeriodFrom() != null) {
|
||||
@@ -425,100 +426,99 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:SpecifiedTradeSettlementLineMonetarySummation>\n"
|
||||
+ " <ram:LineTotalAmount>" + currencyFormat(lc.getItemTotalNetAmount())
|
||||
+ "</ram:LineTotalAmount>\n" // currencyID=\"EUR\"
|
||||
+ " </ram:SpecifiedTradeSettlementLineMonetarySummation>\n";
|
||||
xml = 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 = 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 = xml + "</ram:SpecifiedLineTradeSettlement>"
|
||||
+ "</ram:IncludedSupplyChainTradeLineItem>";
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:ApplicableHeaderTradeAgreement>\n";
|
||||
xml = xml + "<ram:ApplicableHeaderTradeAgreement>";
|
||||
if (trans.getReferenceNumber() != null) {
|
||||
xml = xml + " <ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>\n";
|
||||
xml = xml + "<ram:BuyerReference>" + XMLTools.encodeXML(trans.getReferenceNumber()) + "</ram:BuyerReference>";
|
||||
|
||||
}
|
||||
xml = xml + " <ram:SellerTradeParty>\n"
|
||||
xml = 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 = 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 = 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 = 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 = 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 = 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 = 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 +526,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>\n <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,15 +558,15 @@ 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>\n</ram:ApplicableTradeTax>";
|
||||
}
|
||||
}
|
||||
if ((trans.getDetailedDeliveryPeriodFrom() != null) || (trans.getDetailedDeliveryPeriodTo() != null)) {
|
||||
@@ -588,17 +588,17 @@ public class 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" +
|
||||
xml = 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> \n";
|
||||
|
||||
}
|
||||
@@ -609,17 +609,17 @@ public class 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" +
|
||||
xml = 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";
|
||||
}
|
||||
}
|
||||
@@ -627,10 +627,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
|
||||
if ((trans.getPaymentTerms() == null) && ((paymentTermsDescription != null) || (trans.getTradeSettlement() != null) || (hasDueDate))) {
|
||||
xml = xml + "<ram:SpecifiedTradePaymentTerms>\n";
|
||||
xml = xml + "<ram:SpecifiedTradePaymentTerms>";
|
||||
|
||||
if (paymentTermsDescription != null) {
|
||||
xml = xml + "<ram:Description>" + paymentTermsDescription + "</ram:Description>\n";
|
||||
xml = xml + "<ram:Description>" + paymentTermsDescription + "</ram:Description>";
|
||||
}
|
||||
|
||||
if (trans.getTradeSettlement() != null) {
|
||||
@@ -642,12 +642,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
if (hasDueDate && (trans.getDueDate() != null)) {
|
||||
xml = xml + " <ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
xml = xml + "<ram:DueDateDateTime>" // $NON-NLS-2$
|
||||
+ DATE.udtFormat(trans.getDueDate())
|
||||
+ "</ram:DueDateDateTime>\n";// 20130704
|
||||
+ "</ram:DueDateDateTime>";// 20130704
|
||||
|
||||
}
|
||||
xml = xml + " </ram:SpecifiedTradePaymentTerms>\n";
|
||||
xml = xml + "</ram:SpecifiedTradePaymentTerms>";
|
||||
} else {
|
||||
xml = xml + buildPaymentTermsXml();
|
||||
}
|
||||
@@ -657,34 +657,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 = 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 = 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 = xml + "</ram:ApplicableHeaderTradeSettlement>";
|
||||
// + " <IncludedSupplyChainTradeLineItem>\n"
|
||||
// + " <AssociatedDocumentLineDocument>\n"
|
||||
// + " <IncludedNote>\n"
|
||||
@@ -694,7 +694,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
// + " </AssociatedDocumentLineDocument>\n"
|
||||
// + " </IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
xml = xml + " </rsm:SupplyChainTradeTransaction>\n"
|
||||
xml = xml + "</rsm:SupplyChainTradeTransaction>"
|
||||
+ "</rsm:CrossIndustryInvoice>";
|
||||
|
||||
final byte[] zugferdRaw;
|
||||
|
||||
Reference in New Issue
Block a user