[REL] OpenERP 6.1.1
[odoo/odoo.git] / addons / hr_holidays / report / holidays_summary.xsl
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:import href="hr_custom_default.xsl"/>
7     <xsl:import href="hr_custom_rml.xsl"/>
8
9     <xsl:template match="/">
10         <xsl:call-template name="rml" />
11     </xsl:template>
12
13     <xsl:template name="stylesheet">
14                 <paraStyle name="normal" fontName="Helvetica" fontSize="6" alignment="left" />
15                 <paraStyle name="normal-title" fontName="Helvetica" fontSize="10" alignment="center"/>
16                 <paraStyle name="digits" fontName="Helvetica" fontSize="6" alignment="left"/>
17                 <paraStyle name="title" fontName="Helvetica" fontSize="18" alignment="center" />
18                 <paraStyle name="dept" fontName="Helvetica-Bold" fontSize="8" alignment="left" />
19                 <paraStyle name="employee" fontName="Helvetica-Bold" fontSize="6" textColor="black" />
20                 <paraStyle name="leaveid" fontName="Helvetica" fontSize="6" alignment="center" />
21                 <paraStyle name="print-date" fontName="Helvetica" fontSize="11" alignment="right" />
22                 <paraStyle name="sum" fontName="Helvetica-BoldOblique" fontSize="6" alignment="left" />
23                 <paraStyle name="company" textColor="purple" fontName="Helvetica-Bold" fontSize="11" alignment="left"/>
24                 <blockTableStyle id="header">
25                        <blockAlignment value="LEFT" start="0,0" stop="-1,-1"/>
26                        <blockFont name="Helvetica" size="8" start="0,0" stop="-1,-1"/>
27                       <blockValign value="TOP"/>
28                    </blockTableStyle>
29                 <blockTableStyle id="products">
30                      <blockAlignment value="CENTER" start="1,0" stop="-1,-1"/>
31                      <lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" />
32                      <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/>
33                      <lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/>
34                      <lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/>
35                      <blockFont name="Helvetica-Bold" size="8" start="0,-1" stop="-1,-1"/>
36                      <blockValign value="TOP"/>
37                 </blockTableStyle>
38                 <blockTableStyle id="legend">
39                     <blockAlignment value="CENTER" start="0,0" stop="-1,-1" />
40                     <blockFont name="Helvetica" size="7" start="0,0" stop="-1,-1"/>
41                     <lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" />
42                     <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/>
43                     <lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/>
44                     <lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/>
45                     <blockBackground colorName="#FFFFFF" start="0,0" stop="-1,-1"/>
46                     <xsl:for-each select="/report/legend">
47                         <blockBackground>
48                             <xsl:attribute name="colorName">
49                             <xsl:value-of select="attribute::color" />
50                             </xsl:attribute>
51                             <xsl:attribute name="start">
52                                 <xsl:text>0,</xsl:text>
53                                 <xsl:value-of select="attribute::row" />
54                             </xsl:attribute>
55                             <xsl:attribute name="stop">
56                                 <xsl:text>0,</xsl:text>
57                                 <xsl:value-of select="attribute::row" />
58                             </xsl:attribute>
59                         </blockBackground>
60                     </xsl:for-each>
61                     <blockValign value="TOP"/>
62                 </blockTableStyle>
63                 <blockTableStyle id="month">
64                     <blockAlignment value="CENTER" start="1,0" stop="-1,-1" />
65                     <blockFont name="Helvetica" size="5" start="0,0" stop="-1,-1"/>
66                     <blockFont name="Helvetica-BoldOblique" size="4.5" start="-1,0" stop="-1,-1"/>
67                     <blockBackground colorName="#FFFFFF" start="1,0" stop="-2,1"/>
68                     <xsl:for-each select="/report/days/dayy[@name='Sat' or @name='Sun']">
69                         <xsl:variable name="col" select="attribute::cell" />
70                         <blockBackground>
71                             <xsl:attribute name="colorName">lightgrey</xsl:attribute>
72                             <xsl:attribute name="start">
73                                 <xsl:value-of select="$col" />
74                                 <xsl:text>,0</xsl:text>
75                             </xsl:attribute>
76                             <xsl:attribute name="stop">
77                                 <xsl:value-of select="$col" />
78                                 <xsl:text>,-1</xsl:text>
79                             </xsl:attribute>
80                         </blockBackground>
81                     </xsl:for-each>
82                     <xsl:for-each select="/report/info">
83                         <xsl:variable name="val" select="attribute::val" />
84                         <xsl:variable name="col" select="attribute::number" />
85                         <xsl:variable name="row" select="attribute::id" />
86                         <xsl:for-each select="/report/legend">
87                             <xsl:variable name="val_id" select="attribute::id" />
88                             <xsl:variable name="color" select="attribute::color" />
89                             <xsl:if test="$val_id = $val ">
90                                 <blockBackground>
91                                     <xsl:attribute name="colorName"><xsl:value-of select="$color" /></xsl:attribute>
92                                     <xsl:attribute name="start">
93                                         <xsl:value-of select="$col" />
94                                         <xsl:text>,</xsl:text>
95                                         <xsl:value-of select="$row + 1" />
96                                     </xsl:attribute>
97                                     <xsl:attribute name="stop">
98                                         <xsl:value-of select="$col" />
99                                         <xsl:text>,</xsl:text>
100                                         <xsl:value-of select="$row + 1" />
101                                     </xsl:attribute>
102                                 </blockBackground>
103                             </xsl:if>
104                         </xsl:for-each>
105                     </xsl:for-each>
106                     <xsl:for-each select="report/employee">
107                         <xsl:variable name="dept" select="attribute::id" />
108                         <xsl:variable name="row" select="attribute::row" />
109                         <xsl:if test="$dept = 1">
110                             <blockBackground>
111                                 <xsl:attribute name="colorName">lightgrey</xsl:attribute>
112                                 <xsl:attribute name="start">
113                                     <xsl:text>0,</xsl:text>
114                                     <xsl:value-of select="$row +1" />
115                                 </xsl:attribute>
116                                 <xsl:attribute name="stop">
117                                     <xsl:text>0,</xsl:text>
118                                     <xsl:value-of select="$row +1" />
119                                 </xsl:attribute>
120                             </blockBackground>
121                         </xsl:if>
122                     </xsl:for-each>
123                     <lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" />
124                     <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/>
125                     <lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/>
126                     <lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/>
127                     <blockValign value="TOP"/>
128                 </blockTableStyle>
129     </xsl:template>
130
131     <xsl:template name="story">
132     <xsl:variable name="cols_header">
133             <xsl:text>13.7cm,13.7cm</xsl:text>
134     </xsl:variable>
135     <blockTable>
136             <xsl:attribute name="style">header</xsl:attribute>
137             <xsl:attribute name="colWidths"><xsl:value-of select="$cols_header"/></xsl:attribute>
138             <tr>
139                 <xsl:for-each select="report/res">
140                     <td>
141                     <para>
142                     </para>
143                     </td>
144                     <td>
145                     <para>
146                     </para>
147                     </td>
148                 </xsl:for-each>
149             </tr>
150         </blockTable>
151         <spacer length="1.0cm" />
152         <para style="title" t="1">Off-Days' Summary</para>
153         <spacer length="0.5cm" />
154         <para style="normal-title" t="1">Analyze from <u><xsl:value-of select="report/from" /></u> to <u> <xsl:value-of select="report/to" /> </u> of the <u><xsl:value-of select="report/type" /></u> holidays. </para>
155         <spacer length="1.0cm" />
156         <xsl:variable name="cols_legend">
157             <xsl:text>0.7cm,5.0cm</xsl:text>
158         </xsl:variable>
159         <blockTable>
160             <xsl:attribute name="style">products</xsl:attribute>
161             <xsl:attribute name="colWidths"><xsl:value-of select="report/cols_months"/></xsl:attribute>
162             <tr>
163                  <td>Month</td>
164                 <xsl:for-each select="report/months">
165                     <td>
166                         <xsl:value-of select="attribute::name" />
167                     </td>
168                 </xsl:for-each>
169                 <td> </td>
170             </tr>
171         </blockTable>
172
173         <blockTable>
174             <xsl:attribute name="style">month</xsl:attribute>
175             <xsl:attribute name="colWidths"><xsl:value-of select="report/cols" /></xsl:attribute>
176             <tr>
177                 <td> </td>
178                 <xsl:for-each select="report/days/dayy">
179                     <td>
180                         <xsl:value-of select="attribute::name" />
181                     </td>
182                 </xsl:for-each>
183                 <td> </td>
184             </tr>
185             <tr>
186                 <td><para>
187                         <xsl:attribute name="style">employee</xsl:attribute>
188                                 Departments and Employees
189                     </para>
190                 </td>
191                 <xsl:for-each select="report/days/dayy">
192                     <td><para><xsl:attribute name="style">digits</xsl:attribute>
193                         <xsl:value-of select="attribute::number" /></para>
194                     </td>
195                 </xsl:for-each>
196                 <td>Sum</td>
197             </tr>
198             <xsl:apply-templates select="report/employee"/>
199             <xsl:for-each select="report/employee">
200                 <xsl:variable name="id" select="attribute::id"/>
201                 <xsl:variable name="rw" select="attribute::row"/>
202                 <xsl:variable name="sum" select="attribute::sum"/>
203                 <tr>
204                     <td t="1">
205                         <para>
206                             <xsl:choose>
207                                     <xsl:when test="$id = 1">
208                                        <xsl:attribute name="style">dept</xsl:attribute>
209                                    </xsl:when>
210                                 <xsl:otherwise>
211                                       <xsl:attribute name="style">normal</xsl:attribute>
212                                    </xsl:otherwise>
213                             </xsl:choose>
214                             <xsl:value-of select="attribute::name"/>
215                         </para>
216                     </td>
217                     <xsl:for-each select="//report/days/dayy">
218                         <xsl:variable name="cell" select="attribute::cell" />
219                         <td>
220                         <para><xsl:attribute name="style">digits</xsl:attribute>
221                         <xsl:value-of select="//employee[@row=$rw]/time-element[@index=$cell]"/>
222                         </para>
223
224                         </td>
225                     </xsl:for-each>
226                     <td><para>
227                         <xsl:attribute name="style">sum</xsl:attribute><xsl:value-of select="attribute::sum"/></para></td>
228                 </tr>
229             </xsl:for-each>
230
231         </blockTable>
232         <spacer length="1cm" />
233         <condPageBreak height="1in" />
234         <blockTable>
235             <xsl:attribute name="style">legend</xsl:attribute>
236             <xsl:attribute name="colWidths"><xsl:value-of select="$cols_legend"/></xsl:attribute>
237             <tr>
238                     <td>Color</td>
239                     <td>Holiday Type</td>
240
241             </tr>
242             <xsl:for-each select="report/legend">
243             <tr>
244                     <td>
245                             <para>
246                             <xsl:attribute name="style">digits</xsl:attribute>
247                             </para>
248                     </td>
249                     <td>
250                             <para>
251                             <xsl:attribute name="style">normal</xsl:attribute>
252                                 <xsl:value-of select="attribute::name"/>
253                             </para>
254                     </td>
255             </tr>
256             </xsl:for-each>
257         </blockTable>
258     </xsl:template>
259 </xsl:stylesheet>