<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" version="1.0">
	<xsl:import href="../../../appl/shared/default.xsl"/>
	<xsl:variable name="Rev">
		<!-- Revision van deze cust.xsl -->
		<xsl:value-of select="substring(translate('$Revision$', '$ ', ''), 10)"/>
	</xsl:variable>

	<xsl:template name="pageheader">
		<table border="0" width="100%">
			<tr>
				<td width="33%"></td>
				<td width="34%"></td>
				<td width="33%" valign="bottom" style="text-align:right">
					<xsl:choose>
						<xsl:when test="$mode='email'"><img src="cid:tmpl_logo.gif"/></xsl:when>
						<xsl:otherwise><xsl:element name="img"><xsl:attribute name="src">../../cust/<xsl:value-of select="//header/custId"/>/tmpl_logo.gif</xsl:attribute></xsl:element></xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
		</table>
	</xsl:template>

	<xsl:template match="melding" mode="include">
		<xsl:variable name="sysdate">
			<xsl:value-of select="../header/dateYear"/>
			<xsl:value-of select="../header/dateMonth"/>
			<xsl:value-of select="../header/dateDay"/>
		</xsl:variable>
		<xsl:variable name="planned">
			<xsl:value-of select="datum_gepland/jaar"/>
			<xsl:value-of select="datum_gepland/maand"/>
			<xsl:value-of select="datum_gepland/dag"/>
		</xsl:variable>
		<table border="0" width="100%" cellpadding="2">
			<xsl:choose>
				<!--==============================================-->
				<!-- Vakgroep 721=Incident                        -->
				<!--==============================================-->
				<xsl:when test="discipline/key='721'">
					<tr><td colspan="4"><b>INCIDENTEN RAPPORT</b></td></tr>
					<tr height="30px"><td colspan="4"/></tr>
					<tr>
						<td width="10%">Incidentnummer</td>
						<td width="40%">: <xsl:value-of select="key"/></td>
						<td colspan="2"/>
					</tr>
					<tr>
						<td width="10%">Melding</td>
						<td width="40%">: <xsl:value-of select="stdmelding/omschrijving"/></td>
						<td width="10%">Locatie</td>
						<td width="40%">: <xsl:value-of select="plaats/regio/district/locatie/gebouw/naam"/></td>
					</tr>
					<tr>
						<td>Datum</td>
						<td>: <xsl:value-of select="gemeld/datum"/><xsl:text> </xsl:text><xsl:value-of select="gemeld/tijd"/></td>
						<td>Verdieping</td>
						<td>: <xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/omschrijving"/></td>
					</tr>
					<tr>
						<td>Melder</td>
						<td>: <xsl:value-of select="voor/naam_full"/></td>
						<td>Ruimte</td>
						<td>: <xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"/><xsl:if test="plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving!=plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"> (<xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/>)</xsl:if>
						</td>
					</tr>
					<tr height="30px"><td colspan="4"/></tr>
					<xsl:comment>als we binnen een opdracht zijn, tonen we de meldingtekst niet</xsl:comment>
					<tr><td colspan="4">Omschrijving:</td></tr>
					<tr><td colspan="4" style="border:1px solid black;padding:3px"><xsl:call-template name="linebreaks"><xsl:with-param name="string" select="omschrijving"/></xsl:call-template></td></tr>
				</xsl:when>
				<!--==============================================-->
				<!-- Vakgroep 741=KTO                             -->
				<!--==============================================-->
				<!--xsl:when test="discipline/key='741'">
					<tr>
						<td colspan="2" style="padding-top:20px">
							<b>Bevestiging afhandeling melding</b>
						</td>
					</tr>
					<tr>
						<td colspan="4" style="padding-bottom:20px">
							<b>Meldingsnummer: <xsl:value-of select="key"/></b>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>Geachte Huurder,
							<br/>
							<br/>Hiermee bevestigen wij dat onderstaande melding op <xsl:value-of select="tracking/track[code='MLDAFM']/datum/datum"/> om <xsl:value-of select="tracking/track[code='MLDAFM']/datum/tijd"/> is afgehandeld.
						</td>
					</tr>
					<tr><td colspan="4"><br/></td></tr>
					<tr>
						<td>
							<table>
								<tr>
									<td colspan="4">Omschrijving</td>
									<td>:</td>
									<td><xsl:value-of select="stdmelding/omschrijving"/></td>
								</tr>
								<tr>
									<td colspan="4"></td>
									<td>&#xA0;</td>
									<td><xsl:value-of select="omschrijving"/></td>
								</tr>
								<tr>
									<td colspan="4" style="padding-top:20px">Afhandeling</td>
									<td style="padding-top:20px">:</td>									
									<td style="padding-top:20px"><xsl:value-of select="opdracht/opmerking"/></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr><td colspan="4"><br/></td></tr>
					<tr>
						<xsl:choose>
							<xsl:when test="kostenplaats/nr='WTC'">
								<td colspan="4">Indien deze melding kosten met zich meebrengt worden deze niet aan u doorbelast</td>
							</xsl:when>
							<xsl:otherwise>
								<td colspan="4">Indien deze melding kosten met zich meebrengt worden deze direct door de leverancier aan u doorbelast.</td>
							</xsl:otherwise>
						</xsl:choose>
					</tr>
					<tr><td colspan="4"><br/></td></tr>
					<tr>
						<td colspan="4">
Mocht u vragen hebben over deze opdracht kunt contact op nemen met het WTC Servicepoint via <u>info@wtcservicepoint.com</u> of 020-575 2000. Voor een snelle afhandeling vragen wij uw opdrachtnummer bij de hand te houden.
						</td>
					</tr>
					<tr><td colspan="4"><br/><br/></td></tr>
					<tr><td colspan="4">Met vriendelijke groet,<br/>WTC Servicepoint</td></tr>
					<tr><td><br/><br/><br/></td></tr>
					<tr>
						<td colspan="2" style="padding-top:20px">
							<b>Call handling confirmation</b>
						</td>
					</tr>
					<tr>
						<td colspan="4" style="padding-bottom:20px">
							<b>Call number: <xsl:value-of select="key"/></b>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>Dear Tenant,
							<br/>
							<br/>We hereby inform you that your call is completed on <xsl:value-of select="tracking/track[code='MLDAFM']/datum/datum"/> at <xsl:value-of select="tracking/track[code='MLDAFM']/datum/tijd"/>.
						</td>
					</tr>
					<tr><td colspan="4"><br/></td></tr>
					<tr>
						<td>
							<table>
								<tr>
									<td colspan="4">Description</td>
									<td>:</td>
									<td><xsl:value-of select="stdmelding/omschrijving"/></td>
								</tr>
								<tr>
									<td colspan="4"></td>
									<td>&#xA0;</td>
									<td><xsl:value-of select="omschrijving"/></td>
								</tr>
								<tr>
									<td colspan="4" style="padding-top:20px">Handling</td>
									<td style="padding-top:20px">:</td>									
									<td style="padding-top:20px"><xsl:value-of select="opdracht/opmerking"/></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr><td colspan="4"><br/></td></tr>
					<tr>
						<xsl:choose>
							<xsl:when test="kostenplaats/nr='WTC'">
								<td colspan="4">If this call results in any costs, they will not be charged to you.</td>
							</xsl:when>
							<xsl:otherwise>
								<td colspan="4">If this call results in any costs, they will be charged to you directly by the supplier.</td>
							</xsl:otherwise>
						</xsl:choose>
					</tr>
					<tr><td colspan="4"><br/></td></tr>
					<tr>
						<td colspan="4">
if you have any questions about your call, please contact the WTC Servicepoint via <u>info@wtcservicepoint.com</u> or on 020-575 2000. Please refer to the call number in all communications about this call.
						</td>
					</tr>
					<tr><td colspan="4"><br/><br/></td></tr>
					<tr><td colspan="4">Kind regards,<br/>WTC Servicepoint</td></tr>
				</xsl:when-->
				<!--==============================================-->
				<!-- MLDACP = Acceptatie melding                  -->
				<!--==============================================-->
				<xsl:when test="$srtnotificatiecode='MLDACP'">
					<tr>
						<td colspan="2" style="padding-top:20px">
							<b>Bevestiging ontvangst melding</b>
						</td>
					</tr>
					<tr>
						<td colspan="4" style="padding-bottom:20px">
							<b>Meldingsnummer: <xsl:value-of select="key"/></b>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>Geachte Huurder, <br/><br/>Hiermee bevestigen wij de ontvangst van uw melding.</td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td>
							<table>
								<tr>
									<td colspan="35">Datum melding</td>
									<td>:</td>
									<td>
										<xsl:value-of select="gemeld/datum"/>
									</td>
								</tr>
								<tr>
									<td colspan="35">Tijdstip melding</td>
									<td>:</td>
									<td>
										<xsl:value-of select="gemeld/tijd"/>
									</td>
								</tr>
								<tr>
									<td colspan="35">Omschrijving</td>
									<td>:</td>
									<td>
										<xsl:value-of select="stdmelding/omschrijving"/>
									</td>
								</tr>
								<tr>
									<td colspan="35"></td>
									<td>&#xA0;</td>
									<td>
										<xsl:value-of select="omschrijving"/>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>De geplande einddatum voor de afhandeling van uw melding is <xsl:value-of select="einddatum/datum"/>. Uitvoering vindt plaats op werkdagen.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
						</td>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="kostenplaats/nr='WTC'">
								<td colspan="4">Indien deze melding kosten met zich meebrengt worden deze niet aan u doorbelast</td>
							</xsl:when>
							<xsl:otherwise>
								<td colspan="4">Indien deze melding kosten met zich meebrengt worden deze direct door de leverancier aan u doorbelast.</td>
							</xsl:otherwise>
						</xsl:choose>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">Mocht u vragen hebben over deze melding kunt contact op nemen met het WTC Servicepoint via <u>info@wtcservicepoint.com</u> of 020-575 2000. Voor een snelle afhandeling vragen wij uw meldingsnummer bij de hand te houden.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">Met vriendelijke groet,<br/>
          WTC Servicepoint</td>
					</tr>
					<tr>
						<td>
							<br/>
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="padding-top:20px">
							<b>Call receipt confirmation</b>
						</td>
					</tr>
					<tr>
						<td colspan="4" style="padding-bottom:20px">
							<b>Call number: <xsl:value-of select="key"/></b>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>Dear Tenant, <br/><br/>We hereby confirm receipt of your call.</td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td>
							<table>
								<tr>
									<td colspan="35">Date of call</td>
									<td>:</td>
									<td>
										<xsl:value-of select="gemeld/datum"/>
									</td>
								</tr>
								<tr>
									<td colspan="35">Time of call</td>
									<td>:</td>
									<td>
										<xsl:value-of select="gemeld/tijd"/>
									</td>
								</tr>
								<tr>
									<td colspan="35">Description</td>
									<td>:</td>
									<td>
										<xsl:value-of select="stdmelding/omschrijving"/>
									</td>
								</tr>
								<tr>
									<td colspan="35"></td>
									<td>&#xA0;</td>
									<td>
										<xsl:value-of select="omschrijving"/>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>The scheduled end date for your call is <xsl:value-of select="einddatum/datum"/>. Any work will be done during working hours.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
						</td>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="kostenplaats/nr='WTC'">
								<td colspan="4">If this call results in any costs, they will not be charged to you.</td>
							</xsl:when>
							<xsl:otherwise>
								<td colspan="4">If this call results in any costs, they will be charged to you directly by the supplier</td>
							</xsl:otherwise>
						</xsl:choose>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">If you have questions about your call, please contact the WTC Servicepoint via <u>info@wtcservicepoint.com</u> or on 020-575 2000. Please refer to the call number in all communications about this call.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">Kind regards,<br/>
          WTC Servicepoint</td>
					</tr>
				</xsl:when>
				<!--==============================================-->
				<!-- MLDAFM = Afmelden melding                    -->
				<!--==============================================-->
				<xsl:when test="$srtnotificatiecode='MLDAFM'">
					<tr>
						<td colspan="2" style="padding-top:20px">
							<b>Bevestiging afhandeling melding</b>
						</td>
					</tr>
					<tr>
						<td colspan="4" style="padding-bottom:20px">
							<b>Meldingsnummer: <xsl:value-of select="key"/></b>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>Geachte Huurder,
							<br/>
							<br/>Hiermee bevestigen wij dat onderstaande melding op <xsl:value-of select="tracking/track[code='MLDAFM']/datum/datum"/> om <xsl:value-of select="tracking/track[code='MLDAFM']/datum/tijd"/> is afgehandeld.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
						</td>
					</tr>
					<tr>
						<td>
							<table>
								<tr>
									<td colspan="4">Omschrijving</td>
									<td>:</td>
									<td>
										<xsl:value-of select="stdmelding/omschrijving"/>
									</td>
								</tr>
								<tr>
									<td colspan="4"></td>
									<td>&#xA0;</td>
									<td>
										<xsl:value-of select="omschrijving"/>
									</td>
								</tr>
								<tr>
									<td colspan="4" style="padding-top:20px">Afhandeling</td>
									<td style="padding-top:20px">:</td>									
									<td style="padding-top:20px">
										<xsl:value-of select="opdracht/opmerking"/>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
						</td>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="kostenplaats/nr='WTC'">
								<td colspan="4">Indien deze melding kosten met zich meebrengt worden deze niet aan u doorbelast</td>
							</xsl:when>
							<xsl:otherwise>
								<td colspan="4">Indien deze melding kosten met zich meebrengt worden deze direct door de leverancier aan u doorbelast.</td>
							</xsl:otherwise>
						</xsl:choose>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">Mocht u vragen hebben over deze opdracht kunt contact op nemen met het WTC Servicepoint via <u>info@wtcservicepoint.com</u> of 020-575 2000. Voor een snelle afhandeling vragen wij uw opdrachtnummer bij de hand te houden.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">Met vriendelijke groet,<br/>
          WTC Servicepoint</td>
					</tr>
					<tr>
						<td>
							<br/>
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="padding-top:20px">
							<b>Call handling confirmation</b>
						</td>
					</tr>
					<tr>
						<td colspan="4" style="padding-bottom:20px">
							<b>Call number: <xsl:value-of select="key"/></b>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>Dear Tenant,
							<br/>
							<br/>We hereby inform you that your call is completed on <xsl:value-of select="tracking/track[code='MLDAFM']/datum/datum"/> at <xsl:value-of select="tracking/track[code='MLDAFM']/datum/tijd"/>.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
						</td>
					</tr>
					<tr>
						<td>
							<table>
								<tr>
									<td colspan="4">Description</td>
									<td>:</td>
									<td>
										<xsl:value-of select="stdmelding/omschrijving"/>
									</td>
								</tr>
								<tr>
									<td colspan="4"></td>
									<td>&#xA0;</td>
									<td>
										<xsl:value-of select="omschrijving"/>
									</td>
								</tr>
								<tr>
									<td colspan="4" style="padding-top:20px">Handling</td>
									<td style="padding-top:20px">:</td>									
									<td style="padding-top:20px">
										<xsl:value-of select="opdracht/opmerking"/>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
						</td>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="kostenplaats/nr='WTC'">
								<td colspan="4">If this call results in any costs, they will not be charged to you.</td>
							</xsl:when>
							<xsl:otherwise>
								<td colspan="4">If this call results in any costs, they will be charged to you directly by the supplier.</td>
							</xsl:otherwise>
						</xsl:choose>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">If you have any questions about your call, please contact the WTC Servicepoint via <u>info@wtcservicepoint.com</u> or on 020-575 2000. Please refer to the call number in all communications about this call.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">Kind regards,<br/>
          WTC Servicepoint</td>
					</tr>
				</xsl:when>
				<!--==============================================-->
				<!-- TE LAAT = Als sysdate >= geplande einddatum en melding is nog niet afgesloten-->
				<!--==============================================-->
				<xsl:when test="$sysdate>=$planned and status_key!=1 and status_key!=5 and status_key!=6">
					<tr>
						<td colspan="2" style="padding-top:20px">
							<b>Status melding</b>
						</td>
					</tr>
					<tr>
						<td colspan="4" style="padding-bottom:20px">
							<b>Meldingsnummer: <xsl:value-of select="key"/></b>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>Geachte Huurder, <br/><br/>Wij hebben op <xsl:value-of select="gemeld/datum"/> de volgende melding van u ontvangen:</td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td>
							<table>
								<tr>
									<td colspan="35">Omschrijving</td>
									<td>:</td>
									<td>
										<xsl:value-of select="stdmelding/omschrijving"/>
									</td>
								</tr>
								<tr>
									<td colspan="35"></td>
									<td>&#xA0;</td>
									<td>
										<xsl:value-of select="omschrijving"/>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>Helaas is bovenstaande melding om de volgende reden nog niet afgehandeld:
							<br/>
							<br/>"<xsl:value-of select="opmerking"/>"</td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>U kunt de status van uw melding ook online volgen via: <A HREF="http://wtca.facilitor.nl">wtca.facilitor.nl</A></td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">Mocht u nog vragen hebben over deze melding, of nog niet beschikken over een inlogcode voor het online WTC meldsysteem, neem dan contact met ons op via <A HREF="mailto:info@wtcservicepoint.com">info@wtcservicepoint.com</A> of 020-575 2000.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">Met vriendelijke groet,<br/><br/>
          WTC Servicepoint</td>
					</tr>
					<tr>
						<td>
							<br/>
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="padding-top:20px">
							<b>Call status report</b>
						</td>
					</tr>
					<tr>
						<td colspan="4" style="padding-bottom:20px">
							<b>Call number: <xsl:value-of select="key"/></b>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>Dear Tenant, <br/><br/>We hereby acknowledge the receipt of your call, which was send to us on <xsl:value-of select="gemeld/datum"/>:</td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td>
							<table>
								<tr>
									<td colspan="35">Description</td>
									<td>:</td>
									<td>
										<xsl:value-of select="stdmelding/omschrijving"/>
									</td>
								</tr>
								<tr>
									<td colspan="35"></td>
									<td>&#xA0;</td>
									<td>
										<xsl:value-of select="omschrijving"/>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>Unfortunately, your call has not been completed because of:
							<br/>
							<br/>"<xsl:value-of select="opmerking"/>"</td>
					</tr>
					<tr>
						<td colspan="4"></td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>You can also check the status of your call online via: <A HREF="http://wtca.facilitor.nl">wtca.facilitor.nl</A></td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">If you have additional questions, or if you do not have a login code for the online WTC call system, please contact us via <A HREF="mailto:info@wtcservicepoint.com">info@wtcservicepoint.com</A> or 020-575 2000.</td>
					</tr>
					<tr>
						<td colspan="4">
							<br/>
							<br/>
						</td>
					</tr>
					<tr>
						<td colspan="4">Kind regards,<br/><br/>
          WTC Servicepoint</td>
					</tr>
				</xsl:when>
				<!--==============================================-->
				<!-- DEFAULT MELDING                              -->
				<!--==============================================-->
				<xsl:otherwise>
					<tr>
						<td width="16%"><b>Aanvrager:</b></td>
						<td width="34%"><xsl:value-of select="voor/naam_full"/></td>
						<td width="16%"><b>Telefoon:</b></td>
						<td width="34%"><xsl:if test="voor/telefoonnr=''">-</xsl:if><xsl:value-of select="voor/telefoonnr"/></td>
					</tr>
					<tr>
						<td><b>Locatie:</b></td>
						<td>
							<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/code"/>&#xA0;
							<xsl:if test="voor/werkplek/plaats/regio/district/locatie/omschrijving!=''">(<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/omschrijving"/>)</xsl:if>
						</td>
						<td><b>Afdeling:</b></td>
						<td><xsl:value-of select="voor/afdeling/omschrijving"/></td>
					</tr>
					<tr>
						<td><b>Werkplek:</b></td>
						<td>
							<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/code"/>-<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/naam"/><br/>
							<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/code"/>.<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"/>&#xA0;
							<xsl:if test="voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving!=''">(<xsl:value-of select="voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/>)</xsl:if>
						</td>
						<!-- Vakgroeptype HR=61 met personeelsnummer -->
						<td><xsl:if test="discipline/srtdiscipline/key='61'"><b>Personeelsnr.:</b></xsl:if></td>
						<td><xsl:if test="discipline/srtdiscipline/key='61'"><xsl:value-of select="voor/nr"/></xsl:if></td>
					</tr>
					<tr><td colspan="4"><hr/></td></tr>
					<tr>
						<td><b>Locatie:</b></td>
						<td>
							<xsl:value-of select="plaats/regio/district/locatie/code"/>&#xA0;
							<xsl:if test="plaats/regio/district/locatie/omschrijving!=''">(<xsl:value-of select="plaats/regio/district/locatie/omschrijving"/>)</xsl:if>
						</td>
						<td><b>Melddatum:</b></td>
						<td><xsl:value-of select="gemeld/datum"/>&#xA0;<xsl:value-of select="gemeld/tijd"/></td>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="plaats/@type='T'">
								<td><b>Terrein:</b></td>
								<td><xsl:value-of select="plaats/regio/district/locatie/terrein/code"/>-<xsl:value-of select="plaats/regio/district/locatie/terrein/naam"/></td>
							</xsl:when>
							<xsl:otherwise>
								<td><b>Gebouw:</b></td>
								<td><xsl:value-of select="plaats/regio/district/locatie/gebouw/code"/>-<xsl:value-of select="plaats/regio/district/locatie/gebouw/naam"/></td>
							</xsl:otherwise>
						</xsl:choose>
						<td><b>Ordernr:</b></td>
						<td><xsl:value-of select="kenmerk[@naam='Ordernr']"/></td>
					</tr>
					<tr>
						<xsl:if test="plaats/@type='T' or plaats/@type='G'">
							<td colspan="2"/>
						</xsl:if>
						<xsl:if test="plaats/@type!='T' and plaats/@type!='G'">
							<td><b>Bouwlaag:</b></td>
							<td>
								<xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/code"/>&#xA0;
								<xsl:if test="plaats/regio/district/locatie/gebouw/verdieping/omschrijving!=''">(<xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/omschrijving"/>)</xsl:if>
							</td>
						</xsl:if>
						<td><b>Uitvoertijd:</b></td>
						<td>
							<xsl:value-of select="uitvoertijd"/>
							<xsl:choose>
							  <xsl:when test="uitvoertijd[@eenheid='U']">&#160;<xsl:value-of select="//lcl/MLD/uren"/></xsl:when>
							  <xsl:otherwise>&#160;<xsl:value-of select="//lcl/FAC/dagen"/></xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<xsl:if test="plaats/@type='R'">
							<td><b>Ruimte:</b></td>
							<td>
								<xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"/>&#xA0;
								<xsl:if test="plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving!=''">(<xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/>)</xsl:if>
							</td>
						</xsl:if>
						<xsl:if test="plaats/@type!='R'">
							<td colspan="2"/>
						</xsl:if>
						<td><b>Status:</b></td>
						<td><xsl:value-of select="status"/></td>
					</tr>
					<tr height="30px"><td colspan="4"/></tr>
					<tr>
						<td><b>Melding:</b></td>
						<td><xsl:if test="stdmelding/omschrijving=''">-</xsl:if><xsl:value-of select="stdmelding/omschrijving"/></td>
						<td><b>Vakgroep:</b></td>
						<td><xsl:if test="discipline/omschrijving=''">-</xsl:if><xsl:value-of select="discipline/omschrijving"/></td>
					</tr>
			    <xsl:choose>
    				<xsl:when test="discipline/key='741'">
		    			<xsl:for-each select="kenmerk[@type!='Q']">
				    		<xsl:sort select="@volgnummer" data-type="number"/>
			          <xsl:choose>
    				      <xsl:when test="@type!='L' and @volgnummer&lt;10">
							      <tr>
								      <td><b><xsl:value-of select="@naam"/>:</b></td>
								      <td colspan="3"><xsl:value-of select="."/></td>
							      </tr>
				          </xsl:when>
    				      <xsl:when test="@type!='L' and @volgnummer&gt;9">
							      <tr>
								      <td><b><xsl:value-of select="substring-after(@naam, ' ')"/>:</b></td>
								      <td colspan="3"><xsl:value-of select="."/></td>
							      </tr>
				          </xsl:when>
				          <xsl:otherwise>
							      <tr><td colspan="4"><b><xsl:value-of select="@naam"/><br/><xsl:value-of select="." disable-output-escaping="yes"/></b></td></tr>
				          </xsl:otherwise>
			          </xsl:choose>
					    </xsl:for-each>
				    </xsl:when>
				    <xsl:otherwise>
					    <tr>
						    <td><b>Omschrijving:</b></td>
						    <td colspan="3"><xsl:call-template name="linebreaks"><xsl:with-param name="string" select="omschrijving"/></xsl:call-template></td>
					    </tr>
		    			<xsl:for-each select="kenmerk[@type!='L' and @type!='Q']">
				    		<xsl:sort select="@volgnummer" data-type="number"/>
							  <tr>
								  <td><b><xsl:value-of select="@naam"/>:</b></td>
								  <td colspan="3"><xsl:value-of select="."/></td>
							  </tr>
					    </xsl:for-each>
				    </xsl:otherwise>
			    </xsl:choose>
					<xsl:if test="count(deel)&gt;0">
						<xsl:for-each select="deel">
							<xsl:sort select="omschrijving"/>
							<tr>
								<xsl:choose>
									<xsl:when test="position()=1"><td><b>Objecten:</b></td></xsl:when>
									<xsl:otherwise><td/></xsl:otherwise>
								</xsl:choose>
								<td><xsl:value-of select="omschrijving"/></td>
								<td colspan="2"><xsl:comment>NADER TE DEFINIEREN</xsl:comment></td>
							</tr>
						</xsl:for-each>
					</xsl:if>
					<xsl:if test="opmerking!=''">
						<tr>
							<td><b>Opmerking:</b></td>
							<td colspan="3"><xsl:call-template name="linebreaks"><xsl:with-param name="string" select="opmerking"/></xsl:call-template></td>
						</tr>
					</xsl:if>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>

	<xsl:template match="melding" mode="full">
		<xsl:choose>
			<xsl:when test="$mode='summary'"></xsl:when>
			<xsl:otherwise>
				<html>
					<xsl:comment>Based on FACILITOR default XSL template for melding</xsl:comment>
					<xsl:call-template name="htmlhead"/>
					<xsl:element name="body">
						<xsl:if test="$mode!='email'"><xsl:attribute name="onload">window.print();</xsl:attribute></xsl:if>
						<xsl:choose>
							<xsl:when test="stdmelding/key='3041'">
								<xsl:call-template name="pageheader"/>
								<p>Dienstrapport van <xsl:value-of select="melder/naam_full"/></p>
								<table cellspacing="2">
									<tr>
										<td>Rapport aangemaakt: </td>
										<td><xsl:value-of select="begindatum/datum"/>&#160;<xsl:value-of select="begindatum/tijd"/></td>
									</tr>
									<xsl:for-each select="tracking/track">
										<xsl:if test="code='MLDAFM'">
											<tr>
												<td>Rapport afgesloten: </td>
												<td><xsl:value-of select="datum/datum"/>&#160;<xsl:value-of select="datum/tijd"/></td>
											</tr>
										</xsl:if>
									</xsl:for-each>
								</table>
								<hr/>
								<table cellspacing="10">
									<xsl:for-each select="notes/note">
										<tr><td><xsl:call-template name="linebreaks"><xsl:with-param name="string" select="omschrijving"/></xsl:call-template></td></tr>
									</xsl:for-each>
								</table>
								<xsl:call-template name="pagefooter"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:call-template name="pageheader"/>
								<xsl:choose>
									<xsl:when test="$srtnotificatiecode = 'MLDKTO'"><xsl:apply-templates select="." mode="kto"/></xsl:when>
									<xsl:otherwise><xsl:apply-templates select="." mode="include"/></xsl:otherwise>
								</xsl:choose>
								<xsl:call-template name="pagefooter"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:element>
				</html>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="opdracht" mode="include">
		<table border="0" width="100%" cellpadding="2">
			<xsl:choose>
				<!--==============================================-->
				<!-- Altijd = Opdracht naar externe leverancier   -->
				<!--==============================================-->
				<xsl:when test="1=1">
					<tr><td colspan="4" style="padding-top:20px"><br/>Geachte heer, mevrouw,</td></tr>
					<tr><td colspan="4"><br/><br/>Hierbij ontvangt u een opdracht ten behoeve van het World Trade Center Amsterdam.</td></tr>
					<tr>
						<td colspan="2">
							<table>
								<tr>
						      <td>Opdrachtnummer</td>
						      <td>:</td>
						      <td><xsl:value-of select="melding/discipline/srtdiscipline/prefix"/><xsl:value-of select="melding_key"/></td>
								</tr>
								<tr>
						      <td>Melder</td>
						      <td>:</td>
						      <td><xsl:value-of select="melding/voor/naam"/><xsl:if test="melding/voor/kenmerk[@key=1361]!='' and kostenplaats/key!=361"> [Let op! Onderhuurder]</xsl:if></td>
								</tr>
								<tr>
						      <td>Kostendrager</td>
						      <td>:</td>
						      <td><xsl:value-of select="kostenplaats/nr"/> (<xsl:value-of select="kostenplaats/omschrijving"/>)</td>
								</tr>
								<tr>
						      <td>Melddatum</td>
						      <td>:</td>
						      <td><xsl:value-of select="melding/tracking/track[code='MLDNEW']/datum/datum"/>&#xA0;<xsl:value-of select="melding/tracking/track[code='MLDNEW']/datum/tijd"/></td>
								</tr>
								<tr>
						      <td>Afhandeltijd</td>
						      <td>:</td>
						      <td><xsl:value-of select="melding/uitvoertijd"/>
						      <xsl:choose>
        					    <xsl:when test="melding/uitvoertijd[@eenheid='U']">&#160;<xsl:value-of select="//lcl/MLD/uren"/>
        					    </xsl:when>
        					    <xsl:otherwise>&#160;dag(en)
        					    </xsl:otherwise>
                              </xsl:choose>
                              </td>
								</tr>
								<tr>
						      <td>Omschrijving</td>
						      <td>:</td>
						      <td><xsl:value-of select="melding/stdmelding/omschrijving"/></td>
								</tr>
								<tr>
						      <td></td>
						      <td></td>
						      <td><xsl:value-of select="omschrijving"/></td>
								</tr>
							</table>
						</td>
						<td colspan="2">
							<table>
								<tr>
						      <td>Gebouw</td>
						      <td>: <xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/omschrijving"/></td>
								</tr>
								<tr>
						      <td>Verdieping</td>
						      <td>: <xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/verdieping/omschrijving"/></td>
								</tr>
								<tr>
						      <td>Ruimte</td>
						      <td>: <xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr><td colspan="4"><br/><br/>Voor vragen over deze melding kunt contact opnemen met het WTC Servicepoint op 020-575 2000 of via <u>info@wtcservicepoint.com</u>. Het is van belang dat u uw meldingnummer bij de hand heeft.</td></tr>
					<tr><td colspan="4"><br/><br/>Met vriendelijke groet,<br/>WTC Servicepoint</td></tr>
				</xsl:when>
				<!--==============================================-->
				<!-- DEFAULT OPDRACHT                             -->
				<!--==============================================-->
				<xsl:otherwise></xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>

  <xsl:key name="maanden" match="data_row" use="FCLT_F_MAAND"/>

	<xsl:template match="rapport">
		<style>th {
      border: 1px solid #808080;
    }</style>

		<xsl:if test="@view='wtca_v_rap_freezeopdrachten'">
			<table width="100%" class="rstable" cellpadding="0" cellspacing="0">
				<colgroup>
					<col width="20%"/>
					<col width="10%"/>
					<col width="10%"/>
					<col width="60%"/>
				</colgroup>

				<xsl:if test="count(rapport_data/data_row)=0">
					<tr><td><center><b>Geen gegevens gevonden</b></center></td></tr>
				</xsl:if>

				<xsl:variable name="sorted">
					<xsl:for-each select="rapport_data/data_row">
						<xsl:sort select="FCLT_F_UITVOERENDE"/>
						<xsl:copy-of select="."/>
					</xsl:for-each>
				</xsl:variable>

				<xsl:for-each select="msxml:node-set($sorted)/data_row">
					<xsl:if test="position() = 1">
						<tr>
							<th style="text-align:left">Uitvoerende</th>
							<th style="text-align:center">#Opdrachten</th>
							<th style="text-align:center">Totaal kosten</th>
							<th style="text-align:left">Periode afsluiting</th>
						</tr>
					</xsl:if>

					<tr>
						<td style="text-align:left">
							<xsl:value-of select="FCLT_F_UITVOERENDE"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:center">
							<xsl:value-of select="AANTAL"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="KOSTEN"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<xsl:element name="td">
							<xsl:attribute name="title">Link om opdrachten te bevriezen!</xsl:attribute>
							<xsl:attribute name="style">{ cursor: hand; text-align:left; }</xsl:attribute>
							<xsl:attribute name="onclick">$.post('../../cust/wtca/mld_statusupdate.asp?uv_key=<xsl:value-of select="HIDE_F_BEDRIJF_KEY"/>&amp;uv_naam=<xsl:value-of select="FCLT_F_UITVOERENDE"/>', {}, FcltCallbackRefresh, "json");</xsl:attribute>
							<u>Afsluiten</u>
						</xsl:element>
					</tr>
				</xsl:for-each>
			</table>
		</xsl:if>

		<xsl:if test="@view='wtca_v_rap_lev_perf' or @view='wtca_v_rap_levperf_new'">
			<table class="rstable sortable">
				<xsl:if test="count(rapport_data/data_row)=0">
					<tr><td><center><b>Geen gegevens gevonden</b></center></td></tr>
				</xsl:if>

				<xsl:variable name="van">
				  <xsl:value-of select="substring(substring-after(where,string(&quot;&gt;= to_date(&apos;&quot;)),1,10)"/>
				</xsl:variable>
				<xsl:variable name="tot">
				  <xsl:value-of select="substring(substring-after(where,string(&quot;&lt; to_date(&apos;&quot;)),1,10)"/>
				</xsl:variable>
				<xsl:variable name="sorted">
					<xsl:for-each select="rapport_data/data_row">
						<xsl:sort select="FCLT_F_BEDRIJF"/>
						<xsl:copy-of select="."/>
					</xsl:for-each>
				</xsl:variable>

				<xsl:if test="$mode='print' or $mode='excel'">
					<!--tr><td colspan="7" style="border-width:0px;">Opdrachtafhandeling over de periode: <xsl:value-of select="$van"/> t/m <xsl:value-of select="$tot"/></td></tr-->
					<xsl:choose>
						<xsl:when test="@view='wtca_v_rap_lev_perf'">
						  <tr><td colspan="7" style="border-width:0px;">Opdrachtafhandeling over de AFMELDperiode: <xsl:value-of select="$van"/> t/m <xsl:value-of select="$tot"/></td></tr>
						</xsl:when>
						<xsl:otherwise>
						  <tr><td colspan="7" style="border-width:0px;">Opdrachtafhandeling over de AANMAAKperiode: <xsl:value-of select="$van"/> t/m <xsl:value-of select="$tot"/></td></tr>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>

				<xsl:for-each select="msxml:node-set($sorted)/data_row">
					<xsl:variable name="prev_bedrijf">
						<xsl:choose>
							<xsl:when test="position()=1">Quqelequ</xsl:when>
							<xsl:otherwise><xsl:value-of select="preceding-sibling::data_row[1]/FCLT_F_BEDRIJF"/></xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
          <xsl:variable name="this_bedrijf">
            <xsl:value-of select="FCLT_F_BEDRIJF"/>
          </xsl:variable>
					<xsl:if test="position()=1">
				    <tr>
					    <th><b>Leverancier</b></th>
					    <th style="text-align:right"><b>Afgemelde opdrachten</b></th>
					    <th style="text-align:right"><b>Acceptatie<br/>op tijd (aantal)</b></th>
					    <th style="text-align:right"><b>Acceptatie<br/>op tijd (%)</b></th>
					    <th style="text-align:right"><b>Technische afhandeling<br/>op tijd (aantal)</b></th>
					    <th style="text-align:right"><b>Technische afhandeling<br/>op tijd (%)</b></th>
					    <th style="text-align:right"><b>Technische afhandeling<br/>te laat (%)</b></th>
				    </tr>
					</xsl:if>

          <xsl:variable name="aant_opdr">
            <xsl:value-of select="sum(msxml:node-set($sorted)/data_row[FCLT_F_BEDRIJF=$this_bedrijf]/AANTAL)"/>
          </xsl:variable>
          <xsl:variable name="acp_optijd">
            <xsl:value-of select="sum(msxml:node-set($sorted)/data_row[FCLT_F_BEDRIJF=$this_bedrijf]/ACCEPTATIE_OP_TIJD)"/>
          </xsl:variable>
          <xsl:variable name="afm_optijd">
            <xsl:value-of select="sum(msxml:node-set($sorted)/data_row[FCLT_F_BEDRIJF=$this_bedrijf]/UITVOERING_OP_TIJD)"/>
          </xsl:variable>
					<xsl:choose>
						<!--Als 'this' != 'prev', dan perioderegel gegroepeerd op bedrijf!-->
						<xsl:when test="$this_bedrijf!=$prev_bedrijf">
							<tr>
						    <td><xsl:value-of select="FCLT_F_BEDRIJF"/></td>
						    <td style="text-align:right"><xsl:value-of select="$aant_opdr"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="$acp_optijd"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="format-number(($acp_optijd * 100) div $aant_opdr, '0,00', 'european')"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="$afm_optijd"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="format-number(($afm_optijd * 100) div $aant_opdr, '0,00', 'european')"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="format-number(100 - (($afm_optijd * 100) div $aant_opdr), '0,00', 'european')"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
							</tr>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
				</xsl:for-each>
				<xsl:if test="count(rapport_data/data_row)&gt;0">
					<tr>
						<td/>
						<td style="text-align:right"><b><xsl:value-of select="sum(msxml:node-set($sorted)/data_row/AANTAL)"/></b><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						<td style="text-align:right"/>
						<td style="text-align:right"/>
						<td style="text-align:right"/>
						<td style="text-align:right"/>
						<td style="text-align:right"/>
					</tr>
				</xsl:if>
			</table>
		</xsl:if>

		<xsl:if test="@view='wtca_v_rap_lev_perf_details' or @view='wtca_v_rap_levperf_details_new'">
			<table class="rstable sortable">
				<xsl:if test="count(rapport_data/data_row)=0">
					<tr><td><center><b>Geen gegevens gevonden</b></center></td></tr>
				</xsl:if>

				<xsl:variable name="van">
				  <xsl:value-of select="substring(substring-after(where,string(&quot;&gt;= to_date(&apos;&quot;)),1,10)"/>
				</xsl:variable>
				<xsl:variable name="tot">
				  <xsl:value-of select="substring(substring-after(where,string(&quot;&lt; to_date(&apos;&quot;)),1,10)"/>
				</xsl:variable>
				<xsl:variable name="sorted">
					<xsl:for-each select="rapport_data/data_row">
						<xsl:sort select="FCLT_F_BEDRIJF"/>
						<xsl:sort select="FCLT_F_SLA"/>
						<xsl:copy-of select="."/>
					</xsl:for-each>
				</xsl:variable>

				<xsl:if test="$mode='print' or $mode='excel'">
					<!--tr><td colspan="7" style="border-width:0px;">Opdrachtafhandeling over de periode: <xsl:value-of select="$van"/> t/m <xsl:value-of select="$tot"/></td></tr-->
					<xsl:choose>
						<xsl:when test="@view='wtca_v_rap_lev_perf_details'">
						  <tr><td colspan="7" style="border-width:0px;">Opdrachtafhandeling over de AFMELDperiode: <xsl:value-of select="$van"/> t/m <xsl:value-of select="$tot"/></td></tr>
						</xsl:when>
						<xsl:otherwise>
						  <tr><td colspan="7" style="border-width:0px;">Opdrachtafhandeling over de AANMAAKperiode: <xsl:value-of select="$van"/> t/m <xsl:value-of select="$tot"/></td></tr>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>

				<xsl:for-each select="msxml:node-set($sorted)/data_row">
					<xsl:variable name="prev_bedrijf">
						<xsl:choose>
							<xsl:when test="position()=1">Quqelequ</xsl:when>
							<xsl:otherwise><xsl:value-of select="preceding-sibling::data_row[1]/FCLT_F_BEDRIJF"/></xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
          <xsl:variable name="this_bedrijf">
            <xsl:value-of select="FCLT_F_BEDRIJF"/>
          </xsl:variable>
					<xsl:variable name="prev_sla">
						<xsl:choose>
							<xsl:when test="position()=1">Quqelequ</xsl:when>
							<xsl:otherwise><xsl:value-of select="preceding-sibling::data_row[1]/FCLT_F_SLA"/></xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
          <xsl:variable name="this_sla">
            <xsl:value-of select="FCLT_F_SLA"/>
          </xsl:variable>
					<xsl:if test="position()=1">
				    <tr>
					    <th><b>Leverancier</b></th>
					    <th><b>SLA</b></th>
					    <th style="text-align:right"><b>Afgemelde opdrachten</b></th>
					    <th style="text-align:right"><b>Acceptatie<br/>op tijd (aantal)</b></th>
					    <th style="text-align:right"><b>Acceptatie<br/>op tijd (%)</b></th>
					    <th style="text-align:right"><b>Technische afhandeling<br/>op tijd (aantal)</b></th>
					    <th style="text-align:right"><b>Technische afhandeling<br/>op tijd (%)</b></th>
				    </tr>
					</xsl:if>

          <xsl:variable name="aant_opdr">
            <xsl:value-of select="sum(msxml:node-set($sorted)/data_row[FCLT_F_BEDRIJF=$this_bedrijf and FCLT_F_SLA=$this_sla]/AANTAL)"/>
          </xsl:variable>
          <xsl:variable name="acp_optijd">
            <xsl:value-of select="sum(msxml:node-set($sorted)/data_row[FCLT_F_BEDRIJF=$this_bedrijf and FCLT_F_SLA=$this_sla]/ACCEPTATIE_OP_TIJD)"/>
          </xsl:variable>
          <xsl:variable name="afm_optijd">
            <xsl:value-of select="sum(msxml:node-set($sorted)/data_row[FCLT_F_BEDRIJF=$this_bedrijf and FCLT_F_SLA=$this_sla]/UITVOERING_OP_TIJD)"/>
          </xsl:variable>
					<xsl:choose>
						<!--Als 'this' != 'prev', dan perioderegel gegroepeerd op bedrijf/SLA!-->
						<xsl:when test="$this_bedrijf!=$prev_bedrijf or $this_sla!=$prev_sla">
							<tr>
						    <td><xsl:value-of select="FCLT_F_BEDRIJF"/></td>
						    <td><xsl:value-of select="FCLT_F_SLA"/></td>
						    <td style="text-align:right"><xsl:value-of select="$aant_opdr"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="$acp_optijd"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="format-number(($acp_optijd * 100) div $aant_opdr, '0,00', 'european')"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="$afm_optijd"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="format-number(($afm_optijd * 100) div $aant_opdr, '0,00', 'european')"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
							</tr>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
				</xsl:for-each>
				<xsl:if test="count(rapport_data/data_row)&gt;0">
					<tr>
						<td/>
						<td/>
						<td style="text-align:right"><b><xsl:value-of select="sum(msxml:node-set($sorted)/data_row/AANTAL)"/></b><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						<td style="text-align:right"/>
						<td style="text-align:right"/>
						<td style="text-align:right"/>
						<td style="text-align:right"/>
					</tr>
				</xsl:if>
			</table>
		</xsl:if>

		<xsl:if test="@view='wtca_v_rap_mld_vs_metrage'">
			<table class="rstable sortable">
				<xsl:if test="count(rapport_data/data_row)=0">
					<tr><td><center><b>Geen gegevens gevonden</b></center></td></tr>
				</xsl:if>

				<xsl:variable name="van">
				  <xsl:value-of select="substring(substring-after(where,string(&quot;&gt;= to_date(&apos;&quot;)),1,10)"/>
				</xsl:variable>
				<xsl:variable name="tot">
				  <xsl:value-of select="substring(substring-after(where,string(&quot;&lt; to_date(&apos;&quot;)),1,10)"/>
				</xsl:variable>
				<xsl:variable name="sorted">
					<xsl:for-each select="rapport_data/data_row">
						<xsl:sort select="HUURDERCATEGORIE"/>
						<xsl:copy-of select="."/>
					</xsl:for-each>
				</xsl:variable>

				<xsl:if test="$mode='print' or $mode='excel'">
					<tr><td colspan="7" style="border-width:0px;">Meldingen per metrage over de periode: <xsl:value-of select="$van"/> t/m <xsl:value-of select="$tot"/></td></tr>
				</xsl:if>

				<xsl:for-each select="msxml:node-set($sorted)/data_row">
					<xsl:variable name="prev_cat">
						<xsl:choose>
							<xsl:when test="position()=1">Quqelequ</xsl:when>
							<xsl:otherwise><xsl:value-of select="preceding-sibling::data_row[1]/HUURDERCATEGORIE"/></xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
          <xsl:variable name="this_cat">
            <xsl:value-of select="HUURDERCATEGORIE"/>
          </xsl:variable>
					<xsl:if test="position()=1">
				    <tr>
					    <th><b>Huurdercategorie</b></th>
					    <th style="text-align:right"><b>Aantal storingen</b></th>
					    <th style="text-align:right"><b>Aantal klachten</b></th>
					    <th style="text-align:right"><b>Aantal aanvragen</b></th>
				    </tr>
					</xsl:if>

          <xsl:variable name="aant_storingen">
            <xsl:value-of select="sum(msxml:node-set($sorted)/data_row[HUURDERCATEGORIE=$this_cat]/STORING)"/>
          </xsl:variable>
          <xsl:variable name="aant_klachten">
            <xsl:value-of select="sum(msxml:node-set($sorted)/data_row[HUURDERCATEGORIE=$this_cat]/KLACHT)"/>
          </xsl:variable>
          <xsl:variable name="aant_aanvragen">
            <xsl:value-of select="sum(msxml:node-set($sorted)/data_row[HUURDERCATEGORIE=$this_cat]/AANVRAAG)"/>
          </xsl:variable>
					<xsl:choose>
						<!--Als 'this' != 'prev', dan perioderegel gegroepeerd op huurdercategorie!-->
						<xsl:when test="$this_cat!=$prev_cat">
							<tr>
						    <td>
							    <xsl:choose>
						        <xsl:when test="HUURDERCATEGORIE='1'">Cat1: &lt;= 100 m2</xsl:when>
						        <xsl:when test="HUURDERCATEGORIE='2'">Cat2: 101 t/m 500 m2</xsl:when>
						        <xsl:when test="HUURDERCATEGORIE='3'">Cat3: 501 t/m 1000 m2</xsl:when>
						        <xsl:when test="HUURDERCATEGORIE='4'">Cat4: &gt; 1000 m2</xsl:when>
						        <xsl:otherwise><xsl:value-of select="substring-after(HUURDERCATEGORIE, '5')"/></xsl:otherwise>
							    </xsl:choose>
						    </td>
						    <td style="text-align:right"><xsl:value-of select="$aant_storingen"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="$aant_klachten"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						    <td style="text-align:right"><xsl:value-of select="$aant_aanvragen"/><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
							</tr>
						</xsl:when>
						<xsl:otherwise></xsl:otherwise>
					</xsl:choose>
				</xsl:for-each>
				<xsl:if test="count(rapport_data/data_row)&gt;0">
					<tr>
						<td/>
						<td style="text-align:right"><b><xsl:value-of select="sum(msxml:node-set($sorted)/data_row/STORING)"/></b><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						<td style="text-align:right"><b><xsl:value-of select="sum(msxml:node-set($sorted)/data_row/KLACHT)"/></b><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
						<td style="text-align:right"><b><xsl:value-of select="sum(msxml:node-set($sorted)/data_row/AANVRAAG)"/></b><xsl:if test="$mode != 'excel'">&#xA0;</xsl:if></td>
					</tr>
				</xsl:if>
			</table>
		</xsl:if>

    <xsl:if test="@view='wtca_v_rap_maand_actual_fact'">
      <!--table width="100%" class="DefResultsetTable" border="0" cellpadding="0" cellspacing="0"-->
      <table class="rstable">
        <xsl:if test="count(rapport_data/data_row)=0">
          <tr><td><center><b>Geen gegevens gevonden</b></center></td></tr>
        </xsl:if>

        <xsl:variable name="min_uv">
          <xsl:for-each select="rapport_data/data_row">
            <xsl:sort select="FCLT_F_UITVOERENDE" order="ascending"/>
            <xsl:if test="position()=1"><xsl:value-of select="FCLT_F_UITVOERENDE"/></xsl:if>
          </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="max_uv">
          <xsl:for-each select="rapport_data/data_row">
            <xsl:sort select="FCLT_F_UITVOERENDE" order="descending"/>
            <xsl:if test="position()=1"><xsl:value-of select="FCLT_F_UITVOERENDE"/></xsl:if>
          </xsl:for-each>
        </xsl:variable>

        <xsl:variable name="sortedall">
          <xsl:for-each select="rapport_data/data_row">
            <xsl:sort select="FCLT_F_COMPLEX"/>
            <xsl:sort select="KSOORT"/>
            <xsl:sort select="VAKGROEP"/>
            <xsl:sort select="MELDING"/>
            <xsl:sort select="GEBOUW_TERREIN"/>
            <xsl:sort select="VERDIEPING"/>
            <xsl:sort select="RUIMTE"/>
            <xsl:sort select="OPDR"/>
            <xsl:copy-of select="."/>
          </xsl:for-each>
        </xsl:variable>

        <xsl:variable name="row_count">
          <xsl:value-of select="count(msxml:node-set($sortedall)/data_row)"/>
        </xsl:variable>

        <xsl:for-each select="msxml:node-set($sortedall)/data_row">
          <xsl:variable name="prev_complex">
            <xsl:choose>
              <xsl:when test="position()=1">Quqelequ</xsl:when>
              <xsl:otherwise><xsl:value-of select="preceding-sibling::data_row[1]/FCLT_F_COMPLEX"/></xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <xsl:variable name="this_complex">
            <xsl:value-of select="FCLT_F_COMPLEX"/>
          </xsl:variable>
          <xsl:variable name="prev_ksoort">
            <xsl:choose>
              <xsl:when test="position()=1"><xsl:value-of select="KSOORT"/></xsl:when>
              <xsl:otherwise><xsl:value-of select="preceding-sibling::data_row[1]/KSOORT"/></xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <xsl:variable name="this_ksoort">
            <xsl:value-of select="KSOORT"/>
          </xsl:variable>

          <xsl:if test="position()=1">
            <tr><td colspan="16" style="text-align:left"><b>Concept factuurvoorstel <xsl:choose><xsl:when test="$min_uv=$max_uv"><xsl:value-of select="FCLT_F_UITVOERENDE"/></xsl:when><xsl:otherwise> *ALLE* leveranciers</xsl:otherwise></xsl:choose> t/m <xsl:value-of select="TOT_DATUM"/></b></td></tr>
            <tr><td colspan="16" style="text-align:left">&#160;</td></tr>
          </xsl:if>

          <!--Als 'this' != 'prev', dan invoegen som-regel voor kostensoort!-->
          <xsl:if test="($this_complex!=$prev_complex or $this_ksoort!=$prev_ksoort) and FCLT_F_COMPLEX!=0">
            <xsl:if test="position()&gt;1">
              <tr>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="text-align:right;vertical-align:top;"><b><xsl:value-of select="format-number(sum(msxml:node-set($sortedall)/data_row[FCLT_F_COMPLEX=$prev_complex and KSOORT=$prev_ksoort]/KOSTEN), '0,00', 'european')"/></b></td>
              </tr>
            </xsl:if>
          </xsl:if>

          <!--Als 'this_complex' != 'prev_complex', dan start nieuw complex!-->
          <xsl:if test="$this_complex!=$prev_complex and FCLT_F_COMPLEX!=0">
            <xsl:if test="position()&gt;1">
              <tr><td colspan="16" style="text-align:left">&#160;</td></tr>
            </xsl:if>
            <tr><td colspan="16" style="vertical-align:top;background-color:yellow;"><b><xsl:value-of select="MAATSCHAP"/> (complex <xsl:value-of select="FCLT_F_COMPLEX"/>)</b></td></tr>
            <tr>
              <th style="vertical-align:top;">MAAND</th>
              <th style="vertical-align:top;">OPDR</th>
              <th style="vertical-align:top;">MAATSCHAP</th>
              <th style="vertical-align:top;">KSOORT</th>
              <th style="vertical-align:top;">KSOORT_OMS</th>
              <th style="text-align:center;vertical-align:top;">G_T</th>
              <th style="text-align:center;vertical-align:top;">V</th>
              <th style="text-align:center;vertical-align:top;">RUIMTE</th>
              <th style="vertical-align:top;">VAKGROEP</th>
              <th style="vertical-align:top;">MELDING</th>
              <th style="vertical-align:top;">MELDER</th>
              <th style="vertical-align:top;">OMSCHRIJVING</th>
              <th style="vertical-align:top;">OPMERKING</th>
              <th style="vertical-align:top;">AANMAAK</th>
              <th style="vertical-align:top;">GEREED</th>
              <th style="text-align:right;vertical-align:top;">KOSTEN</th>
            </tr>
          </xsl:if>

          <tr>
            <td style="vertical-align:top;"><xsl:value-of select="MAAND"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="OPDR"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="MAATSCHAP"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="KSOORT"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="KSOORT_OMS"/></td>
            <td style="text-align:center;vertical-align:top;"><xsl:value-of select="GEBOUW_TERREIN"/></td>
            <td style="text-align:center;vertical-align:top;"><xsl:value-of select="VERDIEPING"/></td>
            <td style="text-align:center;vertical-align:top;"><xsl:value-of select="RUIMTE"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="VAKGROEP"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="MELDING"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="MELDER"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="OMSCHRIJVING"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="OPMERKING"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="AANMAAK"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="GEREED"/></td>
            <td style="text-align:right;vertical-align:top;"><xsl:value-of select="format-number(KOSTEN, '0,00', 'european')"/></td>
          </tr>

          <xsl:if test="position()=$row_count">
            <tr>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="text-align:right;vertical-align:top;"><b><xsl:value-of select="format-number(sum(msxml:node-set($sortedall)/data_row[FCLT_F_COMPLEX=$this_complex and KSOORT=$this_ksoort]/KOSTEN), '0,00', 'european')"/></b></td>
            </tr>
          </xsl:if>
        </xsl:for-each>
      </table>
    </xsl:if>

    <xsl:if test="@view='wtca_v_rap_maand_frozen_fact'">
      <!--table width="100%" class="DefResultsetTable" border="0" cellpadding="0" cellspacing="0"-->
      <table class="rstable">
        <xsl:if test="count(rapport_data/data_row)=0">
          <tr><td><center><b>Geen gegevens gevonden</b></center></td></tr>
        </xsl:if>

        <xsl:variable name="min_maand">
          <xsl:for-each select="rapport_data/data_row">
            <xsl:sort select="FCLT_F_MAAND" order="ascending"/>
            <xsl:if test="position()=1"><xsl:value-of select="FCLT_F_MAAND"/></xsl:if>
          </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="max_maand">
          <xsl:for-each select="rapport_data/data_row">
            <xsl:sort select="FCLT_F_MAAND" order="descending"/>
            <xsl:if test="position()=1"><xsl:value-of select="FCLT_F_MAAND"/></xsl:if>
          </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="min_uv">
          <xsl:for-each select="rapport_data/data_row">
            <xsl:sort select="FCLT_F_UITVOERENDE" order="ascending"/>
            <xsl:if test="position()=1"><xsl:value-of select="FCLT_F_UITVOERENDE"/></xsl:if>
          </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="max_uv">
          <xsl:for-each select="rapport_data/data_row">
            <xsl:sort select="FCLT_F_UITVOERENDE" order="descending"/>
            <xsl:if test="position()=1"><xsl:value-of select="FCLT_F_UITVOERENDE"/></xsl:if>
          </xsl:for-each>
        </xsl:variable>

        <!--Regels beperken tot $max_maand als niet is gefilterd op Maand of Uitvoerende!-->
        <xsl:variable name="sortedall">
          <xsl:choose>
            <xsl:when test="$min_maand=$max_maand or $min_uv=$max_uv">
              <xsl:for-each select="rapport_data/data_row">
                <xsl:sort select="FCLT_F_COMPLEX"/>
                <xsl:sort select="KSOORT"/>
                <xsl:sort select="VAKGROEP"/>
                <xsl:sort select="MELDING"/>
                <xsl:sort select="GEBOUW_TERREIN"/>
                <xsl:sort select="VERDIEPING"/>
                <xsl:sort select="RUIMTE"/>
                <xsl:sort select="OPDR"/>
                <xsl:copy-of select="."/>
              </xsl:for-each>
            </xsl:when>
            <xsl:otherwise>
              <xsl:for-each select="rapport_data/data_row">
                <xsl:sort select="FCLT_F_COMPLEX"/>
                <xsl:sort select="KSOORT"/>
                <xsl:sort select="VAKGROEP"/>
                <xsl:sort select="MELDING"/>
                <xsl:sort select="GEBOUW_TERREIN"/>
                <xsl:sort select="VERDIEPING"/>
                <xsl:sort select="RUIMTE"/>
                <xsl:sort select="OPDR"/>
                <xsl:if test="FCLT_F_MAAND=$max_maand">
                  <xsl:copy-of select="."/>
                </xsl:if>
              </xsl:for-each>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>

        <xsl:variable name="row_count">
          <xsl:value-of select="count(msxml:node-set($sortedall)/data_row)"/>
        </xsl:variable>

        <xsl:for-each select="msxml:node-set($sortedall)/data_row">
          <xsl:variable name="prev_complex">
            <xsl:choose>
              <xsl:when test="position()=1">Quqelequ</xsl:when>
              <xsl:otherwise><xsl:value-of select="preceding-sibling::data_row[1]/FCLT_F_COMPLEX"/></xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <xsl:variable name="this_complex">
            <xsl:value-of select="FCLT_F_COMPLEX"/>
          </xsl:variable>
          <xsl:variable name="prev_ksoort">
            <xsl:choose>
              <xsl:when test="position()=1"><xsl:value-of select="KSOORT"/></xsl:when>
              <xsl:otherwise><xsl:value-of select="preceding-sibling::data_row[1]/KSOORT"/></xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <xsl:variable name="this_ksoort">
            <xsl:value-of select="KSOORT"/>
          </xsl:variable>

          <xsl:if test="position()=1">
            <tr><td colspan="16" style="text-align:left"><b>Definitief factuurvoorstel <xsl:choose><xsl:when test="$min_uv=$max_uv"><xsl:value-of select="FCLT_F_UITVOERENDE"/></xsl:when><xsl:otherwise> *ALLE* leveranciers</xsl:otherwise></xsl:choose> t/m <xsl:value-of select="TOT_DATUM"/></b></td></tr>
            <tr><td colspan="16" style="text-align:left">&#160;</td></tr>
          </xsl:if>

          <!--Als 'this' != 'prev', dan invoegen som-regel voor kostensoort!-->
          <xsl:if test="($this_complex!=$prev_complex or $this_ksoort!=$prev_ksoort) and FCLT_F_COMPLEX!=0">
            <xsl:if test="position()&gt;1">
              <tr>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="vertical-align:top;"></td>
                <td style="text-align:right;vertical-align:top;"><b><xsl:value-of select="format-number(sum(msxml:node-set($sortedall)/data_row[FCLT_F_COMPLEX=$prev_complex and KSOORT=$prev_ksoort]/KOSTEN), '0,00', 'european')"/></b></td>
              </tr>
            </xsl:if>
          </xsl:if>

          <!--Als 'this_complex' != 'prev_complex', dan start nieuw complex!-->
          <xsl:if test="$this_complex!=$prev_complex and FCLT_F_COMPLEX!=0">
            <xsl:if test="position()&gt;1">
              <tr><td colspan="16" style="text-align:left">&#160;</td></tr>
            </xsl:if>
            <tr><td colspan="16" style="vertical-align:top;background-color:yellow;"><b><xsl:value-of select="MAATSCHAP"/> (complex <xsl:value-of select="FCLT_F_COMPLEX"/>)</b></td></tr>
            <tr>
              <th style="vertical-align:top;">MAAND</th>
              <th style="vertical-align:top;">OPDR</th>
              <th style="vertical-align:top;">MAATSCHAP</th>
              <th style="vertical-align:top;">KSOORT</th>
              <th style="vertical-align:top;">KSOORT_OMS</th>
              <th style="text-align:center;vertical-align:top;">G_T</th>
              <th style="text-align:center;vertical-align:top;">V</th>
              <th style="text-align:center;vertical-align:top;">RUIMTE</th>
              <th style="vertical-align:top;">VAKGROEP</th>
              <th style="vertical-align:top;">MELDING</th>
              <th style="vertical-align:top;">MELDER</th>
              <th style="vertical-align:top;">OMSCHRIJVING</th>
              <th style="vertical-align:top;">OPMERKING</th>
              <th style="vertical-align:top;">AANMAAK</th>
              <th style="vertical-align:top;">GEREED</th>
              <th style="text-align:right;vertical-align:top;">KOSTEN</th>
            </tr>
          </xsl:if>

          <tr>
            <td style="vertical-align:top;"><xsl:value-of select="FCLT_F_MAAND"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="OPDR"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="MAATSCHAP"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="KSOORT"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="KSOORT_OMS"/></td>
            <td style="text-align:center;vertical-align:top;"><xsl:value-of select="GEBOUW_TERREIN"/></td>
            <td style="text-align:center;vertical-align:top;"><xsl:value-of select="VERDIEPING"/></td>
            <td style="text-align:center;vertical-align:top;"><xsl:value-of select="RUIMTE"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="VAKGROEP"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="MELDING"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="MELDER"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="OMSCHRIJVING"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="OPMERKING"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="AANMAAK"/></td>
            <td style="vertical-align:top;"><xsl:value-of select="GEREED"/></td>
            <td style="text-align:right;vertical-align:top;"><xsl:value-of select="format-number(KOSTEN, '0,00', 'european')"/></td>
          </tr>

          <xsl:if test="position()=$row_count">
            <tr>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="vertical-align:top;"></td>
              <td style="text-align:right;vertical-align:top;"><b><xsl:value-of select="format-number(sum(msxml:node-set($sortedall)/data_row[FCLT_F_COMPLEX=$this_complex and KSOORT=$this_ksoort]/KOSTEN), '0,00', 'european')"/></b></td>
            </tr>
          </xsl:if>
        </xsl:for-each>
      </table>
    </xsl:if>
	</xsl:template>
</xsl:stylesheet>
