VLKC#36864 FACTUUR-import vanuit/via ReadSoft

svn path=/Website/branches/v2016.2/; revision=31987
This commit is contained in:
Maarten van der Heide
2016-12-15 15:41:10 +00:00
parent 1e5e7ada75
commit 14ba3398cd
2 changed files with 105 additions and 0 deletions

View File

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:variable name="new_line" select="'&#xA;'"/>
<xsl:template match="/">Leveranciersnr;Factuurnr;Factuurdatum;Ordernr;Locatie;Afleverdatum;Omschrijving;Aantal;Kostprijs;BTW-bedrag;BTW;DocID;Debiteurnr;Opmerking;BTW verlegd;kenmerk1;kenmerk2;kenmerk3;kenmerk4;kenmerk5;Boekmaand
<xsl:for-each select="//Document">
<xsl:variable name="levnr">
<xsl:value-of select="Invoice/Supplier/Number"/>
</xsl:variable>
<xsl:variable name="levnaam">
<xsl:value-of select="Invoice/Supplier/Name"/>
</xsl:variable>
<xsl:variable name="factnr">
<xsl:value-of select="Invoice/Fields/Field[@Name='FactuurNummer']"/>
</xsl:variable>
<xsl:variable name="factdat">
<xsl:value-of select="substring(Invoice/Fields/Field[@Name='FactuurDatum'],7,2)"/>-<xsl:value-of select="substring(Invoice/Fields/Field[@Name='FactuurDatum'],5,2)"/>-<xsl:value-of select="substring(Invoice/Fields/Field[@Name='FactuurDatum'],1,4)"/>
</xsl:variable>
<xsl:variable name="ordernr">
<xsl:choose>
<xsl:when test="substring(Invoice/Fields/Field[@Name='OrderNummer'], 1, 1)!='C'">
<xsl:value-of select="substring-before(Invoice/Fields/Field[@Name='OrderNummer'], '.')"/>/<xsl:value-of select="substring-after(Invoice/Fields/Field[@Name='OrderNummer'], '.')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="Invoice/Fields/Field[@Name='OrderNummer']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="kostprijs">
<xsl:choose>
<xsl:when test="Invoice/Fields/Field[@Name='NettoBedrag']!=''">
<xsl:choose>
<xsl:when test="substring(Invoice/Fields/Field[@Name='Debet/Credit'],1,6)='Credit'">
<xsl:value-of select="format-number(0 - number(Invoice/Fields/Field[@Name='NettoBedrag']), '0.00')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="Invoice/Fields/Field[@Name='NettoBedrag']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="btwpct">
<xsl:value-of select="Invoice/Fields/Field[@Name='BTW%']"/>
</xsl:variable>
<xsl:variable name="btwbedrag">
<xsl:choose>
<xsl:when test="Invoice/Fields/Field[@Name='BTWBedrag']!=''">
<xsl:choose>
<xsl:when test="substring(Invoice/Fields/Field[@Name='Debet/Credit'],1,6)='Credit'">
<xsl:value-of select="format-number(0 - number(Invoice/Fields/Field[@Name='BTWBedrag']), '0.00')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="Invoice/Fields/Field[@Name='BTWBedrag']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="vrachtkosten">
<xsl:choose>
<xsl:when test="Invoice/Fields/Field[@Name='VrachtKosten']!=''">
<xsl:value-of select="Invoice/Fields/Field[@Name='VrachtKosten']"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="ref">
<xsl:value-of select="Invoice/Fields/Field[@Name='Referentie']"/>
</xsl:variable>
<xsl:choose>
<!--Verzamelfactuur-->
<xsl:when test="count(Invoice/Tables/Table[@Type='LineItem']/TableRow)&gt;0">
<xsl:for-each select="Invoice/Tables/Table[@Type='LineItem']/TableRow">
<xsl:variable name="li_ordernr">
<xsl:choose>
<xsl:when test="substring(Field[@Name='LI_OrderNummer'], 1, 1)!='C'">
<xsl:value-of select="substring-before(Field[@Name='LI_OrderNummer'], '.')"/>/<xsl:value-of select="substring-after(Field[@Name='LI_OrderNummer'], '.')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="Field[@Name='LI_OrderNummer']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="li_kostprijs">
<xsl:value-of select="Field[@Name='LI_Bedrag']"/>
</xsl:variable>
<xsl:variable name="li_btwpct">
<xsl:value-of select="Field[@Name='LI_BTW%']"/>
</xsl:variable>
<xsl:value-of select="$levnr"/>;<xsl:value-of select="$factnr"/>;<xsl:value-of select="$factdat"/>;<xsl:value-of select="$li_ordernr"/>;;;<xsl:value-of select="Field[@Name='LI_ArtikelOmschrijving']"/><xsl:if test="Field[@Name='LI_Aantal']!='' and Field[@Name='LI_EenheidsPrijs']!='' and Field[@Name='LI_EenheidsPrijs']!=Field[@Name='LI_Bedrag']"> (<xsl:value-of select="Field[@Name='LI_Aantal']"/> * <xsl:value-of select="Field[@Name='LI_EenheidsPrijs']"/>)</xsl:if>;;<xsl:value-of select="$li_kostprijs"/>;;<xsl:value-of select="$li_btwpct"/>;;;<xsl:value-of select="$levnaam"/> (<xsl:value-of select="$levnr"/>);;;;;;;<xsl:value-of select="$new_line"/>
</xsl:for-each>
</xsl:when>
<!--Enkelv. factuur-->
<xsl:otherwise>
<xsl:value-of select="$levnr"/>;<xsl:value-of select="$factnr"/>;<xsl:value-of select="$factdat"/>;<xsl:value-of select="$ordernr"/>;;;<xsl:value-of select="$ref"/>;;<xsl:value-of select="number($kostprijs)+$vrachtkosten"/>;<xsl:value-of select="$btwbedrag"/>;<xsl:value-of select="$btwpct"/>;;;<xsl:value-of select="$levnaam"/> (<xsl:value-of select="$levnr"/>);;;;;;;<xsl:value-of select="$new_line"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>