bugfix
[odoo/odoo.git] / addons / auction / report / lots_with_vat.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="../../custom/corporate_defaults.xsl"/>
7     <xsl:import href="../../base/report/rml_template.xsl"/>
8     <xsl:variable name="page_format">a4_normal</xsl:variable>
9
10     <xsl:template name="stylesheet">
11         <blockTableStyle id="vat_table">
12             <blockFont name="Helvetica-BoldOblique" size="10" start="0,0" stop="-1,0"/>
13             <blockBackground colorName="grey" start="0,0" stop="-1,0"/>
14             <lineStyle kind="LINEAFTER" colorName="grey" start="0,0" stop="-1,-1"/>
15             <lineStyle kind="LINEBELOW" colorName="grey" start="0,-1" stop="-1,-1"/>
16             <lineStyle kind="LINEBEFORE" colorName="grey" start="0,0" stop="0,-1"/>
17             <blockValign value="TOP"/>
18         </blockTableStyle>
19         <blockTableStyle id="vat_total">
20             <blockBackground colorName="lightgrey" start="0,0" stop="-1,0"/>
21             <blockBackground colorName="lightgrey" start="0,-1" stop="-1,-1"/>
22             <lineStyle kind="LINEAFTER" colorName="grey" start="0,0" stop="-1,-1"/>
23             <lineStyle kind="LINEBELOW" colorName="grey" start="0,-1" stop="-1,-1"/>
24             <lineStyle kind="LINEBEFORE" colorName="grey" start="0,0" stop="0,-1"/>
25             <blockValign value="TOP"/>
26         </blockTableStyle>
27     </xsl:template>
28
29     <xsl:template match="/">
30         <xsl:call-template name="rml" />
31     </xsl:template>
32
33         <xsl:template name="story">
34                 <h3>TVA = 6%</h3>
35                 <blockTable colWidths="3cm,3cm,3cm,3cm,3cm,3cm" style="vat_table" repeatRows="1">
36                         <tr>
37                                 <td>Lot number</td>
38                                 <td>Depositer price</td>
39                                 <td>Commission</td>
40                                 <td>Adjudicated</td>
41                                 <td>Expenses</td>
42                                 <td>Buyer price</td>
43                         </tr>
44                         <xsl:apply-templates select="/lots/lot[vat='VAT 6%']">
45                                 <xsl:sort select="number" data-type="number" />
46                         </xsl:apply-templates>
47                 </blockTable>
48                 <blockTable colWidths="3cm,3cm,3cm,3cm,3cm,3cm" style="vat_total">
49                         <tr>
50                                 <td>Total </td>
51                                 <td>
52
53                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 6%'][adjudicated != '']/adjudicated) + sum(/lots/lot[vat='VAT 6%']/commission/amount)" />
54                                 </td>
55                                 <td>
56                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 6%']/commission/amount)" />
57                                 </td>
58                                 <td>
59                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 6%'][adjudicated != '']/adjudicated)" />
60                                 </td>
61                                 <td>
62                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 6%']/expenses/amount)" />
63                                 </td>
64                                 <td>
65                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 6%'][adjudicated != '']/adjudicated) + sum(/lots/lot[vat='VAT 6%']/expenses/amount)" />
66                                 </td>
67                         </tr>
68                 </blockTable>
69                 <h3>VAT = 21%</h3>
70                 <blockTable colWidths="3cm,3cm,3cm,3cm,3cm,3cm" style="vat_table" repeatRows="1">
71                         <tr>
72                                 <td>Lot number</td>
73                                 <td>Depositer price</td>
74                                 <td>Commission</td>
75                                 <td>Adjudicated</td>
76                                 <td>Expenses</td>
77                                 <td>Buyer price</td>
78                         </tr>
79                         <xsl:apply-templates select="/lots/lot[vat='VAT 21%']">
80                                 <xsl:sort select="number" data-type="number"/>
81                         </xsl:apply-templates>
82                 </blockTable>
83                 <blockTable colWidths="3cm,3cm,3cm,3cm,3cm,3cm" style="vat_total">
84                         <tr>
85                                 <td>Total</td>
86                                 <td>
87                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 21%'][adjudicated != '']/adjudicated) + sum(/lots/lot[vat='VAT 21%']/commission/amount)" />
88                                         <xsl:value-of select="vat" />
89                                 </td>
90                                 <td>
91                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 21%']/commission/amount)" />
92                                 </td>
93                                 <td>
94                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 21%'][adjudicated != '']/adjudicated)" />
95                                 </td>
96                                 <td>
97                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 21%']/expenses/amount)" />
98                                 </td>
99                                 <td>
100                                         <xsl:value-of select="sum(/lots/lot[vat='VAT 21%'][adjudicated != '']/adjudicated) + sum(/lots/lot[vat='TVA 21%']/expenses/amount)" />
101                                 </td>
102                         </tr>
103                 </blockTable>
104     </xsl:template>
105
106         <xsl:template match="lot">
107                 <tr>
108
109                         <td><xsl:value-of select="number" /></td>
110                         <td>
111                                 <xsl:choose>
112                                         <xsl:when test="adjudicated != ''">
113                                                 <xsl:value-of select="number(adjudicated) + sum(commission/amount)" />
114                                         </xsl:when>
115                                         <xsl:otherwise>
116                                                 <xsl:text name="adj">0</xsl:text>
117                                         </xsl:otherwise>
118                                 </xsl:choose>
119                         </td>
120                         <td>
121                                 <xsl:value-of select="sum(commission/amount)" />
122                         </td>
123                         <td>
124                                 <xsl:choose>
125                                         <xsl:when test="adjudicated != ''">
126                                                 <xsl:value-of select="adjudicated" />
127                                         </xsl:when>
128                                         <xsl:otherwise>
129                                                 <xsl:text name="adj">0</xsl:text>
130                                         </xsl:otherwise>
131                                 </xsl:choose>
132                         </td>
133                         <td>
134                                 <xsl:value-of select="sum(expenses/amount)" />
135                         </td>
136                         <td>
137                                 <xsl:choose>
138                                         <xsl:when test="adjudicated != ''">
139                                                 <xsl:value-of select="number(adjudicated) + sum(expenses/amount)" />
140                                         </xsl:when>
141                                         <xsl:otherwise>
142                                                 <xsl:text name="adj">0</xsl:text>
143                                         </xsl:otherwise>
144                                 </xsl:choose>
145                         </td>
146                 </tr>
147     </xsl:template>
148 </xsl:stylesheet>
149