53540: Ontblobben facturatie in Mareon verwerken

svn path=/Website/branches/v2018.2/; revision=40347
This commit is contained in:
Marcel Bourseau
2018-12-21 20:35:28 +00:00
parent b80f368988
commit c53d25c668
5 changed files with 268 additions and 33 deletions

View File

@@ -3,6 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:insbou4="http://www.gs1.nl/factuur/insbou/004"
xmlns:sales005="http://www.ketenstandaard.nl/factuur/SALES/005"
xmlns:mes24="http://etim.nl/xmlschemas/messageservice/2.40"
xmlns:mes30="https://www.ketenstandaard.nl/WS/MessageService/3.0"
xmlns:mes31="https://www.ketenstandaard.nl/WS/MessageService/3.1" version="1.0">
@@ -10,15 +11,21 @@
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="Invoice">
<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:comment>woconr;leveranciernr;factuurnr;factuurdatum;onderwerp;opdrachtnr;omschrijving;bedrag;btwperc;btwbedrag;btw_verlegd;document;iban;G_iban;G_bedrag;kvk_nr;btw_nr;afleverdatum;locatie;kostensoort;opdrachtregelid;artikelnr;aantal;eenheid</xsl:comment>
<xsl:for-each select="InvoiceLine">
<xsl:value-of select="../Invoicee/GLN"/>;<xsl:value-of select="../Invoicer/GLN"/>;<xsl:value-of select="../InvoiceNumber"/>;<xsl:value-of select="../InvoiceDate"/>;<xsl:call-template name="vrije_tekst"><xsl:with-param name="p_string" select="../FreeText"/></xsl:call-template>;<xsl:value-of select="../BuyersOrderNumber"/>;<xsl:call-template name="construct_factuurregel_omschr"/>;<xsl:value-of select="NetLineAmount"/>;<xsl:apply-templates select="VATInformation"/>;<xsl:value-of select="../Attachment/FileName"/>;<xsl:value-of select="../Supplier/AccountInformation/IBAN"/>;<xsl:value-of select="../PaymentOnBlockedAccount/IBAN"/>;<xsl:value-of select="../PaymentOnBlockedAccount/Amount"/>;<xsl:value-of select="../Supplier/ChamberOfCommerceNumber"/>;<xsl:value-of select="../Supplier/VATRegistrationNumber"/>;<xsl:value-of select="../DeliveryDate"/>;&#10;</xsl:for-each>
<xsl:value-of select="../Invoicee/GLN"/>;<xsl:value-of select="../Invoicer/GLN"/>;<xsl:value-of select="../InvoiceNumber"/>;<xsl:value-of select="../InvoiceDate"/>;<xsl:call-template name="vrije_tekst"><xsl:with-param name="p_string" select="../FreeText"/></xsl:call-template>;<xsl:value-of select="../BuyersOrderNumber"/>;<xsl:call-template name="construct_factuurregel_omschr_insbou-003"/>;<xsl:value-of select="NetLineAmount"/>;<xsl:apply-templates select="VATInformation"/>;<xsl:value-of select="../Attachment/FileName"/>;<xsl:value-of select="../Supplier/AccountInformation/IBAN"/>;<xsl:value-of select="../PaymentOnBlockedAccount/IBAN"/>;<xsl:value-of select="../PaymentOnBlockedAccount/Amount"/>;<xsl:value-of select="../Supplier/ChamberOfCommerceNumber"/>;<xsl:value-of select="../Supplier/VATRegistrationNumber"/>;<xsl:value-of select="../DeliveryDate"/>;<xsl:value-of select="MaintenanceInformation/Location"/>;<xsl:value-of select="MaintenanceInformation/ChargeTo"/>;<xsl:value-of select="OrderLineIdentification"/>;<xsl:call-template name="factuurregel_artnr_insbou-003"/>;<xsl:value-of select="DeliveredQuantity"/>;<xsl:call-template name="factuurregel_eenheid_insbou-003"/>;&#10;</xsl:for-each>
</xsl:template>
<xsl:template match="insbou4:Invoice">
<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:comment>woconr;leveranciernr;factuurnr;factuurdatum;onderwerp;opdrachtnr;omschrijving;bedrag;btwperc;btwbedrag;btw_verlegd;document;iban;G_iban;G_bedrag;kvk_nr;btw_nr;afleverdatum;locatie;kostensoort;opdrachtregelid;artikelnr;aantal;eenheid</xsl:comment>
<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="insbou4_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: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_insbou-004"/>;<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"/>;<xsl:value-of select="insbou4:MaintenanceInformation/insbou4:Location"/>;<xsl:value-of select="insbou4:MaintenanceInformation/insbou4:ChargeTo"/>;<xsl:value-of select="insbou4:OrderLineIdentification"/>;<xsl:call-template name="factuurregel_artnr_insbou-004"/>;<xsl:value-of select="insbou4:DeliveredQuantity"/>;<xsl:call-template name="factuurregel_eenheid_insbou-004"/>;&#10;</xsl:for-each>
</xsl:template>
<xsl:template match="sales005:Invoice">
<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;locatie;kostensoort;opdrachtregelid;artikelnr;aantal;eenheid</xsl:comment>
<xsl:for-each select="sales005:InvoiceLine">
<xsl:value-of select="../sales005:Invoicee/sales005:GLN"/>;<xsl:value-of select="../sales005:Invoicer/sales005:GLN"/>;<xsl:value-of select="../sales005:InvoiceNumber"/>;<xsl:value-of select="../sales005:InvoiceDate"/>;<xsl:call-template name="vrije_tekst"><xsl:with-param name="p_string" select="../sales005:FreeText"/></xsl:call-template>;<xsl:value-of select="../sales005:BuyersOrderNumber"/>;<xsl:call-template name="construct_factuurregel_omschr_sales005"/>;<xsl:value-of select="sales005:NetLineAmount"/>;<xsl:apply-templates select="sales005:VATInformation"/>;<xsl:value-of select="../sales005:Attachment/sales005:FileName"/>;<xsl:value-of select="../sales005:Supplier/sales005:AccountInformation/sales005:IBAN"/>;<xsl:value-of select="../sales005:PaymentOnBlockedAccount/sales005:IBAN"/>;<xsl:value-of select="../sales005:PaymentOnBlockedAccount/sales005:Amount"/>;<xsl:value-of select="../sales005:Supplier/sales005:ChamberOfCommerceNumber"/>;<xsl:value-of select="../sales005:Supplier/sales005:VATRegistrationNumber"/>;<xsl:value-of select="../sales005:DeliveryDate"/>;<xsl:value-of select="sales005:MaintenanceInformation/sales005:Location"/>;<xsl:value-of select="sales005:MaintenanceInformation/sales005:ChargeTo"/>;<xsl:value-of select="sales005:OrderLineIdentification"/>;<xsl:call-template name="factuurregel_artnr_sales005"/>;<xsl:value-of select="sales005:DeliveredQuantity"/>;<xsl:call-template name="factuurregel_eenheid_sales005"/>;&#10;</xsl:for-each>
</xsl:template>
<xsl:template match="VATInformation">
@@ -58,32 +65,122 @@
</xsl:choose>
</xsl:template>
<xsl:template name="construct_factuurregel_omschr">
<xsl:template match="sales005: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="../../sales005:ReverseChargeIndicator = 'AC' or ../../sales005:ReverseChargeIndicator = 'AE' or sales005: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="sales005:VATPercentage != ''"><xsl:value-of select="sales005: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="sales005:VATPercentage"/>;;</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="factuurregel_artnr_insbou-003">
<xsl:call-template name="COALESCE">
<xsl:with-param name="p_param1">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft Id-->
<xsl:with-param name="p_param1" select="TradeItemIdentification/SuppliersTradeItemId"/>
<!-- INSBOU003 heeft Identification-->
<xsl:with-param name="p_param2" select="TradeItemIdentification/SuppliersTradeItemIdentification"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="p_param2" select="TradeItemIdentification/GTIN"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="factuurregel_eenheid_insbou-003">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft UoM-->
<xsl:with-param name="p_param1" select="DeliveredQuantityUoM"/>
<!-- INSBOU003 heeft MeasureUnitCode-->
<xsl:with-param name="p_param2" select="DeliveredQuantityMeasureUnitCode"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="construct_factuurregel_omschr_insbou-003">
<xsl:call-template name="vrije_tekst">
<xsl:with-param name="p_string">
<xsl:if test="DeliveredQuantity != ''"><xsl:value-of select="DeliveredQuantity"/><xsl:text> </xsl:text></xsl:if>
<xsl:call-template name="SidB_translate_from_eenheidscode"><xsl:with-param name="p_unit" select="DeliveredQuantityMeasureUnitCode"/></xsl:call-template>
<xsl:if test="TradeItemIdentification/AdditionalItemIdentification/TradeItemDescription != ''"><xsl:text> </xsl:text><xsl:value-of select="TradeItemIdentification/AdditionalItemIdentification/TradeItemDescription"/></xsl:if>
<xsl:if test="FreeText != ''"><xsl:text> - </xsl:text><xsl:value-of select="FreeText"/></xsl:if>
<xsl:if test="TradeItemIdentification/SuppliersTradeItemIdentification != ''"><xsl:text> - </xsl:text><xsl:value-of select="TradeItemIdentification/SuppliersTradeItemIdentification"/></xsl:if>
<xsl:if test="TradeItemIdentification/GTIN != ''"><xsl:text> (GTIN: </xsl:text><xsl:value-of select="TradeItemIdentification/GTIN"/><xsl:text>)</xsl:text></xsl:if>
<xsl:if test="FreeText != ''"><xsl:text> - </xsl:text><xsl:value-of select="FreeText"/></xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="insbou4_construct_factuurregel_omschr">
<xsl:template name="factuurregel_artnr_insbou-004">
<xsl:call-template name="COALESCE">
<xsl:with-param name="p_param1">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft Id-->
<xsl:with-param name="p_param1" select="insbou4:TradeItemIdentification/insbou4:SuppliersTradeItemId"/>
<!-- INSBOU003 heeft Identification-->
<xsl:with-param name="p_param2" select="insbou4:TradeItemIdentification/insbou4:SuppliersTradeItemIdentification"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="p_param2" select="insbou4:TradeItemIdentification/insbou4:GTIN"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="factuurregel_eenheid_insbou-004">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft UoM-->
<xsl:with-param name="p_param1" select="insbou4:DeliveredQuantityUoM"/>
<!-- INSBOU003 heeft MeasureUnitCode-->
<xsl:with-param name="p_param2" select="insbou4:DeliveredQuantityMeasureUnitCode"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="construct_factuurregel_omschr_insbou-004">
<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:if test="insbou4:FreeText != ''"><xsl:text> - </xsl:text><xsl:value-of select="insbou4:FreeText"/></xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="factuurregel_artnr_sales005">
<xsl:call-template name="COALESCE">
<xsl:with-param name="p_param1">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft Id-->
<xsl:with-param name="p_param1" select="sales005:TradeItemIdentification/sales005:SuppliersTradeItemId"/>
<!-- INSBOU003 heeft Identification-->
<xsl:with-param name="p_param2" select="sales005:TradeItemIdentification/sales005:SuppliersTradeItemIdentification"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="p_param2" select="sales005:TradeItemIdentification/sales005:GTIN"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="factuurregel_eenheid_sales005">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft UoM-->
<xsl:with-param name="p_param1" select="sales005:DeliveredQuantityUoM"/>
<!-- INSBOU003 heeft MeasureUnitCode-->
<xsl:with-param name="p_param2" select="sales005:DeliveredQuantityMeasureUnitCode"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="construct_factuurregel_omschr_sales005">
<xsl:call-template name="vrije_tekst">
<xsl:with-param name="p_string">
<xsl:if test="sales005:TradeItemIdentification/sales005:AdditionalItemIdentification/sales005:TradeItemDescription != ''"><xsl:text> </xsl:text><xsl:value-of select="sales005:TradeItemIdentification/sales005:AdditionalItemIdentification/sales005:TradeItemDescription"/></xsl:if>
<xsl:if test="sales005:FreeText != ''"><xsl:text> - </xsl:text><xsl:value-of select="sales005:FreeText"/></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>
@@ -98,8 +195,6 @@
</xsl:choose>
</xsl:template>
<xsl:template name="escape_linebreaks">
<xsl:param name="string"/>
<xsl:choose>
@@ -149,11 +244,13 @@
<!-- Het is CDATA of een string, dan parsen -->
<xsl:apply-templates select="$parsedXml/Invoice"/>
<xsl:apply-templates select="$parsedXml/insbou4:Invoice"/>
<xsl:apply-templates select="$parsedXml/sales005:Invoice"/>
</xsl:when>
<xsl:otherwise>
<!-- Het is een XML node-->
<xsl:apply-templates select="./Invoice"/>
<xsl:apply-templates select="./insbou4:Invoice"/>
<xsl:apply-templates select="./sales005:Invoice"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

View File

@@ -5,10 +5,10 @@
<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:comment>woconr;leveranciernr;factuurnr;factuurdatum;onderwerp;opdrachtnr;omschrijving;bedrag;btwperc;btwbedrag;btw_verlegd;document;iban;G_iban;G_bedrag;kvk_nr;btw_nr;afleverdatum;locatie;kostensoort;opdrachtregelid;artikelnr;aantal;eenheid</xsl:comment>
<xsl:for-each select="Invoice">
<xsl:for-each select="InvoiceLine">
<xsl:value-of select="../Invoicee/GLN"/>;<xsl:value-of select="../Invoicer/GLN"/>;<xsl:value-of select="../InvoiceNumber"/>;<xsl:value-of select="../InvoiceDate"/>;<xsl:call-template name="vrije_tekst"><xsl:with-param name="p_string" select="../FreeText"/></xsl:call-template>;<xsl:value-of select="../BuyersOrderNumber"/>;<xsl:call-template name="construct_factuurregel_omschr"/>;<xsl:value-of select="NetLineAmount"/>;<xsl:apply-templates select="VATInformation"/>;<xsl:value-of select="../Attachment/FileName"/>;<xsl:value-of select="../Supplier/AccountInformation/IBAN"/>;<xsl:value-of select="../PaymentOnBlockedAccount/IBAN"/>;<xsl:value-of select="../PaymentOnBlockedAccount/Amount"/>;<xsl:value-of select="../Supplier/ChamberOfCommerceNumber"/>;<xsl:value-of select="../Supplier/VATRegistrationNumber"/>;<xsl:value-of select="../DeliveryDate"/>;&#10;</xsl:for-each></xsl:for-each>
<xsl:value-of select="../Invoicee/GLN"/>;<xsl:value-of select="../Invoicer/GLN"/>;<xsl:value-of select="../InvoiceNumber"/>;<xsl:value-of select="../InvoiceDate"/>;<xsl:call-template name="vrije_tekst"><xsl:with-param name="p_string" select="../FreeText"/></xsl:call-template>;<xsl:value-of select="../BuyersOrderNumber"/>;<xsl:call-template name="construct_factuurregel_omschr"/>;<xsl:value-of select="NetLineAmount"/>;<xsl:apply-templates select="VATInformation"/>;<xsl:value-of select="../Attachment/FileName"/>;<xsl:value-of select="../Supplier/AccountInformation/IBAN"/>;<xsl:value-of select="../PaymentOnBlockedAccount/IBAN"/>;<xsl:value-of select="../PaymentOnBlockedAccount/Amount"/>;<xsl:value-of select="../Supplier/ChamberOfCommerceNumber"/>;<xsl:value-of select="../Supplier/VATRegistrationNumber"/>;<xsl:value-of select="../DeliveryDate"/>;<xsl:value-of select="MaintenanceInformation/Location"/>;<xsl:value-of select="MaintenanceInformation/ChargeTo"/>;<xsl:value-of select="OrderLineIdentification"/>;<xsl:call-template name="factuurregel_artnr"/>;<xsl:value-of select="DeliveredQuantity"/>;<xsl:call-template name="factuurregel_eenheid"/>;&#10;</xsl:for-each></xsl:for-each>
</xsl:template>
<xsl:template match="VATInformation">
@@ -29,15 +29,34 @@
</xsl:choose>
</xsl:template>
<xsl:template name="factuurregel_artnr">
<xsl:call-template name="COALESCE">
<xsl:with-param name="p_param1">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft Id-->
<xsl:with-param name="p_param1" select="TradeItemIdentification/SuppliersTradeItemId"/>
<!-- INSBOU003 heeft Identification-->
<xsl:with-param name="p_param2" select="TradeItemIdentification/SuppliersTradeItemIdentification"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="p_param2" select="TradeItemIdentification/GTIN"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="factuurregel_eenheid">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft UoM-->
<xsl:with-param name="p_param1" select="DeliveredQuantityUoM"/>
<!-- INSBOU003 heeft MeasureUnitCode-->
<xsl:with-param name="p_param2" select="DeliveredQuantityMeasureUnitCode"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="construct_factuurregel_omschr">
<xsl:call-template name="vrije_tekst">
<xsl:with-param name="p_string">
<xsl:if test="DeliveredQuantity != ''"><xsl:value-of select="DeliveredQuantity"/><xsl:text> </xsl:text></xsl:if>
<xsl:call-template name="SidB_translate_from_eenheidscode"><xsl:with-param name="p_unit" select="DeliveredQuantityMeasureUnitCode"/></xsl:call-template>
<xsl:if test="TradeItemIdentification/AdditionalItemIdentification/TradeItemDescription != ''"><xsl:text> </xsl:text><xsl:value-of select="TradeItemIdentification/AdditionalItemIdentification/TradeItemDescription"/></xsl:if>
<xsl:if test="FreeText != ''"><xsl:text> - </xsl:text><xsl:value-of select="FreeText"/></xsl:if>
<xsl:if test="TradeItemIdentification/SuppliersTradeItemIdentification != ''"><xsl:text> - </xsl:text><xsl:value-of select="TradeItemIdentification/SuppliersTradeItemIdentification"/></xsl:if>
<xsl:if test="TradeItemIdentification/GTIN != ''"><xsl:text> (GTIN: </xsl:text><xsl:value-of select="TradeItemIdentification/GTIN"/><xsl:text>)</xsl:text></xsl:if>
<xsl:if test="FreeText != ''"><xsl:text> - </xsl:text><xsl:value-of select="FreeText"/></xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:template>

View File

@@ -5,10 +5,10 @@
<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:comment>woconr;leveranciernr;factuurnr;factuurdatum;onderwerp;opdrachtnr;omschrijving;bedrag;btwperc;btwbedrag;btw_verlegd;document;iban;G_iban;G_bedrag;kvk_nr;btw_nr;afleverdatum;locatie;kostensoort;opdrachtregelid;artikelnr;aantal;eenheid</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: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"/>;<xsl:value-of select="insbou4:MaintenanceInformation/insbou4:Location"/>;<xsl:value-of select="insbou4:MaintenanceInformation/insbou4:ChargeTo"/>;<xsl:value-of select="insbou4:OrderLineIdentification"/>;<xsl:call-template name="factuurregel_artnr"/>;<xsl:value-of select="insbou4:DeliveredQuantity"/>;<xsl:call-template name="factuurregel_eenheid"/>;&#10;</xsl:for-each></xsl:for-each>
</xsl:template>
<xsl:template match="insbou4:VATInformation">
@@ -29,20 +29,38 @@
</xsl:choose>
</xsl:template>
<xsl:template name="factuurregel_artnr">
<xsl:call-template name="COALESCE">
<xsl:with-param name="p_param1">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft Id-->
<xsl:with-param name="p_param1" select="insbou4:TradeItemIdentification/insbou4:SuppliersTradeItemId"/>
<!-- INSBOU003 heeft Identification-->
<xsl:with-param name="p_param2" select="insbou4:TradeItemIdentification/insbou4:SuppliersTradeItemIdentification"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="p_param2" select="insbou4:TradeItemIdentification/insbou4:GTIN"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="factuurregel_eenheid">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft UoM-->
<xsl:with-param name="p_param1" select="insbou4:DeliveredQuantityUoM"/>
<!-- INSBOU003 heeft MeasureUnitCode-->
<xsl:with-param name="p_param2" select="insbou4:DeliveredQuantityMeasureUnitCode"/>
</xsl:call-template>
</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:if test="insbou4:FreeText != ''"><xsl:text> - </xsl:text><xsl:value-of select="insbou4:FreeText"/></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>

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sales005="http://www.ketenstandaard.nl/factuur/SALES/005" xmlns:exs="http://www.ketenstandaard.nl/SALES/Extensies" 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;locatie;kostensoort;opdrachtregelid;artikelnr;aantal;eenheid</xsl:comment>
<xsl:for-each select="sales005:Invoice">
<xsl:for-each select="sales005:InvoiceLine">
<xsl:value-of select="../sales005:Invoicee/sales005:GLN"/>;<xsl:value-of select="../sales005:Invoicer/sales005:GLN"/>;<xsl:value-of select="../sales005:InvoiceNumber"/>;<xsl:value-of select="../sales005:InvoiceDate"/>;<xsl:call-template name="vrije_tekst"><xsl:with-param name="p_string" select="../sales005:FreeText"/></xsl:call-template>;<xsl:value-of select="../sales005:BuyersOrderNumber"/>;<xsl:call-template name="construct_factuurregel_omschr"/>;<xsl:value-of select="sales005:NetLineAmount"/>;<xsl:apply-templates select="sales005:VATInformation"/>;<xsl:value-of select="../sales005:Attachment/sales005:FileName"/>;<xsl:value-of select="../sales005:Supplier/sales005:AccountInformation/sales005:IBAN"/>;<xsl:value-of select="../sales005:PaymentOnBlockedAccount/sales005:IBAN"/>;<xsl:value-of select="../sales005:PaymentOnBlockedAccount/sales005:Amount"/>;<xsl:value-of select="../sales005:Supplier/sales005:ChamberOfCommerceNumber"/>;<xsl:value-of select="../sales005:Supplier/sales005:VATRegistrationNumber"/>;<xsl:value-of select="../sales005:DeliveryDate"/>;<xsl:value-of select="sales005:MaintenanceInformation/sales005:Location"/>;<xsl:value-of select="sales005:MaintenanceInformation/sales005:ChargeTo"/>;<xsl:value-of select="sales005:OrderLineIdentification"/>;<xsl:call-template name="factuurregel_artnr"/>;<xsl:value-of select="sales005:DeliveredQuantity"/>;<xsl:call-template name="factuurregel_eenheid"/>;&#10;</xsl:for-each></xsl:for-each>
</xsl:template>
<xsl:template match="sales005: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="../../sales005:ReverseChargeIndicator = 'AC' or ../../sales005:ReverseChargeIndicator = 'AE' or sales005: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="sales005:VATPercentage != ''"><xsl:value-of select="sales005: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="sales005:VATPercentage"/>;;</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="factuurregel_artnr">
<xsl:call-template name="COALESCE">
<xsl:with-param name="p_param1">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft Id-->
<xsl:with-param name="p_param1" select="sales005:TradeItemIdentification/sales005:SuppliersTradeItemId"/>
<!-- INSBOU003 heeft Identification-->
<xsl:with-param name="p_param2" select="sales005:TradeItemIdentification/sales005:SuppliersTradeItemIdentification"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="p_param2" select="sales005:TradeItemIdentification/sales005:GTIN"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="factuurregel_eenheid">
<xsl:call-template name="COALESCE">
<!-- INSBOU004 en SALES005 heeft UoM-->
<xsl:with-param name="p_param1" select="sales005:DeliveredQuantityUoM"/>
<!-- INSBOU003 heeft MeasureUnitCode-->
<xsl:with-param name="p_param2" select="sales005:DeliveredQuantityMeasureUnitCode"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="construct_factuurregel_omschr">
<xsl:call-template name="vrije_tekst">
<xsl:with-param name="p_string">
<xsl:if test="sales005:TradeItemIdentification/sales005:AdditionalItemIdentification/sales005:TradeItemDescription != ''"><xsl:text> </xsl:text><xsl:value-of select="sales005:TradeItemIdentification/sales005:AdditionalItemIdentification/sales005:TradeItemDescription"/></xsl:if>
<xsl:if test="sales005:FreeText != ''"><xsl:text> - </xsl:text><xsl:value-of select="sales005:FreeText"/></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>

View File

@@ -6,6 +6,15 @@
<xsl:param name="mode"/>
<xsl:template name="COALESCE">
<xsl:param name="p_param1"/>
<xsl:param name="p_param2"/>
<xsl:choose>
<xsl:when test="$p_param1 != ''"><xsl:value-of select="$p_param1"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$p_param2"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="leverancier_nr">
<!-- Lengte check: moet exact 13 tekens zijn. Indien anders, dan niet meesturen -->
<xsl:if test="string-length(.) = 13">