[MERGE]:merged from trunk
[odoo/odoo.git] / addons / hr_timesheet / report / user_timesheet.xsl
index 0cf95bc..b58e8af 100644 (file)
@@ -3,34 +3,28 @@
     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:import href="custom_default.xsl"/>
+       <xsl:import href="custom_rml.xsl"/>
 
+       <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" />
+       <xsl:template name="stylesheet">
+                               <paraStyle name="normal" fontName="Helvetica" fontSize="6" alignment="left" />
                                <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="red" />
-                               <paraStyle name="normal_people" textColor="green" />
-                               <paraStyle name="esclave" textColor="purple" />
+                               <paraStyle name="glande" textColor="red" fontSize="7" fontName="Helvetica"/>
+                               <paraStyle name="normal_people" textColor="green" fontSize="7" fontName="Helvetica"/>
+                               <paraStyle name="esclave" textColor="purple" fontSize="7" fontName="Helvetica"/>
                                <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:for-each select="/report/days/day[@weekday=6 or @weekday=7]">
                                                <xsl:variable name="col" select="attribute::number" />
                                                <blockBackground>
                                                        <xsl:attribute name="colorName">lightgrey</xsl:attribute>
@@ -39,7 +33,7 @@
                                                                <xsl:text>,0</xsl:text>
                                                        </xsl:attribute>
                                                        <xsl:attribute name="stop">
-                                                               <xsl:value-of select="$col+1" />
+                                                               <xsl:value-of select="$col" />
                                                                <xsl:text>,-1</xsl:text>
                                                        </xsl:attribute>
                                                </blockBackground>
                                        <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>
 
     <xsl:template name="story">
-               <para style="title" t="1">Timesheet</para>
+               <spacer length="1cm" />
+               <para style="title" t="1">Timesheet by Employee</para>
                <spacer length="1cm" />
                <para style="employee"><xsl:value-of select="/report/employee" /></para>
                <spacer length="1cm" />
@@ -90,7 +79,7 @@
                                <xsl:for-each select="report/days/day">
                                        <xsl:variable name="today" select="attribute::number" />
                                        <td>
-                                               <para>
+                                               <para style="normal">
                                                        <xsl:choose>
                                                                <xsl:when test="sum(//time-element[@date=$today]) &lt; 7.5">
                                                                        <xsl:attribute name="style">glande</xsl:attribute>
                                                                        <xsl:attribute name="style">esclave</xsl:attribute>
                                                                </xsl:otherwise>
                                                        </xsl:choose>
-                                                       <xsl:value-of select="sum(//time-element[@date=$today])" />
+                                                       <xsl:value-of select="format-number(sum(//time-element[@date=$today]),'##.##')" />
                                                </para>
                                        </td>
                                </xsl:for-each>
                                <td>
-                                       <xsl:value-of select="sum(//time-element)" />
+                                       <xsl:value-of select="format-number(sum(//time-element),'##.##')" />
                                </td>
                        </tr>
         </blockTable>
 
     <xsl:template match="account">
                <xsl:variable name="aid" select="attribute::id" />
+
                <tr>
                        <td>
                                <para style="normal-title"><xsl:value-of select="attribute::name" /></para>
                                </td>
                        </xsl:for-each>
                        <td>
-                               <para style="normal"><xsl:value-of select="sum(//account[@id=$aid]/time-element)" /></para>
+                               <para style="normal"><xsl:value-of select="format-number(sum(//account[@id=$aid]/time-element),'##.##')" /></para>
                        </td>
                </tr>
     </xsl:template>