Difference between revisions of "Accounting export template Ebp"

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":"cp850",
     <xsl:strip-space elements="*"/>
+
    "filePrefix":"ecriture_",
 
+
    "fileExtension":"txt",
    <xsl:include href="xsl/str.template.xsl"/>
+
     "converter":"DOS"
     <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>cp850</charset>
+
          "%5.0f"
            <file_prefix>ecriture_</file_prefix>
+
        ]
            <file_extension>txt</file_extension>
+
      }
            <converter>DOS</converter>
+
    },
        </output-format>
+
    {
         <xsl:apply-templates select="account_entrys/account_entry">
+
      "name":"account_date",
            <xsl:sort select="@id" order="ascending" data-type="number"/>
+
      "format":{
         </xsl:apply-templates>
+
         "name":"formatDate",
     </xsl:template>
+
        "parameter":[
 
+
          "DDMMYYYY"
     <!--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"/>
+
      "name":"paper",
        <!-- entry number on 5 strings -->
+
      "format":{
         <xsl:call-template name="replace-zero-head-by-white-space">
+
         "name":"accountPaper"
            <xsl:with-param name="entry" select="format-number($flow_id, '00000')"/>
+
      }
         </xsl:call-template>
+
    },
         <xsl:text>,</xsl:text>
+
    {
        <!-- date on 8 strings -->
+
      "name":"export_account",
          <xsl:call-template name="displayDate">
+
      "format":{
            <xsl:with-param name="date">
+
         "name":"formatText",
                <xsl:call-template name="dateTimeISO">
+
        "removeChar":",",
                    <xsl:with-param name="dateTime" select="converted_account_date"/>
+
         "rightPadding":" ",
                </xsl:call-template>
+
         "size":15
            </xsl:with-param>
+
      }
         </xsl:call-template>
+
    },
         <xsl:text>,</xsl:text>
+
    {
         <!-- paper on 2 strings -->
+
      "text":""
        <xsl:call-template name="choose-paper">
+
    },
            <xsl:with-param name="flowAccounts" select="$accounts"/>
+
    {
         </xsl:call-template>
+
      "name":"account_entry_description",
        <xsl:text>,</xsl:text>
+
      "format":{
        <!-- account number on 15 strings -->
+
         "name":"formatText",
        <xsl:call-template name="format-text">
+
         "appendText":"\"",
            <xsl:with-param name="text" select="account/export_account"/>
+
         "prependText":"\"",
            <xsl:with-param name="size" select="15"/>
+
        "rightPadding":" ",
         </xsl:call-template>
+
         "size":40
         <xsl:text>,</xsl:text>
+
      }
         <!-- label on 2 strings -->
+
    },
         <xsl:text>,</xsl:text>
+
    {
        <!-- account name on 40 strings -->
+
      "text":"",
        <xsl:text>"</xsl:text>
+
      "format":{
        <xsl:call-template name="accountExportName">
+
        "name":"formatText",
            <xsl:with-param name="entry" select="account_entry"/>
+
         "appendText":"\"",
            <xsl:with-param name="size" select="40"/>
+
         "prependText":"\"",
            <xsl:with-param name="forbiddenCharacter">
+
         "rightPadding":" ",
                <xsl:text>,</xsl:text>
+
         "size":15
            </xsl:with-param>
+
      }
         </xsl:call-template>
+
    },
         <xsl:text>"</xsl:text>
+
    {
         <xsl:text>,</xsl:text>
+
      "name":"debit",
        <!-- Ident number 15 string-->
+
      "format":{
        <xsl:text>"               ",</xsl:text>
+
        "name":"formatNumber",
         <!-- amount on 13 strings + 1 string to write D or C -->
+
        "parameter":[
         <xsl:choose>
+
          "%013.2f"
            <xsl:when test="debit!=0">
+
        ]
                <xsl:value-of select="format-number(debit,'0000000000.00')"/>
+
      },
                <xsl:text>,D</xsl:text>
+
      "if":{
            </xsl:when>
+
         "leftPart":"debit",
            <xsl:otherwise>
+
         "operator":">",
                <xsl:value-of select="format-number(credit,'0000000000.00')"/>
+
         "rightPart":"0"
                <xsl:text>,C</xsl:text>
+
      }
            </xsl:otherwise>
+
    },
         </xsl:choose>
+
    {
         <xsl:text>,</xsl:text>
+
      "text":"D",
         <!-- deadline -->
+
      "if":{
        <xsl:call-template name="displayDate">
+
         "leftPart":"debit",
            <xsl:with-param name="date">
+
         "operator":">",
                <xsl:call-template name="dateTimeISO">
+
        "rightPart":"0"
                    <xsl:with-param name="dateTime" select="converted_account_date"/>
+
      }
                </xsl:call-template>
+
    },
            </xsl:with-param>
+
    {
         </xsl:call-template>
+
      "name":"credit",
         <xsl:text>,</xsl:text>
+
      "format":{
         <xsl:value-of select="$LF"/>
+
        "name":"formatNumber",
     </xsl:template>
+
        "parameter":[
 
+
          "%013.2f"
    <xsl:template name="displayDate">
+
        ]
        <xsl:param name="date"/>
+
      },
         <xsl:value-of select="substring($date,9,2)"/>
+
      "if":{
         <xsl:value-of select="substring($date,6,2)"/>
+
         "leftPart":"debit",
         <xsl:value-of select="substring($date,1,4)"/>
+
         "operator":"==",
     </xsl:template>
+
         "rightPart":"0"
 
+
      }
</xsl:stylesheet></xml>
+
    },
 +
    {
 +
      "text":"C",
 +
      "if":{
 +
         "leftPart":"debit",
 +
         "operator":"==",
 +
         "rightPart":"0"
 +
      }
 +
     },
 +
    {
 +
      "name":"account_date",
 +
      "format":{
 +
         "name":"formatDate",
 +
         "parameter":[
 +
          "DDMMYYYY"
 +
         ]
 +
      }
 +
    },
 +
    {
 +
      "text":""
 +
     }
 +
  ],
 +
  "separator":",",
 +
  "endLine":"\n"
 +
}</javascript>

Revision as of 12:38, 2 May 2014

{
  "outputFormat":{
    "contentType":"text\/plain",
    "charset":"cp850",
    "filePrefix":"ecriture_",
    "fileExtension":"txt",
    "converter":"DOS"
  },
  "field":[
    {
      "name":"flow_id",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%5.0f"
        ]
      }
    },
    {
      "name":"account_date",
      "format":{
        "name":"formatDate",
        "parameter":[
          "DDMMYYYY"
        ]
      }
    },
    {
      "name":"paper",
      "format":{
        "name":"accountPaper"
      }
    },
    {
      "name":"export_account",
      "format":{
        "name":"formatText",
        "removeChar":",",
        "rightPadding":" ",
        "size":15
      }
    },
    {
      "text":""
    },
    {
      "name":"account_entry_description",
      "format":{
        "name":"formatText",
        "appendText":"\"",
        "prependText":"\"",
        "rightPadding":" ",
        "size":40
      }
    },
    {
      "text":"",
      "format":{
        "name":"formatText",
        "appendText":"\"",
        "prependText":"\"",
        "rightPadding":" ",
        "size":15
      }
    },
    {
      "name":"debit",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%013.2f"
        ]
      },
      "if":{
        "leftPart":"debit",
        "operator":">",
        "rightPart":"0"
      }
    },
    {
      "text":"D",
      "if":{
        "leftPart":"debit",
        "operator":">",
        "rightPart":"0"
      }
    },
    {
      "name":"credit",
      "format":{
        "name":"formatNumber",
        "parameter":[
          "%013.2f"
        ]
      },
      "if":{
        "leftPart":"debit",
        "operator":"==",
        "rightPart":"0"
      }
    },
    {
      "text":"C",
      "if":{
        "leftPart":"debit",
        "operator":"==",
        "rightPart":"0"
      }
    },
    {
      "name":"account_date",
      "format":{
        "name":"formatDate",
        "parameter":[
          "DDMMYYYY"
        ]
      }
    },
    {
      "text":""
    }
  ],
  "separator":",",
  "endLine":"\n"
}