125 lines
4.7 KiB
XML
125 lines
4.7 KiB
XML
<?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:call-template name="rml" />
|
|
</xsl:template>
|
|
|
|
|
|
<xsl:template name="rml">
|
|
<document filename="example.pdf">
|
|
<template pageSize="29.7cm,21cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Timesheets" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20">
|
|
<pageTemplate id="first">
|
|
<frame id="col1" x1="2.0cm" y1="2.5cm" width="24.7cm" height="17cm"/>
|
|
</pageTemplate>
|
|
</template>
|
|
|
|
<stylesheet>
|
|
<paraStyle name="normal" fontName="Helvetica" fontSize="6" alignment="center" />
|
|
<paraStyle name="normal-title" fontName="Helvetica" fontSize="6" />
|
|
<paraStyle name="title" fontName="Helvetica" fontSize="18" alignment="center" />
|
|
<paraStyle name="employee" fontName="Helvetica-Oblique" fontSize="10" textColor="blue" />
|
|
<paraStyle name="glande" textColor="purple" />
|
|
<paraStyle name="normal_people" textColor="green" />
|
|
<paraStyle name="esclave" textColor="red" />
|
|
<blockTableStyle id="month">
|
|
<blockAlignment value="CENTER" start="1,0" stop="-1,-1" />
|
|
<blockFont name="Helvetica" size="8" start="0,0" stop="-1,1"/>
|
|
<blockFont name="Helvetica" size="6" start="0,2" stop="-2,-2"/>
|
|
<blockFont name="Helvetica-BoldOblique" size="8" start="0,-1" stop="-1,-1"/>
|
|
<blockBackground colorName="#AAAAAA" start="1,0" stop="-2,1"/>
|
|
<xsl:for-each select="/report/days/day[@name='Sat']">
|
|
<xsl:variable name="col" select="attribute::number" />
|
|
<blockBackground>
|
|
<xsl:attribute name="colorName">lightgrey</xsl:attribute>
|
|
<xsl:attribute name="start">
|
|
<xsl:value-of select="$col" />
|
|
<xsl:text>,0</xsl:text>
|
|
</xsl:attribute>
|
|
<xsl:attribute name="stop">
|
|
<xsl:value-of select="$col+1" />
|
|
<xsl:text>,-1</xsl:text>
|
|
</xsl:attribute>
|
|
</blockBackground>
|
|
</xsl:for-each>
|
|
<lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" />
|
|
<lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/>
|
|
<lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/>
|
|
<lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/>
|
|
<blockValign value="TOP"/>
|
|
</blockTableStyle>
|
|
</stylesheet>
|
|
|
|
<story>
|
|
<xsl:call-template name="story"/>
|
|
</story>
|
|
</document>
|
|
</xsl:template>
|
|
|
|
<xsl:template name="story">
|
|
<para style="title" t="1">Timesheet</para>
|
|
<spacer length="1cm" />
|
|
<blockTable>
|
|
<xsl:attribute name="style">month</xsl:attribute>
|
|
<xsl:attribute name="colWidths"><xsl:value-of select="report/cols" /></xsl:attribute>
|
|
<tr>
|
|
<td><xsl:value-of select="report/date/attribute::year" /></td>
|
|
<xsl:for-each select="report/days/day">
|
|
<td>
|
|
<xsl:value-of select="attribute::name" />
|
|
</td>
|
|
</xsl:for-each>
|
|
<td></td>
|
|
</tr>
|
|
<tr>
|
|
<td><xsl:value-of select="report/date/attribute::month" /></td>
|
|
<xsl:for-each select="report/days/day">
|
|
<td>
|
|
<xsl:value-of select="attribute::number" />
|
|
</td>
|
|
</xsl:for-each>
|
|
<td t="1">Total</td>
|
|
</tr>
|
|
<xsl:apply-templates select="report/employee"/>
|
|
<xsl:for-each select="report/employee">
|
|
<xsl:variable name="id" select="attribute::id"/>
|
|
<tr>
|
|
<td t="1"><xsl:value-of select="attribute::name"/></td>
|
|
<xsl:for-each select="//report/days/day">
|
|
<xsl:variable name="today" select="attribute::number" />
|
|
<td>
|
|
<para>
|
|
<xsl:choose>
|
|
<xsl:when test="sum(//employee[@id=$id]/time-element[@date=$today]) < 7.5">
|
|
<xsl:attribute name="style">glande</xsl:attribute>
|
|
</xsl:when>
|
|
<xsl:when test="sum(//employee[@id=$id]/time-element[@date=$today]) < 8.5 and sum(//time-element[@date=$today]) >= 7.5">
|
|
<xsl:attribute name="style">normal_people</xsl:attribute>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:attribute name="style">esclave</xsl:attribute>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
<xsl:value-of select="//employee[@id=$id]/time-element[@date=$today]" />
|
|
</para>
|
|
</td>
|
|
</xsl:for-each>
|
|
<td>
|
|
<xsl:value-of select="sum(//employee[@id=$id]/time-element)"/>
|
|
</td>
|
|
</tr>
|
|
</xsl:for-each>
|
|
<tr>
|
|
<td>Total</td>
|
|
<xsl:for-each select="report/days/day">
|
|
<xsl:variable name="today" select="attribute::number"/>
|
|
<td t="1"><xsl:value-of select="sum(//time-element[@date=$today])"/></td>
|
|
</xsl:for-each>
|
|
<td t="1"><xsl:value-of select="sum(//time-element)"/></td>
|
|
</tr>
|
|
</blockTable>
|
|
</xsl:template>
|
|
</xsl:stylesheet>
|