Difference between revisions of "Accounting export template CielRimport"

Jump to: navigation, search
m
Line 1: Line 1:
<xml><?xml version="1.0" encoding="ISO-8859-1"?>
+
<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":"Rimport_",
 
+
     "fileExtension":"txt",
     <xsl:include href="xsl/str.template.xsl"/>
+
     "converter":"ISO"
     <xsl:include href="xsl/formatFunctions.xsl"/>
+
  },
     <xsl:include href="xsl/accountingFormatFunction.xsl"/>
+
  "field":[
 
+
     {
    <!--      Main       -->
+
      "name":"flow_id",
    <xsl:template match="/">
+
       "format":{
         <output-format>
+
        "name":"formatNumber",
            <content_type>text/plain</content_type>
+
         "parameter":[
            <charset>ISO-8859-15</charset>
+
          "%06.0f"
            <file_prefix>Rimport_</file_prefix>
+
        ]
            <file_extension>txt</file_extension>
+
      }
            <converter>ISO</converter>
+
    },
        </output-format>
+
    {
        <xsl:apply-templates select="account_entrys/account_entry">
+
      "name":"paper",
            <xsl:sort select="@id" order="ascending" data-type="number"/>
+
      "format":{
        </xsl:apply-templates>
+
        "name":"accountPaper"
     </xsl:template>
+
      }
 
+
     },
     <!--show account line -->
+
     {
    <xsl:template match="account_entry">
+
      "name":"account_date",
        <xsl:variable name="flow_id" select="flow_id"/>
+
      "format":{
         <xsl:variable name="accounts"
+
        "name":"formatDate",
            select="/account_entrys/account_entry[flow_id=$flow_id]/account/export_account"/>
+
         "parameter":[
         <xsl:variable name="line">
+
          "DD\/MM\/YYYY"
            <!-- entry number -->
+
         ]
            <xsl:value-of select="format-number($flow_id, '000000')"/>
+
      }
            <xsl:value-of select="$TAB"/>
+
    },
            <!-- paper on 2 strings -->
+
    {
            <xsl:call-template name="choose-paper">
+
      "name":"export_account",
                <xsl:with-param name="flowAccounts" select="$accounts"/>
+
      "format":{
            </xsl:call-template>
+
        "name":"formatText",
            <xsl:value-of select="$TAB"/>
+
        "rightPadding":" ",
            <!-- date on 10 strings -->
+
        "size":13
            <xsl:call-template name="displayDate">
+
      }
                <xsl:with-param name="date">
+
    },
                    <xsl:call-template name="dateTimeISO">
+
    {
                        <xsl:with-param name="dateTime">
+
      "name":"account_entry_description",
                            <xsl:value-of select="converted_account_date"/>
+
      "format":{
                        </xsl:with-param>
+
        "name":"formatText",
                    </xsl:call-template>
+
        "rightPadding":" ",
                </xsl:with-param>
+
        "size":35
            </xsl:call-template>
+
      }
            <xsl:value-of select="$TAB"/>
+
    },
            <!-- account number on 13 strings -->
+
    {
            <xsl:call-template name="format-text">
+
      "name":"debit",
                <xsl:with-param name="text" select="account/export_account"/>
+
      "format":{
                <xsl:with-param name="size" select="13"/>
+
        "name":"formatNumber",
            </xsl:call-template>
+
        "parameter":[
            <xsl:value-of select="$TAB"/>
+
          "%0.2f"
            <!-- account name on 35 strings -->
+
        ]
            <xsl:call-template name="accountExportName">
+
      },
                <xsl:with-param name="entry" select="account_entry"/>
+
      "if":{
                <xsl:with-param name="size" select="35"/>
+
        "leftPart":"debit",
            </xsl:call-template>
+
        "operator":">",
            <xsl:value-of select="$TAB"/>
+
        "rightPart":"0"
            <!-- amount + 1 string D or C -->
+
      }
            <xsl:choose>
+
    },
                <xsl:when test="debit!=0">
+
    {
                    <xsl:value-of select="format-number(debit,'0.00')"/>
+
      "text":"D",
                    <xsl:value-of select="$TAB"/>
+
      "if":{
                    <xsl:text>D</xsl:text>
+
        "leftPart":"debit",
                </xsl:when>
+
        "operator":">",
                <xsl:otherwise>
+
        "rightPart":"0"
                    <xsl:value-of select="format-number(credit,'0.00')"/>
+
      }
                    <xsl:value-of select="$TAB"/>
+
    },
                    <xsl:text>C</xsl:text>
+
    {
                </xsl:otherwise>
+
      "name":"credit",
            </xsl:choose>
+
      "format":{
            <xsl:value-of select="$TAB"/>
+
        "name":"formatNumber",
            <!-- code status 1 strings, B = brouillard -->
+
        "parameter":[
            <xsl:text>B</xsl:text>
+
          "%0.2f"
            <xsl:value-of select="$TAB"/>
+
        ]
            <!-- label on 50 strings -->
+
      },
            <xsl:call-template name="format-text">
+
      "if":{
                <xsl:with-param name="text">
+
        "leftPart":"debit",
                    <xsl:call-template name="str.characterRemover">
+
        "operator":"==",
                        <xsl:with-param name="string2Clean">
+
        "rightPart":"0"
                            <xsl:value-of select="comments"/>
+
      }
                            <xsl:text>&#160;</xsl:text>
+
    },
                            <xsl:value-of select="flight/comments"/>
+
    {
                        </xsl:with-param>
+
      "text":"C",
                        <xsl:with-param name="character2Remove">
+
      "if":{
                            <xsl:text></xsl:text>
+
        "leftPart":"debit",
                        </xsl:with-param>
+
         "operator":"==",
                    </xsl:call-template>
+
         "rightPart":"0"
                </xsl:with-param>
+
      }
                <xsl:with-param name="size" select="50"/>
+
     },
            </xsl:call-template>
+
    {
            <xsl:value-of select="$CR"/><xsl:value-of select="$LF"/>
+
      "text":"B"
         </xsl:variable>
+
    },
         <xsl:value-of select="$line" disable-output-escaping="yes"/>
+
     {
     </xsl:template>
+
      "name":"account_entry_comments",
 
+
      "format":{
     <xsl:template name="displayDate">
+
         "name":"formatText",
         <xsl:param name="date"/>
+
         "rightPadding":" ",
         <xsl:value-of select="substring($date,9,2)"/>
+
         "size":50,
         <xsl:text>/</xsl:text>
+
         "removeNewLine":true
         <xsl:value-of select="substring($date,6,2)"/>
+
      }
        <xsl:text>/</xsl:text>
+
    }
        <xsl:value-of select="substring($date,1,4)"/>
+
  ],
    </xsl:template>
+
  "separator":"\t",
 
+
  "endLine":"\r\n"
</xsl:stylesheet></xml>
+
}</javascript>

Revision as of 12:36, 2 May 2014

{
  "outputFormat":{
    "contentType":"text\/plain",
    "charset":"ISO-8859-15",
    "filePrefix":"Rimport_",
    "fileExtension":"txt",
    "converter":"ISO"
  },
  "field":[
    {
      "name":"flow_id",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%06.0f"
        ]
      }
    },
    {
      "name":"paper",
      "format":{
        "name":"accountPaper"
      }
    },
    {
      "name":"account_date",
      "format":{
        "name":"formatDate",
        "parameter":[
          "DD\/MM\/YYYY"
        ]
      }
    },
    {
      "name":"export_account",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":13
      }
    },
    {
      "name":"account_entry_description",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":35
      }
    },
    {
      "name":"debit",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%0.2f"
        ]
      },
      "if":{
        "leftPart":"debit",
        "operator":">",
        "rightPart":"0"
      }
    },
    {
      "text":"D",
      "if":{
        "leftPart":"debit",
        "operator":">",
        "rightPart":"0"
      }
    },
    {
      "name":"credit",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%0.2f"
        ]
      },
      "if":{
        "leftPart":"debit",
        "operator":"==",
        "rightPart":"0"
      }
    },
    {
      "text":"C",
      "if":{
        "leftPart":"debit",
        "operator":"==",
        "rightPart":"0"
      }
    },
    {
      "text":"B"
    },
    {
      "name":"account_entry_comments",
      "format":{
        "name":"formatText",
        "rightPadding":" ",
        "size":50,
        "removeNewLine":true
      }
    }
  ],
  "separator":"\t",
  "endLine":"\r\n"
}