MARX#48987: Ondersteuning facturatie INSBOU004

svn path=/Website/branches/v2017.2/; revision=35853
This commit is contained in:
Marcel Bourseau
2017-10-30 14:48:46 +00:00
parent 13b254f9f2
commit 50e1b750e1

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:insbou4="http://www.gs1.nl/factuur/insbou/004" version="1.0">
<xsl:import href="./F_SIDB_common.xsl"/>
<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="insbou4:Invoice">
<xsl:for-each select="insbou4:InvoiceLine">
<xsl:value-of select="../insbou4:Invoicee/insbou4:GLN"/>;<xsl:value-of select="../insbou4:Invoicer/insbou4:GLN"/>;<xsl:value-of select="../insbou4:InvoiceNumber"/>;<xsl:value-of select="../insbou4:InvoiceDate"/>;<xsl:call-template name="vrije_tekst"><xsl:with-param name="p_string" select="../insbou4:FreeText"/></xsl:call-template>;<xsl:value-of select="../insbou4:BuyersOrderNumber"/>;<xsl:call-template name="construct_factuurregel_omschr"/>;<xsl:value-of select="insbou4:NetLineAmount"/>;<xsl:apply-templates select="insbou4:VATInformation"/>;<xsl:value-of select="../insbou4:Attachment/insbou4:FileName"/>;<xsl:value-of select="../insbou4:Supplier/insbou4:AccountInformation/insbou4:IBAN"/>;<xsl:value-of select="../insbou4:PaymentOnBlockedAccount/insbou4:IBAN"/>;<xsl:value-of select="../insbou4:PaymentOnBlockedAccount/insbou4:Amount"/>;<xsl:value-of select="../insbou4:Supplier/insbou4:ChamberOfCommerceNumber"/>;<xsl:value-of select="../insbou4:Supplier/insbou4:VATRegistrationNumber"/>;<xsl:value-of select="../insbou4:DeliveryDate"/>;&#10;</xsl:for-each></xsl:for-each>
</xsl:template>
<xsl:template match="insbou4: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="../../insbou4:ReverseChargeIndicator = 'AC' or ../../insbou4:ReverseChargeIndicator = 'AE' or insbou4:VATRate = 'E'">
<!-- BTW verlegd = Ja, en neem BTW-percentage over uit XML, indien deze NIET(!) staat ingevuld (hoeft kennelijk niet in SidB/volgens wet, zet dan hard 21% hier in -->
<!-- MARX#39379: BTW verlegd zit officieel in node "Reverse charge indicator" en is in INSBOU003 dan de waarde AC en in INSBOU004 waarde 'AE'. Enkele koppelingen (wo. Reparaad) gebruiken Vatrate = E -->
<xsl:choose>
<xsl:when test="insbou4:VATPercentage != ''"><xsl:value-of select="insbou4:VATPercentage"/>;;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="insbou4:VATPercentage"/>;;</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="insbou4:DeliveredQuantity != ''"><xsl:value-of select="insbou4:DeliveredQuantity"/><xsl:text> </xsl:text></xsl:if>
<xsl:call-template name="SidB_translate_from_eenheidscode"><xsl:with-param name="p_unit" select="insbou4:DeliveredQuantityMeasureUnitCode"/></xsl:call-template>
<xsl:if test="insbou4:TradeItemIdentification/insbou4:AdditionalItemIdentification/insbou4:TradeItemDescription != ''"><xsl:text> </xsl:text><xsl:value-of select="insbou4:TradeItemIdentification/insbou4:AdditionalItemIdentification/insbou4:TradeItemDescription"/></xsl:if>
<xsl:if test="insbou4:FreeText != ''"><xsl:text> - </xsl:text><xsl:value-of select="insbou4:FreeText"/></xsl:if>
<xsl:if test="insbou4:TradeItemIdentification/insbou4:SuppliersTradeItemIdentification != ''"><xsl:text> - </xsl:text><xsl:value-of select="insbou4:TradeItemIdentification/insbou4:SuppliersTradeItemIdentification"/></xsl:if>
<xsl:if test="insbou4:TradeItemIdentification/insbou4:GTIN != ''"><xsl:text> (GTIN: </xsl:text><xsl:value-of select="insbou4:TradeItemIdentification/insbou4:GTIN"/><xsl:text>)</xsl:text></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>