diff options
Diffstat (limited to 'bin/addons/base/report')
| -rw-r--r-- | bin/addons/base/report/custom.xsl | 246 | ||||
| -rw-r--r-- | bin/addons/base/report/custom_default.xsl | 36 | ||||
| -rw-r--r-- | bin/addons/base/report/custom_new.xsl | 127 | ||||
| -rw-r--r-- | bin/addons/base/report/custom_rml.xsl | 62 | ||||
| -rw-r--r-- | bin/addons/base/report/rml_template.xsl | 70 |
5 files changed, 541 insertions, 0 deletions
diff --git a/bin/addons/base/report/custom.xsl b/bin/addons/base/report/custom.xsl new file mode 100644 index 00000000000..e40c62ddb2a --- /dev/null +++ b/bin/addons/base/report/custom.xsl @@ -0,0 +1,246 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> + +<xsl:template match="/"> + <xsl:apply-templates select="report"/> +</xsl:template> + +<xsl:template match="report"> + <document filename="example_5.pdf"> + <template leftMargin="1.5cm" rightMargin="1.5cm" topMargin="1.5cm" bottomMargin="1.5cm" title="Reporting" author="Generated by Tiny ERP, Fabien Pinckaers"> + <xsl:attribute name="pageSize"> + <xsl:value-of select="/report/config/pageSize"/> + </xsl:attribute> + <pageTemplate id="first"> + <pageGraphics> + <drawCentredString> + <xsl:attribute name="x"> + <xsl:value-of select="/report/config/pageWidth div 2"/> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="/report/config/pageHeight - 56.69"/> + </xsl:attribute> + <xsl:value-of select="config/report-header"/> + </drawCentredString> + + <fill color="(0.2,0.2,0.2)"/> + <setFont name="Helvetica" size="10"/> + <drawCentredString y="10mm"> + <xsl:attribute name="x"> + <xsl:value-of select="/report/config/pageWidth div 2"/> + </xsl:attribute> + <xsl:value-of select="config/report-footer"/> + </drawCentredString> + + <fill color="(0.969,0.2,0.2)"/> + <setFont name="Helvetica" size="8"/> + <drawString x="1.5cm"> + <xsl:attribute name="y"> + <xsl:value-of select="/report/config/pageHeight - 56.69"/> + </xsl:attribute><xsl:text>Tiny ERP</xsl:text> + </drawString> + + <fill color="(0.2,0.2,0.2)"/> + <drawRightString> + <xsl:attribute name="x"> + <xsl:value-of select="/report/config/pageWidth - 45"/> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="/report/config/pageHeight - 56.69"/> + </xsl:attribute><xsl:value-of select="/report/config/date"/> + </drawRightString> + </pageGraphics> + <frame id="column" x1="1.5cm" y1="1.5cm"> + <xsl:attribute name="width"> + <xsl:value-of select="/report/config/pageWidth - 85"/> + </xsl:attribute> + <xsl:attribute name="height"> + <xsl:value-of select="/report/config/pageHeight - 100"/> + </xsl:attribute> + </frame> + </pageTemplate> + </template> + <stylesheet> + <paraStyle name="sum" fontName="Helvetica" textColor="green"/> + <paraStyle name="sum_float" fontName="Helvetica" alignment="right" textColor="green"/> + <paraStyle name="sum_end" fontName="Helvetica" textColor="red"/> + <paraStyle name="sum_float_end" fontName="Helvetica" alignment="right" textColor="red"/> + <blockTableStyle id="table"> + <blockValign value="TOP"/> + <blockFont name="Helvetica" size="12" start="0,0" stop="-1,0"/> + <blockBackground colorName="(0.8,0.8,0.8)" start="0,0" stop="-1,0"/> + + <lineStyle kind="GRID" colorName="lightgrey" thickness="0.3"/> + + <lineStyle kind="LINEBELOW" colorName="black" thickness="1.5" start="0,0" stop="-1,0"/> + <lineStyle kind="LINEABOVE" colorName="black" thickness="1.5" start="0,0" stop="-1,0"/> + </blockTableStyle> + </stylesheet> + <story> + <blockTable style="table"> + <xsl:attribute name="colWidths"> + <xsl:value-of select="/report/config/tableSize"/> + </xsl:attribute> + <xsl:apply-templates select="header"/> + <xsl:apply-templates select="group"/> + + <xsl:if test="group//@sum"> + <tr> + <xsl:for-each select="group[position()=1]/record[position()=1]/field"> + <xsl:choose> + <xsl:when test="position()=1"> + <td><para style="sum_end">SUM</para></td> + </xsl:when> + <xsl:when test="@sum"> + <xsl:variable name="ici"> + <xsl:value-of select="@id"/> + </xsl:variable> + <td><para style="sum_float_end"><xsl:value-of select="sum(../../../group/record/field[@id=$ici])"/></para></td> + </xsl:when> + <xsl:otherwise> + <td/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </tr> + </xsl:if> + <xsl:if test="group//@count"> + <tr> + <xsl:for-each select="group[position()=1]/record[position()=1]/field"> + <xsl:choose> + <xsl:when test="position()=1"> + <td><para style="sum_end">#</para></td> + </xsl:when> + <xsl:when test="@count"> + <xsl:variable name="ici"> + <xsl:value-of select="@id"/> + </xsl:variable> + <td><para style="sum_float_end"><xsl:value-of select="count(../../../group/record/field[@id=$ici])"/></para></td> + </xsl:when> + <xsl:otherwise> + <td/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </tr> + </xsl:if> + <xsl:if test="group//@avg"> + <tr> + <xsl:for-each select="group[position()=1]/record[position()=1]/field"> + <xsl:choose> + <xsl:when test="position()=1"> + <td><para style="sum_end">AVG</para></td> + </xsl:when> + <xsl:when test="@avg"> + <xsl:variable name="ici"> + <xsl:value-of select="@id"/> + </xsl:variable> + <td><para style="sum_float_end"><xsl:value-of select="sum(../../../group/record/field[@id=$ici]) div count(../../../group/record/field[@id=$ici])"/></para></td> + </xsl:when> + <xsl:otherwise> + <td/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </tr> + </xsl:if> + </blockTable> + </story> + </document> +</xsl:template> + +<xsl:template match="header"> + <tr> + <xsl:apply-templates select="field"/> + </tr> +</xsl:template> + +<xsl:template match="group"> + <xsl:if test="not(/report/config/totalonly)"> + <xsl:apply-templates select="record"/> + </xsl:if> + <xsl:if test="/report/config/groupby"> + <!-- SUM --> + <xsl:if test="//@sum"> + <tr> + <xsl:for-each select="record[position()=1]/field"> + <xsl:choose> + <xsl:when test="/report/config/groupby = @id"> + <td><para style="sum"><xsl:value-of select="."/> (SUM)</para></td> + </xsl:when> + <xsl:when test="@sum"> + <xsl:variable name="ici"> + <xsl:value-of select="@id"/> + </xsl:variable> + <td><para style="sum_float"><xsl:value-of select="sum(../../record/field[@id=$ici])"/></para></td> + </xsl:when> + <xsl:otherwise> + <td/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </tr> + </xsl:if> + <!-- COUNT --> + <xsl:if test="//@count"> + <tr> + <xsl:for-each select="record[position()=1]/field"> + <xsl:choose> + <xsl:when test="/report/config/groupby = @id"> + <td><para style="sum"><xsl:value-of select="."/> (#)</para></td> + </xsl:when> + <xsl:when test="@count"> + <xsl:variable name="ici"> + <xsl:value-of select="@id"/> + </xsl:variable> + <td><para style="sum_float"><xsl:value-of select="count(../../record/field[@id=$ici])"/></para></td> + </xsl:when> + <xsl:otherwise> + <td/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </tr> + </xsl:if> + <!-- AVG --> + <xsl:if test="//@avg"> + <tr> + <xsl:for-each select="record[position()=1]/field"> + <xsl:choose> + <xsl:when test="/report/config/groupby = @id"> + <td><para style="sum"><xsl:value-of select="."/> (AVG)</para></td> + </xsl:when> + <xsl:when test="@avg"> + <xsl:variable name="ici"> + <xsl:value-of select="@id"/> + </xsl:variable> + <td><para style="sum_float"><xsl:value-of select="sum(../../record/field[@id=$ici]) div count(../../record/field[@id=$ici])"/></para></td> + </xsl:when> + <xsl:otherwise> + <td/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </tr> + </xsl:if> + </xsl:if> +</xsl:template> + +<xsl:template match="record"> + <tr> + <xsl:apply-templates select="field"/> + </tr> +</xsl:template> + +<xsl:template match="field"> + <xsl:choose> + <xsl:when test="@level"> + <td><pre><xsl:value-of select="@level"/><xsl:value-of select="."/></pre></td> + </xsl:when> + <xsl:otherwise> + <td><para><xsl:value-of select="."/></para></td> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +</xsl:stylesheet> diff --git a/bin/addons/base/report/custom_default.xsl b/bin/addons/base/report/custom_default.xsl new file mode 100644 index 00000000000..c9194789f93 --- /dev/null +++ b/bin/addons/base/report/custom_default.xsl @@ -0,0 +1,36 @@ +<?xml version = '1.0' encoding="utf-8"?> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <xsl:variable name="signature" select="//corporate-header/signature"/> + <xsl:variable name="title">Tiny ERP Report</xsl:variable> + <xsl:variable name="leftMargin">1cm</xsl:variable> + <xsl:variable name="rightMargin">1cm</xsl:variable> + <xsl:variable name="topMargin">1cm</xsl:variable> + <xsl:variable name="bottomMargin">1cm</xsl:variable> + <xsl:variable name="pageSize">21cm,29.7cm</xsl:variable> + + <xsl:variable name="page_format">a4_letter</xsl:variable> + + <xsl:template name="first_page_frames"> + <frame id="column" x1="1.5cm" y1="1.5cm"> + <xsl:attribute name="width"> + <xsl:value-of select="/report/config/PageWidth - 85"/> + </xsl:attribute> + <xsl:attribute name="height"> + <xsl:value-of select="/report/config/PageHeight - 100"/> + </xsl:attribute> + </frame> + </xsl:template> + + <xsl:template name="other_pages_frames"> + <frame id="column" x1="1.5cm" y1="1.5cm"> + <xsl:attribute name="width"> + <xsl:value-of select="/report/config/PageWidth - 85"/> + </xsl:attribute> + <xsl:attribute name="height"> + <xsl:value-of select="/report/config/PageHeight - 100"/> + </xsl:attribute> + </frame> + </xsl:template> + +</xsl:stylesheet> diff --git a/bin/addons/base/report/custom_new.xsl b/bin/addons/base/report/custom_new.xsl new file mode 100644 index 00000000000..2788c4d2ed9 --- /dev/null +++ b/bin/addons/base/report/custom_new.xsl @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> + + <xsl:import href="../../base/report/custom_default.xsl"/> + <xsl:import href="../../base/report/custom_rml.xsl"/> + <xsl:template match="/"> + <xsl:call-template name="rml"> + <xsl:with-param name="pageSize" select="report/config/PageSize"/> + <xsl:with-param name="page_format" select="report/config/PageFormat"/> + </xsl:call-template> + </xsl:template> + + <!-- stylesheet --> + + <xsl:template name="stylesheet"> + <paraStyle name="title" fontName="Helvetica-Bold" fontSize="22" alignment="center"/> + + <blockTableStyle id="products"> + <blockBackground colorName="grey" start="0,0" stop="-1,0"/> + <blockValign value="TOP"/> + <blockAlignment value="RIGHT"/> + <lineStyle kind="GRID" colorName="black"/> + </blockTableStyle> + </xsl:template> + + <xsl:template name="story"> + <xsl:apply-templates select="report"/> + </xsl:template> + + <xsl:template match="report"> + <xsl:apply-templates select="config"/> + <!--<setNextTemplate name="other_pages"/>--> + <blockTable style="products"> + <xsl:if test="string-length(./config/tableSize)>1"> + <xsl:attribute name="colWidths"> + <xsl:value-of select="./config/tableSize"/> + </xsl:attribute> + </xsl:if> + + <xsl:apply-templates select="header"/> + <xsl:apply-templates select="lines"/> + </blockTable> + </xsl:template> + + <xsl:template match="config"> + <para style="title"> + <xsl:value-of select="report-header"/> + </para> + <spacer length="1cm" width="2mm"/> + </xsl:template> + + <xsl:template match="header"> + <tr> + <xsl:for-each select="field"> + <td> + <para> + <xsl:value-of select="."/> + </para> + </td> + </xsl:for-each> + </tr> + </xsl:template> + + <xsl:template match="lines"> + <xsl:apply-templates select="row"/> + </xsl:template> + + <xsl:template match="row"> + <tr> + <xsl:apply-templates select="col"/> + </tr> + </xsl:template> + + <xsl:template match="col"> + <td> + <xsl:choose> + <xsl:when test="@para='yes'"> + <xsl:choose> + <xsl:when test="@tree='yes'"> + <para> + <xsl:attribute name="leftIndent"><xsl:value-of select="@space"/></xsl:attribute> + <xsl:value-of select="."/> + </para> + </xsl:when> + <xsl:otherwise> + <para> + <xsl:value-of select="."/> + </para> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xpre> + <xsl:value-of select="."/> + </xpre> + </xsl:otherwise> + </xsl:choose> + </td> + </xsl:template> + + +<!-- <xsl:template match="col"> + <td> + <xsl:if test="@tree='yes'"> + <xsl:choose> + <xsl:when test="@para='yes'"> + <para> + <xsl:attribute name="leftIndent"><xsl:value-of select="@space"/></xsl:attribute> + <xsl:value-of select="."/> + </para> + </xsl:when> + <xsl:otherwise> + <xpre> + <xsl:value-of select="."/> + </xpre> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:if test="@tree!='yes'"> + <xpre> + <xsl:value-of select="."/> + </xpre> + </xsl:if> + </td> + </xsl:template> +--> +</xsl:stylesheet> diff --git a/bin/addons/base/report/custom_rml.xsl b/bin/addons/base/report/custom_rml.xsl new file mode 100644 index 00000000000..afc8c3d9a92 --- /dev/null +++ b/bin/addons/base/report/custom_rml.xsl @@ -0,0 +1,62 @@ +<?xml version = '1.0' encoding="utf-8"?> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> + + <xsl:template name="first_page_graphics_report"/> + <xsl:template name="other_pages_graphics_report"/> + + <xsl:template name="rml"> + <document> + <template author="Generated by Tiny ERP, Fabien Pinckaers"> + <xsl:attribute name="pageSize"> + <xsl:value-of select="$pageSize"/> + </xsl:attribute> + + <xsl:attribute name="leftMargin"> + <xsl:value-of select="$leftMargin"/> + </xsl:attribute> + + <xsl:attribute name="rightMargin"> + <xsl:value-of select="$rightMargin"/> + </xsl:attribute> + + <xsl:attribute name="topMargin"> + <xsl:value-of select="$topMargin"/> + </xsl:attribute> + + <xsl:attribute name="bottomMargin"> + <xsl:value-of select="$bottomMargin"/> + </xsl:attribute> + + <xsl:attribute name="title"> + <xsl:value-of select="$title"/> + </xsl:attribute> + + <pageTemplate id="first_page"> + <pageGraphics> + <xsl:call-template name="first_page_graphics_report"/> + </pageGraphics> + + <xsl:call-template name="first_page_frames"/> + </pageTemplate> + + <pageTemplate id="other_pages"> + <pageGraphics> + <xsl:call-template name="other_pages_graphics_report"/> + </pageGraphics> + + <xsl:call-template name="other_pages_frames"/> + </pageTemplate> + </template> + + <stylesheet> + <xsl:call-template name="stylesheet"/> + </stylesheet> + + <story> + <xsl:call-template name="story"/> + </story> + + </document> + </xsl:template> +</xsl:stylesheet> diff --git a/bin/addons/base/report/rml_template.xsl b/bin/addons/base/report/rml_template.xsl new file mode 100644 index 00000000000..8c956891133 --- /dev/null +++ b/bin/addons/base/report/rml_template.xsl @@ -0,0 +1,70 @@ +<?xml version = '1.0' encoding="utf-8"?> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> + + <xsl:template name="first_page_graphics_report"/> + <xsl:template name="other_pages_graphics_report"/> +<!-- + <xsl:template name="first_page_graphics_corporation"/> + <xsl:template name="other_pages_graphics_corporation"/> + + <xsl:template name="first_page_frames"/> + <xsl:template name="other_pages_frames"/> +--> + <xsl:template name="rml"> + <document> + <template author="Generated by Tiny ERP, Fabien Pinckaers"> + <xsl:attribute name="pageSize"> + <xsl:value-of select="$pageSize"/> + </xsl:attribute> + + <xsl:attribute name="leftMargin"> + <xsl:value-of select="$leftMargin"/> + </xsl:attribute> + + <xsl:attribute name="rightMargin"> + <xsl:value-of select="$rightMargin"/> + </xsl:attribute> + + <xsl:attribute name="topMargin"> + <xsl:value-of select="$topMargin"/> + </xsl:attribute> + + <xsl:attribute name="bottomMargin"> + <xsl:value-of select="$bottomMargin"/> + </xsl:attribute> + + <xsl:attribute name="title"> + <xsl:value-of select="$title"/> + </xsl:attribute> + + <pageTemplate id="first_page"> + <pageGraphics> + <xsl:call-template name="first_page_graphics_corporation"/> + <xsl:call-template name="first_page_graphics_report"/> + </pageGraphics> + + <xsl:call-template name="first_page_frames"/> + </pageTemplate> + + <pageTemplate id="other_pages"> + <pageGraphics> + <xsl:call-template name="other_pages_graphics_corporation"/> + <xsl:call-template name="other_pages_graphics_report"/> + </pageGraphics> + + <xsl:call-template name="other_pages_frames"/> + </pageTemplate> + </template> + + <stylesheet> + <xsl:call-template name="stylesheet"/> + </stylesheet> + + <story> + <xsl:call-template name="story"/> + </story> + + </document> + </xsl:template> +</xsl:stylesheet> |
