~technofluid-team/openobject-addons/technofluid_multiple_installations

« back to all changes in this revision

Viewing changes to hr_timesheet/report/users_timesheet.xsl

  • Committer: pinky
  • Date: 2006-12-07 13:41:40 UTC
  • Revision ID: pinky-dedd7f8a42bd4557112a0513082691b8590ad6cc
New trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="utf-8"?>
 
2
<xsl:stylesheet version="1.0"
 
3
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
4
    xmlns:fo="http://www.w3.org/1999/XSL/Format">
 
5
 
 
6
        <xsl:template match="/">
 
7
                <xsl:call-template name="rml" />
 
8
        </xsl:template>
 
9
 
 
10
 
 
11
        <xsl:template name="rml">
 
12
                <document filename="example.pdf">
 
13
                        <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">
 
14
                                <pageTemplate id="first">
 
15
                                        <frame id="col1" x1="2.0cm" y1="2.5cm" width="24.7cm" height="17cm"/>
 
16
                                </pageTemplate>
 
17
                        </template>
 
18
                        
 
19
                        <stylesheet>
 
20
                                <paraStyle name="normal" fontName="Helvetica" fontSize="6" alignment="center" />
 
21
                                <paraStyle name="normal-title" fontName="Helvetica" fontSize="6" />
 
22
                                <paraStyle name="title" fontName="Helvetica" fontSize="18" alignment="center" />
 
23
                                <paraStyle name="employee" fontName="Helvetica-Oblique" fontSize="10" textColor="blue" />
 
24
                                <paraStyle name="glande" textColor="purple" />
 
25
                                <paraStyle name="normal_people" textColor="green" />
 
26
                                <paraStyle name="esclave" textColor="red" />
 
27
                                <blockTableStyle id="month">
 
28
                                        <blockAlignment value="CENTER" start="1,0" stop="-1,-1" />
 
29
                                        <blockFont name="Helvetica" size="8" start="0,0" stop="-1,1"/>
 
30
                                        <blockFont name="Helvetica" size="6" start="0,2" stop="-2,-2"/>
 
31
                                        <blockFont name="Helvetica-BoldOblique" size="8" start="0,-1" stop="-1,-1"/>
 
32
                                        <blockBackground colorName="#AAAAAA" start="1,0" stop="-2,1"/>
 
33
                                        <xsl:for-each select="/report/days/day[@name='Sat']">
 
34
                                                <xsl:variable name="col" select="attribute::number" />
 
35
                                                <blockBackground>
 
36
                                                        <xsl:attribute name="colorName">lightgrey</xsl:attribute>
 
37
                                                        <xsl:attribute name="start">
 
38
                                                                <xsl:value-of select="$col" />
 
39
                                                                <xsl:text>,0</xsl:text>
 
40
                                                        </xsl:attribute>
 
41
                                                        <xsl:attribute name="stop">
 
42
                                                                <xsl:value-of select="$col+1" />
 
43
                                                                <xsl:text>,-1</xsl:text>
 
44
                                                        </xsl:attribute>
 
45
                                                </blockBackground>
 
46
                                        </xsl:for-each>
 
47
                                        <lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" />
 
48
                                        <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/>
 
49
                                        <lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/>
 
50
                                        <lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/>
 
51
                                        <blockValign value="TOP"/>
 
52
                                </blockTableStyle>
 
53
                        </stylesheet>
 
54
 
 
55
                        <story>
 
56
                                <xsl:call-template name="story"/>
 
57
                        </story>
 
58
                </document>
 
59
        </xsl:template>
 
60
 
 
61
        <xsl:template name="story">
 
62
                <para style="title" t="1">Timesheet</para>
 
63
                <spacer length="1cm" />
 
64
                <blockTable>
 
65
                        <xsl:attribute name="style">month</xsl:attribute>
 
66
                        <xsl:attribute name="colWidths"><xsl:value-of select="report/cols" /></xsl:attribute>
 
67
                        <tr>
 
68
                                <td><xsl:value-of select="report/date/attribute::year" /></td>
 
69
                                <xsl:for-each select="report/days/day">
 
70
                                        <td>
 
71
                                                <xsl:value-of select="attribute::name" />
 
72
                                        </td>
 
73
                                </xsl:for-each>
 
74
                                <td></td>
 
75
                        </tr>
 
76
                        <tr>
 
77
                                <td><xsl:value-of select="report/date/attribute::month" /></td>
 
78
                                <xsl:for-each select="report/days/day">
 
79
                                        <td>
 
80
                                                <xsl:value-of select="attribute::number" />
 
81
                                        </td>
 
82
                                </xsl:for-each>
 
83
                                <td t="1">Total</td>
 
84
            </tr>
 
85
                        <xsl:apply-templates select="report/employee"/>
 
86
                        <xsl:for-each select="report/employee">
 
87
                                <xsl:variable name="id" select="attribute::id"/>
 
88
                                <tr>
 
89
                                        <td t="1"><xsl:value-of select="attribute::name"/></td>
 
90
                                        <xsl:for-each select="//report/days/day">
 
91
                                                <xsl:variable name="today" select="attribute::number" />
 
92
                                                <td>
 
93
                                                        <para>
 
94
                                                                <xsl:choose>
 
95
                                                                        <xsl:when test="sum(//employee[@id=$id]/time-element[@date=$today]) &lt; 7.5">
 
96
                                                                                <xsl:attribute name="style">glande</xsl:attribute>
 
97
                                                                        </xsl:when>
 
98
                                                                        <xsl:when test="sum(//employee[@id=$id]/time-element[@date=$today]) &lt; 8.5 and sum(//time-element[@date=$today]) &gt;= 7.5">
 
99
                                                                                <xsl:attribute name="style">normal_people</xsl:attribute>
 
100
                                                                        </xsl:when>
 
101
                                                                        <xsl:otherwise>
 
102
                                                                                <xsl:attribute name="style">esclave</xsl:attribute>
 
103
                                                                        </xsl:otherwise>
 
104
                                                                </xsl:choose>
 
105
                                                                <xsl:value-of select="//employee[@id=$id]/time-element[@date=$today]" />
 
106
                                                        </para>
 
107
                                                </td>
 
108
                                        </xsl:for-each>
 
109
                                        <td>
 
110
                                                <xsl:value-of select="sum(//employee[@id=$id]/time-element)"/>
 
111
                                        </td>
 
112
                                </tr>
 
113
                        </xsl:for-each>
 
114
                        <tr>
 
115
                                <td>Total</td>
 
116
                                <xsl:for-each select="report/days/day">
 
117
                                        <xsl:variable name="today" select="attribute::number"/>
 
118
                                        <td t="1"><xsl:value-of select="sum(//time-element[@date=$today])"/></td>
 
119
                                </xsl:for-each>
 
120
                                <td t="1"><xsl:value-of select="sum(//time-element)"/></td>
 
121
                        </tr>
 
122
                </blockTable>
 
123
        </xsl:template>
 
124
</xsl:stylesheet>