<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template name="stylesheet">
		<style>body {
       font-family: Verdana;
       background-color: rgb(255, 255, 255);
       margin-left:0;
       margin-top:8px;
       cursor: auto;
    }

    table {
      border: 0;
    }

    table.details {
      background-color: "#31398C";
    }

    th {
      font-family: Verdana;
      font-size: 9pt;
      font-weight: normal;
      color: #ffffff;
      text-decoration: none;
      padding-left:  3px;
      padding-right: 3px;
      padding-top: 3px;
      padding-bottom: 3px;
      background-color: #31398C;
    }

    td {
      font-family: Verdana;
      font-style: normal;
      font-size: 8pt;
      font-weight: normal;
      color:  #000000;
      text-align: left;
      vertical-align: top;
    }

    td.result {
      text-decoration: none;
      padding-bottom: 2px;
      padding-top: 2px;
      padding-left: 2px;
      padding-right: 2px;
      background-color: #D6D8E8;
    }

    td.sec_heading {
      font-size: 9pt;
      text-decoration: none;
      padding-bottom: 2px;
      padding-top: 2px;
      padding-left: 2px;
      padding-right: 2px;
      text-align: left;
      background-color: #d0d0d0;
    }

    td.caption {
      font-size:   18pt;
      padding-bottom: 30px;
      padding-top: 40px;
    }

    td.subcaption {
      font-size: 10pt;
      font-weight: bold;
      text-decoration: underline;
    }

    td.label {
      font-size: 10pt;
    }

    td.value {
      font-style: italic;
      font-size: 10pt;
    }

    td.tekst {
      font-size: 10pt;
    }

    td.adres {
      font-size: 8pt;
      text-align: right;
    }

    td.tekstkop {
      font-weight: bold;
      font-size: 10pt;
    }

    td.tiny {
      font-size: 6pt;
      text-align: right;
    }

	span.tekstkop {
      font-weight: bold;
      font-size: 9pt;
	}
	span.tekstkopsmall {
      font-weight: bold;
      font-size: 8pt;
	}</style>
	</xsl:template>	
	
	<xsl:template name="prioriteit">
		<xsl:param name="lang"/>
		 <xsl:choose>
			<xsl:when test="$lang = 'EN'">
	    		<xsl:choose>
	      		<xsl:when test="melding/spoed=1">Critical</xsl:when>
	      		<xsl:when test="melding/spoed=2">High</xsl:when>
	      		<xsl:when test="melding/spoed=3">Normal</xsl:when>
	      		<xsl:when test="melding/spoed=4">Low</xsl:when>
	      		<xsl:when test="melding/spoed=5">Hold</xsl:when> 
	      		<xsl:otherwise>
	        		Unknown
	      		</xsl:otherwise>		
	      </xsl:choose>
	    </xsl:when>
	   	<xsl:otherwise>
     			<xsl:choose>
	      		<xsl:when test="melding/spoed=1">Calamiteit</xsl:when>
	      		<xsl:when test="melding/spoed=2">Hoog</xsl:when>
	      		<xsl:when test="melding/spoed=3">Normaal</xsl:when>
	      		<xsl:when test="melding/spoed=4">Laag</xsl:when>
	      		<xsl:when test="melding/spoed=5">Hold</xsl:when> 
	      		<xsl:otherwise>
	        		Onbekend
	      		</xsl:otherwise>
	    		</xsl:choose>
	    	</xsl:otherwise>
	   </xsl:choose>
	</xsl:template>	
	
	<xsl:template name="rsv_ruimte">
		<xsl:param name="min_volgnr"/>
		<tr>
			<xsl:choose>
				<xsl:when test="res_ruimte!=''">
					<td class="tekstkop" colspan="10" frame="box" style="border-style:solid;border-width:0px;">
						<br/><xsl:value-of select="van/datum"/>&#xA0;<xsl:if test="dirtlevel!='0'"><span class="fatal"><xsl:value-of select="//lcl/RES/ongeldig"/></span>&#xA0;</xsl:if><xsl:value-of select="//lcl/RES/deelreservering"/> &#160; <xsl:value-of select="volgnr"/>&#xA0;
						<xsl:if test="string(res_activiteit/omschrijving)!=''">(<xsl:value-of select="res_activiteit/omschrijving"/>)&#xA0;</xsl:if>
						<xsl:value-of select="res_ruimte/plaats/regio/district/locatie/omschrijving"/>
					</td>
				</xsl:when>
				<!-- "roomservice" -->
				<xsl:otherwise>
					<td class="tekstkop" colspan="10" frame="box" style="border-style:solid;border-width:0px;">
						<br/><xsl:value-of select="van/datum"/><xsl:if test="string(van/datum)!=string(tot/datum)">&#xA0;-&#xA0;<xsl:value-of select="tot/datum"/></xsl:if>&#xA0;<xsl:if test="dirtlevel!='0'"><span class="fatal"><xsl:value-of select="//lcl/RES/ongeldig"/></span>&#xA0;</xsl:if><xsl:value-of select="//lcl/RES/deelreservering"/>  &#160;<xsl:value-of select="volgnr"/>&#xA0;
						<xsl:value-of select="plaats/regio/district/locatie/omschrijving"/> - 
						<xsl:value-of select="plaats/regio/district/locatie/gebouw/naam"/> - 
						<xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/omschrijving"/> - 
						<xsl:value-of select="plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"/>
					</td>
				</xsl:otherwise>
			</xsl:choose>
		</tr>
		<xsl:if test="string(omschrijving)!=string(//reservering/rsv_ruimte[volgnr=$min_volgnr]/omschrijving)">
			<tr>
				<td class="label" frame="box" style="border-style:solid;border-width:0px;">- <xsl:value-of select="//lcl/FAC/omschrijving"/>:</td>
				<td class="value" colspan="9" frame="box" style="border-style:solid;border-width:0px;">
					<xsl:value-of select="omschrijving"/>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="string(opmerking)!=string(//reservering/rsv_ruimte[volgnr=$min_volgnr]/opmerking)">
			<tr>
				<td class="label" frame="box" style="border-style:solid;border-width:0px;">- <xsl:value-of select="//lcl/FAC/opmerking"/>:</td>
				<td class="value" colspan="9" frame="box" style="border-style:solid;border-width:0px;">
					<xsl:call-template name="linebreaks">
						<xsl:with-param name="string" select="opmerking"/>
					</xsl:call-template>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="string(contact_user/naam_full)!=string(//reservering/rsv_ruimte[volgnr=$min_volgnr]/contact_user/naam_full)">
			<tr>
				<td class="label" frame="box" style="border-style:solid;border-width:0px;">- <xsl:value-of select="//lcl/FAC/aanvrager"/>:</td>
				<td class="value" colspan="9" frame="box" style="border-style:solid;border-width:0px;">
					<xsl:value-of select="contact_user/naam_full"/>/ <xsl:value-of select="contact_user/werkplek/plaats/regio/district/locatie/omschrijving"/></td>
			</tr>
		</xsl:if>
		<xsl:if test="string(host_user/naam_full)!=string(//reservering/rsv_ruimte[volgnr=$min_volgnr]/host_user/naam_full)">
			<tr>
				<td class="label" frame="box" style="border-style:solid;border-width:0px;">- <xsl:value-of select="//lcl/RES/gastheer_vrouw"/>:</td>
				<td class="value" colspan="9" frame="box" style="border-style:solid;border-width:0px;">
					<xsl:value-of select="host_user/naam_full"/>
				</td>
			</tr>
		</xsl:if>
		<xsl:if test="string(kostenplaats/nr)!=string(//reservering/rsv_ruimte[volgnr=$min_volgnr]/kostenplaats/nr)">
			<tr>
				<td class="label" frame="box" style="border-style:solid;border-width:0px;">- <xsl:value-of select="//lcl/FAC/kostenplaats"/>:</td>
				<td class="value" colspan="9" frame="box" style="border-style:solid;border-width:0px;">
					<xsl:value-of select="kostenplaats/nr"/>&#xA0;<xsl:value-of select="kostenplaats/omschrijving"/></td>
			</tr>
		</xsl:if>
		<tr>
			<th><xsl:value-of select="//lcl/FAC/omschrijving"/></th>
			<th><xsl:value-of select="//lcl/RES/aantal"/></th>
			<th style="text-align:right"><xsl:value-of select="//lcl/RES/prijs"/></th>
			<!--<th width="80">Datum</th>-->
			<th style="text-align:right"><xsl:value-of select="//lcl/RES/begintijd"/></th>
			<th style="text-align:right"><xsl:value-of select="//lcl/RES/eindtijd"/></th>
			<th><xsl:value-of select="//lcl/RES/status"/></th>
			<th><xsl:value-of select="//lcl/RES/opstelling"/></th>
		</tr>
		<xsl:if test="res_ruimte!=''">
			<tr>
				<td class="result" style="text-align:left" width="35%"><xsl:if test="dirtlevel!='0'"><span class="fatal"><xsl:value-of select="//lcl/RES/ongeldig"/></span>&#xA0;</xsl:if>
					<xsl:value-of select="res_ruimte/nr"/>
					<br/>(max. <xsl:value-of select="res_ruimte/bezoekers"/> <xsl:value-of select="//lcl/FAC/personen"/>)
					<xsl:if test="res_ruimte/omschrijving!=''">
					  <br/><br/><xsl:value-of select="res_ruimte/omschrijving"/> 
			        </xsl:if>
			    </td>
				<td class="result" style="text-align:left">
					<xsl:value-of select="bezoekers"/>&#xA0;<xsl:value-of select="//lcl/FAC/personen"/></td>
				<td class="result" style="text-align:right">
					<xsl:call-template name="europrijs">
						<xsl:with-param name="prijs" select="prijs"/>
					</xsl:call-template>
				</td>
				<!--<td class="result" style="text-align:right">
					<xsl:value-of select="van/datum"/>
				</td>-->
				<td class="result" style="text-align:right">
					<xsl:value-of select="van/tijd"/>
				</td>
				<td class="result" style="text-align:right">
					<xsl:value-of select="tot/tijd"/>
				</td>
				<td class="result" style="text-align:left">
					<xsl:value-of select="status_fo"/>
				</td>
				<td class="result" style="text-align:left">
					<xsl:value-of select="res_ruimte/opstelling"/>
				</td>
			</tr>
		</xsl:if>
		<!-- rsv_deel-lijst gesorteerd op van-tijd -->
		<xsl:for-each select="rsv_deel">
			<xsl:sort select="van/tijd"/>
			<tr>
				<td class="result"><xsl:if test="dirtlevel!='0'"><span class="fatal"><xsl:value-of select="//lcl/RES/ongeldig"/></span>&#xA0;</xsl:if>
					<xsl:value-of select="res_deel/deel/omschrijving"/>
				</td>
				<td class="result">
					<xsl:value-of select="aantal"/>
				</td>
				<td class="result" style="text-align:right">
					<xsl:call-template name="europrijs">
						<xsl:with-param name="prijs" select="prijs"/>
					</xsl:call-template>
				</td>
				<!--<td class="result" style="text-align:right">
					<xsl:value-of select="van/datum"/>
				</td>-->
				<td class="result" style="text-align:right">
					<xsl:value-of select="van/tijd"/>
				</td>
				<td class="result" style="text-align:right">
					<xsl:value-of select="tot/tijd"/>
				</td>
			</tr>
		</xsl:for-each>
		<!-- rsv_artikel-lijst gesorteerd op van-tijd -->
		<xsl:for-each select="rsv_artikel">
			<xsl:sort select="levering/tijd"/>
			<tr>
				<td class="result">
					<xsl:value-of select="res_artikel/omschrijving"/>
				</td>
				<td class="result">
					<xsl:value-of select="aantal"/>
				</td>
				<td class="result" style="text-align:right">
					<xsl:call-template name="europrijs">
						<xsl:with-param name="prijs" select="prijs"/>
					</xsl:call-template>
				</td>
				<!--<td class="result" style="text-align:right">
					<xsl:value-of select="levering/datum"/>
				</td>-->
				<td class="result" style="text-align:right">
					<xsl:value-of select="levering/tijd"/>
				</td>
			</tr>
		</xsl:for-each>		
		<!-- totaal per deelreservering -->
		<tr>
			<td class="tekst" colspan="2" style="border-style:solid;border-width:0px;"><xsl:value-of select="//lcl/RES/totaal_deelreservering"/></td>
			<td class="tekst" style="text-align:right;border-style:solid;border-width:0px;">
             <xsl:call-template name="europrijs">
               <xsl:with-param name="prijs" select="sum(prijs[string(number(.))!='NaN'])+sum(rsv_deel/prijs[string(number(.))!='NaN'])+sum(rsv_artikel/prijs[string(number(.))!='NaN'])"/>
             </xsl:call-template>
			</td>
		</tr>
		
		<!-- afspraak-lijst gesorteerd op naam -->
		<xsl:for-each select="afspraak/bezoeker">
			<xsl:sort select="naam"/>
			<xsl:choose>
				<xsl:when test="position() = 1">
					<tr>
						<td class="tekst" style="border-style:solid;border-width:0px;">
							<br/><xsl:value-of select="//lcl/BEZ/bezoekers"/></td>
					</tr>
					<tr>
						<th><xsl:value-of select="//lcl/FAC/naam"/></th>
						<th colspan="3"><xsl:value-of select="//lcl/FAC/bedrijf"/></th>
						<th colspan="4"><xsl:value-of select="//lcl/BEZ/parkeerplaats"/></th>
					</tr>
				</xsl:when>
			</xsl:choose>
			<tr>
				<td class="result">
					<xsl:value-of select="naam"/>
				</td>
				<td class="result" colspan="3">
					<xsl:value-of select="bedrijf"/>
				</td>
				<td class="result" colspan="4">
					<xsl:value-of select="deel/omschrijving"/>
				</td>
			</tr>
		</xsl:for-each>
	

		<!-- kenmerk -->
		<xsl:if test="kenmerk">
		<tr>
		<td colspan="5">
		<table>
			<xsl:for-each select="kenmerk[@type!='L' and @type!='l' and @type!='Q' and count(@xmlnode)=0]">
				<xsl:sort select="@volgnummer" data-type="number"/>
				<xsl:if test=".!=''">
					<tr>
						<td class="label">
							<xsl:value-of select="@naam"/></td>
						<td class="value">
							: <xsl:value-of select="."/>
						</td>
					</tr>
				</xsl:if>
			</xsl:for-each>
		</table>
		</td>
		</tr>
		<tr height="20px">
				<td class="tekst" colspan="2" style="border-style:solid;border-width:0px;"></td>
		</tr>
		</xsl:if>			
	</xsl:template>
	
  <xsl:template match="reservering" mode="include">
    <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
      <TR>
        <TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"/>
        <TD>
          <xsl:choose>
             <xsl:when test="$srtnotificatiecode='RESDEL' and verwijder">
              <table>
                <tr>
                  <td height="20"/>
                </tr>
                <tr>
                  <td class="caption" style="color: red"><xsl:value-of select="//lcl/RES/annulering"/></td>
                </tr>
              </table>
            </xsl:when>
          </xsl:choose>
            <!-- Bevestiging reservering -->
            <!-- Ook tonen voor verwijderde reserveringen -->

            <!-- De algemene gegevens van de deelreservering met het laagste volgnummer worden gebruikt als referentie gegevens! -->
            <xsl:variable name="min_volgnr">
              <xsl:value-of select="//reservering/rsv_ruimte/volgnr[not(. &gt; //reservering/rsv_ruimte/volgnr)]"/>
            </xsl:variable>

            <table border="0" bordercolor="#ffffff" width="100%">
              <tr>
                <td class="caption" valign="top" colspan="2">
                  <xsl:choose>
                    <xsl:when test="@content='complete'"><xsl:value-of select="//lcl/RES/reservering"/>&#xA0;<xsl:value-of select="key"/><br/></xsl:when>
                    <xsl:otherwise><xsl:value-of select="//lcl/RES/deelreservering"/>&#xA0;<xsl:value-of select="key"/> / <xsl:value-of select="$min_volgnr"/><br/></xsl:otherwise>
                  </xsl:choose>
                  <xsl:if test="string(rsv_ruimte[volgnr=$min_volgnr]/omschrijving)!=''">(<xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/omschrijving"/>)</xsl:if>&#xA0;</td>
              </tr>
              <tr>
                <td width="20%" class="label"><xsl:value-of select="//lcl/FAC/aanvrager"/></td>
                <td width="80%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/naam_full"/></td>
              </tr>
              <tr>
                <td width="20%" class="label"><xsl:value-of select="//lcl/FAC/e-mail"/></td>
                <td width="80%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/email"/></td>
              </tr>
              <tr>
                <td width="20%" class="label"><xsl:value-of select="//lcl/FAC/locatie"/></td>
                <td width="80%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/werkplek/plaats/regio/district/locatie/omschrijving"/></td>
              </tr>
              <tr>
                <td width="20%" class="label"><xsl:value-of select="//lcl/FAC/afdeling"/></td>
                <td width="80%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/afdeling/omschrijving"/></td>
              </tr>
              <tr>
                <td width="20%" class="label"><xsl:value-of select="//lcl/RES/gastheer_vrouw"/></td>
                <td width="80%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/host_user/naam_full"/></td>
              </tr>
              <tr>
                <td width="20%" class="label"><xsl:value-of select="//lcl/FAC/kostenplaats"/></td>
                <td width="80%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/kostenplaats/nr"/>&#xA0;
                  <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/kostenplaats/omschrijving"/>
                </td>
              </tr>
             <xsl:if test="$srtnotificatiecode='RESDEL'">
              <tr>
                <td width="20%" class="label"><xsl:value-of select="//lcl/RES/begintijd"/></td>
                <td width="80%" class="value">: <xsl:value-of select="rsv_ruimte/van/datum"/>&#xA0;<xsl:value-of select="rsv_ruimte/van/tijd"/></td>
              </tr>
             </xsl:if>
              <tr>
                <td height="30px"/>
              </tr>
              <xsl:if test="rsv_ruimte[volgnr=$min_volgnr]/contact_user/key!=ingevoerd_user/key">
                <tr>
                  <td width="20%" class="label"><xsl:value-of select="//lcl/RES/behandeld_door"/></td>
                  <td width="80%" class="value">: <xsl:value-of select="ingevoerd_user/naam_full"/></td>
                </tr>
                <tr>
                  <td height="30px"/>
                </tr>
              </xsl:if>
              <tr>
                <td colspan="2" class="tekst">
                  <xsl:choose>
                    <xsl:when test="$srtnotificatiecode='RESNEW'"/>
                    <xsl:when test="$srtnotificatiecode='RESDEL'"><xsl:value-of select="//lcl/RES/reservering_vervallen"/></xsl:when>
                    <xsl:otherwise>
                      <xsl:call-template name="res_begintext"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </td>
              </tr>
                    <xsl:choose>
                        <xsl:when test="$srtnotificatiecode!='RESDEL'">
              <tr>
                <td height="10px"/>
              </tr>
              <tr>
                <td class="tekstkop" colspan="2" style="text-decoration:underline"><xsl:value-of select="//lcl/RES/reserveringsgegevens"/></td>
              </tr>
              <tr>
                <td height="5px"/>
              </tr>
              <xsl:if test="string(rsv_ruimte[volgnr=$min_volgnr]/opmerking)!=''">
                <tr>
                  <td colspan="2" class="label"><xsl:value-of select="//lcl/FAC/opmerking"/></td>
                </tr>
                <tr>
                  <td colspan="2" class="value">
                    <xsl:call-template name="linebreaks">
                      <xsl:with-param name="string" select="rsv_ruimte[volgnr=$min_volgnr]/opmerking"/>
                    </xsl:call-template>
                  </td>
                </tr>
                <tr>
                  <td height="5px"/>
                </tr>
              </xsl:if>
              <tr>
                <td colspan="2">
                  <table cellpadding="0" cellspacing="0" border="1" bordercolor="#000000" frame="box">
                    <!-- rsv_ruimte -->
                    <xsl:for-each select="rsv_ruimte">
                      <xsl:sort select="van/timestamp"/>
                      <xsl:call-template name="rsv_ruimte">
                        <xsl:with-param name="min_volgnr" select="$min_volgnr"/>
                      </xsl:call-template>
                    </xsl:for-each>
                    <!-- totaal reservering -->
                    <tr>
                      <td height="10px" style="border-style:solid;border-width:0px;"/>
                    </tr>
                    <tr>
                      <td class="tekstkop" align="right" colspan="2" style="border-width:0px;"><xsl:value-of select="//lcl/RES/totaalprijs_reservering"/>:</td>
                      <td class="tekstkop" style="text-align:right;border-width:0px;">
                                              <xsl:call-template name="europrijs">
                                                  <xsl:with-param name="prijs" select="sum(rsv_ruimte/prijs[string(number(.))!='NaN'])+sum(rsv_ruimte/rsv_deel/prijs[string(number(.))!='NaN'])+sum(rsv_ruimte/rsv_artikel/prijs[string(number(.))!='NaN'])"/>
                                              </xsl:call-template>
                      </td>
                    </tr>
                  </table>
                </td>
              </tr>
              <xsl:call-template name="res_endtext">
                <xsl:with-param name="min_volgnr" select="$min_volgnr"/>
              </xsl:call-template>
                </xsl:when>
              </xsl:choose>
            </table>
            <!-- Bevestiging reservering -->
        </TD>
        <TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
      </TR>
    </TABLE>
  </xsl:template>	
	
	<xsl:template name="qrc_ins_new_page">
		<xsl:param name="p_page"/>
		<xsl:param name="p_rows"/>
		<xsl:param name="p_cols"/>
		<table>
			<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">
				<xsl:sort select="FCLT_F_GEBOUW"/>
				<xsl:sort select="FCLT_F_VERDIEPING"/>
				<xsl:sort select="PLAATS"/>
				<xsl:if test="position() &gt;= (($p_page - 1) * ($p_rows * $p_cols) + 1) and position() &lt;= ($p_page * ($p_rows * $p_cols))">
					<xsl:if test="(position() mod $p_cols) = 0">
						<xsl:comment>=== Na elke 1 records (1x1 passen op 1 regel) ===</xsl:comment>
						<xsl:call-template name="qrc_ins_new_tr">
							<xsl:with-param name="p_pos" select="position() - $p_cols + 1"/>
							<xsl:with-param name="p_cols" select="$p_cols"/>
						</xsl:call-template>
					</xsl:if>
					<xsl:if test="(position() = last()) and (position() mod $p_cols) != 0">
						<xsl:comment>=== Na elke 1 records (1x1 passen op 1 regel) ===</xsl:comment>
						<xsl:call-template name="qrc_ins_new_tr">
							<xsl:with-param name="p_pos" select="floor(position() div $p_cols) * $p_cols + 1"/>
							<xsl:with-param name="p_cols" select="$p_cols"/>
						</xsl:call-template>
					</xsl:if>
				</xsl:if>
			</xsl:for-each>
		</table>
	</xsl:template>

	<xsl:template name="qrc_ins_new_tr">
		<xsl:param name="p_pos"/>
		<xsl:param name="p_cols"/>
		<tr height="80px">
			<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">
				<xsl:sort select="FCLT_F_SOORTMELDING"/>
				<xsl:sort select="FCLT_F_LOCATIE"/>
				<xsl:sort select="FCLT_F_GEBOUW"/>
				<xsl:sort select="FCLT_F_VERDIEPING"/>
				<xsl:sort select="PLAATS"/>
				<xsl:sort select="FCLT_F_OBJECTGROEP"/>
				<xsl:sort select="FCLT_F_OBJECTSOORT"/>
				<xsl:sort select="INS_DEEL_OMSCHRIJVING"/>
				<xsl:if test="position() &gt;= $p_pos and position() &lt;= $p_pos + $p_cols - 1">
					<xsl:choose>
						<xsl:when test="VARIABELE = 'INS_KEY'">
					<td width="25%" style="text-align:center">
						<xsl:element name="img">
							<xsl:attribute name="style">height: 5cm</xsl:attribute>
							<xsl:attribute name="src">
								../../appl/shared/qrcode.asp?size=16&amp;text=%3Fu%3D<xsl:value-of select="HIDE_F_BOOKMARK_ID"/>%26ins_key%3D<xsl:value-of select="INS_DEEL_KEY"/>
							</xsl:attribute>
						</xsl:element>
						<br/>
					</td>
						</xsl:when>
						<xsl:when test="VARIABELE = 'RES_RUIMTE_KEY'">
					<td width="25%" style="text-align:center">
						<xsl:element name="img">
							<xsl:attribute name="style">height: 5cm</xsl:attribute>
							<xsl:attribute name="src">
								../../appl/shared/qrcode.asp?size=16&amp;text=%3Fu%3D<xsl:value-of select="HIDE_F_BOOKMARK_ID"/>%26res_ruimte_key%3D<xsl:value-of select="RUIMTE_KEY"/>
							</xsl:attribute>
						</xsl:element>
						<br/>
					</td>
						</xsl:when>
						<xsl:otherwise>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
			</xsl:for-each>
		</tr>
		<tr height="80px">
			<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">
				<xsl:sort select="FCLT_F_SOORTMELDING"/>
				<xsl:sort select="FCLT_F_LOCATIE"/>
				<xsl:sort select="FCLT_F_GEBOUW"/>
				<xsl:sort select="FCLT_F_VERDIEPING"/>
				<xsl:sort select="PLAATS"/>
				<xsl:sort select="FCLT_F_OBJECTGROEP"/>
				<xsl:sort select="FCLT_F_OBJECTSOORT"/>
				<xsl:sort select="INS_DEEL_OMSCHRIJVING"/>
				<xsl:if test="position() &gt;= $p_pos and position() &lt;= $p_pos + $p_cols - 1">
					<td width="25%" style="text-align:center">
						<xsl:value-of select="FCLT_F_SOORTMELDING"/>
						<br/>
						<xsl:value-of select="FCLT_F_LOCATIE"/>
						<br/>
						<xsl:value-of select="PLAATS"/>
						<br/>
						<xsl:value-of select="FCLT_F_OBJECTGROEP"/>
						<br/>
						<xsl:value-of select="FCLT_F_OBJECTSOORT"/>
						<br/>
						<xsl:value-of select="INS_DEEL_OMSCHRIJVING"/>
						<br/>
					</td>
				</xsl:if>
			</xsl:for-each>
		</tr>
	</xsl:template>

	<xsl:template match="rapport">
		<xsl:choose>
		<xsl:when test="@view='aaxx_v_rap_test' or @view='AAXX_V_RAP_TEST'">
			<table class="rstable">
				<tr>
					<th>Kolom</th>
				</tr>
			<xsl:for-each select="rapport_data/data_row">
			<xsl:sort select="HIDE_F_SORT"/>
			   <tr>
					<td><xsl:value-of select="COL1"/></td>
				</tr>
			</xsl:for-each>
			</table>
		</xsl:when>

		<!--De generatie van QR-codes voor object-meldingen en reserveringen)-->
		<xsl:when test="@view = 'aaxx_v_rap_mld_qrc' or @view = 'AAXX_V_RAP_MLD_QRC'">
			<xsl:variable name="p_rows" select="3"/>
			<xsl:variable name="p_cols" select="2"/>

			<table>
				<tr height="200">
					<td width="50%" align="center">
						<span style="font-size:24pt;color:#000000">QR-codes</span>
					</td>
				</tr>
				<tr height="200">
					<td width="50%" align="center">
						<span style="font-size:24pt;color:#000000">object-meldingen</span>
					</td>
				</tr>
				<tr height="200">
					<td width="50%" align="center">
						<span style="font-size:24pt;color:#000000">(startpagina tbv. uitlijning)</span>
					</td>
				</tr>
			</table>

			<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">
				<xsl:sort select="FCLT_F_SOORTMELDING"/>
				<xsl:sort select="FCLT_F_LOCATIE"/>
				<xsl:sort select="FCLT_F_GEBOUW"/>
				<xsl:sort select="FCLT_F_VERDIEPING"/>
				<xsl:sort select="PLAATS"/>
				<xsl:sort select="FCLT_F_OBJECTGROEP"/>
				<xsl:sort select="FCLT_F_OBJECTSOORT"/>
				<xsl:sort select="INS_DEEL_OMSCHRIJVING"/>
				<xsl:if test="position() mod ($p_rows * $p_cols) = 0">
					<div style="page-break-before:always">&#160;</div>
					<xsl:comment>=== Na elke 2 records (2x1 passen op 1 A4) =====</xsl:comment>
					<xsl:call-template name="qrc_ins_new_page">
						<xsl:with-param name="p_page" select="floor(position() div ($p_rows * $p_cols))"/>
						<xsl:with-param name="p_rows" select="$p_rows"/>
						<xsl:with-param name="p_cols" select="$p_cols"/>
					</xsl:call-template>
				</xsl:if>
				<xsl:if test="position() = last() and position() mod ($p_rows * $p_cols) != 0 ">
					<div style="page-break-before:always">&#160;</div>
					<xsl:comment>=== De laatste paar, zijn minder dan 2 =====</xsl:comment>
					<xsl:call-template name="qrc_ins_new_page">
						<xsl:with-param name="p_page" select="floor((position() div ($p_rows * $p_cols)) + 1)"/>
						<xsl:with-param name="p_rows" select="$p_rows"/>
						<xsl:with-param name="p_cols" select="$p_cols"/>
					</xsl:call-template>
				</xsl:if>
			</xsl:for-each>
		</xsl:when>

		<xsl:otherwise>
			<xsl:apply-templates select="." mode="cust"/>
		</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	
	<xsl:template match="bestelling" mode="include">
		<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
			<TR>
				<TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"></TD>
				<TD>
					<table border="0" width="100%" bordercolor="#000000">
						<tr>
							<td align="left" width="100%" class="caption" colspan="2"><xsl:value-of select="//lcl/BES/bestelaanvraag"/>&#xA0;<xsl:value-of select="key"/>
							    <xsl:if test="ismutatie=1"> (WIJZIGING)</xsl:if>
								<xsl:if test="isretour=1"> (RETOUR)</xsl:if>
						    </td>
						</tr>
						<tr>
							<td width="20%" class="label"><xsl:value-of select="//lcl/FAC/aanvrager"/></td>
							<td width="80%" class="value">: <xsl:value-of select="voor/naam_full"/></td>
						</tr>
						<xsl:if test="string(voor/email)!=''">
							<tr>
								<td class="label"><xsl:value-of select="//lcl/FAC/e-mail"/></td>
								<td class="value">: <xsl:value-of select="voor/email"/></td>
							</tr>
						</xsl:if>
						<xsl:if test="voor/telefoonnr!=''">
							<tr>
								<td class="label"><xsl:value-of select="//lcl/FAC/telefoon"/></td>
								<td class="value">: <xsl:value-of select="voor/telefoonnr"/></td>
							</tr>
						</xsl:if>
						<tr>
							<td class="label"><xsl:value-of select="//lcl/FAC/afdeling"/></td>
							<td class="value">:
								<xsl:if test="voor/afdeling/omschrijving=''">-</xsl:if>
								<xsl:value-of select="voor/afdeling/omschrijving"/>
							</td>
						</tr>
						<xsl:if test="string(voor/naam_full)!=string(voor/naam_full)">
													<tr>
								<td class="label"><xsl:value-of select="//lcl/BES/bestelvoor"/></td>
								<td class="value">: <xsl:value-of select="voor/naam_full"/></td>
							</tr>
						</xsl:if>
						<tr>
							<td class="label"><xsl:value-of select="//lcl/FAC/kostenplaats"/></td>
							<td class="value">:
								<xsl:if test="kostenplaats/nr=''">-</xsl:if>
								<xsl:value-of select="kostenplaats/nr"/>
							</td>
						</tr>
						<tr>
							<td height="20px"/>
						</tr>
						<tr>
							<td class="label"><xsl:value-of select="//lcl/BES/aanvraagdatum"/></td>
							<td class="value">:
								<xsl:value-of select="datum/datum"/>&#xA0;
								<xsl:value-of select="datum/tijd"/>
							</td>
						</tr>
						<tr>
							<td class="label"><xsl:value-of select="//lcl/BES/aanvraagstatus"/></td>
							<td class="value">: <xsl:value-of select="status"/></td>
						</tr>
						<tr>
							<td class="label">Afleverdatum</td>
							<td class="value">: <xsl:value-of select="leverdatum/datum"/></td>
						</tr>
						<tr>
							<td class="label" style="vertical-align:top"><xsl:value-of select="//lcl/BES/afleveradres"/></td>
							<td class="value">:
								<xsl:value-of select="afleveradres/naam"/>
								<br/>&#xA0;
								<xsl:value-of select="afleveradres/bezoek_adres"/>
								<br/>&#xA0;
								<xsl:value-of select="afleveradres/bezoek_postcode"/>&#xA0;
								<xsl:value-of select="afleveradres/bezoek_plaats"/>
								<br/>&#xA0;
								<xsl:value-of select="afleveradres/bezoek_land"/>
							</td>
						</tr>
						<tr>
							<td height="20px"/>
						</tr>
						<xsl:for-each select="kenmerk[count(@xmlnode)=0]">
						<xsl:if test="(@type!='L' and @type!='l')">
							<tr>
								<td class="label">
									<xsl:value-of select="@naam"/>
								</td>
								<td class="value">: <xsl:value-of select="."/></td>
							</tr>
						</xsl:if>	
						</xsl:for-each>
							<tr>
								<td height="20px"/>
							</tr>
						<xsl:if test="status='Geleverd'">
							<tr>
	   							<td class="label">Commentaar levering</td>
	   							<td class="value">: <xsl:value-of select="bestelopdracht/leveringopmerking"/></td>	
							</tr>
						   </xsl:if>											
						<tr>
							<td height="20px"/>
						</tr>
						<tr>
							<td colspan="2">
								<table cellpadding="0" cellspacing="0" border="1" bordercolor="#303030" width="100%">
									<tr>
										<th><xsl:value-of select="//lcl/BES/artikelnr"/></th>
										<th><xsl:value-of select="//lcl/FAC/omschrijving"/></th>
										<th><xsl:value-of select="//lcl/FAC/opmerkingen"/></th>
										<th style="text-align:right"><xsl:value-of select="//lcl/FAC/aantal"/></th>
										<th style="text-align:right"><xsl:value-of select="//lcl/FAC/prijs"/></th>
										<th style="text-align:right"><xsl:value-of select="//lcl/FAC/totaal"/></th>
									</tr>
									<xsl:for-each select="bestelitem">
										<tr>
											<td class="result" style="text-align:left">
												<xsl:value-of select="srtdeel/artikel_nummer"/>
											</td>
											<td class="result" style="text-align:left">
												<xsl:value-of select="srtdeel/omschrijving"/>
											</td>
											<td class="result">
												<xsl:for-each select="kenmerk[count(@xmlnode)=0]">
												<xsl:if test="(@type!='L' and @type!='l')">
													<xsl:value-of select="@naam"/>:
													<xsl:value-of select="."/>
													<br/>
												</xsl:if>	
												</xsl:for-each>&#xA0;</td>
											<td class="result" style="text-align:right">
												<xsl:value-of select="aantal"/>
											</td>
											<td class="result" style="text-align:right">
												<xsl:value-of select="format-number(prijs, '0,00', 'european')"/>
											</td>
											<td class="result" style="text-align:right">
												<xsl:value-of select="format-number(aantal*prijs, '0,00', 'european')"/>
											</td>
										</tr>
									</xsl:for-each>
									<tr>
										<td height="6px" style="border-style:solid;border-width:0px;"/>
									</tr>
									<tr>
										<td class="tekstkop" style="text-align:right;border-style:solid;border-width:0px;" colspan="5"><xsl:value-of select="//lcl/FAC/totaal"/>:</td>
										<td class="tekstkop" style="text-align:right;border-style:solid;border-width:0px;">
											<xsl:value-of select="format-number(sum(/facilitor/bestelling/bestelitem/totaal), '0,00', 'european')"/>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</TD>
				<TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
			</TR>
		</TABLE>
	</xsl:template>	


	<xsl:template match="perslid" mode="include">
 	<xsl:comment>================================ PERSONEN ==============================</xsl:comment>
	<xsl:comment>Facilitor new style default XSL template for perslid</xsl:comment>
	<br/><br/>
	Geachte heer, mevrouw,<br/><br/><br/>
  Over 7 dagen zal uw gebruikersaccount voor de Online Facilitydesk verlopen. Wanneer u binnen deze periode inlogt zal uw account niet worden gedeactiveerd.<br/><br/>
  Bent u uw wachtwoord vergeten? Klik dan <xsl:element name="a"><xsl:attribute name="href">https://<xsl:value-of select="/facilitor/header/user"/>.facilitor.nl</xsl:attribute>hier</xsl:element> om uw wachtwoord opnieuw in te stellen.<br/><br/>
	</xsl:template>


</xsl:stylesheet>
