[fix] problem in o2m
[odoo/odoo.git] / addons / auction / report / results_buyer.xsl
1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
4 <xsl:variable name="number_columns">2</xsl:variable>
5
6 <xsl:variable name="initial_left_pos">1.2</xsl:variable>
7 <xsl:variable name="width_increment">9.5</xsl:variable>
8 <xsl:variable name="frame_width">9.0cm</xsl:variable>
9
10 <xsl:variable name="width_col1">1.2cm</xsl:variable>
11 <xsl:variable name="width_col2">1.8cm</xsl:variable>
12 <xsl:variable name="width_col3">6cm</xsl:variable>
13
14 <xsl:variable name="bottom_pos">2.4cm</xsl:variable>
15 <xsl:variable name="frame_height">26cm</xsl:variable>
16
17 <xsl:template match="/">
18         <xsl:apply-templates select="results"/>
19 </xsl:template>
20
21 <xsl:template match="results">
22         <document filename="example_5.pdf">
23         <template pageSize="21cm,29.7cm" leftMargin="1.5cm" rightMargin="1.5cm" topMargin="1.5cm" bottomMargin="1.5cm" title="Bordereau acheteur" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
24                 <pageTemplate id="main">
25                         <pageGraphics>
26                                 <fill color="(0.4,0.4,0.4)"/>
27                                 <stroke color="(0.4,0.4,0.4)"/>
28                                 <setFont name="Helvetica" size="8"/>
29                                 <drawString x="1.8cm" y="1.4cm"><xsl:value-of select="auction/name"/></drawString>
30                                 <drawRightString x="19.2cm" y="1.4cm"><xsl:value-of select="auction/date-au1"/></drawRightString>
31                                 <lineMode width="0.2mm"/>
32                                 <lines>1.8cm 1.8cm 19.2cm 1.8cm</lines>
33                         </pageGraphics>
34                         <xsl:apply-templates select="lines/lot" mode="frames"/>
35                 </pageTemplate>
36         </template>
37
38         <stylesheet>
39                 <paraStyle name="name" fontName="Helvetica-Bold" fontSize="16" alignment="center"/>
40                 <blockTableStyle id="result">
41                          <blockValign value="TOP"/>
42                          <blockAlignment value="CENTER" start="0,0" stop="-1,0"/>
43                          <blockAlignment value="RIGHT" start="0,1" stop="-1,-1"/>
44                          <blockFont name="Helvetica-BoldOblique" size="12" start="0,0" stop="-1,0"/>
45                          <blockBackground colorName="grey" start="0,0" stop="-1,0"/>
46                          <blockTextColor colorName="white" start="0,0" stop="-1,0"/>
47                          <lineStyle kind="LINEBELOW" colorName="red" start="0,0" stop="-1,0"/>
48                          <lineStyle kind="LINEBEFORE" colorName="grey" start="-2,0" stop="-2,-1"/>
49                          <lineStyle kind="LINEBEFORE" colorName="grey" start="-1,0" stop="-1,-1"/>
50                          <lineStyle kind="LINEBEFORE" colorName="black" start="0,1" stop="0,-1"/>
51                          <lineStyle kind="LINEAFTER" colorName="black" start="-1,1" stop="-1,-1"/>
52                 </blockTableStyle>
53         </stylesheet>
54         
55         <story>
56                 <xsl:apply-templates select="lines"/>
57         </story>
58         
59         </document>
60 </xsl:template>
61
62 <xsl:template match="lines/lot" mode="frames">
63         <xsl:if test="position() &lt; $number_columns + 1">
64                 <frame>
65                         <xsl:attribute name="width">
66                                 <xsl:value-of select="$frame_width"/>
67                         </xsl:attribute>
68                         <xsl:attribute name="height">
69                                 <xsl:value-of select="$frame_height"/>
70                         </xsl:attribute>
71                         <xsl:attribute name="x1">
72                                 <xsl:value-of select="$initial_left_pos + (position()-1) * $width_increment"/>
73                                 <xsl:text>cm</xsl:text>
74                         </xsl:attribute>
75                         <xsl:attribute name="y1">
76                                 <xsl:value-of select="$bottom_pos"/>
77                         </xsl:attribute>
78                 </frame>
79         </xsl:if>
80 </xsl:template>
81
82 <xsl:template match="lines">
83         <blockTable  repeatRows="1" style="result">
84                 <xsl:attribute name="colWidths">
85                         <xsl:value-of select="$width_col1"/>
86                         <xsl:text>, </xsl:text>
87                         <xsl:value-of select="$width_col2"/>
88                         <xsl:text>, </xsl:text>
89                         <xsl:value-of select="$width_col3"/>
90                 </xsl:attribute>
91                         
92                 <tr>
93                         <td t="1">Num.</td>
94                         <td t="1">Adj.</td>
95                         <td t="1">Buyer</td>
96                 </tr>
97                 <xsl:apply-templates select="lot" mode="story"/>
98         </blockTable>
99         <pageBreak/>
100 </xsl:template>
101
102 <xsl:template match="lot" mode="story">
103         <tr>
104                 <td>
105                         <xsl:value-of select="lot-number"/>
106                 </td>
107                 <td>
108                         <xsl:if test="lot-price!=''">
109                                 <xsl:value-of select="round(lot-price)"/>
110                         </xsl:if>
111                 </td>
112                 <td>
113                         <para><xsl:value-of select="lot-buyer"/></para>
114                 </td>
115         </tr>
116 </xsl:template>
117
118 </xsl:stylesheet>