~willowit-openerp-team/willowit-openerp-addons/development

« back to all changes in this revision

Viewing changes to auction/report/buyer_list.xsl

  • Committer: Deepak Seshadri
  • Date: 2011-04-04 07:04:07 UTC
  • Revision ID: deepak@willowit.com.au-20110404070407-8j9mnxzzgh53o24t
Remove irrelevant modules from this branch.

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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
 
 
4
 
        <xsl:template match="/">
5
 
                <xsl:apply-templates select="achat-listing"/>
6
 
        </xsl:template>
7
 
 
8
 
        <xsl:template match="achat-listing">
9
 
                <document filename="example.pdf">
10
 
                        <template pageSize="21cm,29.7cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Bordereau acheteur" author="Generated by Open ERP, Fabien Pinckaers" allowSplitting="20">
11
 
                                <pageTemplate id="first">
12
 
                                        <pageGraphics>
13
 
                                                <drawRightString x="19.0cm" y="26.0cm"><xsl:value-of select="date"/></drawRightString>
14
 
                                        </pageGraphics>
15
 
                                        <frame id="col1" x1="2.0cm" y1="2.5cm" width="17.0cm" height="22.7cm"/>
16
 
                                </pageTemplate>
17
 
                        </template>
18
 
                        
19
 
                        <stylesheet>
20
 
                                <paraStyle name="name" fontName="Helvetica-Bold" fontSize="16" alignment="center"/>
21
 
                                <paraStyle name="cost-name" fontName="Helvetica-BoldOblique" fontSize="10" alignment="RIGHT"/>
22
 
                                <blockTableStyle id="products">
23
 
                                         <blockAlignment value="RIGHT" start="2,0" stop="-1,-1"/>
24
 
                                         <lineStyle kind="LINEBELOW" start="0,0" stop="-1,0"/>
25
 
                                         <lineStyle kind="LINEABOVE" start="0,-1" stop="-1,-1"/>
26
 
                                         <blockFont name="Helvetica-BoldOblique" size="11" start="0,0" stop="-1,0"/>
27
 
                                         <blockValign value="TOP"/>
28
 
                                </blockTableStyle>
29
 
                        </stylesheet>
30
 
 
31
 
                        <story>
32
 
                                <xsl:apply-templates select="auctions"/>
33
 
                        </story>
34
 
                </document>
35
 
        </xsl:template>
36
 
 
37
 
        <xsl:template match="auctions">
38
 
                <para style="name"><xsl:value-of select="title"/></para>
39
 
                <xsl:variable name="colWidths">
40
 
                        <xsl:choose>
41
 
                                <xsl:when test="count(//cost-index)=0">1.5cm,7.5cm,1cm,2.2cm,2cm</xsl:when>
42
 
                                <xsl:otherwise>
43
 
                                        <xsl:text>1.5cm,7.5cm,1cm,2.2cm</xsl:text>
44
 
                                        <xsl:for-each select="//cost-index">
45
 
                                                <xsl:text>,2cm</xsl:text>
46
 
                                        </xsl:for-each>
47
 
                                        <xsl:text>,2cm</xsl:text>
48
 
                                </xsl:otherwise>
49
 
                        </xsl:choose>
50
 
                </xsl:variable>
51
 
 
52
 
                <spacer length="1cm"/>
53
 
                
54
 
                <blockTable style="products" repeatRows="1"> 
55
 
                        <xsl:attribute name="colWidths">
56
 
                                <xsl:value-of select="$colWidths"/>
57
 
                        </xsl:attribute>
58
 
                        
59
 
                        <tr>
60
 
                                <td t="1">Buyer</td>
61
 
                                <td/>
62
 
                                <td t="1">Adj.</td>
63
 
                                <xsl:for-each select="//cost-index">
64
 
                                        <xsl:sort select="id" data-type="number"/>
65
 
                                        <td><para style="cost-name"><xsl:value-of select="name"/></para></td>
66
 
                                </xsl:for-each>
67
 
                                <td><para style="cost-name" t="1">To pay</para></td>
68
 
                                <td><para style="cost-name" t="1">Already paid</para></td>
69
 
                        </tr>
70
 
                        
71
 
                        <xsl:apply-templates select="buyers">
72
 
                                <xsl:sort select="login" order="ascending" data-type="number"/>
73
 
                                <xsl:sort select="name" order="ascending"/>
74
 
                        </xsl:apply-templates>
75
 
                        
76
 
                        <tr>
77
 
                                <td/>
78
 
                                <td><para><b t="1">Total:</b></para></td>
79
 
                                <td><xsl:value-of select="sum(buyers/product/price)"/></td>
80
 
                                <xsl:for-each select="//cost-index">
81
 
                                        <xsl:sort select="id" data-type="number"/>
82
 
                                        <xsl:variable name="cost_id" select="id"/>
83
 
                                        <td><xsl:value-of select="format-number(sum(//buyers/product/cost[id=$cost_id]/amount), '#,##0.00')"/></td>
84
 
                                </xsl:for-each>
85
 
                                <td><xsl:value-of select="sum(buyers/product[payment = '']/price) + sum(buyers/product[payment = '']/cost/amount)"/></td>
86
 
                                <td><xsl:value-of select="sum(buyers/product[payment !='']/price) + sum(buyers/product[payment !='']/cost/amount)"/></td>
87
 
                        </tr>
88
 
                </blockTable>
89
 
        </xsl:template>
90
 
 
91
 
        <xsl:template match="buyers">
92
 
                <xsl:variable name="buyer_id" select="id"/>
93
 
                <tr>
94
 
                        <td><xsl:value-of select="login"/></td>
95
 
                        <td><xsl:value-of select="name"/></td>
96
 
                        <td><xsl:value-of select="sum(product/price)"/></td>
97
 
                        <xsl:for-each select="//cost-index">
98
 
                                <xsl:sort select="id" data-type="number"/>
99
 
                                <xsl:variable name="cost_id" select="id"/>
100
 
                                <td><xsl:value-of select="sum(//buyers[id=$buyer_id]/product/cost[id=$cost_id]/amount)"/></td>
101
 
                        </xsl:for-each>
102
 
                        <td><xsl:value-of select="sum(product[payment = '']/price) + sum(product[payment = '']/cost/amount)"/></td>
103
 
                        <td><xsl:value-of select="sum(product[payment !='']/price) + sum(product[payment !='']/cost/amount)"/></td>
104
 
                </tr>
105
 
        </xsl:template>
106
 
 
107
 
</xsl:stylesheet>