Difference between revisions of "Accounting export template SageCoala"

Jump to: navigation, search
m (Created page with "<xml><?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" media-type="text/plain" ...")
 
Line 1: Line 1:
<xml><?xml version="1.0" encoding="UTF-8"?>
+
<javascript>{
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
  "outputFormat":{
     <xsl:output method="text" media-type="text/plain" indent="no" standalone="yes"
+
    "contentType":"text\/csv",
        omit-xml-declaration="yes" encoding="ISO-8859-1"/>
+
     "charset":"UTF-8",
     <xsl:strip-space elements="*"/>
+
    "filePrefix":"accountancy_",
 
+
    "fileExtension":"csv",
    <xsl:include href="xsl/formatFunctions.xsl"/>
+
     "converter":"Default"
     <xsl:include href="xsl/accountingFormatFunction.xsl"/>
+
  },
    <xsl:include href="xsl/reportFunction.xsl"/> 
+
  "field":[
 
+
     {
    <!--      Main       -->
+
      "name":"account_date",
    <xsl:template match="/">
+
       "format":{
         <output-format>
+
        "name":"formatDate",
            <content_type>text/csv</content_type>
+
         "parameter":[
            <charset>UTF-8</charset>
+
          "DD\/MM\/YYYY"
            <file_prefix>accountancy_</file_prefix>
+
        ]
            <file_extension>csv</file_extension>
+
      }
            <converter>Default</converter>
+
    },
        </output-format>
+
    {
        <xsl:apply-templates select="account_entrys/account_entry">
+
      "name":"paper",
            <xsl:sort select="@data_date" order="ascending" data-type="text"/>
+
      "format":{
        </xsl:apply-templates>
+
        "name":"accountPaper"
     </xsl:template>
+
      }
 
+
     },
     <!--show account line -->
+
     {
    <xsl:template match="account_entry">
+
      "name":"flow_id"
        <xsl:variable name="flow_id" select="flow_id"/>
+
    },
        <xsl:variable name="accounts"
+
    {
            select="/account_entrys/account_entry[flow_id=$flow_id]/account/export_account"/>
+
      "name":"export_account"
        <!-- date  -->
+
    },
        <xsl:call-template name="displayDate">
+
    {
            <xsl:with-param name="date">
+
      "name":"debit",
                <xsl:call-template name="dateTimeISO">
+
      "format":{
                    <xsl:with-param name="dateTime" select="converted_account_date"/>
+
        "name":"formatNumber",
                </xsl:call-template>
+
         "parameter":[
            </xsl:with-param>
+
          "%0.2f"
         </xsl:call-template>
+
         ],
        <xsl:text>;</xsl:text>
+
         "separatorDecimal":","
         <!-- paper -->
+
      }
         <xsl:call-template name="choose-paper">
+
    },
            <xsl:with-param name="flowAccounts" select="$accounts"/>
+
    {
        </xsl:call-template>
+
      "name":"credit",
        <xsl:text>;</xsl:text>
+
      "format":{
        <!-- entry number -->
+
         "name":"formatNumber",
        <xsl:value-of select="format-number($flow_id, '0')"/>
+
         "parameter":[
        <xsl:text>;</xsl:text>
+
          "%0.2f"
         <!-- account code -->
+
         ],
        <xsl:value-of select="account/export_account"/>
+
         "separatorDecimal":","
         <xsl:text>;</xsl:text>
+
      }
        <!-- debit -->
+
    },
        <xsl:value-of select="translate(format-number(debit, '0.00'),'.',',')"/>
+
    {
         <xsl:text>;</xsl:text>
+
      "name":"account_entry_description",
         <!-- credit -->
+
      "format":{
        <xsl:value-of select="translate(format-number(credit, '0.00'),'.',',')"/>
+
        "name":"formatText",
        <xsl:text>;</xsl:text>
+
        "rightPadding":" ",
        <!-- account name -->
+
         "removeChar":",",
        <xsl:call-template name="accountExportName">
+
         "size":50
            <xsl:with-param name="entry" select="account_entry"/>
+
      }
            <xsl:with-param name="size" select="50"/>
+
    },
            <xsl:with-param name="forbiddenCharacter">
+
    {
                <xsl:text>;</xsl:text>
+
      "name":"flow_id"
            </xsl:with-param>
+
     },
         </xsl:call-template>
+
    {
         <xsl:text>;</xsl:text>
+
      "text":"E"
        <!-- add E for euros-->
+
    }
        <xsl:text>E</xsl:text>
+
  ],
        <xsl:value-of select="$LF"/>
+
  "separator":";",
     </xsl:template>
+
  "endLine":"\n"
 
+
}</javascript>
    <xsl:template name="displayDate">
+
        <xsl:param name="date"/>
+
        <xsl:value-of select="substring($date,9,2)"/>
+
        <xsl:text>/</xsl:text>
+
        <xsl:value-of select="substring($date,6,2)"/>
+
        <xsl:text>/</xsl:text>
+
        <xsl:value-of select="substring($date,1,4)"/>
+
    </xsl:template>
+
</xsl:stylesheet></xml>
+

Revision as of 12:39, 2 May 2014

{
  "outputFormat":{
    "contentType":"text\/csv",
    "charset":"UTF-8",
    "filePrefix":"accountancy_",
    "fileExtension":"csv",
    "converter":"Default"
  },
  "field":[
    {
      "name":"account_date",
      "format":{
        "name":"formatDate",
        "parameter":[
          "DD\/MM\/YYYY"
        ]
      }
    },
    {
      "name":"paper",
      "format":{
        "name":"accountPaper"
      }
    },
    {
      "name":"flow_id"
    },
    {
      "name":"export_account"
    },
    {
      "name":"debit",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%0.2f"
        ],
        "separatorDecimal":","
      }
    },
    {
      "name":"credit",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%0.2f"
        ],
        "separatorDecimal":","
      }
    },
    {
      "name":"account_entry_description",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "removeChar":",",
        "size":50
      }
    },
    {
      "name":"flow_id"
    },
    {
      "text":"E"
    }
  ],
  "separator":";",
  "endLine":"\n"
}