-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCreateReport.xslt
162 lines (144 loc) · 3.6 KB
/
CreateReport.xslt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="timesheet/projects">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><xsl:value-of select="/timesheet/summary/@title"/> [<xsl:value-of select="/timesheet/summary/@start"/> - <xsl:value-of select="/timesheet/summary/@end"/>]</title>
<style>
@media print {
table {
width: 95%;
}
input[id^="sum"]
{
border:0px;
}
}
body
{
font-family: Arial;
}
table
{
padding: 2pt;
}
tr
{
vertical-align:top;
border: 1px solid silver;
}
.comment
{
color: silver;
font-style:italic;
}
th
{
text-align:left;
}
thead th
{
border-bottom: 1px solid gray;
}
tfoot th
{
border-top: 1px solid gray;
}
tr
{
}
td.details {
font-size: 10pt;
}
div.p
{
page-break-after:always;
background: top right no-repeat
}
.nobr { white-space:nowrap; font-size: 75%; }
tr.nobr
{
vertical-align: bottom;
}
thead < tr
{
border-bottom: 1px solid silver;
}
input
{
border: 1px silver solid;
text-align:right;
}
</style>
</head>
<body>
<!-- details for every project -->
<xsl:apply-templates select="/timesheet/projects/project" mode="projects-details"/>
</body></html>
</xsl:template>
<xsl:template match="timesheet/projects/project" mode="projects-details">
<xsl:variable name="projectKey"><xsl:value-of select="@key"/></xsl:variable>
<div class="p"><xsl:attribute name="id">project_<xsl:value-of select="@key"/></xsl:attribute>
<h1><xsl:value-of select="@title"/></h1>
<xsl:if test="properties/p/@key='AP'">
<u>Ansprechpartner:</u>  <xsl:value-of select="properties/p[@key='AP']/@value"/>  
</xsl:if>
<xsl:if test="properties/p/@key='ORDER'">
<u>Bestellung:</u>
  <xsl:value-of select="properties/p[@key='ORDER']/@value"/>
</xsl:if>
<p/>
<table><xsl:attribute name="id">tblAp<xsl:value-of select="$projectKey"/></xsl:attribute>
<thead>
<tr>
<th>Von</th>
<th>Bis</th>
<th style="text-align: right;">Dauer [h]</th>
<th>Beschreibung</th>
</tr>
</thead>
<tbody>
<tr>
<xsl:apply-templates select="/timesheet/entries/entry[@key=$projectKey]" mode="inTable"/>
</tr>
</tbody>
<tfoot>
<tr>
<th colspan="2" style="text-align:right">Summe [h]</th>
<th style="text-align:right;" name="sum"><xsl:attribute name="id"><xsl:value-of select="$projectKey"/>_sum</xsl:attribute><xsl:value-of select="format-number((sum(/timesheet/entries/entry[@key=$projectKey]/@minutes) div 60),'0.00')"/></th>
<th style="text-align:right;" colspan="2"> </th>
</tr>
</tfoot>
</table>
</div>
</xsl:template>
<xsl:template match="timesheet/entries/entry" mode="inTable">
<tr>
<td class="nobr"><xsl:value-of select="@from"/></td>
<td class="nobr"><xsl:value-of select="@to"/></td>
<td align="right"><xsl:value-of select="format-number((@minutes div 60), '0.00')"/></td>
<td>
<xsl:choose>
<xsl:when test="@link">
<a>
<xsl:attribute name="href"><xsl:value-of select="@link"/></xsl:attribute>
<xsl:attribute name="target">calendar</xsl:attribute>
<xsl:value-of select="@subject"/>
</a>
</xsl:when>
<xsl:otherwise><xsl:value-of select="@subject"/></xsl:otherwise>
</xsl:choose>
</td>
</tr>
<xsl:if test="details">
<tr valign="top">
<td colspan="3"></td>
<td class="details"><xsl:value-of select="details"/></td>
</tr>
</xsl:if>
</xsl:template>
<!-- default handler for elements containing text -->
<xsl:template match="text()"/>
</xsl:stylesheet>