<?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:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'"/>
	<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
	<xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/>



	<xsl:template match="rapport" mode="default">
		<html>

			<style>body {
       font-family: MS Sans Serif;
       background-color: rgb(255, 255, 255);
       margin-left:0px;
       margin-top:8px;
       cursor: auto;
    }

		p {
		    border-style: none;
				text-align: center;
		}

		p.kader {
		    border-style: solid;
		    border-width: 1px;
		}

		table {
		}


    th {
      font-family: Verdana;
      font-size: 9pt;
      font-weight: normal;
      color: #ffffff;
			text-align: center;
      text-decoration: bold;
      padding-left:  3px;
      padding-right: 3px;
      padding-top: 3px;
      padding-bottom: 3px;
      background-color: #333333;
    }

    td {
      font-family: Verdana;
      font-style: normal;
      font-size: 10pt;
      font-weight: normal;
      color:  #000000;
			text-align: center;
      vertical-align: top;
    }
    td.kop {
      font-size: 12pt;
      vertical-align: middle;
    }</style>

			<xsl:choose>

				<xsl:when test="translate(@view, $smallcase, $uppercase)='ASLE_V_RAP_SCHOONMAAK_SCHED'">
					<xsl:if test=" count(rapport_data/data_row) = 0">
						<table width="100%" border="1" cellpadding="0" cellspacing="0">


							<tr>
								<td>
									<center>
										<b>Geen gegevens gevonden</b>
									</center>
								</td>
							</tr>
						</table>
					</xsl:if>


					<xsl:variable name="distinct">
						<xsl:for-each select="rapport_data/data_row">
							<xsl:sort select="FCLT_F_NAAM"/>
							<xsl:sort select="PLAN_START"/>
							<xsl:copy-of select="."/>
						</xsl:for-each>
					</xsl:variable>

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

					<xsl:for-each select="msxml:node-set($distinct)/data_row">
						<xsl:variable name="naam">
							<xsl:value-of select="FCLT_F_NAAM"/>
						</xsl:variable>

						<xsl:variable name="prev_naam">
							<xsl:choose>
								<xsl:when test="position()=1">Quqelequ</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="preceding-sibling::data_row[1]/FCLT_F_NAAM"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>


						<xsl:if test="$prev_naam != FCLT_F_NAAM">

							<xsl:if test="position() != 1">
								<div style="page-break-before:always">&#xA0;</div>
							</xsl:if>
							<xsl:if test="$mode = 'print'">
								<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td>
											<img align="left" src="../../cust/asle/xsl/logo_asito.jpg"/>
										</td>
										<td>
											<img align="right" src="../../cust/asle/xsl/logo_nh.jpg"/>
										</td>
									</tr>
								</table>
							</xsl:if>

							<p>FIRST CLEAN C/O - EERST C/O SCHOONMAKEN - JAKO PIERWSZE POSPRZATAJ C/O</p>

							<p class="kader">
								<xsl:value-of select="LOCATIE"/>- FLOOR LIST - ROOM ATTENDANTS</p>
							<br/>
							<table width="100%" border="1" cellpadding="0" cellspacing="0">
								<thead>
									<tr>
										<th>Name R.A.</th>
										<th>Date</th>
										<th>Trolley number</th>
										<th>Key number</th>
										<th>Start time</th>
									</tr>
								</thead>
								<tbody>
									<tr height="40">
										<td class="kop">
											<xsl:value-of select="FCLT_F_NAAM"/>
										</td>
										<td class="kop">
											<xsl:value-of select="FCLT_F_DATUM"/>
										</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td class="kop">
											<xsl:value-of select="START_INZET"/>
										</td>
									</tr>
								</tbody>
							</table>
							<br/>

							<table width="100%" border="1" cellpadding="0" cellspacing="0">
								<thead>
									<tr>
										<th></th>
										<th>Room</th>
										<th>Check out</th>
										<th>Time</th>
										<th>SO/NC</th>
										<th>SO/LC</th>
										<th>Remarks</th>
									</tr>
								</thead>
								<tbody>
									<xsl:for-each select="msxml:node-set($sorted)/data_row[FCLT_F_NAAM=$naam]">

										<tr>
											<td>
												<xsl:value-of select="position()"/>
											</td>
											
											<td>
												<xsl:value-of select="RUIMTE"/>
											</td>
											<td>
												<xsl:if test="TYPE_SCHOONMAAK = 'Checkout'">x</xsl:if>&#xA0;</td>
											<td>
												<xsl:value-of select="BESCHIKBAAR"/>
											</td>
											<td>
												<xsl:if test="TYPE_SCHOONMAAK = 'Stay NLC'">x</xsl:if>&#xA0;</td>
											<td>
												<xsl:if test="TYPE_SCHOONMAAK = 'Stay LC'">x</xsl:if>&#xA0;</td>
											<td>&#xA0;</td>
										</tr>
									</xsl:for-each>
									<tr>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
									</tr>
									<tr>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
									</tr>
									<tr>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
									</tr>
									<tr>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
										<td>&#xA0;</td>
									</tr>
								</tbody>
							</table>
							<p class="kader">Floor Supervisors: floor 1 + 2 = 4200 - floor 3 + 4 = 4300 - floor 5 + 6 = 3000</p>


							<p>Tamara/Jolanta: 4500 - Linen room: 4000 - Public area: 4400<br/>
								TD: 5102 - Reception 9 - In case of Fire / Security: 6</p>

							<p class="kader">
								<br/>
								<br/>
							</p>
						</xsl:if>
					</xsl:for-each>
				</xsl:when>

			<xsl:when test="translate(@view, $smallcase, $uppercase)='ASLE_V_RAP_SUPERVISOR_SCHED'
			             or translate(@view, $smallcase, $uppercase)='ASLE_V_RAP_SUPERV_SCHED_TODAY'">
					<xsl:if test=" count(rapport_data/data_row) = 0">
						<table width="100%" border="1" cellpadding="0" cellspacing="0">


							<tr>
								<td>
									<center>
										<b>Geen gegevens gevonden</b>
									</center>
								</td>
							</tr>
						</table>
					</xsl:if>


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

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

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

					<xsl:for-each select="msxml:node-set($page_ns)/data_row">
						<xsl:variable name="page">
							<xsl:value-of select="PAGE"/>
						</xsl:variable>

						<xsl:variable name="prev_page">
							<xsl:choose>
								<xsl:when test="position()=1">Quqelequ</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="preceding-sibling::data_row[1]/PAGE"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>

						<xsl:if test="$prev_page != PAGE">
							<xsl:if test="position() != 1">
								<div style="page-break-before:always">&#xA0;</div>
							</xsl:if>
							<xsl:if test="$mode = 'print'">
								<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td>
											<img align="left" src="../../cust/asle/xsl/logo_asito.jpg"/>
										</td>
										<td>
											<img align="right" src="../../cust/asle/xsl/logo_nh.jpg"/>
										</td>
									</tr>
								</table>
							</xsl:if>
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
							<tr><td style="text-align: left; text-decoration:bold;">SUPERVISOR LIST</td>
							<td style="text-align: right;"><xsl:value-of select="FCLT_F_DATUM"/></td></tr></table>
							<br/>
              <xsl:for-each select="msxml:node-set($sorted)/data_row[PAGE=$page]">

							<xsl:variable name="zone">
							  <xsl:value-of select="ZONE"/>
						  </xsl:variable>

							<xsl:variable name="prev_zone">
							<xsl:choose>
								<xsl:when test="position()=1">Quqelequ</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="preceding-sibling::data_row[1]/ZONE"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>

						<xsl:if test="$prev_zone != ZONE">
						  <p>Zone: <xsl:value-of select="ZONE"/></p>
				    	<table width="100%" border="1" cellpadding="0" cellspacing="0">
								<thead>
									<tr>
										<th>DND</th>
										<th>Room</th>
										<th>SUP</th>
										<th>S/O</th>
										<th>C/O</th>
										<th>Time C/O</th>
										<th>R.A. Name</th>
										<th>Remark</th>
									</tr>
								</thead>

								<tbody>
									<xsl:for-each select="msxml:node-set($sorted)/data_row[ZONE=$zone and PAGE=$page]">

										<tr>
											<td>
												<xsl:if test="TYPE_SCHOONMAAK = 'DND'">x</xsl:if>&#xA0;
											</td>
											<xsl:element name="td">
												<xsl:attribute name="onclick">FcltMgr.openDetail('appl/pda/melding.asp?urole=fe&amp;stdm_key=62&amp;ruimte_key=<xsl:value-of select="ALG_RUIMTE_KEY"/>', '');</xsl:attribute>
												<span style="cursor:pointer; text-decoration: underline;"><xsl:value-of select="RUIMTE"/></span>
											</xsl:element>
											<td>&#xA0;</td>
											<td>
												<xsl:if test="TYPE_SCHOONMAAK = 'Stay LC'">LC</xsl:if>
												<xsl:if test="TYPE_SCHOONMAAK = 'Stay NLC'">NC</xsl:if>&#xA0;
											</td>
											<td>
												<xsl:if test="TYPE_SCHOONMAAK = 'Checkout'">x</xsl:if>&#xA0;
											</td>
											<td>
											  <xsl:if test="GROEP_NAAM and TYPE_SCHOONMAAK = 'Checkout'">
														<xsl:value-of select="BESCHIKBAAR"/>
												</xsl:if>
												<xsl:if test="not(GROEP_NAAM) and NAAM">IND</xsl:if>
											</td>
                      <td>
												<xsl:value-of select="NAAM"/>
											</td>
											<td>
											    <xsl:if test="TYPE_SCHOONMAAK = 'Blocked'">*BLOCKED*</xsl:if>
											    <xsl:if test="TYPE_SCHOONMAAK = 'Check'">*CHECK*</xsl:if>
													<xsl:value-of select="OPMERKING_SUP"/>
											</td>
										</tr>
									</xsl:for-each>
								</tbody>
							</table>
								
								</xsl:if>
                 </xsl:for-each>		
								 				
						 </xsl:if>
					</xsl:for-each>
					<div style="page-break-before:always">&#xA0;</div>
					<p>Samenvatting:<br/>
					Checkout: <xsl:value-of select="count(rapport_data/data_row[TYPE_SCHOONMAAK='Checkout'])"/><br/>
					DND: <xsl:value-of select="count(rapport_data/data_row[TYPE_SCHOONMAAK='DND'])"/><br/>
					Stay LC: <xsl:value-of select="count(rapport_data/data_row[TYPE_SCHOONMAAK='Stay LC'])"/><br/>
					Stay NLC: <xsl:value-of select="count(rapport_data/data_row[TYPE_SCHOONMAAK='Stay NLC'])"/><br/>
					</p>
				</xsl:when>

				<xsl:when test="translate(@view, $smallcase, $uppercase)='ASLE_V_RAP_LEEGLOOP'">
					<xsl:if test=" count(rapport_data/data_row) = 0">
						<table border="1" cellpadding="0" cellspacing="0">


							<tr>
								<td>
									<center>
										<b>Geen gegevens gevonden</b>
									</center>
								</td>
							</tr>
						</table>
					</xsl:if>

					<xsl:variable name="sorted">
						<xsl:for-each select="rapport_data/data_row">
							<xsl:sort select="FCLT_F_DATUM"/>
							<xsl:sort select="TIJDSTIP"/>
							<xsl:copy-of select="."/>
						</xsl:for-each>
					</xsl:variable>
					<table width="100%" border="1" cellpadding="0" cellspacing="0">
						<xsl:for-each select="msxml:node-set($sorted)/data_row">


							<xsl:if test="position() = 1">
								<thead>
									<tr>
										<th>Datum</th>
										<th>Tijdstip</th>
										<th>Beschikbaar</th>
										<th>Schoonmaak gestart</th>
										<th>Saldo</th>
									</tr>
								</thead>
							</xsl:if>
							<tr>
								<td>
									<xsl:value-of select="FCLT_F_DATUM"/>
								</td>
								<td>
									<xsl:value-of select="TIJDSTIP"/>
								</td>
								<td>
									<xsl:value-of select="BESCHIKBAAR"/>
								</td>
								<td>
									<xsl:value-of select="SCHOONMAAK_GESTART"/>
								</td>
								<xsl:variable name="background">
									<xsl:choose>
										<xsl:when test="BESCHIKBAAR - SCHOONMAAK_GESTART &lt; 0">#CC0000</xsl:when>
										<xsl:otherwise>#FFFFFF</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<xsl:element name="td">
									<xsl:attribute name="style">background-color: <xsl:value-of select="$background"/></xsl:attribute>
									<xsl:value-of select="BESCHIKBAAR - SCHOONMAAK_GESTART"/>
								</xsl:element>
							</tr>
						</xsl:for-each>
					</table>
				</xsl:when>

				<xsl:when test="translate(@view, $smallcase, $uppercase)='ASLE_V_WORK_LIST_COORDINATOR'">
					<xsl:if test=" count(rapport_data/data_row) = 0">
						<table border="1" cellpadding="0" cellspacing="0">


							<tr>
								<td>
									<center>
										<b>Geen gegevens gevonden</b>
									</center>
								</td>
							</tr>
						</table>
					</xsl:if>

					<xsl:variable name="sorted">
						<xsl:for-each select="rapport_data/data_row">
							<xsl:sort select="HIDE_F_TIMESTAMP"/>
							<xsl:copy-of select="."/>
						</xsl:for-each>
					</xsl:variable>
					<table width="100%" border="1" cellpadding="0" cellspacing="0">
						<xsl:for-each select="msxml:node-set($sorted)/data_row">


							<xsl:if test="position() = 1">
								<thead>
									<tr>
										<th>Kamer</th>
										<th>Naam</th>
										<th>Schoonmaak</th>
										<th>Beschikbaar</th>
										<th>Opdrachten</th>
										<th>Opmerkingen</th>
										<th>Status</th>
										<th>Actie</th>
									</tr>
								</thead>
							</xsl:if>
							<tr>
								<xsl:element name="td">
									<xsl:attribute name="onclick">FcltMgr.openDetail('appl/mld/mld_melding.asp?urole=bo&amp;mld_key=<xsl:value-of select="MLD_MELDING_KEY"/>', '');</xsl:attribute>
									<span style="cursor:pointer; text-decoration: underline;"><xsl:value-of select="KAMERNR"/></span>
								</xsl:element>
								<xsl:element name="td">
									<xsl:attribute name="onclick">FcltMgr.openDetail('appl/prs/prs_perslid.asp?prs_key=<xsl:value-of select="PRS_PERSLID_KEY"/>', '');</xsl:attribute>
									<span style="cursor:pointer; text-decoration: underline;"><xsl:value-of select="NAAM"/></span>
								</xsl:element>
								<td>
									<xsl:value-of select="TYPE_SCHOONMAAK"/>
								</td>
								<td>
									<xsl:value-of select="substring(substring-after(MLD_MELDING_EINDDATUM, 'T'),1,5)"/>
								</td>
								<td>
									<xsl:call-template name="linebreaks">
            				<xsl:with-param name="string" select="OPDRACHTEN"/>
          				</xsl:call-template>
								</td>
								<td>
									<xsl:call-template name="linebreaks">
            				<xsl:with-param name="string" select="OPMERKINGEN"/>
          				</xsl:call-template>
								</td>
								<xsl:variable name="background">
									<xsl:choose>
										<xsl:when test="OPDRSTATUS = 'Gecontroleerd'">#00CC00</xsl:when>
										<xsl:when test="OPDRSTATUS = 'Afgemeld'">#FF7F00</xsl:when>
										<xsl:when test="OPDRSTATUS = 'Gestart'">#FF0000</xsl:when>
										<xsl:otherwise>#FFFFFF</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<xsl:element name="td">
									<xsl:attribute name="style">background-color: <xsl:value-of select="$background"/></xsl:attribute>
									<xsl:value-of select="OPDRSTATUS"/>
								</xsl:element>
								<xsl:element name="td">
								  <xsl:if test="OPDRSTATUS = 'Gecontroleerd'">
											<xsl:attribute name="colspan">2</xsl:attribute>
											<xsl:attribute name="class">DRR</xsl:attribute>
											<xsl:attribute name="title">Kamer afronden</xsl:attribute>
											<xsl:attribute name="style">{ cursor: hand; border:none; text-align:right; }</xsl:attribute>
											<xsl:attribute name="onclick">$.post('../../cust/asle/mld_statusupdate.asp?meldingnr=<xsl:value-of select="MLD_MELDING_KEY"/>', {}, FcltCallbackRefresh, "json");</xsl:attribute>
											<span style="cursor:pointer; text-decoration: underline;">Afronden</span>
									</xsl:if>
									&#xA0;
								</xsl:element>

							</tr>
						</xsl:for-each>
					</table>
				</xsl:when>

				<xsl:otherwise>
					<xsl:comment>================================ RAPPORT ==============================</xsl:comment>
					<xsl:comment>FACILITOR default XSL template for rapport</xsl:comment>
					<xsl:call-template name="htmlhead"/>
					<body>
						<table>
							<xsl:for-each select="rapport_data/data_row">
								<xsl:sort select="."/>
								<tr>
									<td>
										<xsl:value-of select="current()"/>
									</td>
								</tr>
							</xsl:for-each>
						</table>
					</body>
				</xsl:otherwise>
			</xsl:choose>
		</html>
	</xsl:template>
</xsl:stylesheet>