MARX#41719: UBL ondersteuning voor Rochdale via Mareon: UBL implementatie

svn path=/Website/branches/v2017.1/; revision=35046
This commit is contained in:
Marcel Bourseau
2017-08-22 16:26:26 +00:00
parent 008c3b4068
commit ab9d1b5bb7

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:ccts="urn:oasis:names:specification:ubl:schema:xsd:CoreComponentParameters-2"
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
xmlns:stat="urn:oasis:names:specification:ubl:schema:xsd:DocumentStatusCode-1.0"
xmlns:udt="urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/">
<xsl:comment>woconr;leveranciernr;factuurnr;factuurdatum;onderwerp;opdrachtnr;omschrijving;bedrag;btwperc;btwbedrag;btw_verlegd;document;iban;G_iban;G_bedrag;kvk_nr;btw_nr;afleverdatum</xsl:comment>
<xsl:for-each select="//cac:InvoiceLine">
<xsl:value-of select="../cac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID"/>;<xsl:value-of select="../cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID"/>;<xsl:value-of select="../cbc:ID"/>;<xsl:value-of select="../cbc:IssueDate"/>;<xsl:call-template name="vrije_tekst"><xsl:with-param name="p_string" select="../cbc:Note"/></xsl:call-template>;<xsl:call-template name="get_customer_po"/>;<xsl:call-template name="construct_factuurregel_omschr"/>;<xsl:value-of select="cbc:LineExtensionAmount"/>;<xsl:call-template name="VATInformation"/>;<xsl:value-of select="../cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename"/>;<xsl:value-of select="../cac:PaymentMeans/cac:PayeeFinancialAccount/cbc:ID"/>;;;<xsl:value-of select="../cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID"/>;<xsl:value-of select="../cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID"/>;<xsl:value-of select="../cac:Delivery/cbc:ActualDeliveryDate"/>;&#10;</xsl:for-each>
</xsl:template>
<xsl:template name="get_customer_po">
<xsl:choose>
<xsl:when test="cac:OrderLineReference/cac:OrderReference/cbc:ID != ''"><xsl:value-of select="cac:OrderLineReference/cac:OrderReference/cbc:ID"/></xsl:when>
<xsl:when test="../cbc:AccountingCost != ''"><xsl:value-of select="../cbc:AccountingCost"/></xsl:when>
<xsl:when test="../cac:OrderReference/cbc:ID != ''"><xsl:value-of select="../cac:OrderReference/cbc:ID"/></xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="VATInformation">
<!-- Deze template levert het gedeelte [btwperc;btwbedrag;btw_verlegd] op -->
<!-- Let even op: geen voorgaande ; en zeker ook geen ; op einde, dat gebeurt in de aanroepende regel (hierboven dus) -->
<!-- Let op: btw bedrag wordt niet uit SidB uit de node InvoiceLine aangeboden, dus deze is hier altijd leeg. -->
<xsl:choose>
<xsl:when test="../cac:TaxTotal/cac:TaxSubtotal[1]/cac:TaxCategory/cac:TaxScheme/cbc:ID = 'AE' or cac:Item/cac:ClassifiedTaxCategory/cac:TaxScheme/cbc:ID = 'AE'">
<!-- BTW verlegd = Ja, en neem BTW-percentage over uit XML, indien deze NIET(!) staat ingevuld dan hard 21% hier in -->
<xsl:choose>
<xsl:when test="cac:Item/cac:ClassifiedTaxCategory/cbc:Percent != ''"><xsl:value-of select="cac:Item/cac:ClassifiedTaxCategory/cbc:Percent"/>;;Ja</xsl:when>
<xsl:otherwise>21;;Ja</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- BTW verlegd = Nee (Vatrate is dan S), veld btw_verlegd in CSV gewoon leeg laten, en neem BTW-percentage over uit XML -->
<xsl:otherwise><xsl:value-of select="cac:Item/cac:ClassifiedTaxCategory/cbc:Percent"/>;;</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="construct_factuurregel_omschr">
<xsl:call-template name="vrije_tekst">
<xsl:with-param name="p_string">
<xsl:if test="cbc:InvoicedQuantity != ''"><xsl:value-of select="cbc:InvoicedQuantity"/><xsl:text> </xsl:text></xsl:if>
<xsl:if test="cbc:InvoicedQuantity/@unitCode != ''"><xsl:value-of select="cbc:InvoicedQuantity/@unitCode"/><xsl:text> </xsl:text></xsl:if>
<xsl:if test="cac:Item/cac:SellersItemIdentification/cbc:ID != ''"><xsl:value-of select="cac:Item/cac:SellersItemIdentification/cbc:ID"/><xsl:text> - </xsl:text></xsl:if>
<xsl:if test="cac:Item/cbc:Name != ''"><xsl:value-of select="cac:Item/cbc:Name"/><xsl:text> </xsl:text></xsl:if>
<xsl:if test="cac:Item/cbc:Description != ''"><xsl:value-of select="cac:Item/cbc:Description"/></xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="vrije_tekst">
<xsl:param name="p_string"/>
<xsl:variable name="l_string_esc_quotes"><xsl:call-template name="escape_quote"><xsl:with-param name="string" select="$p_string"/></xsl:call-template></xsl:variable>
<xsl:variable name="l_string_esc_linebreaks"><xsl:call-template name="escape_linebreaks"><xsl:with-param name="string" select="$l_string_esc_quotes"/></xsl:call-template></xsl:variable>"<xsl:value-of select="$l_string_esc_linebreaks"/>"</xsl:template>
<xsl:template name="escape_quote">
<xsl:param name="string"/>
<xsl:choose>
<xsl:when test="contains($string, '&quot;')"><xsl:value-of select="substring-before($string, '&quot;')"/>&quot;&quot;<xsl:call-template name="escape_quote">
<xsl:with-param name="string" select="substring-after($string, '&quot;')"/></xsl:call-template></xsl:when>
<xsl:otherwise><xsl:value-of select="$string"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="escape_linebreaks">
<xsl:param name="string"/>
<xsl:choose>
<xsl:when test="contains($string, '&#xA;')"><xsl:value-of select="substring-before($string, '&#xA;')"/>@@<xsl:call-template name="escape_linebreaks">
<xsl:with-param name="string" select="substring-after($string, '&#xA;')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$string"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>