Difference between revisions of "Accounting export template Sage"

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\/plain",
        omit-xml-declaration="yes" encoding="ISO-8859-1"/>
+
    "charset":"ISO-8859-15",
     <xsl:strip-space elements="*"/>
+
     "filePrefix":"Import_",
 
+
     "fileExtension":"pnm",
     <xsl:include href="xsl/formatFunctions.xsl"/>
+
     "converter":"ISOWithHeader"
     <xsl:include href="xsl/accountingFormatFunction.xsl"/>
+
  },
    <xsl:include href="xsl/reportFunction.xsl"/>
+
  "field":[
 
+
    {
    <!--      Main       -->
+
       "name":"paper",
    <xsl:template match="/">
+
      "format":{
        <output-format>
+
        "name":"accountPaper"
            <content_type>text/plain</content_type>
+
      }
            <charset>ISO-8859-15</charset>
+
    },
            <file_prefix>Import_</file_prefix>
+
    {
            <file_extension>pnm</file_extension>
+
      "text":"",
            <converter>ISOWithHeader</converter>
+
      "format":{
        </output-format>
+
         "name":"formatText",
         <xsl:apply-templates select="account_entrys/account_entry">
+
        "rightPadding":" ",
            <xsl:sort select="@id" order="ascending" data-type="number"/>
+
         "size":1
         </xsl:apply-templates>
+
      }
    </xsl:template>
+
    },
 
+
     {
     <!--show account line -->
+
      "name":"account_date",
    <xsl:template match="account_entry">
+
      "format":{
        <xsl:variable name="flow_id" select="flow_id"/>
+
        "name":"formatDate",
         <xsl:variable name="accounts"
+
        "parameter":[
            select="/account_entrys/account_entry[flow_id=$flow_id]/account/export_account"/>
+
          "DDMMYY"
         <xsl:variable name="line">
+
         ]
            <!-- paper 3 strings -->
+
      }
            <xsl:call-template name="choose-paper">
+
    },
                <xsl:with-param name="flowAccounts" select="$accounts"/>
+
    {
            </xsl:call-template>
+
      "text":"",
            <xsl:text> </xsl:text>
+
      "format":{
            <!-- date on  6 strings -->
+
         "name":"formatText",
            <xsl:call-template name="dateSage">
+
        "rightPadding":" ",
                <xsl:with-param name="date">
+
        "size":2
                    <xsl:call-template name="dateTimeISO">
+
      }
                        <xsl:with-param name="dateTime" select="converted_account_date"/>
+
    },
                    </xsl:call-template>
+
    {
                </xsl:with-param>
+
      "name":"export_account",
            </xsl:call-template>
+
      "format":{
            <!-- type on 2 strings -->
+
        "name":"formatText",
            <xsl:text>  </xsl:text>
+
        "rightPadding":" ",
            <!-- account number on 13 strings -->
+
        "size":13
            <xsl:call-template name="format-text">
+
      }
                <xsl:with-param name="text" select="account/export_account"/>
+
    },
                <xsl:with-param name="size" select="13"/>
+
    {
            </xsl:call-template>
+
      "text":"",
            <!-- Account t ype on 1 string -->
+
      "format":{
            <xsl:text> </xsl:text>
+
        "name":"formatText",
            <!-- auxillary account on 13 strings -->
+
        "rightPadding":" ",
            <xsl:text>            </xsl:text>
+
        "size":1
            <!-- transaction reference on 13 strings -->
+
      }
            <xsl:call-template name="format-text">
+
    },
                <xsl:with-param name="text" select="@id"/>
+
    {
                <xsl:with-param name="size" select="13"/>
+
      "text":"",
            </xsl:call-template>
+
      "format":{
            <!-- transaction name on 25 strings -->
+
        "name":"formatText",
            <xsl:call-template name="accountExportName">
+
        "rightPadding":" ",
                <xsl:with-param name="entry" select="account_entry"/>
+
        "size":13
                <xsl:with-param name="size" select="25"/>
+
      }
            </xsl:call-template>
+
    },
            <!-- Paiment mod on 1 string -->
+
    {
            <xsl:text> </xsl:text>
+
      "name":"id",
            <!-- Due date on 6 strings -->
+
      "format":{
            <xsl:text>      </xsl:text>
+
        "name":"formatNumber",
            <!-- amount on  1 string to write D or C + 20 strings, two digits -->
+
        "parameter":[
            <xsl:choose>
+
          "%-13.0f"
                <xsl:when test="debit!=0">
+
        ]
                    <xsl:text>D</xsl:text>
+
      }
                    <xsl:call-template name="replace-zero-head-by-white-space">
+
    },
                        <xsl:with-param name="entry">
+
    {
                            <xsl:value-of select="format-number(debit,'00000000000000000.00')"/>
+
      "name":"account_entry_description",
                        </xsl:with-param>
+
      "format":{
                    </xsl:call-template>
+
        "name":"formatText",
                </xsl:when>
+
        "rightPadding":" ",
                <xsl:otherwise>
+
        "size":25
                    <xsl:text>C</xsl:text>
+
      }
                    <xsl:call-template name="replace-zero-head-by-white-space">
+
    },
                        <xsl:with-param name="entry">
+
    {
                            <xsl:value-of select="format-number(credit,'00000000000000000.00')"/>
+
      "text":"",
                        </xsl:with-param>
+
      "format":{
                    </xsl:call-template>
+
        "name":"formatText",
                </xsl:otherwise>
+
        "rightPadding":" ",
            </xsl:choose>
+
        "size":1
            <!-- Transaction type on 1 string -->
+
      }
            <xsl:text>N</xsl:text>
+
    },
            <!-- Entry number on 7 strings -->
+
    {
            <xsl:value-of select="format-number($flow_id, '0000000')"/>
+
      "text":"",
            <!-- not used on 26 strings -->
+
      "format":{
            <xsl:text>                          </xsl:text>
+
        "name":"formatText",
            <xsl:value-of select="$CR"/><xsl:value-of select="$LF"/>
+
        "rightPadding":" ",
         </xsl:variable>
+
        "size":6
         <xsl:value-of select="$line" disable-output-escaping="yes"/>
+
      }
    </xsl:template>
+
    },
 
+
    {
</xsl:stylesheet></xml>
+
      "text":"D",
 +
      "if":{
 +
        "leftPart":"debit",
 +
        "operator":">",
 +
        "rightPart":"0"
 +
      }
 +
    },
 +
    {
 +
      "name":"debit",
 +
      "format":{
 +
        "name":"formatNumber",
 +
        "parameter":[
 +
          "%20.2f"
 +
        ]
 +
      },
 +
      "if":{
 +
        "leftPart":"debit",
 +
        "operator":">",
 +
        "rightPart":"0"
 +
      }
 +
    },
 +
    {
 +
      "text":"C",
 +
      "if":{
 +
        "leftPart":"debit",
 +
        "operator":"==",
 +
        "rightPart":"0"
 +
      }
 +
    },
 +
    {
 +
      "name":"credit",
 +
      "format":{
 +
        "name":"formatNumber",
 +
        "parameter":[
 +
          "%20.2f"
 +
        ]
 +
      },
 +
      "if":{
 +
        "leftPart":"debit",
 +
        "operator":"==",
 +
        "rightPart":"0"
 +
      }
 +
    },
 +
    {
 +
      "text":"N"
 +
    },
 +
    {
 +
      "name":"flow_id",
 +
      "format":{
 +
        "name":"formatNumber",
 +
        "parameter":[
 +
          "%07.0f"
 +
        ]
 +
      }
 +
    },
 +
    {
 +
      "text":"",
 +
      "format":{
 +
        "name":"formatText",
 +
         "rightPadding":" ",
 +
         "size":26
 +
      }
 +
    }
 +
  ],
 +
  "separator":"",
 +
  "endLine":"\r\n"
 +
}</javascript>

Revision as of 12:39, 2 May 2014

{
  "outputFormat":{
    "contentType":"text\/plain",
    "charset":"ISO-8859-15",
    "filePrefix":"Import_",
    "fileExtension":"pnm",
    "converter":"ISOWithHeader"
  },
  "field":[
    {
      "name":"paper",
      "format":{
        "name":"accountPaper"
      }
    },
    {
      "text":"",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":1
      }
    },
    {
      "name":"account_date",
      "format":{
        "name":"formatDate",
        "parameter":[
          "DDMMYY"
        ]
      }
    },
    {
      "text":"",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":2
      }
    },
    {
      "name":"export_account",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":13
      }
    },
    {
      "text":"",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":1
      }
    },
    {
      "text":"",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":13
      }
    },
    {
      "name":"id",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%-13.0f"
        ]
      }
    },
    {
      "name":"account_entry_description",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":25
      }
    },
    {
      "text":"",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":1
      }
    },
    {
      "text":"",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":6
      }
    },
    {
      "text":"D",
      "if":{
        "leftPart":"debit",
        "operator":">",
        "rightPart":"0"
      }
    },
    {
      "name":"debit",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%20.2f"
        ]
      },
      "if":{
        "leftPart":"debit",
        "operator":">",
        "rightPart":"0"
      }
    },
    {
      "text":"C",
      "if":{
        "leftPart":"debit",
        "operator":"==",
        "rightPart":"0"
      }
    },
    {
      "name":"credit",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%20.2f"
        ]
      },
      "if":{
        "leftPart":"debit",
        "operator":"==",
        "rightPart":"0"
      }
    },
    {
      "text":"N"
    },
    {
      "name":"flow_id",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%07.0f"
        ]
      }
    },
    {
      "text":"",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":26
      }
    }
  ],
  "separator":"",
  "endLine":"\r\n"
}