Accounting export template Quadratus
Revision as of 14:47, 30 January 2013 by Jcheng (Talk | contribs) (Created page with "<xml><?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" media-type="text/pl...")
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" media-type="text/plain" indent="no" standalone="yes" omit-xml-declaration="yes" encoding="ISO-8859-1"/> <xsl:strip-space elements="*"/> <xsl:include href="xsl/str.template.xsl"/> <xsl:include href="xsl/formatFunctions.xsl"/> <xsl:include href="xsl/accountingFormatFunction.xsl"/> <!-- Main --> <xsl:template match="/"> <output-format> <content_type>text/csv</content_type> <charset>ISO-8859-15</charset> <file_prefix>exportQuatratus_</file_prefix> <file_extension>txt</file_extension> <converter>ISO</converter> </output-format> <xsl:apply-templates select="account_entrys/account_entry"> <xsl:sort select="@id" order="ascending" data-type="number"/> </xsl:apply-templates> </xsl:template> <!--show account line --> <xsl:template match="account_entry"> <xsl:variable name="flow_id" select="flow_id"/> <xsl:variable name="accounts" select="/account_entrys/account_entry[flow_id=$flow_id]/account/export_account"/> <xsl:variable name="line"> <!-- mouvment type on 1 string --> <xsl:text>M</xsl:text> <!-- account number on 8 strings --> <xsl:call-template name="format-text"> <xsl:with-param name="text" select="account/export_account"/> <xsl:with-param name="size" select="8"/> </xsl:call-template> <!-- paper on 2 strings --> <xsl:call-template name="choose-paper"> <xsl:with-param name="flowAccounts" select="$accounts"/> </xsl:call-template> <!-- folio on 3 string default 000 --> <xsl:text>000</xsl:text> <!-- date on 6 strings --> <xsl:call-template name="displayDate"> <xsl:with-param name="date"> <xsl:call-template name="dateTimeISO"> <xsl:with-param name="dateTime"> <xsl:value-of select="converted_account_date"/> </xsl:with-param> </xsl:call-template> </xsl:with-param> </xsl:call-template> <!-- Code libellé 1 string --> <xsl:text> </xsl:text> <!-- label on 20 strings --> <xsl:text> </xsl:text> <!-- amount on 13 strings firt = sign, value in cent --> <xsl:choose> <xsl:when test="debit!=0"> <xsl:text>D</xsl:text> <xsl:text>+</xsl:text> <xsl:value-of select="format-number(debit*100,'000000000000')"/> </xsl:when> <xsl:otherwise> <xsl:text>C</xsl:text> <xsl:text>+</xsl:text> <xsl:value-of select="format-number(credit*100,'000000000000')"/> </xsl:otherwise> </xsl:choose> <!-- account linked 8 strings --> <xsl:text> </xsl:text> <!-- Deadline date 6 strings --> <xsl:text> </xsl:text> <!-- Lettring 2 strings --> <xsl:text> </xsl:text> <!-- Statistic code 3 strings --> <xsl:text> </xsl:text> <!-- Document number 5 strings --> <xsl:text> </xsl:text> <!-- entry number 10 strings--> <xsl:call-template name="format-text"> <xsl:with-param name="text" select="customer_bill_account_entry/customer_bill_id"/> <xsl:with-param name="size" select="10"/> </xsl:call-template> <!-- Quantity 10 strings --> <xsl:text> </xsl:text> <!-- accouting document 8 strings --> <xsl:value-of select="format-number($flow_id, '00000000')"/> <!-- currency 3 strings --> <xsl:text>EUR</xsl:text> <!-- paper 3 strings --> <xsl:call-template name="format-text"> <xsl:with-param name="text"> <xsl:call-template name="choose-paper"> <xsl:with-param name="flowAccounts" select="$accounts"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="size" select="3"/> </xsl:call-template> <!-- if TVA 3 next fieds--> <xsl:choose> <xsl:when test="account/category=6"> <!-- flag TVA 1 string --> <xsl:text>O</xsl:text> <!-- code TVA 1 string --> <xsl:text>1</xsl:text> <!-- TVA method 1 string --> <xsl:text>D</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> <!-- label on 30 strings --> <xsl:call-template name="format-text"> <xsl:with-param name="text"> <xsl:call-template name="str.characterRemover"> <xsl:with-param name="string2Clean"> <xsl:value-of select="comments"/> <xsl:text> </xsl:text> <xsl:value-of select="flight/comments"/> </xsl:with-param> <xsl:with-param name="character2Remove"> <xsl:text></xsl:text> </xsl:with-param> </xsl:call-template> </xsl:with-param> <xsl:with-param name="size" select="30"/> </xsl:call-template> <!-- code TVA 2 strings --> <xsl:choose> <xsl:when test="account/category=6"> <xsl:text>AF</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> <!-- account name on 10 strings --> <xsl:call-template name="accountExportName"> <xsl:with-param name="entry" select="account_entry"/> <xsl:with-param name="size" select="10"/> </xsl:call-template> <!-- not used on 10 strings --> <xsl:text> </xsl:text> <!-- amount currency on 13 strings with sign--> <xsl:choose> <xsl:when test="debit!=0"> <xsl:text>+</xsl:text> <xsl:value-of select="format-number(debit*100,'000000000000')"/> </xsl:when> <xsl:otherwise> <xsl:text>+</xsl:text> <xsl:value-of select="format-number(credit*100,'000000000000')"/> </xsl:otherwise> </xsl:choose> <!-- file associated on 12 strings --> <xsl:text> </xsl:text> <!-- quantiy 2 on 10 strings --> <xsl:text> </xsl:text> <!-- export only on 28 strings --> <xsl:text> </xsl:text> <xsl:value-of select="$CR"/><xsl:value-of select="$LF"/> </xsl:variable> <xsl:value-of select="$line" disable-output-escaping="yes"/> </xsl:template> <xsl:template name="displayDate"> <xsl:param name="date"/> <xsl:value-of select="substring($date,9,2)"/> <xsl:value-of select="substring($date,6,2)"/> <xsl:value-of select="substring($date,3,2)"/> </xsl:template> </xsl:stylesheet>