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">
4
<xsl:template match="/">
5
<xsl:apply-templates select="achat-listing"/>
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">
13
<drawRightString x="19.0cm" y="26.0cm"><xsl:value-of select="date"/></drawRightString>
15
<frame id="col1" x1="2.0cm" y1="2.5cm" width="17.0cm" height="22.7cm"/>
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"/>
32
<xsl:apply-templates select="auctions"/>
37
<xsl:template match="auctions">
38
<para style="name"><xsl:value-of select="title"/></para>
39
<xsl:variable name="colWidths">
41
<xsl:when test="count(//cost-index)=0">1.5cm,7.5cm,1cm,2.2cm,2cm</xsl:when>
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>
47
<xsl:text>,2cm</xsl:text>
52
<spacer length="1cm"/>
54
<blockTable style="products" repeatRows="1">
55
<xsl:attribute name="colWidths">
56
<xsl:value-of select="$colWidths"/>
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>
67
<td><para style="cost-name" t="1">To pay</para></td>
68
<td><para style="cost-name" t="1">Already paid</para></td>
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>
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>
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>
91
<xsl:template match="buyers">
92
<xsl:variable name="buyer_id" select="id"/>
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>
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>