Create E-Tax Invoice
program.cs
using CreateETDAInvoiceFromXml;
using iTextSharp.text;
using iTextSharp.text.pdf;
using Saxon.Api;
using System;
using System.IO;
namespace CreateEtaxInvoiceUsingXslt2
{
class Program
{
static void Main(string[] args)
{
string xsltfilename = @"ExampleDesignForETDA_1p0_c1p0_s1p0_2.xsl";
string inputfilename = @"Example_TaxInvoice_v2-0.xml";
string outputpdfilename = "result.pdf";
var xslt = new FileInfo(xsltfilename);
var input = new FileInfo(inputfilename);
var output = new FileInfo(@"result.html");
var outputpdf = new FileInfo(outputpdfilename);
Processor proc = new Processor();
proc.RegisterExtensionFunction(new BahtText());
XsltCompiler xsltc = proc.NewXsltCompiler();
var executable = xsltc.Compile(new Uri(xslt.FullName));
// Do transformation to a destination
var destination = new DomDestination();
using (var inputStream = input.OpenRead())
{
var transformer = executable.Load();
transformer.SetInputStream(inputStream, new Uri(input.DirectoryName));
transformer.Run(destination);
}
File.WriteAllBytes("result.pdf", createPDF(destination.XmlDocument.OuterXml).ToArray());
// Save result to a file (or whatever else you wanna do)
destination.XmlDocument.Save(output.FullName);
System.Diagnostics.Process.Start("result.pdf");
}
private static MemoryStream createPDF(string html)
{
MemoryStream msOutput = new MemoryStream();
TextReader reader = new StringReader(html);
// step 1: creation of a document-object
Document document = new Document(PageSize.A4, 30, 30, 30, 30);
// step 2:
// we create a writer that listens to the document
// and directs a XML-stream to a file
PdfWriter writer = PdfWriter.GetInstance(document, msOutput);
// step 3: we create a worker parse the document
// var worker = new XMLWorker(document);
/**************************************************
* Example #2 *
* *
* Use the XMLWorker to parse the HTML. *
* Only inline CSS and absolutely linked *
* CSS is supported *
* ************************************************/
document.Open();
//XMLWorker also reads from a TextReader and not directly from a string
//Parse the HTML
iTextSharp.tool.xml.XMLWorkerHelper.GetInstance().ParseXHtml(writer, document, reader);
// step 4: we open document and start the worker on the document
//worker.StartDocument();
//// step 5: parse the html into the document
//worker.Parse(reader);
//// step 6: close the document and the worker
//worker.EndDocument();
// worker.Close();
document.Close();
return msOutput;
}
}
}
Here are some examples on how to use the program (please click on the document to see the sourcecode).
example_taxinvoice.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"
-
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
-
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15">
-
<rsm:SpecifiedExchangedDocumentContext>
-
<ram:TestIndicator>
-
<udt:Indicator>false</udt:Indicator>
-
</ram:TestIndicator>
-
<ram:GuidelineSpecifiedDocumentContextParameter>
-
<ram:ID>urn:ferd:CrossIndustryDocument:invoice:1p0:extended</ram:ID>
-
</ram:GuidelineSpecifiedDocumentContextParameter>
-
</rsm:SpecifiedExchangedDocumentContext>
-
<rsm:HeaderExchangedDocument>
-
<ram:ID>322567-53654816</ram:ID>
-
<ram:Name>Beitragsrechnung für GS1 Complete 2015</ram:Name>
-
<ram:TypeCode>380</ram:TypeCode>
-
<ram:IssueDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:IssueDateTime>
-
<ram:IncludedNote>
-
<ram:Content></ram:Content>
-
</ram:IncludedNote>
-
<ram:IncludedNote>
-
<ram:Content>Ihr Antrag vom: 28.07.2015, Herr Johannes Döring</ram:Content>
-
</ram:IncludedNote>
-
<ram:IncludedNote>
-
<ram:Content>
-
Hiermit berechnen wir Ihnen gem. Ziffer III, 1 der Allg. Geschäftsbedingungen im Rahmen Ihrer Teilnahme an GS1 Complete für die Lokationsnummer (GLN):
-
-
42 6044293 000 6 Johannes Döring</ram:Content>
-
</ram:IncludedNote>
-
<ram:IncludedNote>
-
<ram:Content></ram:Content>
-
</ram:IncludedNote>
-
<ram:IncludedNote>
-
<ram:Content>
-
Die Berechnung des jährlichen Nutzungspreises erfolgt auf Basis des von Ihnen gemeldeten Gesamtumsatzes Ihres Unternehmens. Wir behalten uns eine Prüfung und eventuelle Umgruppierung, verbunden mit Nachberechnungen, vor.
-
</ram:Content>
-
</ram:IncludedNote>
-
<ram:IncludedNote>
-
<ram:Content>Vorsitzender des Aufsichtsrates: Erich Harsch Geschäftsführung: Jörg Pretzel Gesellschafter der GS1 Germany: EHI Retail Institute, Markenverband Amtsgericht Köln HRB 6276</ram:Content>
-
<ram:SubjectCode>REG</ram:SubjectCode>
-
</ram:IncludedNote>
-
</rsm:HeaderExchangedDocument>
-
<rsm:SpecifiedSupplyChainTradeTransaction>
-
<ram:ApplicableSupplyChainTradeAgreement>
-
<ram:SellerTradeParty>
-
<ram:GlobalID schemeID="0088">4000001000005</ram:GlobalID>
-
<ram:Name>GS1 Germany GmbH</ram:Name>
-
<ram:DefinedTradeContact>
-
<ram:PersonName>yj</ram:PersonName>
-
<ram:TelephoneUniversalCommunication>
-
<ram:CompleteNumber>+49 (221) 94714-333</ram:CompleteNumber>
-
</ram:TelephoneUniversalCommunication>
-
<ram:FaxUniversalCommunication>
-
<ram:CompleteNumber>+49 (221) 94714-7291</ram:CompleteNumber>
-
</ram:FaxUniversalCommunication>
-
<ram:EmailURIUniversalCommunication>
-
<ram:URIID>rechnung@gs1-germany.de</ram:URIID>
-
</ram:EmailURIUniversalCommunication>
-
</ram:DefinedTradeContact>
-
<ram:PostalTradeAddress>
-
<ram:PostcodeCode>50825</ram:PostcodeCode>
-
<ram:LineOne>Maarweg 133</ram:LineOne>
-
<ram:CityName>Köln</ram:CityName>
-
<ram:CountryID>DE</ram:CountryID>
-
</ram:PostalTradeAddress>
-
<ram:SpecifiedTaxRegistration>
-
<ram:ID schemeID="VA">DE122775856</ram:ID>
-
</ram:SpecifiedTaxRegistration>
-
</ram:SellerTradeParty>
-
<ram:BuyerTradeParty>
-
<ram:ID>D322567</ram:ID>
-
<ram:GlobalID schemeID="0088">4260442930006</ram:GlobalID>
-
<ram:Name>Johannes Döring</ram:Name>
-
<ram:PostalTradeAddress>
-
<ram:PostcodeCode>56567</ram:PostcodeCode>
-
<ram:LineOne>Melsbacher Str. 25</ram:LineOne>
-
<ram:CityName>Neuwied</ram:CityName>
-
<ram:CountryID>DE</ram:CountryID>
-
</ram:PostalTradeAddress>
-
<ram:SpecifiedTaxRegistration>
-
<ram:ID schemeID="VA">DE211477959</ram:ID>
-
</ram:SpecifiedTaxRegistration>
-
</ram:BuyerTradeParty>
-
</ram:ApplicableSupplyChainTradeAgreement>
-
<ram:ApplicableSupplyChainTradeDelivery>
-
<ram:ActualDeliverySupplyChainEvent>
-
<ram:OccurrenceDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:OccurrenceDateTime>
-
</ram:ActualDeliverySupplyChainEvent>
-
</ram:ApplicableSupplyChainTradeDelivery>
-
<ram:ApplicableSupplyChainTradeSettlement>
-
<ram:PaymentReference>322567-53654816</ram:PaymentReference>
-
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
-
<ram:SpecifiedTradeSettlementPaymentMeans>
-
<ram:TypeCode>31</ram:TypeCode>
-
<ram:Information>sofort netto ohne Abzug</ram:Information>
-
<ram:PayeePartyCreditorFinancialAccount>
-
<ram:IBANID>DE86570900001052005000</ram:IBANID>
-
</ram:PayeePartyCreditorFinancialAccount>
-
<ram:PayeeSpecifiedCreditorFinancialInstitution>
-
<ram:BICID>GENODE51KOB</ram:BICID>
-
<ram:Name>Volksbank Koblenz Mittelrhein eG</ram:Name>
-
</ram:PayeeSpecifiedCreditorFinancialInstitution>
-
</ram:SpecifiedTradeSettlementPaymentMeans>
-
<ram:ApplicableTradeTax>
-
<ram:CalculatedAmount currencyID="EUR">77.90</ram:CalculatedAmount>
-
<ram:TypeCode>VAT</ram:TypeCode>
-
<ram:BasisAmount currencyID="EUR">410.00</ram:BasisAmount>
-
<ram:CategoryCode>S</ram:CategoryCode>
-
<ram:ApplicablePercent>19.00</ram:ApplicablePercent>
-
</ram:ApplicableTradeTax>
-
<ram:BillingSpecifiedPeriod>
-
<ram:StartDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:StartDateTime>
-
<ram:EndDateTime>
-
<udt:DateTimeString format="102">20151231</udt:DateTimeString>
-
</ram:EndDateTime>
-
</ram:BillingSpecifiedPeriod>
-
<ram:SpecifiedTradePaymentTerms>
-
<ram:Description>Zahlbar sofort ohne Abzug</ram:Description>
-
<ram:DueDateDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:DueDateDateTime>
-
</ram:SpecifiedTradePaymentTerms>
-
<ram:SpecifiedTradeSettlementMonetarySummation>
-
<ram:LineTotalAmount currencyID="EUR">410.00</ram:LineTotalAmount>
-
<ram:ChargeTotalAmount currencyID="EUR">0.00</ram:ChargeTotalAmount>
-
<ram:AllowanceTotalAmount currencyID="EUR">0.00</ram:AllowanceTotalAmount>
-
<ram:TaxBasisTotalAmount currencyID="EUR">410.00</ram:TaxBasisTotalAmount>
-
<ram:TaxTotalAmount currencyID="EUR">77.90</ram:TaxTotalAmount>
-
<ram:GrandTotalAmount currencyID="EUR">487.25</ram:GrandTotalAmount>
-
<ram:TotalPrepaidAmount currencyID="EUR">0.00</ram:TotalPrepaidAmount>
-
<ram:DuePayableAmount currencyID="EUR">487.90</ram:DuePayableAmount>
-
</ram:SpecifiedTradeSettlementMonetarySummation>
-
</ram:ApplicableSupplyChainTradeSettlement>
-
<ram:IncludedSupplyChainTradeLineItem>
-
<ram:AssociatedDocumentLineDocument>
-
<ram:LineID>1</ram:LineID>
-
</ram:AssociatedDocumentLineDocument>
-
<ram:SpecifiedSupplyChainTradeAgreement>
-
<ram:GrossPriceProductTradePrice>
-
<ram:ChargeAmount currencyID="EUR">230.0000</ram:ChargeAmount>
-
<ram:BasisQuantity unitCode="C62">1.0000</ram:BasisQuantity>
-
</ram:GrossPriceProductTradePrice>
-
<ram:NetPriceProductTradePrice>
-
<ram:ChargeAmount currencyID="EUR">230.0000</ram:ChargeAmount>
-
<ram:BasisQuantity unitCode="C62">1.0000</ram:BasisQuantity>
-
</ram:NetPriceProductTradePrice>
-
</ram:SpecifiedSupplyChainTradeAgreement>
-
<ram:SpecifiedSupplyChainTradeDelivery>
-
<ram:BilledQuantity unitCode="C62">1.0000</ram:BilledQuantity>
-
<ram:ActualDeliverySupplyChainEvent>
-
<ram:OccurrenceDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:OccurrenceDateTime>
-
</ram:ActualDeliverySupplyChainEvent>
-
</ram:SpecifiedSupplyChainTradeDelivery>
-
<ram:SpecifiedSupplyChainTradeSettlement>
-
<ram:ApplicableTradeTax>
-
<ram:TypeCode>VAT</ram:TypeCode>
-
<ram:CategoryCode>S</ram:CategoryCode>
-
<ram:ApplicablePercent>19.00</ram:ApplicablePercent>
-
</ram:ApplicableTradeTax>
-
<ram:BillingSpecifiedPeriod>
-
<ram:StartDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:StartDateTime>
-
<ram:EndDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:EndDateTime>
-
</ram:BillingSpecifiedPeriod>
-
<ram:SpecifiedTradeSettlementMonetarySummation>
-
<ram:LineTotalAmount currencyID="EUR">230.00</ram:LineTotalAmount>
-
</ram:SpecifiedTradeSettlementMonetarySummation>
-
</ram:SpecifiedSupplyChainTradeSettlement>
-
<ram:SpecifiedTradeProduct>
-
<ram:GlobalID schemeID="0088">4000001016495</ram:GlobalID>
-
<ram:SellerAssignedID>4000001016495</ram:SellerAssignedID>
-
<ram:Name>Bereitstellungspreis für 9-stellige Basisnummer</ram:Name>
-
</ram:SpecifiedTradeProduct>
-
</ram:IncludedSupplyChainTradeLineItem>
-
<ram:IncludedSupplyChainTradeLineItem>
-
<ram:AssociatedDocumentLineDocument>
-
<ram:LineID>2</ram:LineID>
-
</ram:AssociatedDocumentLineDocument>
-
<ram:SpecifiedSupplyChainTradeAgreement>
-
<ram:GrossPriceProductTradePrice>
-
<ram:ChargeAmount currencyID="EUR">150.0000</ram:ChargeAmount>
-
<ram:BasisQuantity unitCode="C62">1.0000</ram:BasisQuantity>
-
</ram:GrossPriceProductTradePrice>
-
<ram:NetPriceProductTradePrice>
-
<ram:ChargeAmount currencyID="EUR">150.0000</ram:ChargeAmount>
-
<ram:BasisQuantity unitCode="C62">1.0000</ram:BasisQuantity>
-
</ram:NetPriceProductTradePrice>
-
</ram:SpecifiedSupplyChainTradeAgreement>
-
<ram:SpecifiedSupplyChainTradeDelivery>
-
<ram:BilledQuantity unitCode="C62">1.0000</ram:BilledQuantity>
-
<ram:ActualDeliverySupplyChainEvent>
-
<ram:OccurrenceDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:OccurrenceDateTime>
-
</ram:ActualDeliverySupplyChainEvent>
-
</ram:SpecifiedSupplyChainTradeDelivery>
-
<ram:SpecifiedSupplyChainTradeSettlement>
-
<ram:ApplicableTradeTax>
-
<ram:TypeCode>VAT</ram:TypeCode>
-
<ram:CategoryCode>S</ram:CategoryCode>
-
<ram:ApplicablePercent>19.00</ram:ApplicablePercent>
-
</ram:ApplicableTradeTax>
-
<ram:BillingSpecifiedPeriod>
-
<ram:StartDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:StartDateTime>
-
<ram:EndDateTime>
-
<udt:DateTimeString format="102">20151231</udt:DateTimeString>
-
</ram:EndDateTime>
-
</ram:BillingSpecifiedPeriod>
-
<ram:SpecifiedTradeSettlementMonetarySummation>
-
<ram:LineTotalAmount currencyID="EUR">150.00</ram:LineTotalAmount>
-
</ram:SpecifiedTradeSettlementMonetarySummation>
-
</ram:SpecifiedSupplyChainTradeSettlement>
-
<ram:SpecifiedTradeProduct>
-
<ram:GlobalID schemeID="0088">4000001020300</ram:GlobalID>
-
<ram:SellerAssignedID>4000001020300</ram:SellerAssignedID>
-
<ram:Name>Jährlicher Nutzungspreis Umsatzstufe 1</ram:Name>
-
</ram:SpecifiedTradeProduct>
-
</ram:IncludedSupplyChainTradeLineItem>
-
<ram:IncludedSupplyChainTradeLineItem>
-
<ram:AssociatedDocumentLineDocument>
-
<ram:LineID>3</ram:LineID>
-
</ram:AssociatedDocumentLineDocument>
-
<ram:SpecifiedSupplyChainTradeAgreement>
-
<ram:GrossPriceProductTradePrice>
-
<ram:ChargeAmount currencyID="EUR">30.0000</ram:ChargeAmount>
-
<ram:BasisQuantity unitCode="C62">1.0000</ram:BasisQuantity>
-
</ram:GrossPriceProductTradePrice>
-
<ram:NetPriceProductTradePrice>
-
<ram:ChargeAmount currencyID="EUR">30.0000</ram:ChargeAmount>
-
<ram:BasisQuantity unitCode="C62">1.0000</ram:BasisQuantity>
-
</ram:NetPriceProductTradePrice>
-
</ram:SpecifiedSupplyChainTradeAgreement>
-
<ram:SpecifiedSupplyChainTradeDelivery>
-
<ram:BilledQuantity unitCode="C62">1.0000</ram:BilledQuantity>
-
<ram:ActualDeliverySupplyChainEvent>
-
<ram:OccurrenceDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:OccurrenceDateTime>
-
</ram:ActualDeliverySupplyChainEvent>
-
</ram:SpecifiedSupplyChainTradeDelivery>
-
<ram:SpecifiedSupplyChainTradeSettlement>
-
<ram:ApplicableTradeTax>
-
<ram:TypeCode>VAT</ram:TypeCode>
-
<ram:CategoryCode>S</ram:CategoryCode>
-
<ram:ApplicablePercent>19.00</ram:ApplicablePercent>
-
</ram:ApplicableTradeTax>
-
<ram:BillingSpecifiedPeriod>
-
<ram:StartDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:StartDateTime>
-
<ram:EndDateTime>
-
<udt:DateTimeString format="102">20150731</udt:DateTimeString>
-
</ram:EndDateTime>
-
</ram:BillingSpecifiedPeriod>
-
<ram:SpecifiedTradeSettlementMonetarySummation>
-
<ram:LineTotalAmount currencyID="EUR">30.00</ram:LineTotalAmount>
-
</ram:SpecifiedTradeSettlementMonetarySummation>
-
</ram:SpecifiedSupplyChainTradeSettlement>
-
<ram:SpecifiedTradeProduct>
-
<ram:GlobalID schemeID="0088">4000001021109</ram:GlobalID>
-
<ram:SellerAssignedID>4000001021109</ram:SellerAssignedID>
-
<ram:Name>Zertifikat Englisch/Deutsch</ram:Name>
-
</ram:SpecifiedTradeProduct>
-
</ram:IncludedSupplyChainTradeLineItem>
-
</rsm:SpecifiedSupplyChainTradeTransaction>
-
</rsm:CrossIndustryDocument>
example_design-for-ETDA.xsl
-
-
<?xml version="1.0" encoding="utf-8"?>
-
<xsl:stylesheet exclude-result-prefixes="rsm ram udt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12" xmlns:rsm="urn:ferd:CrossIndustryDocument:invoice:1p0" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" version="1.0">
-
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
-
<xsl:template match="/rsm:CrossIndustryDocument">
-
<html>
-
<head>
-
<link rel="stylesheet" type="text/css" href="invoice.css" />
-
</head>
-
<body>
-
<img src="logo.png" alt="Das Company - logo" />
-
<br />
-
<xsl:apply-templates />
-
</body>
-
</html>
-
</xsl:template>
-
-
<xsl:template match="rsm:SpecifiedExchangedDocumentContext" />
-
<xsl:template match="rsm:HeaderExchangedDocument">
-
<h1 id="header">
-
<xsl:value-of select="ram:Name" />
-
<xsl:text> </xsl:text>
-
<xsl:value-of select="ram:ID" />
-
</h1>
-
<xsl:apply-templates select="ram:IssueDateTime" />
-
</xsl:template>
-
<xsl:template match="rsm:SpecifiedSupplyChainTradeTransaction">
-
<table width="100%" border="0" id="addresses">
-
<tr>
-
<td valign="Top" width="10%">
-
<b>From:</b>
-
</td>
-
<td valign="Top" width="40%">
-
<xsl:for-each select="ram:ApplicableSupplyChainTradeAgreement/ram:SellerTradeParty">
-
<xsl:call-template name="address" />
-
</xsl:for-each>
-
</td>
-
<td valign="Top" width="10%">
-
<b>To:</b>
-
</td>
-
<td valign="Top" width="40%">
-
<xsl:for-each select="ram:ApplicableSupplyChainTradeAgreement/ram:BuyerTradeParty">
-
<xsl:call-template name="address" />
-
</xsl:for-each>
-
</td>
-
</tr>
-
</table>
-
<table width="100%" id="products">
-
<tr class="headerrow">
-
<th>#</th>
-
<th>Product</th>
-
<th>Unit</th>
-
<th>Qty.</th>
-
<th>Sub.</th>
-
<th>Tax%</th>
-
<th>Tax</th>
-
<th>Total</th>
-
<th>Curr.</th>
-
</tr>
-
<xsl:for-each select="ram:IncludedSupplyChainTradeLineItem">
-
<tr>
-
<td align="Right">
-
<xsl:value-of select="ram:AssociatedDocumentLineDocument/ram:LineID" />.
-
</td>
-
<td class="bold">
-
<xsl:value-of select="ram:SpecifiedTradeProduct/ram:Name" />
-
</td>
-
<td align="Right">
-
<xsl:call-template name="twodecimals">
-
<xsl:with-param name="number" select="ram:SpecifiedSupplyChainTradeAgreement/ram:GrossPriceProductTradePrice/ram:ChargeAmount" />
-
</xsl:call-template>
-
</td>
-
<td align="Right">
-
<xsl:call-template name="twodecimals">
-
<xsl:with-param name="number" select="ram:SpecifiedSupplyChainTradeDelivery/ram:BilledQuantity" />
-
</xsl:call-template>
-
</td>
-
<td align="Right">
-
<xsl:value-of select="ram:SpecifiedSupplyChainTradeSettlement/ram:SpecifiedTradeSettlementMonetarySummation/ram:LineTotalAmount" />
-
</td>
-
<td align="Right">
-
<xsl:value-of select="ram:SpecifiedSupplyChainTradeSettlement/ram:ApplicableTradeTax/ram:ApplicablePercent" />%
-
</td>
-
<td align="Right">
-
<xsl:call-template name="calcTax">
-
<xsl:with-param name="basis" select="ram:SpecifiedSupplyChainTradeSettlement/ram:SpecifiedTradeSettlementMonetarySummation/ram:LineTotalAmount" />
-
<xsl:with-param name="tax" select="ram:SpecifiedSupplyChainTradeSettlement/ram:ApplicableTradeTax/ram:ApplicablePercent" />
-
</xsl:call-template>
-
</td>
-
<td align="Right" class="bold">
-
<xsl:call-template name="calcWithTax">
-
<xsl:with-param name="basis" select="ram:SpecifiedSupplyChainTradeSettlement/ram:SpecifiedTradeSettlementMonetarySummation/ram:LineTotalAmount" />
-
<xsl:with-param name="tax" select="ram:SpecifiedSupplyChainTradeSettlement/ram:ApplicableTradeTax/ram:ApplicablePercent" />
-
</xsl:call-template>
-
</td>
-
<td>
-
<xsl:value-of select="ram:SpecifiedSupplyChainTradeSettlement/ram:SpecifiedTradeSettlementMonetarySummation/ram:LineTotalAmount/@currencyID" />
-
</td>
-
</tr>
-
</xsl:for-each>
-
</table>
-
<table width="100%" id="totals">
-
<tr class="headerrow">
-
<th>Tax</th>
-
<th>%</th>
-
<th>Base amount:</th>
-
<th>Tax amount:</th>
-
<th>Total</th>
-
<th>Curr.</th>
-
</tr>
-
<xsl:for-each select="ram:ApplicableSupplyChainTradeSettlement/ram:ApplicableTradeTax">
-
<tr>
-
<td align="Right">
-
<xsl:value-of select="ram:TypeCode" />
-
</td>
-
<td align="Right">
-
<xsl:value-of select="ram:ApplicablePercent" />
-
</td>
-
<td align="Right">
-
<xsl:value-of select="ram:BasisAmount" />
-
</td>
-
<td align="Right">
-
<xsl:value-of select="ram:CalculatedAmount" />
-
</td>
-
<td align="Right">
-
<xsl:call-template name="calcWithTax">
-
<xsl:with-param name="basis" select="ram:BasisAmount" />
-
<xsl:with-param name="tax" select="ram:ApplicablePercent" />
-
</xsl:call-template>
-
</td>
-
<td>
-
<xsl:value-of select="ram:CalculatedAmount/@currencyID" />
-
</td>
-
</tr>
-
</xsl:for-each>
-
<tr>
-
<td class="total" align="Right" colspan="2">Grand total:</td>
-
<td class="total" align="Right">
-
<xsl:value-of select="ram:ApplicableSupplyChainTradeSettlement/ram:SpecifiedTradeSettlementMonetarySummation/ram:TaxBasisTotalAmount" />
-
</td>
-
<td class="total" align="Right">
-
<xsl:value-of select="ram:ApplicableSupplyChainTradeSettlement/ram:SpecifiedTradeSettlementMonetarySummation/ram:TaxTotalAmount" />
-
</td>
-
<td class="total" align="Right">
-
<xsl:value-of select="ram:ApplicableSupplyChainTradeSettlement/ram:SpecifiedTradeSettlementMonetarySummation/ram:GrandTotalAmount" />
-
</td>
-
<td class="total">
-
<xsl:value-of select="ram:ApplicableSupplyChainTradeSettlement/ram:SpecifiedTradeSettlementMonetarySummation/ram:GrandTotalAmount/@currencyID" />
-
</td>
-
</tr>
-
</table>
-
<table id="wireinfo">
-
<tr>
-
<td colspan="4">
-
Please wire the amount due to our bank account using the following reference: <xsl:value-of select="ram:ApplicableSupplyChainTradeSettlement/ram:PaymentReference" />
-
</td>
-
</tr>
-
<tr>
-
<th></th>
-
<th class="wireheader">Bank</th>
-
<th class="wireheader">BIC ID</th>
-
<th class="wireheader">IBAN Number</th>
-
</tr>
-
<xsl:for-each select="ram:ApplicableSupplyChainTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans">
-
<tr>
-
<td></td>
-
<td>
-
<xsl:value-of select="ram:PayeeSpecifiedCreditorFinancialInstitution/ram:Name" />
-
</td>
-
<td>
-
<xsl:value-of select="ram:PayeeSpecifiedCreditorFinancialInstitution/ram:BICID" />
-
</td>
-
<td>
-
<xsl:value-of select="ram:PayeePartyCreditorFinancialAccount/ram:IBANID" />
-
</td>
-
</tr>
-
</xsl:for-each>
-
</table>
-
</xsl:template>
-
-
-
<xsl:template match="udt:DateTimeString">
-
<h2 id="date">
-
<xsl:choose>
-
<xsl:when test="@format='610'">
-
<xsl:call-template name="YYYYMM">
-
<xsl:with-param name="date" select="." />
-
</xsl:call-template>
-
</xsl:when>
-
<xsl:when test="@format='616'">
-
<xsl:call-template name="YYYYWW">
-
<xsl:with-param name="date" select="." />
-
</xsl:call-template>
-
</xsl:when>
-
<xsl:otherwise>
-
<xsl:call-template name="YYYYMMDD">
-
<xsl:with-param name="date" select="." />
-
</xsl:call-template>
-
</xsl:otherwise>
-
</xsl:choose>
-
</h2>
-
</xsl:template>
-
-
<xsl:template name="address">
-
<span class="name">
-
<xsl:value-of select="ram:Name" />
-
</span><br />
-
<xsl:value-of select="ram:PostalTradeAddress/ram:LineOne" /><br />
-
<xsl:value-of select="ram:PostalTradeAddress/ram:LineTwo" /><br />
-
<xsl:value-of select="ram:PostalTradeAddress/ram:CountryID" />-<xsl:value-of select="ram:PostalTradeAddress/ram:PostcodeCode" /><xsl:text> </xsl:text><xsl:value-of select="ram:PostalTradeAddress/ram:CityName" /><br />
-
<xsl:for-each select="ram:SpecifiedTaxRegistration/ram:ID">
-
<xsl:value-of select="@schemeID" />: <xsl:value-of select="." /><br />
-
</xsl:for-each>
-
</xsl:template>
-
-
<xsl:template name="calcTax">
-
<xsl:param name="basis" />
-
<xsl:param name="tax" />
-
<xsl:call-template name="twodecimals">
-
<xsl:with-param name="number" select="($basis * $tax) div 100" />
-
</xsl:call-template>
-
</xsl:template>
-
<xsl:template name="calcWithTax">
-
<xsl:param name="basis" />
-
<xsl:param name="tax" />
-
<xsl:call-template name="twodecimals">
-
<xsl:with-param name="number" select="$basis + (($basis * $tax) div 100)" />
-
</xsl:call-template>
-
</xsl:template>
-
<xsl:template name="twodecimals">
-
<xsl:param name="number" />
-
<xsl:value-of select="format-number(round($number*100) div 100, '0.00')"/>
-
</xsl:template>
-
<xsl:template name="YYYYMMDD">
-
<xsl:param name="date" />
-
<xsl:value-of select="substring($date,1,4)" />-<xsl:value-of select="substring($date,5,2)" />-<xsl:value-of select="substring($date,7,2)" />
-
</xsl:template>
-
<xsl:template name="YYYYMM">
-
<xsl:param name="date" />
-
<xsl:value-of select="substring($date,1,4)" />-<xsl:value-of select="substring($date,5,2)" />
-
</xsl:template>
-
<xsl:template name="YYYYWW">
-
<xsl:param name="date" />
-
<xsl:value-of select="substring($date,1,4)" />; week <xsl:value-of select="substring($date,5,2)" />
-
</xsl:template>
-
</xsl:stylesheet>