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


<xsl:template match="melding" mode="include">
	<xsl:choose>
		<xsl:when test="$srtnotificatiecode = 'CUST02'">
			<xsl:apply-templates select="." mode="CUST02"/>
		</xsl:when>
		<xsl:otherwise>
		    <xsl:choose>
		        <xsl:when test="./discipline/srtdiscipline/key = '1'">
		            <xsl:apply-templates select="." mode="Beschikking"/>
		        </xsl:when>
		        <xsl:otherwise>
					<xsl:apply-templates select="." mode="Overig"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template match="melding" mode="CUST02">
		<table border="0" width="100%" cellpadding="2">
			<tr>
				<td colspan="2" class="caption" style="padding-top:20px;padding-bottom:20px">
					<b>!! Conflicten gevonden in uitgegeven uren aan de verzorgers t.o.v. de beschikking uitgegeven door gemeente</b>
				</td>
			</tr>
		</table>
</xsl:template>




<xsl:template match="melding" mode="Beschikking">
		<table border="0" width="100%" cellpadding="2">
			<tr>
				<td colspan="2" class="caption" style="padding-top:20px;padding-bottom:20px">
					<b>Meldingnr <xsl:value-of select="discipline/srtdiscipline/prefix"/><xsl:value-of select="key"/></b>
				</td>
				<td colspan="2" class="caption" style="padding-top:20px;padding-bottom:20px">
					<xsl:if test="spoed&lt;3">
						<b>SPOED!</b>
					</xsl:if>
				</td>
			</tr>
			<tr>
				<td colspan="2" style="font-size:14pt;padding-bottom:20px">
					<b>Team: <xsl:value-of select="discipline/omschrijving"/></b>
				</td>
				<td colspan="2">
				</td>
			</tr>
			<tr height="20px">
				<td colspan="4">
					<hr/>
				</td>
			</tr>
			<tr>
				<td colspan='4' style="font-size:14pt;padding-bottom:10px">
					<b>Clientgegevens:</b>
				</td>
			</tr>
			<tr>
				<td align="right" width="16%">
					<b>Client:</b>
				</td>
				<td align="left" width="34%">
					<xsl:value-of select="voor/naam_full"/>
				</td>
				<td align="right" width="16%">
					<!-- MBMB Telefoon (thuis)  -->
					<b><xsl:value-of select="voor/kenmerk[@key='1006']/@naam"/>:</b>
				</td>
				<td align="left" width="34%">
					<!-- MBMB Telefoon (thuis)  -->
					<xsl:value-of select="voor/kenmerk[@key='1006']"/>
				</td>
			</tr>
			<tr>
				<td align="right">
					<!-- MBMB Adres -->
					<b>Adres:</b>
				</td>
				<td align="left">
					<!-- MBMB Adres -->
					<xsl:value-of select="voor/kenmerk[@key='1003']"/>&#xA0;<xsl:value-of select="voor/kenmerk[@key='1040']"/>
				</td>
				<td align="right" valign="top">
					<!-- MBMB Postcode -->
					<b><xsl:value-of select="voor/kenmerk[@key='1004']/@naam"/>:</b>
				</td>
				<td align="left">
					<!-- MBMB Postcode -->
					<xsl:value-of select="voor/kenmerk[@key='1004']"/>
				</td>
			</tr>
			<tr>
				<td align="right">
					<!-- MBMB Woonplaats -->
					<b><xsl:value-of select="voor/kenmerk[@key='1005']/@naam"/>:</b>
				</td>
				<td align="left">
					<!-- MBMB Woonplaats -->
					<xsl:value-of select="voor/kenmerk[@key='1005']"/>
				</td>
				<td align="right" valign="top">
				</td>
			</tr>

			<tr height="40px">
				<td colspan="4">
					<hr/>
				</td>
			</tr>

			<tr>
				<td colspan='4' style="font-size:14pt;padding-bottom:10px">
					<b>Beschikkingsgegevens:</b>
				</td>
			</tr>
			<tr>
				<td align="right" width="16%">
					<!-- MBMB Beschikkingsnr -->
					<b><xsl:value-of select="kenmerk[@key='1']/@naam"/>:</b>
				</td>
				<td align="left" width="34%">
					<!-- MBMB Beschikkingsnr -->
					<xsl:value-of select="kenmerk[@key='1']"/>
				</td>
				<td align="right" width="16%">
					<b>Opdracht via:</b>
				</td>
				<td align="left" width="34%">
	            <xsl:choose>
				   <xsl:when test="kostenplaats/key='1'">
                  <xsl:value-of select="kostenplaats/omschrijving"/>
         		</xsl:when>
         		<xsl:otherwise>
	 					Gemeente <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>
					</xsl:otherwise>
					</xsl:choose>
				</td>
			</tr>
			<tr>
				<td align="right" width="16%">
					<b>Startdatum:</b>
				</td>
				<td align="left" width="34%">
					<xsl:value-of select="begindatum/datum"/>
				</td>
				<td align="right">
					<!-- MBMB Product -->
					<b><xsl:value-of select="kenmerk[@key='2']/@naam"/>:</b>
				</td>
				<td align="left">
					<!-- MBMB Product -->
					<xsl:value-of select="kenmerk[@key='2']"/>
				</td>
			</tr>
			<tr>
				<td align="right" width="16%">
					<b>Einddatum: </b>
				</td>
				<td align="left" width="34%">
					<xsl:value-of select="einddatum/datum"/>
				</td>
				<td align="right" valign="top">
					<!-- MBMB Indicatie -->
					<b><xsl:value-of select="kenmerk[@key='3']/@naam"/>:</b>
				</td>
				<td align="left">
					<!-- MBMB Indicatie -->
					<xsl:value-of select="kenmerk[@key='3']"/> uur per week
				</td>
			</tr>
			<tr height="40px">
				<td colspan="4">
					<hr/>
				</td>
			</tr>

			<tr>
				<td colspan='4' style="font-size:14pt;padding-bottom:10px">
					<b>Bijzonderheden:</b>
				</td>
			</tr>
			<tr>
				<td align="left" colspan="4">
					<xsl:call-template name="linebreaks">
						<xsl:with-param name="string" select="voor/kenmerk[@key='1041']"/>
					</xsl:call-template>
				</td>
			</tr>
			<tr>
				<td align="left" colspan="4">
					<xsl:call-template name="linebreaks">
						<xsl:with-param name="string" select="omschrijving"/>
					</xsl:call-template>
				</td>
			</tr>
			<xsl:if test="opmerking!=''">
				<tr>
					<td colspan="4">
						<xsl:call-template name="linebreaks">
							<xsl:with-param name="string" select="opmerking"/>
						</xsl:call-template>
					</td>
				</tr>
			</xsl:if>
		</table>
</xsl:template>

<xsl:template match="melding" mode="Overig">
		<table border="0" width="100%" cellpadding="2">
			<tr>
				<td colspan="2" class="caption" style="padding-top:20px;padding-bottom:20px">
					<b>Klachtnr <xsl:value-of select="discipline/srtdiscipline/prefix"/><xsl:value-of select="key"/></b>
				</td>
				<td colspan="2" class="caption" style="padding-top:20px;padding-bottom:20px">
					<xsl:if test="spoed&lt;3">
						<b>SPOED!</b>
					</xsl:if>
				</td>
			</tr>
			<tr>
				<td colspan="2" style="font-size:14pt;padding-bottom:20px">
					<b><xsl:value-of select="discipline/omschrijving"/></b>
				</td>
				<td colspan="2">
				</td>
			</tr>
			<tr height="20px">
				<td colspan="4">
					<hr/>
				</td>
			</tr>
			<tr>
				<td colspan='4' style="font-size:14pt;padding-bottom:10px">
					<b>Clientgegevens:</b>
				</td>
			</tr>
			<tr>
				<td align="right" width="16%">
					<b>Client:</b>
				</td>
				<td align="left" width="34%">
					<xsl:value-of select="voor/naam_full"/>
				</td>
				<td align="right" width="16%">
					<!-- MBMB Telefoon (thuis)  -->
					<b><xsl:value-of select="voor/kenmerk[@key='1006']/@naam"/>:</b>
				</td>
				<td align="left" width="34%">
					<!-- MBMB Telefoon (thuis)  -->
					<xsl:value-of select="voor/kenmerk[@key='1006']"/>
				</td>
			</tr>
			<tr>
				<td align="right">
					<!-- MBMB Adres -->
					<b>Adres:</b>
				</td>
				<td align="left">
					<!-- MBMB Adres -->
					<xsl:value-of select="voor/kenmerk[@key='1003']"/>&#xA0;<xsl:value-of select="voor/kenmerk[@key='1040']"/>
				</td>
				<td align="right" valign="top">
					<!-- MBMB Postcode -->
					<b><xsl:value-of select="voor/kenmerk[@key='1004']/@naam"/>:</b>
				</td>
				<td align="left">
					<!-- MBMB Postcode -->
					<xsl:value-of select="voor/kenmerk[@key='1004']"/>
				</td>
			</tr>
			<tr>
				<td align="right">
					<!-- MBMB Woonplaats -->
					<b><xsl:value-of select="voor/kenmerk[@key='1005']/@naam"/>:</b>
				</td>
				<td align="left">
					<!-- MBMB Woonplaats -->
					<xsl:value-of select="voor/kenmerk[@key='1005']"/>
				</td>
				<td align="right" valign="top">
				</td>
			</tr>

			<tr height="20px">
				<td colspan="4">
					<hr/>
				</td>
			</tr>

			<tr>
				<td colspan='4' style="font-size:14pt;padding-bottom:10px">
					<b>Klachtgegevens:</b>
				</td>
			</tr>
			<tr>
				<td align="right" width="16%">
					<!-- Soort klacht -->
					<b>Soort klacht:</b>
				</td>
				<td align="right" width="16%">
					<!-- Soort klacht -->
					<b><xsl:value-of select="stdmelding/omschrijving"/></b>
				</td>
			</tr>

			<tr>
			    <td align="right" width="16%">
					<!-- Omschrijving -->
					<b>Omschrijving:</b>
				</td>

				<td align="left" colspan="4">
					<xsl:call-template name="linebreaks">
						<xsl:with-param name="string" select="omschrijving"/>
					</xsl:call-template>
                </td>
			</tr>


			<tr>
				<td align="right" width="16%">
					<b>Melddatum:</b>
				</td>
				<td align="left" width="34%">
					<xsl:value-of select="begindatum/datum"/>
				</td>


				<td align="right" width="16%">
					<b>Planning afhandeling klacht: </b>
				</td>
				<td align="left" width="34%">
					<xsl:value-of select="einddatum/datum"/>
				</td>

			</tr>

			<tr>
				<td align="right" width="16%">
					<b>Status:</b>
				</td>
				<td align="left" width="34%">
					<xsl:value-of select="status"/>
				</td>
				<td align="right" width="16%">
					<b>Klacht afgehandeld:</b>
				</td>
				<td align="left" width="34%">
					<xsl:value-of select="tracking/track[@code='MLDAFM']/datum/datum"/>
				</td>

			</tr>
			<tr height="20px">
				<td colspan="4">
					<hr/>
				</td>
			</tr>

			<tr>
				<td colspan='4' style="font-size:14pt;padding-bottom:10px">
					<b>Bijzonderheden:</b>
				</td>
			</tr>
			<xsl:if test="opmerking!=''">
				<tr>
					<td colspan="4">
						<xsl:call-template name="linebreaks">
							<xsl:with-param name="string" select="opmerking"/>
						</xsl:call-template>
					</td>
				</tr>
			</xsl:if>
			<xsl:apply-templates select="notes"/>

		</table>
</xsl:template>





<xsl:template match="notes">
    <tr height="20px">
    	<td colspan="4">
    		<hr/>
    	</td>
    </tr>
    <tr>
        <td colspan='4' style="font-size:14pt;padding-bottom:10px"><b>Notities:</b></td>
	</tr>
    <xsl:for-each select="note">

        <xsl:if test="position() = 1">
        <tr>
            <td><b>Wie</b></td>
            <td><b>Wanneer</b></td>
            <td colspan='2'><b>Wat</b></td>
        </tr>
        </xsl:if>
        <tr>
            <td><xsl:value-of select="noteur/naam_full"/></td>
            <td><xsl:value-of select="aanmaak/datum"/> (<xsl:value-of select="aanmaak/tijd"/>u)</td>
            <td colspan='2'>
                <xsl:call-template name="linebreaks">
				    <xsl:with-param name="string" select="omschrijving"/>
				</xsl:call-template>
			</td>
        </tr>
    </xsl:for-each>
</xsl:template>



<xsl:template match="opdracht" mode="include">
		<table border="0" width="100%" cellpadding="2">
			<tr>
				<td colspan="4" class="caption" style="padding-top:20px;padding-bottom:20px">
					<b>
						<xsl:value-of select="opdrachttype/omschrijving"/>&#160;
						<xsl:value-of select="melding/discipline/srtdiscipline/prefix"/>
						<xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/></b>
				</td>
			</tr>

			<xsl:if test="melding/kenmerk[@naam='Ordernr']!=''">
				<tr>
					<td colspan="2"/>
					<td align="right">
						<b>Ordernr:</b>
					</td>
					<td align="left">
						<xsl:value-of select="melding/kenmerk[@naam='Ordernr']"/>
					</td>
				</tr>
			</xsl:if>
			<tr>
				<td align="right">
					<b>Verzorger:</b>
				</td>
				<td align="left">
					<xsl:value-of select="uitvoerende/persoon/naam_full"/>
				</td>
				<td colspan="2"/>
			</tr>

			<tr>
				<td align="right">
					<b>Startdatum:</b>
				</td>
				<td align="left">
					<xsl:value-of select="datumbegin/datum"/>
				</td>
				<td colspan="2"/>
			</tr>
			<tr>
				<td align="right">
					<b>Einddatum:</b>
				</td>
				<td align="left">
					<xsl:value-of select="datumgereed/datum"/>
				</td>
				<td colspan="2"/>
			</tr>
			<tr>
				<td align="right">
					<b>Aantal uren per week:</b>
				</td>
				<td>
					<xsl:value-of select="uren"/>
				</td>
				<td colspan="2"/>
			</tr>
			<tr>
				<td colspan="4">
					<hr/>
				</td>
			</tr>
			<tr>
				<td align="right">
					<b>Teamleider:</b>
				</td>
				<td align="left">
					<xsl:value-of select="backoffice_contact/naam_full"/>
				</td>
				<td colspan="2"/>
			</tr>
			<tr>
				<td align="right">
					<b>Telefoon:</b>
				</td>
				<td align="left">
					<xsl:value-of select="backoffice_contact/telefoonnr"/>
				</td>
				<td align="right">
					<b>E-mail:</b>
				</td>
				<td align="left">
					<xsl:value-of select="backoffice_contact/email"/>
				</td>
			</tr>
			<tr>
				<td colspan="4" align="center">
					<table width="100%" style="background-color:#EEEEEE;border: 1px solid blue">
						<tr>
							<td>
								<xsl:apply-templates select="melding" mode="include"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td colspan="4" height="30px" valign="center">
					<hr/>
				</td>
			</tr>
		</table>
</xsl:template>



<xsl:key name="gemeente" match="//facilitor/rapport/rapport_data/data_row" use="FCLT_F_GEMEENTE"/>
<xsl:key name="bsn" match="//facilitor/rapport/rapport_data/data_row" use="BSN_CLIENT"/>
<xsl:key name="verzorger" match="//facilitor/rapport/rapport_data/data_row" use="VERZORGER_NAAM"/>
<xsl:key name="dagnr" match="//facilitor/rapport/rapport_data/data_row" use="DAG"/>

<xsl:template match="rapport">

	<xsl:if test="@view = 'care_v_rap2_factuur_uren_iwmo'">
		<style>
	  		.num0dec {mso-number-format:0;} .num2dec {mso-number-format:Fixed;} .tekst {mso-number-format:"\@";}
	  </style>
		<table border="0" bordercolor="#ffffff" width="100%">
		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">


			  <xsl:if test="position() = 1">
    				<tr>
    					<td>BSN</td>
							<td>Geboortedatum</td>
							<td>Geslacht</td>
							<td>Geboortenaam</td>
							<td>Voorvoegsel</td>
							<td>Naamcode 1</td>
							<td>Achternaampartner</td>
							<td>Voorvoegsel partner</td>
							<td>Voorletters</td>
							<td>Naamcode 2</td>
							<td>Postcode</td>
							<td>Huisnummer</td>
							<td>Huisnummertoevoeging</td>
							<td>Indicatie cliënt overleden</td>
							<td>Beschikkingsnummer</td>
							<td>Productcategorie</td>
							<td>Begindatumproduct</td>
							<td>Einddatumproduct</td>
							<td>Productcode</td>
							<td>aantaluitgevoerdeproduct</td>
							<td>tijdseenheid zorgperiode</td>
							<td>Declaratiebedrag</td>
							<td>Debet Credit</td>
							<td>Referentienummer credit</td>
						</tr>
	    	</xsl:if>
				<tr>
					<td class="tekst"><xsl:value-of select="BSN"/></td>
					<td class="tekst"><xsl:value-of select="GEBOORTEDATUM"/></td>
					<td class="tekst"><xsl:value-of select="GESLACHT"/></td>
					<td class="tekst"><xsl:value-of select="GEBOORTENAAM"/></td>
					<td class="tekst"><xsl:value-of select="VOORVOEGSEL"/></td>
					<td class="tekst"><xsl:value-of select="NAAMCODE1"/></td>
					<td class="tekst"><xsl:value-of select="ACHTERNAAMPARTNER"/></td>
					<td class="tekst"><xsl:value-of select="VOORVOEGSELPARTNER"/></td>
					<td class="tekst"><xsl:value-of select="VOORLETTERS"/></td>
					<td class="tekst"><xsl:value-of select="NAAMCODE2"/></td>
					<td class="tekst"><xsl:value-of select="POSTCODE"/></td>
					<td class="tekst"><xsl:value-of select="HUISNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="HUISNUMMERTOEVOEGING"/></td>
					<td class="tekst"><xsl:value-of select="INDICATIEOVERLEDEN"/></td>
					<td class="tekst"><xsl:value-of select="BESCHIKKINGSNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="PRODUCTCATEGORIE"/></td>
					<td class="tekst"><xsl:value-of select="BEGINDATUMPRODUCT"/></td>
					<td class="tekst"><xsl:value-of select="EINDDATUMPRODUCT"/></td>
					<td class="tekst"><xsl:value-of select="PRODUCTCODE"/></td>
					<td class="tekst"><xsl:value-of select="AANTALUITGEVOERDEPRODUCT"/></td>
					<td class="tekst"><xsl:value-of select="TIJDSEENHEIDZORGPERIODE"/></td>
					<td class="tekst"><xsl:value-of select="DECLARATIEBEDRAG"/></td>
					<td class="tekst"><xsl:value-of select="DEBETCREDIT"/></td>
					<td class="tekst"><xsl:value-of select="REFERENTIENUMMERCREDIT"/></td>
				</tr>

  	</xsl:for-each>
		</table>
  </xsl:if>

	<xsl:if test="@view = 'care_v_rap2_factuur_uren_R'">
		<style>
	  		.num0dec {mso-number-format:0;} .num2dec {mso-number-format:Fixed;} .tekst {mso-number-format:"\@";}
	  </style>
		<table border="0" bordercolor="#ffffff" width="100%">
		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">


			  <xsl:if test="position() = 1">
    				<tr>
    					<td>Factuurnr</td>
							<td>BSN</td>
							<td>Voorletters</td>
							<td>Tussenvoegsel</td>
							<td>Naam</td>
							<td>Meisjesnaam</td>
							<td>Naam2</td>
							<td>Geboortedatum</td>
							<td>Geslacht</td>
							<td>Straat</td>
							<td>Huisnummer</td>
							<td>Postcode</td>
							<td>Woonplaats</td>
							<td>Telefoonnummer</td>
							<td>Mobielnummer</td>
							<td>Contactpersoon</td>
							<td>Email</td>
							<td>Opmerking</td>
							<td>Bijzonderheden</td>
							<td>Beschikkingsnummer</td>
							<td>Start indiciatie</td>
							<td>Eind indicatie</td>
							<td>Soort HV</td>
							<td>Indicatie uren</td>
							<td>Uren besteed</td>
						</tr>
	    	</xsl:if>
				<tr>
					<td class="tekst"><xsl:value-of select="FACTUURNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="BSN"/></td>
					<td class="tekst"><xsl:value-of select="VOORLETTERS"/></td>
					<td class="tekst"><xsl:value-of select="TUSSENVOEGSEL"/></td>
					<td class="tekst"><xsl:value-of select="NAAM"/></td>
					<td class="tekst"><xsl:value-of select="MEISJES_NAAM"/></td>
					<td class="tekst"><xsl:value-of select="NAAM2"/></td>
					<td class="tekst"><xsl:value-of select="GEBOORTEDATUM"/></td>
					<td class="tekst"><xsl:value-of select="GESLACHT"/></td>
					<td class="tekst"><xsl:value-of select="STRAAT"/></td>
					<td class="tekst"><xsl:value-of select="HUISNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="POSTCODE"/></td>
					<td class="tekst"><xsl:value-of select="WOONPLAATS"/></td>
					<td class="tekst"><xsl:value-of select="TELEFOONNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="MOBIELNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="CONTACTPERSOON"/></td>
					<td class="tekst"><xsl:value-of select="EMAIL"/></td>
					<td class="tekst"><xsl:value-of select="OPMERKING"/></td>
					<td class="tekst"><xsl:value-of select="BIJZONDERHEDEN"/></td>
					<td class="tekst"><xsl:value-of select="BESCHIKKINGSNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="substring(START_INDICATIE,9,2)" />-<xsl:value-of select="substring(START_INDICATIE,6,2)" />-<xsl:value-of select="substring(START_INDICATIE,1,4)" /></td>
					<td class="tekst"><xsl:value-of select="substring(EIND_INDICATIE,9,2)" />-<xsl:value-of select="substring(EIND_INDICATIE,6,2)" />-<xsl:value-of select="substring(EIND_INDICATIE,1,4)" /></td>
					<td class="tekst"><xsl:value-of select="SOORT_HV"/></td>
					<td class="tekst"><xsl:value-of select="INDICATIE_UREN"/></td>
					<td class="tekst"><xsl:value-of select="UREN_BESTEED"/></td>
				</tr>

  	</xsl:for-each>
		</table>
  </xsl:if>

	<xsl:if test="@view = 'care_v_rap_tot_clientzorg' or @view = 'CARE_V_RAP_TOT_CLIENTZORG_MDW'">
		<style>
	  		.num0dec {mso-number-format:0;} .num2dec {mso-number-format:Fixed;} .tekst {mso-number-format:"\@";}
	  		.nowrap {white-space: nowrap;)
	  </style>
		<table border="0" bordercolor="#ffffff" width="100%">
		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">

			  <xsl:if test="position() = 1">
    				<tr>
    				    <td>Periode</td>
    					<td>Gemeente</td>
    					<td>Status</td>
						<td>BSN</td>
						<td>Voorletters</td>
						<td>Tussenvoegsel</td>
						<td>Naam</td>
						<td>Meisjesnaam</td>
						<td>Naam2</td>
						<td>Geboortedatum</td>
						<td>Geslacht</td>
						<td>Straat</td>
						<td>Huisnummer</td>
						<td>Postcode</td>
						<td>Woonplaats</td>
						<td>Telefoonnummer</td>
						<td>Mobielnummer</td>
						<td>Contactpersoon</td>
						<td>Email</td>
						<td>Opmerking</td>
						<td>Bijzonderheden</td>
						<td>Beschikkingsnummer</td>
						<td class="nowrap">Start indiciatie</td>
						<td class="nowrap">Eind indicatie</td>
						<td class="nowrap">Soort HV</td>
						<td class="nowrap">Indicatie uren</td>
						<td class="nowrap">Uren besteed</td>
					    <xsl:if test="//facilitor/rapport/@view = 'CARE_V_RAP_TOT_CLIENTZORG_MDW'">
					        <td>Medewerker</td>
                            <td>Personeelsnummer</td>
					    </xsl:if>
						</tr>
	    	</xsl:if>
				<tr>
				  <td class="tekst"><xsl:value-of select="FCLT_F_PERIODE"/></td>
					<td class="tekst"><xsl:value-of select="FCLT_F_GEMEENTE"/></td>
                    <td class="tekst"><xsl:value-of select="FCLT_F_STATUS"/></td>
					<td class="tekst"><xsl:value-of select="BSN"/></td>
					<td class="tekst"><xsl:value-of select="VOORLETTERS"/></td>
					<td class="tekst"><xsl:value-of select="TUSSENVOEGSEL"/></td>
					<td class="tekst"><xsl:value-of select="NAAM"/></td>
					<td class="tekst"><xsl:value-of select="MEISJES_NAAM"/></td>
					<td class="tekst"><xsl:value-of select="NAAM2"/></td>
					<td class="tekst"><xsl:value-of select="GEBOORTEDATUM"/></td>
					<td class="tekst"><xsl:value-of select="GESLACHT"/></td>
					<td class="tekst"><xsl:value-of select="STRAAT"/></td>
					<td class="tekst"><xsl:value-of select="HUISNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="POSTCODE"/></td>
					<td class="tekst"><xsl:value-of select="WOONPLAATS"/></td>
					<td class="tekst"><xsl:value-of select="TELEFOONNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="MOBIELNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="CONTACTPERSOON"/></td>
					<td class="tekst"><xsl:value-of select="EMAIL"/></td>
					<td class="tekst"><xsl:value-of select="OPMERKING"/></td>
					<td class="tekst"><xsl:value-of select="BIJZONDERHEDEN"/></td>
					<td class="tekst"><xsl:value-of select="BESCHIKKINGSNUMMER"/></td>
					<td class="tekst"><xsl:value-of select="substring(FCLT_F_START_INDICATIE,9,2)" />-<xsl:value-of select="substring(FCLT_F_START_INDICATIE,6,2)" />-<xsl:value-of select="substring(FCLT_F_START_INDICATIE,1,4)" /></td>
					<td class="tekst"><xsl:value-of select="substring(EIND_INDICATIE,9,2)" />-<xsl:value-of select="substring(EIND_INDICATIE,6,2)" />-<xsl:value-of select="substring(EIND_INDICATIE,1,4)" /></td>
					<td class="tekst"><xsl:value-of select="SOORT_HV"/></td>
					<td class="tekst"><xsl:value-of select="INDICATIE_UREN"/></td>
					<td class="tekst"><xsl:value-of select="UREN_BESTEED"/></td>
                    <xsl:if test="//facilitor/rapport/@view = 'CARE_V_RAP_TOT_CLIENTZORG_MDW'">
                        <td class="tekst"><xsl:value-of select="FCLT_F_MEDEWERKER"/></td>
                        <td class="tekst"><xsl:value-of select="PERSONEELSNUMMER"/></td>
                    </xsl:if>
				</tr>

  	</xsl:for-each>
		</table>
  </xsl:if>

  <xsl:if test="@view = 'care_v_rap2_factuur_uren_G' or @view = 'care_v_rap2_factuur_uren_H'">
		<table border="0" bordercolor="#ffffff" width="100%">
		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">
		  <xsl:sort select="HIDE_F_NR"/>

		  <xsl:choose>
				  <xsl:when test="HIDE_F_NR = 1">
	    				<tr>
								<td><xsl:value-of select="RECORD_START"/></td>
								<td><xsl:value-of select="WZACODE"/></td>
								<td><xsl:value-of select="FACTUURNUMMER"/></td>
								<td><xsl:value-of select="CODE"/></td>
								<td><xsl:value-of select="BSN"/></td>
								<td><xsl:value-of select="GEBOORTEDATUM"/></td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>



							</tr>
		    	</xsl:when>
		    	<xsl:when test="HIDE_F_NR = 2">
	    				<tr>
								<td><xsl:value-of select="RECORD_START"/></td>
								<td><xsl:value-of select="position()-1"/></td>
								<td><xsl:value-of select="WZACODE"/></td>
								<td><xsl:value-of select="FACTUURNUMMER"/></td>
								<td><xsl:value-of select="CODE"/></td>
								<td><xsl:value-of select="BSN"/></td>
								<td><xsl:value-of select="GEBOORTEDATUM"/></td>
								<td><xsl:value-of select="VAN"/></td>
								<td><xsl:value-of select="TOT"/></td>
								<td><xsl:value-of select="PRODUCT"/></td>
								<td><xsl:value-of select="PRODUCTCODE"/></td>
								<td><xsl:value-of select="MINUTEN"/></td>
								<td><xsl:value-of select="CENTEN"/></td>
								<td><xsl:value-of select="BTW"/></td>
								<td><xsl:value-of select="SUBTOTAAL"/></td>
								<td><xsl:value-of select="RECORD_EINDE"/></td>
							</tr>
					</xsl:when>

		    	<xsl:when test="HIDE_F_NR = 3">
		    			<tr>
								<td><xsl:value-of select="RECORD_START"/></td>
								<td><xsl:value-of select="WZACODE"/></td>
								<td><xsl:value-of select="FACTUURNUMMER"/></td>
								<td><xsl:value-of select="CODE"/></td>
								<td><xsl:value-of select="BSN"/></td>
								<td><xsl:value-of select="GEBOORTEDATUM"/></td>
								<td><xsl:value-of select="position()-2"/></td>
								<td><xsl:value-of select="sum(//facilitor/rapport/rapport_data/data_row/SUBTOTAAL[string(number(.))!='NaN'])"/></td>
								<td><xsl:value-of select="RECORD_EINDE"/></td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>
								<td>&#160;</td>

							</tr>
		    	</xsl:when>

			</xsl:choose>

  	</xsl:for-each>
		</table>
  </xsl:if>

  <xsl:if test="@view = 'care_v_rap2_factuur_uren_L'">
        <table border="0" bordercolor="#ffffff" width="100%">
            <tr>
                <td><b>Naam</b></td>
                <td><b>BSN</b></td>
                <td><b>Client nr</b></td>
                <td><b>Geboortedatum</b></td>
                <td><b>Adres</b></td>
                <td><b>PC</b></td>
                <td><b>Woonplaats</b></td>
                <td><b>Product</b></td>
                <td><b>Totaal uren per Periode</b></td>
                <td><b>Totaal bedrag client</b></td>
                <td><b>Periode</b></td>
                <td><b>Factuurnummer</b></td>
            </tr>
    		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">
    		  <xsl:sort select="NAAM"/>

      				<tr>
    						<td><xsl:value-of select="NAAM"/></td>
    						<td><xsl:value-of select="BSN"/></td>
    						<td><xsl:value-of select="CLIENTNUMMER"/></td>
    						<td><xsl:value-of select="GEBOORTEDATUM"/></td>
    						<td><xsl:value-of select="ADRES"/></td>
    						<td><xsl:value-of select="PC"/></td>
    						<td><xsl:value-of select="WOONPLAATS"/></td>
    						<td><xsl:value-of select="PRODUCT"/></td>
    						<td><xsl:value-of select="UREN_PER_PERIODE"/></td>
    						<td><xsl:value-of select="TOTAAL_BEDRAG"/></td>
    						<td><xsl:value-of select="PERIODE"/></td>
    						<td><xsl:value-of select="FACTUURNUMMER"/></td>
    					</tr>

      	</xsl:for-each>
    		</table>
  </xsl:if>



    <xsl:if test="@view = 'care_v_rap2_factuur_uren_N'">
        <table border="0" bordercolor="#ffffff" width="100%">
            <tr>
                <td>Recordsoort</td>
                <td>Volgnummer</td>
                <td>WZAcode</td>
                <td>Factuurnummer</td>
                <td>Soort factuur</td>
                <td>BSN</td>
                <td>Geboortedatum</td>
                <td>Startdatum</td>
                <td>Einddatum</td>
                <td>Hoofdcategorie</td>
                <td>Categoriecode</td>
                <td>Totaal uren</td>
                <td>Factuurbedrag ex BTW</td>
                <td>Btw</td>
                <td>Factuurbedrag incl BTW</td>
                <td>Debet credit</td>
                <td>Uurtarief</td>
                <td>Naam client</td>
                <td>Initialen client</td>
                <td>Voorvoegsel client</td>
                <td>Datum aanvang zorg</td>
                <td>Gemeentecode</td>
                <td>Periode</td>
            </tr>
    		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row">
    		  <xsl:sort select="HIDE_F_NR"/>

      				<tr>
    						<td><xsl:value-of select="RECORD_START"/></td>
    						<td><xsl:value-of select="position()"/></td>
    						<td><xsl:value-of select="WZACODE"/></td>
    						<td><xsl:value-of select="FACTUURNUMMER"/></td>
    						<td><xsl:value-of select="CODE"/></td>
    						<td><xsl:value-of select="BSN"/></td>
    						<td><xsl:value-of select="GEBOORTEDATUM"/></td>
    						<td><xsl:value-of select="VAN"/></td>
    						<td><xsl:value-of select="TOT"/></td>
    						<td><xsl:value-of select="PRODUCT"/></td>
    						<td><xsl:value-of select="PRODUCTCODE"/></td>
    						<td><xsl:value-of select="MINUTEN"/></td>
    						<td><xsl:value-of select="CENTEN"/></td>
    						<td><xsl:value-of select="BTW"/></td>
    						<td><xsl:value-of select="SUBTOTAAL"/></td>
    						<td><xsl:value-of select="RECORD_EINDE"/></td>
    						<td><xsl:value-of select="UURTARIEF"/></td>
    						<td><xsl:value-of select="ACHTERNAAM"/></td>
    						<td><xsl:value-of select="VOORLETTERS"/></td>
    						<td><xsl:value-of select="VOORVOEGSELS"/></td>
    						<td><xsl:value-of select="substring(DATUM_EERSTKEERZORG,9,2)"/>-<xsl:value-of select="substring(DATUM_EERSTKEERZORG,6,2)"/>-<xsl:value-of select="substring(DATUM_EERSTKEERZORG,1,4)"/></td>
    						<td><xsl:value-of select="GEMEENTE_CODE"/></td>
    						<td><xsl:value-of select="FCLT_X_PERIODE"/></td>
    					</tr>

      	</xsl:for-each>
    		</table>
    </xsl:if>


    <xsl:if test="@view = 'care_v_rap_prs_planbord' or @view = 'care_v_rap_prs_team_planbord'">


        <script>
            <xsl:text disable-output-escaping="yes">
            function prs_showverzorger (p_prs_perslid_key){
                var url = "appl/prs/prs_perslid.asp?prs_key=" + p_prs_perslid_key;
                FcltMgr.openDetail(url, "Persoonsgegevens", { });
            }
            function prs_add_inzetbaar (p_prs_perslid_key, p_dag){
                if (p_dag == 7){
                    // zondag in xsl = 7, en zondag in asp/sql = 0
                    p_dag = 0;
                }

                var url = "../../appl/prs/prs_edit_inzetbaar.asp?prs_key=" + p_prs_perslid_key + "&amp;prs_dag=" + p_dag ;
                FcltMgr.openModalDetail(url, "Inzetbaarheid", { });
            }
            function prs_chg_inzetbaar (prs_inzetbaar_key){
                var url = "../../appl/prs/prs_edit_inzetbaar.asp?prs_inzetbaar_key=" + prs_inzetbaar_key;
                FcltMgr.openModalDetail(url, "Inzetbaarheid", { });
            }
            function mld_edit_werkplan (p_mld_opdr_key, p_client_naam){
                var url = "../../appl/mld/mld_uitvoeren_list.asp?embedded=0&amp;opdr_key=" + p_mld_opdr_key + "&amp;collapsed=0";
                FcltMgr.openModalDetail(url, p_client_naam, { });
            }
            function mld_lopende_opdrachten (p_prs_perslid_key, p_verzorger_naam){
                var url = "appl/mld/opdr_search.asp?urole=bo&amp;autosearch=1&amp;handler_key=" + p_prs_perslid_key;
                FcltMgr.openDetail(url, p_verzorger_naam, { });
            }
            </xsl:text>
        </script>

        <table width="100%" style="border:1px solid black;border-collapse:collapse;">

            <thead>
                <tr>
                    <th colspan="2"><b> </b></th>
                    <th colspan="10"><b>DIENSTVERBAND</b></th>
                </tr>
                <tr>
                    <th colspan="2"><b>VERZORGER</b></th>
                    <th width="2%"><b>TOT</b></th>
                    <th width="2%"><b>WERK</b></th>
                    <th width="2%"><b>OVER</b></th>
                    <th><b>MAANDAG</b></th>
                    <th><b>DINSDAG</b></th>
                    <th><b>WOENSDAG</b></th>
                    <th><b>DONDERDAG</b></th>
                    <th><b>VRIJDAG</b></th>
                    <th><b>ZATERDAG</b></th>
                    <th><b>ZONDAG</b></th>
                </tr>
            </thead>
            <xsl:for-each select="//facilitor/rapport/rapport_data/data_row[generate-id(.)=generate-id(key('verzorger',VERZORGER_NAAM)[1])]">
      	        <xsl:sort select="VERZORGER_NAAM"/>
      	        <xsl:sort select="DAG"/>
                <tr>
        			  		<xsl:call-template name="planbord_verzorger"><xsl:with-param name="p_verzorger_key" select="PRS_PERSLID_KEY"/><xsl:with-param name="p_verzorger_naam" select="VERZORGER_NAAM"/></xsl:call-template>
        			  		<xsl:call-template name="planbord_dienstverband"><xsl:with-param name="p_verzorger_dienstverband" select="VERZORGER_DIENSTVERBAND"/><xsl:with-param name="p_verzorger_opdr_uren" select="VERZORGER_OPDR_UREN"/></xsl:call-template>
        			  		<xsl:call-template name="planbord_dag"><xsl:with-param name="p_verzorger_key" select="PRS_PERSLID_KEY"/><xsl:with-param name="p_dag" select="1"/></xsl:call-template>
            				<xsl:call-template name="planbord_dag"><xsl:with-param name="p_verzorger_key" select="PRS_PERSLID_KEY"/><xsl:with-param name="p_dag" select="2"/></xsl:call-template>
            				<xsl:call-template name="planbord_dag"><xsl:with-param name="p_verzorger_key" select="PRS_PERSLID_KEY"/><xsl:with-param name="p_dag" select="3"/></xsl:call-template>
            				<xsl:call-template name="planbord_dag"><xsl:with-param name="p_verzorger_key" select="PRS_PERSLID_KEY"/><xsl:with-param name="p_dag" select="4"/></xsl:call-template>
            				<xsl:call-template name="planbord_dag"><xsl:with-param name="p_verzorger_key" select="PRS_PERSLID_KEY"/><xsl:with-param name="p_dag" select="5"/></xsl:call-template>
            				<xsl:call-template name="planbord_dag"><xsl:with-param name="p_verzorger_key" select="PRS_PERSLID_KEY"/><xsl:with-param name="p_dag" select="6"/></xsl:call-template>
            				<xsl:call-template name="planbord_dag"><xsl:with-param name="p_verzorger_key" select="PRS_PERSLID_KEY"/><xsl:with-param name="p_dag" select="7"/></xsl:call-template>
                </tr>
                <!-- <xsl:call-template name="planbord_regel"><xsl:with-param name="p_verzorger_key" select="PRS_PERSLID_KEY"/></xsl:call-template> -->

            </xsl:for-each>
        </table>
    </xsl:if>




  <xsl:if test="@view = 'care_v_rap_factuur_voorblad_a' or @view = 'care_v_rap2_factuur_voorblad_a'">

		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row[generate-id(.)=generate-id(key('gemeente',FCLT_F_GEMEENTE)[1])]">

	    <xsl:sort select="FCLT_F_GEMEENTE"/>

			<xsl:if test="position() != 1">
				<div style="page-break-before:always">&#160;</div>
			</xsl:if>
			<xsl:apply-templates select="." mode="aanhefgemeente"/>
			<xsl:apply-templates select="." mode="factuurgegevens"/>
			<xsl:call-template name="factuurproductentabel"><xsl:with-param name="p_gemeente" select="FCLT_F_GEMEENTE"/></xsl:call-template>
			<xsl:call-template name="betalingsvoorwaarde"/>
		  <xsl:apply-templates select="." mode="zorgaanbieder"/>
		</xsl:for-each>
  </xsl:if>
  <xsl:if test="@view = 'care_v_rap_factuur_pgb_a' or @view = 'care_v_rap2_factuur_pgb_a' or @view = 'care_v_rap2_factuur_pgb_a_mnd'">

		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row[generate-id(.)=generate-id(key('bsn',BSN_CLIENT)[1])]">

  		<xsl:sort select="BSN_CLIENT"/>

			<xsl:if test="position() != 1">
				<div style="page-break-before:always">&#160;</div>
			</xsl:if>
			<xsl:apply-templates select="." mode="aanhefclient"/>
			<xsl:apply-templates select="." mode="factuurgegevens"/>
			<xsl:call-template name="factuurproductentabel"><xsl:with-param name="p_bsn" select="BSN_CLIENT"/></xsl:call-template>
			<xsl:call-template name="betalingsvoorwaarde"/>
		  <xsl:apply-templates select="." mode="zorgaanbieder"/>
		</xsl:for-each>
  </xsl:if>


  <xsl:if test="@view = 'care_v_rap_km_per_dag'" >


    <script>
        <xsl:text disable-output-escaping="yes">
        function opdr_uren_edit(p_role, p_prs_perslid, p_fromdate, p_jaarweek){
            var l_datum_from = new Date (parseInt(p_fromdate.substr(0,4),10), parseInt(p_fromdate.substr(5,2),10) - 1 , parseInt(p_fromdate.substr(8,2),10));
            l_time_from = l_datum_from.getTime();
            var url = "../../appl/mld/opdr_edit_uren.asp?urole=" + p_role +
                      "&amp;prs_key=" + p_prs_perslid +
                      "&amp;datefrom=" + l_time_from;

            FcltMgr.openModalDetail(url, "Weeklijst" + p_jaarweek,{ });
        }
		    </xsl:text>
    </script>

    <table border="0" bordercolor="#ffffff" width="100%">
    <tr>
        <td><b>VERZORGER</b></td>
        <td><b>PERIODE</b></td>
        <td><b>WEEK</b></td>
        <td style="text-align:center;"><b>DATUM</b></td>
        <td><b>ADRES</b></td>
        <td><b>POSTCODE</b></td>
        <td><b>WOONPLAATS</b></td>
        <td><b>TELEFOONNR</b></td>
        <td><b>MOBIEL</b></td>
        <td><b>AUTO</b></td>
        <td><b>CLIENTEN</b></td>
        <td><b>KM</b></td>
        <td><b>NORM</b></td>
        <td><b>VERSCHIL</b></td>
        <td><b>PERC</b></td>
        <td><b>STATUS</b></td>
    </tr>
    <xsl:for-each select="//facilitor/rapport/rapport_data/data_row">
		    <xsl:sort select="FCLT_F_VERZORGER"/>
        <xsl:sort select="DATUM"/>
            <xsl:apply-templates select="." mode="auto_km"/>
		</xsl:for-each>
		</table>
  </xsl:if>


  <xsl:if test="@view = 'care_v_rap_my_km_per_dag'" >


    <script>
        <xsl:text disable-output-escaping="yes">
        function opdr_uren_edit(p_role, p_prs_perslid, p_fromdate, p_jaarweek){
            var l_datum_from = new Date (parseInt(p_fromdate.substr(0,4),10), parseInt(p_fromdate.substr(5,2),10) - 1 , parseInt(p_fromdate.substr(8,2),10));
            l_time_from = l_datum_from.getTime();
            var url = "../../appl/mld/opdr_edit_uren.asp?urole=" + p_role +
                      "&amp;prs_key=" + p_prs_perslid +
                      "&amp;datefrom=" + l_time_from;

            FcltMgr.openModalDetail(url, "Weeklijst" + p_jaarweek,{ });
        }
		    </xsl:text>
    </script>

    <table border="0" bordercolor="#ffffff" width="100%">
    <tr>
        <td><b>WEEK</b></td>
        <td style="text-align:center;"><b>DATUM</b></td>
        <td><b>CLIENTEN</b></td>
        <td><b>KM</b></td>
        <td><b>NORM</b></td>
        <td style="text-align:center;"><b>VERSCHIL</b></td>
        <td style="text-align:center;"><b>PERC</b></td>
        <td style="text-align:center;"><b>STATUS</b></td>
    </tr>
    <xsl:for-each select="//facilitor/rapport/rapport_data/data_row">
		    <xsl:sort select="DATUM"/>
            <xsl:apply-templates select="." mode="my_auto_km"/>
		</xsl:for-each>
		</table>
  </xsl:if>
</xsl:template>


<xsl:template name="planbord_dag">
    <xsl:param name="p_verzorger_key"/>
    <xsl:param name="p_dag"/>

		<xsl:element name="td">

		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row[PRS_PERSLID_KEY=$p_verzorger_key and DAG=$p_dag and (MATCHTYPE='A1' or MATCHTYPE='A2' or MATCHTYPE='B' or MATCHTYPE='C' or MATCHTYPE='D')]">
		    <xsl:sort select="FIRSTVAN"/>
		    <xsl:sort select="OPDR_VAN"/>
		    <xsl:choose>
            <xsl:when test="MATCHTYPE = 'D'">
                <xsl:attribute name="style">cursor: pointer ;text-align:center;background-color:#C0C0C0;border:1px solid black</xsl:attribute>
                <xsl:attribute name="onclick">prs_add_inzetbaar(<xsl:value-of select="$p_verzorger_key"/>,<xsl:value-of select="$p_dag"/>)</xsl:attribute>
                &#160;x&#160;
            </xsl:when>
            <xsl:when test="MATCHTYPE = 'C'">
                <xsl:attribute name="style">border:1px solid black</xsl:attribute>
                <xsl:element name="span">
                    <xsl:attribute name="onclick">mld_edit_werkplan(<xsl:value-of select="MLD_OPDR_KEY"/>,'<xsl:value-of select="CLIENT_NAAM"/>')</xsl:attribute>
                    <xsl:attribute name="title">Looptijd: <xsl:value-of select="MLD_OPDR_STARTDATUM"/> t/m <xsl:value-of select="MLD_OPDR_EINDDATUM"/></xsl:attribute>
                    <xsl:attribute name="style">cursor: pointer ;color:#FF4040;font-size:7pt</xsl:attribute>
                    <b><xsl:value-of select="OPDR_VANTIJD"/>-<xsl:value-of select="OPDR_TOTTIJD"/>
                        <xsl:if test="MLD_OPDR_UITVOEREN_INFREQUENT = 1">
                            <span title="Onregelmatig" style="color:red;font-size:10pt"><b> (*)</b></span>
                        </xsl:if>
                    </b>&#160;<xsl:value-of select="CLIENT_NAAM"/><br/>
                </xsl:element>

            </xsl:when>
            <xsl:when test="MATCHTYPE = 'B'">
                <xsl:attribute name="style">color:#00C000;font-size:7pt;border:1px solid black</xsl:attribute>
                    <xsl:element name="span">
                        <xsl:attribute name="onclick">prs_chg_inzetbaar(<xsl:value-of select="PRS_PERSLID_INZETBAAR_KEY"/>)</xsl:attribute>
                        <xsl:attribute name="style">cursor: pointer ;color:#00C000;font-size:7pt</xsl:attribute>
                        <b><xsl:value-of select="PVANTIJD"/>-<xsl:value-of select="PTOTTIJD"/></b> beschikbaar<br/>
                    </xsl:element>
            </xsl:when>
            <xsl:when test="MATCHTYPE = 'A1' or MATCHTYPE = 'A2'">
                <xsl:attribute name="style">border:1px solid black</xsl:attribute>
                <xsl:choose>
                    <xsl:when test="position()=1">
                        <xsl:if test="PVAN &lt; OPDR_VAN">
                            <xsl:element name="span">
                                <xsl:attribute name="onclick">prs_chg_inzetbaar(<xsl:value-of select="PRS_PERSLID_INZETBAAR_KEY"/>)</xsl:attribute>
                                <xsl:attribute name="style">cursor: pointer ;color:#00C000;font-size:7pt</xsl:attribute>
                                <b><xsl:value-of select="PVANTIJD"/>-<xsl:value-of select="OPDR_VANTIJD"/></b> beschikbaar<br/>
                            </xsl:element>
                        </xsl:if>
                    </xsl:when>
                </xsl:choose>
                <xsl:variable name="p_pvan"><xsl:value-of select="PVAN"/></xsl:variable>
                <xsl:variable name="p_ptot"><xsl:value-of select="PTOT"/></xsl:variable>
                <xsl:variable name="p_opdr_van"><xsl:value-of select="OPDR_VAN"/></xsl:variable>
                <xsl:variable name="p_opdr_tot"><xsl:value-of select="OPDR_TOT"/></xsl:variable>
                <xsl:variable name="p_opdr_tottijd"><xsl:value-of select="OPDR_TOTTIJD"/></xsl:variable>

                <xsl:choose>
                    <xsl:when test="MATCHTYPE = 'A1'">
                        <!-- dubbele A1's zijn er niet -->
                        <xsl:element name="span">
                            <xsl:attribute name="onclick">mld_edit_werkplan(<xsl:value-of select="MLD_OPDR_KEY"/>,'<xsl:value-of select="CLIENT_NAAM"/>')</xsl:attribute>
                            <xsl:attribute name="style">cursor: pointer ;color:#000000;font-size:7pt</xsl:attribute>
                            <xsl:attribute name="title">Looptijd: <xsl:value-of select="MLD_OPDR_STARTDATUM"/> t/m <xsl:value-of select="MLD_OPDR_EINDDATUM"/></xsl:attribute>
                            <b><xsl:value-of select="OPDR_VANTIJD"/>-<xsl:value-of select="OPDR_TOTTIJD"/>
                                <xsl:if test="MLD_OPDR_UITVOEREN_INFREQUENT = 1">
                                    <span title="Onregelmatig" style="color:red;font-size:10pt"><b> (*)</b></span>
                                </xsl:if>
                            </b>&#160;<xsl:value-of select="CLIENT_NAAM"/>
                        </xsl:element><br/>
                    </xsl:when>
                    <xsl:when test="MATCHTYPE = 'A2'">
                        <xsl:choose>
                            <!-- dubbele A2's eruit: distinct A2 tonen om dubbele regels te voorkomen -->
                            <xsl:when test="count(//facilitor/rapport/rapport_data/data_row[PRS_PERSLID_KEY=$p_verzorger_key and DAG=$p_dag and (MATCHTYPE='A2') and PVAN &gt; $p_pvan and OPDR_VAN = $p_opdr_van and OPDR_TOT = $p_opdr_tot]) = 0">
                                <xsl:element name="span">
                                    <xsl:attribute name="onclick">mld_edit_werkplan(<xsl:value-of select="MLD_OPDR_KEY"/>,'<xsl:value-of select="CLIENT_NAAM"/>')</xsl:attribute>
                                    <xsl:attribute name="style">cursor: pointer ;color:#FF7800;font-size:7pt</xsl:attribute>
                                    <xsl:attribute name="title">Looptijd: <xsl:value-of select="MLD_OPDR_STARTDATUM"/> t/m <xsl:value-of select="MLD_OPDR_EINDDATUM"/></xsl:attribute>
                                    <b><xsl:value-of select="OPDR_VANTIJD"/>-<xsl:value-of select="OPDR_TOTTIJD"/>
                                        <xsl:if test="MLD_OPDR_UITVOEREN_INFREQUENT = 1">
                                            <span style="color:red;font-size:10pt"><b>(*)</b></span>
                                        </xsl:if>
                                    </b>&#160;<xsl:value-of select="CLIENT_NAAM"/>
                                </xsl:element><br/>
                            </xsl:when>
                        </xsl:choose>
                    </xsl:when>
                </xsl:choose>
                <xsl:if test="position() != last()">
                    <xsl:choose>
                        <xsl:when test="count(//facilitor/rapport/rapport_data/data_row[PRS_PERSLID_KEY=$p_verzorger_key and DAG=$p_dag and (MATCHTYPE='A1' or MATCHTYPE='A2') and PVAN=$p_pvan and PTOT=$p_ptot and OPDR_VAN &gt; $p_opdr_tot]) &gt;= 1">
                            <xsl:for-each select="//facilitor/rapport/rapport_data/data_row[PRS_PERSLID_KEY=$p_verzorger_key and DAG=$p_dag and (MATCHTYPE='A1' or MATCHTYPE='A2') and PVAN=$p_pvan and PTOT=$p_ptot and OPDR_VAN &gt; $p_opdr_tot]">
                                <xsl:sort select="OPDR_VAN"/>
                                <xsl:if test="position() = 1">
                                    <xsl:if test="$p_opdr_tot &lt; OPDR_VAN">
                                        <xsl:element name="span">
                                            <xsl:attribute name="onclick">prs_chg_inzetbaar(<xsl:value-of select="PRS_PERSLID_INZETBAAR_KEY"/>)</xsl:attribute>
                                            <xsl:attribute name="style">cursor: pointer ;color:#00C000;font-size:7pt</xsl:attribute>
                                            <b><xsl:value-of select="$p_opdr_tottijd"/>-<xsl:value-of select="OPDR_VANTIJD"/></b> beschikbaar<br/>
                                        </xsl:element>
                                    </xsl:if>
                                </xsl:if>
                            </xsl:for-each>
                        </xsl:when>
                        <xsl:when test="count(//facilitor/rapport/rapport_data/data_row[PRS_PERSLID_KEY=$p_verzorger_key and DAG=$p_dag and (MATCHTYPE='A1' or MATCHTYPE='A2') and PVAN=$p_pvan and PTOT=$p_ptot and OPDR_VAN = $p_opdr_tot]) = 0">
                            <xsl:if test="OPDR_TOT &lt; PTOT">
                                <xsl:element name="span">
                                    <xsl:attribute name="onclick">prs_chg_inzetbaar(<xsl:value-of select="PRS_PERSLID_INZETBAAR_KEY"/>)</xsl:attribute>
                                    <xsl:attribute name="style">cursor: pointer ;color:#00C000;font-size:7pt</xsl:attribute>
                                    <b><xsl:value-of select="OPDR_TOTTIJD"/>-<xsl:value-of select="PTOTTIJD"/></b> beschikbaar<br/>
                                </xsl:element>
                            </xsl:if>
            		        </xsl:when>
                    </xsl:choose>
                </xsl:if>

                <xsl:choose>
                    <xsl:when test="position()=last() and OPDR_TOT &lt; PTOT">
                        <xsl:element name="span">
                            <xsl:attribute name="onclick">prs_chg_inzetbaar(<xsl:value-of select="PRS_PERSLID_INZETBAAR_KEY"/>)</xsl:attribute>
                            <xsl:attribute name="style">cursor: pointer ;color:#00C000;font-size:7pt</xsl:attribute>
                            <b><xsl:value-of select="OPDR_TOTTIJD"/>-<xsl:value-of select="PTOTTIJD"/></b> beschikbaar<br/>
                        </xsl:element>

                    </xsl:when>
                </xsl:choose>
            </xsl:when>

            <xsl:otherwise>
                <xsl:attribute name="style">border:1px solid black</xsl:attribute>
		            <xsl:value-of select="MATCHTYPE"/><br/>
		        </xsl:otherwise>
		    </xsl:choose>
		</xsl:for-each>
		</xsl:element>
</xsl:template>


<xsl:template name="planbord_verzorger">
    <xsl:param name="p_verzorger_key"/>
    <xsl:param name="p_verzorger_naam"/>

    <xsl:element name="td">
        <xsl:attribute name="width">8%</xsl:attribute>
        <xsl:attribute name="style">cursor: pointer ;border:1px solid black</xsl:attribute>
        <xsl:attribute name="onclick">prs_showverzorger(<xsl:value-of select="$p_verzorger_key"/>)</xsl:attribute>
        <xsl:value-of select="$p_verzorger_naam"/>
    </xsl:element>


    <xsl:element name="td">
        <xsl:attribute name="width">1%</xsl:attribute>
        <xsl:attribute name="style">cursor: pointer ;border:1px solid black</xsl:attribute>
        <xsl:element name="img">
            <xsl:attribute name="src">../../appl/care/images/weekbrief.png</xsl:attribute>
            <xsl:attribute name="title">Opdrachten/werkplan</xsl:attribute>
            <xsl:attribute name="onclick">mld_lopende_opdrachten(<xsl:value-of select="$p_verzorger_key"/>,'<xsl:value-of select="$p_verzorger_naam"/>')</xsl:attribute>
        </xsl:element>
    </xsl:element>
</xsl:template>

<xsl:template name="planbord_dienstverband">
    <xsl:param name="p_verzorger_dienstverband"/>
    <xsl:param name="p_verzorger_opdr_uren"/>

    <td width="2%" style="border:1px solid black">
    <xsl:choose>
        <xsl:when test="$p_verzorger_dienstverband != ''">
            <xsl:value-of select="format-number($p_verzorger_dienstverband, '##.##')"/>
        </xsl:when>
        <xsl:otherwise>

		    </xsl:otherwise>
		</xsl:choose>
		</td>

		<td width="2%" style="border:1px solid black">
    <xsl:choose>
        <xsl:when test="$p_verzorger_opdr_uren != ''">
            <xsl:value-of select="format-number($p_verzorger_opdr_uren, '##.##')"/>
        </xsl:when>
        <xsl:otherwise>

		    </xsl:otherwise>
		</xsl:choose>
		</td>

		<xsl:choose>
        <xsl:when test="$p_verzorger_dienstverband - $p_verzorger_opdr_uren &gt; 0">
            <td width="2%" style="border:1px solid black;background-color:#80FF80"><xsl:value-of select="format-number($p_verzorger_dienstverband - $p_verzorger_opdr_uren,'##.##')"/></td>
        </xsl:when>
        <xsl:when test="$p_verzorger_dienstverband - $p_verzorger_opdr_uren &lt; 0">
            <td width="2%" style="border:1px solid black;background-color:#FF4040"><xsl:value-of select="format-number($p_verzorger_dienstverband - $p_verzorger_opdr_uren,'##.##')"/></td>
        </xsl:when>
        <xsl:when test="$p_verzorger_dienstverband - $p_verzorger_opdr_uren = 0">
            <td width="2%" style="border:1px solid black;background-color:#C0C0C0">0</td>
        </xsl:when>
        <xsl:otherwise>
            <td width="2%" style="border:1px solid black"></td>
		    </xsl:otherwise>
		</xsl:choose>
</xsl:template>




<xsl:template match="data_row" mode="auto_km">
    <tr>
        <td><xsl:value-of select="FCLT_F_VERZORGER"/></td>
        <td><xsl:value-of select="FCLT_F_PERIODE"/></td>
        <td><xsl:value-of select="FCLT_F_WEEK"/></td>
        <xsl:apply-templates select="DATUM" mode="weekbrief">
            <xsl:with-param name="p_prs_perslid_key" select="HIDE_F_PRS_PERSLID_KEY"/>
            <xsl:with-param name="p_3d_prs_perslid_key" select="FCLT_3D_USER_KEY"/>
            <xsl:with-param name="p_jaarweek"><xsl:value-of select="FCLT_F_JAAR"/> - <xsl:value-of select="FCLT_F_WEEK"/></xsl:with-param>
            <xsl:with-param name="p_maandag" select="HIDE_MAANDAG"/>
            <xsl:with-param name="p_role" select="UROLE"/>
        </xsl:apply-templates>
        <td><xsl:value-of select="ADRES"/>&#160;&#160;<xsl:value-of select="HUISNR"/></td>
        <td><xsl:value-of select="POSTCODE"/></td>
        <td><xsl:value-of select="WOONPLAATS"/></td>
        <td><xsl:value-of select="TELEFOONNR"/></td>
        <td><xsl:value-of select="MOBIEL"/></td>
        <xsl:apply-templates select="FCLT_F_AUTO"></xsl:apply-templates>
        <td><xsl:value-of select="CLIENTEN"/></td>
        <td><xsl:value-of select="KM"/></td>
        <td><xsl:value-of select="NORM_KM"/></td>
        <xsl:apply-templates select="VERSCHIL">
            <xsl:with-param name="p_staffel_aant" select="substring(FCLT_F_STAFFEL,1,1)"/>
            <xsl:with-param name="p_staffel_perc" select="substring(FCLT_F_PERCENTAGE,1,1)"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="PERC">
            <xsl:with-param name="p_staffel_aant" select="substring(FCLT_F_STAFFEL,1,1)"/>
            <xsl:with-param name="p_staffel_perc" select="substring(FCLT_F_PERCENTAGE,1,1)"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="NORM_M">
            <xsl:with-param name="p_MLD_OPDR_UREN_KEY" select="MLD_OPDR_UREN_KEY"/>
            <xsl:with-param name="p_URL" select="URL"/>
        </xsl:apply-templates>
    </tr>
</xsl:template>




<xsl:template match="data_row" mode="my_auto_km">
    <tr>
        <td><xsl:value-of select="FCLT_F_JAAR"/> - <xsl:value-of select="FCLT_F_WEEK"/></td>
        <xsl:apply-templates select="DATUM" mode="weekbrief">
            <xsl:with-param name="p_prs_perslid_key" select="HIDE_F_PRS_PERSLID_KEY"/>
            <xsl:with-param name="p_3d_prs_perslid_key" select="FCLT_3D_USER_KEY"/>
            <xsl:with-param name="p_jaarweek"><xsl:value-of select="FCLT_F_JAAR"/> - <xsl:value-of select="FCLT_F_WEEK"/></xsl:with-param>
            <xsl:with-param name="p_maandag" select="HIDE_MAANDAG"/>
            <xsl:with-param name="p_role" select="UROLE"/>
        </xsl:apply-templates>
        <td><xsl:value-of select="CLIENTEN"/></td>
        <td><xsl:value-of select="KM"/></td>
        <td><xsl:value-of select="NORM_KM"/></td>
        <xsl:apply-templates select="VERSCHIL">
            <xsl:with-param name="p_staffel_aant" select="substring(HIDE_F_STAFFEL,1,1)"/>
            <xsl:with-param name="p_staffel_perc" select="substring(HIDE_F_PERCENTAGE,1,1)"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="PERC">
            <xsl:with-param name="p_staffel_aant" select="substring(HIDE_F_STAFFEL,1,1)"/>
            <xsl:with-param name="p_staffel_perc" select="substring(HIDE_F_PERCENTAGE,1,1)"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="NORM_M">
            <xsl:with-param name="p_MLD_OPDR_UREN_KEY" select="MLD_OPDR_UREN_KEY"/>
            <xsl:with-param name="p_URL" select="URL"/>
        </xsl:apply-templates>
    </tr>
</xsl:template>


<xsl:template match="DATUM" mode="weekbrief">
    <xsl:param name="p_prs_perslid_key"/>
    <xsl:param name="p_3d_prs_perslid_key"/>
    <xsl:param name="p_jaarweek"/>
    <xsl:param name="p_maandag"/>
    <xsl:param name="p_role"/>
    <xsl:element name="td">
        <xsl:attribute name="title">Weekbrief tonen</xsl:attribute>
        <xsl:attribute name="style">{ cursor: pointer ; border:none; text-align:center;}</xsl:attribute>
        <xsl:attribute name="onclick">opdr_uren_edit('<xsl:value-of select="$p_role"/>',
            <xsl:if test="$p_prs_perslid_key != ''">
                <xsl:value-of select="$p_prs_perslid_key"/>
            </xsl:if>
            <xsl:if test="$p_3d_prs_perslid_key != ''">
                <xsl:value-of select="$p_3d_prs_perslid_key"/>
            </xsl:if>
            , '<xsl:value-of select="$p_maandag"/>', '<xsl:value-of select="$p_jaarweek"/>')
        </xsl:attribute>
        <xsl:value-of select="."/>
        <xsl:element name="img">
            <xsl:attribute name="src">../../appl/care/images/weekbrief.png</xsl:attribute>
        </xsl:element>
    </xsl:element>
</xsl:template>

<xsl:template match="FCLT_F_AUTO">
    <xsl:choose>
        <xsl:when test=". = 'N'">
            <xsl:element name="td">
                <xsl:attribute name="style">text-align:center;background-color:#FF0000</xsl:attribute>
                <xsl:value-of select="."/>
            </xsl:element>
        </xsl:when>
    		<xsl:otherwise>
		        <td><xsl:value-of select="."/></td>
		    </xsl:otherwise>
		</xsl:choose>
</xsl:template>

<xsl:template match="VERSCHIL">
    <xsl:param name="p_staffel_aant"/>
    <xsl:param name="p_staffel_perc"/>
    <xsl:choose>
        <xsl:when test="$p_staffel_aant = 'O'">
            <td>&#160;</td>
        </xsl:when>
    		<xsl:when test="$p_staffel_aant = 'A' or $p_staffel_aant = 'B'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#00E22B'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:when test="$p_staffel_aant = 'C'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#C5E200'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:when test="$p_staffel_aant = 'D'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#FAE700'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:when test="$p_staffel_aant = 'E'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#FC7D00'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:when test="$p_staffel_aant = 'F'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#FC4242'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
		        <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#FF0000'"/></xsl:apply-templates>
		    </xsl:otherwise>
		</xsl:choose>
</xsl:template>

<xsl:template match="VERSCHIL" mode="metkleur">
<xsl:param name="p_color"/>
    <xsl:element name="td">
        <xsl:attribute name="style">text-align:center;background-color:<xsl:value-of select="$p_color"/></xsl:attribute>
        <xsl:value-of select="."/>
    </xsl:element>
</xsl:template>


<xsl:template match="PERC">
    <xsl:param name="p_staffel_aant"/>
    <xsl:param name="p_staffel_perc"/>
    <xsl:choose>
        <xsl:when test="$p_staffel_perc = 'O'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'transparent'"/></xsl:apply-templates>
        </xsl:when>
    		<xsl:when test="$p_staffel_perc = 'A' or $p_staffel_perc = 'B'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#00E22B'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:when test="$p_staffel_perc = 'C'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#C5E200'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:when test="$p_staffel_perc = 'D'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#FAE700'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:when test="$p_staffel_perc = 'E'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#FC7D00'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:when test="$p_staffel_perc = 'F'">
            <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#FC4242'"/></xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
		        <xsl:apply-templates select="." mode="metkleur"><xsl:with-param name="p_color" select="'#FF0000'"/></xsl:apply-templates>
		    </xsl:otherwise>
		</xsl:choose>
</xsl:template>

<xsl:template match="PERC" mode="metkleur">
<xsl:param name="p_color"/>
    <xsl:element name="td">
        <xsl:attribute name="style">text-align:center;background-color:<xsl:value-of select="$p_color"/></xsl:attribute>
        <xsl:value-of select="."/>
    </xsl:element>
</xsl:template>


<xsl:template match="NORM_M">
  <xsl:param name="p_MLD_OPDR_UREN_KEY"/>
  <xsl:param name="p_URL"/>
	<xsl:choose>
		<xsl:when test=". = 0">
        <xsl:element name="td">
            <xsl:attribute name="title">Route berekenen</xsl:attribute>
            <xsl:attribute name="style">{ cursor: pointer ; border:none; text-align:center;}</xsl:attribute>
            <xsl:attribute name="onclick">$.post('../../appl/care/care_calc_dist.asp?mld_opdr_uren_key=<xsl:value-of select="$p_MLD_OPDR_UREN_KEY"/>', {}, FcltCallbackRefresh, "json");</xsl:attribute>
            <xsl:element name="img">
                <xsl:attribute name="src">../../appl/care/images/vraagje.png</xsl:attribute>
            </xsl:element>
        </xsl:element>
		</xsl:when>

  	<xsl:when test=". &lt; 0">
        <xsl:element name="td">
            <xsl:attribute name="title">Route opnieuw berekenen</xsl:attribute>
            <xsl:attribute name="style">{ cursor: pointer ; border:none; text-align:center;}</xsl:attribute>
            <xsl:attribute name="onclick">$.post('../../appl/care/care_calc_dist.asp?mld_opdr_uren_key=<xsl:value-of select="$p_MLD_OPDR_UREN_KEY"/>', {}, FcltCallbackRefresh, "json");</xsl:attribute>
                <xsl:element name="img">
                    <xsl:attribute name="src">../../appl/care/images/foutje.png</xsl:attribute>
                </xsl:element>
        </xsl:element>
    </xsl:when>

    <xsl:otherwise>

        <xsl:element name="td">
            <xsl:attribute name="title">Dagroute tonen</xsl:attribute>
            <xsl:attribute name="style">{ cursor: pointer ; border:none; text-align:center;}</xsl:attribute>
                <xsl:element name="a">
                    <xsl:attribute name="href"><xsl:value-of select="$p_URL"/></xsl:attribute>
                    <xsl:attribute name="target">_blank</xsl:attribute>
                    <xsl:element name="img">
                        <xsl:attribute name="src">../../appl/care/images/googlemaps.png</xsl:attribute>
                    </xsl:element>
                </xsl:element>
        </xsl:element>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>


<xsl:template match="data_row" mode="aanhefgemeente">
	<table border="0" bordercolor="#ffffff" width="100%">
			<tr>
				<td width="10%"/>
				<td height="120px"/>
			</tr>
			<tr>
				<td width="10%"/>
				<td><b>Gemeente <xsl:value-of select="FCLT_F_GEMEENTE"/></b></td>
			</tr>
			<tr>
				<td width="10%"/>
				<td><b>T.a.v.&#160;<xsl:value-of select="GEMEENTE_CONTACTPERSOON"/></b></td>
			</tr>
			<tr>
				<td width="10%"/>
				<td><b><xsl:value-of select="GEMEENTE_POST_ADRES"/></b></td>
			</tr>
			<tr>
				<td width="10%"/>
				<td><b><xsl:value-of select="GEMEENTE_POST_POSTCODE"/>&#160;&#160;<xsl:value-of select="GEMEENTE_POST_PLAATS"/></b></td>
			</tr>
			<tr>
				<td width="10%"/>
				<td height="80px"/>
			</tr>
			</table>
</xsl:template>

<xsl:template match="data_row" mode="aanhefclient">
	<table border="0" bordercolor="#ffffff" width="100%">
			<tr>
				<td width="10%"/>
				<td height="120px"/>
			</tr>
			<tr>
				<td width="10%"/>
				<td><b>&#160;</b></td>
			</tr>
			<tr>
				<td width="10%"/>
				<td><b>T.a.v.&#160;<xsl:value-of select="CLIENT"/></b></td>
			</tr>
			<tr>
				<td width="10%"/>
				<td><b><xsl:value-of select="CLIENT_ADRES"/>&#160;<xsl:value-of select="CLIENT_HUISNR"/></b></td>
			</tr>
			<tr>
				<td width="10%"/>
				<td><b><xsl:value-of select="CLIENT_POSTCODE"/>&#160;&#160;<xsl:value-of select="CLIENT_WOONPLAATS"/></b></td>
			</tr>
			<tr>
				<td width="10%"/>
				<td height="80px"/>
			</tr>
			</table>
</xsl:template>

<xsl:template match="data_row" mode="factuurgegevens">
	<table border="0" bordercolor="#ffffff" width="100%">
		<tr>
			<td width="10%"/>
			<td width="15%"><b style="font-size:14pt"><u>FACTUUR</u></b></td>
			<td width="40%"/>
			<td/>
			<td/>
		</tr>
		<tr>
			<td height="10px"/>
			<td/>
			<td/>
			<td/>
			<td/>
		</tr>
		<tr>
			<td/>
			<td>Factuurnummer:</td>
			<td align="left"><xsl:apply-templates select="." mode="factuurnummer"/></td>
			<td>Factuurdatum:</td>
			<td><xsl:value-of select="FACTUURDATUM"/></td>
		</tr>
		<tr>
			<td/>
			<td>Debiteurnummer:</td>
			<td/>
			<td/>
			<td/>
		</tr>
		<tr>
			<td/>
			<td>Betreft:</td>
			<td>Geleverde HV uren</td>
			<td/>
			<td/>
		</tr>
		<tr>
			<td/>
			<td>Periode:</td>
		 <xsl:choose>
					<xsl:when test="string(PERIODE_NR) != ''">
					    <td>
					    	<xsl:value-of select="PERIODE_NR"/>-<xsl:value-of select="JAAR"/>
					   	</td>
					</xsl:when>
					<xsl:otherwise>
						<td><xsl:value-of select="MAAND_OMSCHR_NR"/></td>
					</xsl:otherwise>
				</xsl:choose>
			<td/>
		</tr>
		<tr height="20px">
			<td colspan="5"/>
		</tr>
	</table>
	<br/><br/><br/>
</xsl:template>


<xsl:template match="data_row" mode="factuurnummer">
	<xsl:choose>
  	<xsl:when test="./FACTUURNR != ''">
    	<xsl:value-of select="FACTUURNR"/>
    </xsl:when>
    <xsl:otherwise>
			<xsl:value-of select="JAAR"/>.<xsl:value-of select="PERIODE_NR"/>.<xsl:value-of select="CLIENT_NR"/>.<xsl:value-of select="substring(FACTUURDATUM,1,2)"/>
		</xsl:otherwise>
	</xsl:choose>

</xsl:template>

<xsl:template name="factuurproductentabel">
	<xsl:param name="p_gemeente"/>
	<xsl:param name="p_bsn"/>
			<table border="1" bordercolor="#000000" cellspacing="0" width="100%">
				<tr>
					<td style="text-align:center;border-top:none;border-left:none;border-bottom:none;border-right:none" width="10%"/>
					<td style="text-align:center;border-left:none;border-top:none"><b>Product</b></td>
					<td style="text-align:center;border-top:none"><b>Prijs</b></td>
					<td style="text-align:center;border-top:none"><b>Aantal</b></td>
					<td style="text-align:center;border-top:none;border-right:none"><b>Bedrag</b></td>
					<td style="text-align:center;border-left:none;border-top:none;border-bottom:none;border-right:none" width="30%"/>
				</tr>

				<xsl:choose>
			  	<xsl:when test="$p_gemeente != ''">
						<xsl:call-template name="gemeentefactuurtabel"><xsl:with-param name="p_gemeente" select="$p_gemeente"/></xsl:call-template>
			    </xsl:when>
			    <xsl:when test="$p_bsn != ''">
			    	<xsl:call-template name="pgbfactuurtabel"><xsl:with-param name="p_bsn" select="$p_bsn"/></xsl:call-template>
			    </xsl:when>
				</xsl:choose>


  	  </table>
  	  <br/><br/><br/>
</xsl:template>


<xsl:template name="gemeentefactuurtabel">
	<xsl:param name="p_gemeente"/>

		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row[FCLT_F_GEMEENTE=$p_gemeente]">
		<xsl:sort select="PRODUCT"/>
			<tr>
				<td style="text-align:center;border-top:none;border-left:none;border-bottom:none;border-right:none" width="10%"/>
				<td style="text-align:center;border-top:none;border-left:none;border-bottom:none"><xsl:value-of select="PRODUCT"/></td>
				<td style="text-align:center;border-top:none;border-bottom:none"><xsl:call-template name="europrijs"><xsl:with-param name="prijs" select="TARIEF"/></xsl:call-template></td>
				<td style="text-align:center;border-top:none;border-bottom:none"><xsl:value-of select="WEEK_UREN_BESTEED"/></td>
				<td style="text-align:center;border-top:none;border-bottom:none;border-right:none"><xsl:call-template name="europrijs"><xsl:with-param name="prijs" select="SUBTOTAAL"/></xsl:call-template></td>
			</tr>
		</xsl:for-each>

		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>
		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>
		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>
		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>

		<tr>
			<td style="text-align:center;border-top:none;border-left:none;border-bottom:none;border-right:none" width="10%"/>
			<td style="text-align:center;border-top:none;border-left:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top-style:2pt;border-bottom:none;border-right:none">
				<xsl:call-template name="europrijs">
          <xsl:with-param name="prijs" select="sum(//facilitor/rapport/rapport_data/data_row[FCLT_F_GEMEENTE=$p_gemeente]/SUBTOTAAL[string(number(.))!='NaN'])"/>
      	</xsl:call-template>
      </td>
      <td style="text-align:left;border:none;">Subtotaal</td>
		</tr>

		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>

		<tr>
			<td style="text-align:center;border-top:none;border-left:none;border-bottom:none;border-right:none" width="10%"/>
			<td style="text-align:center;border-top:none;border-left:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top-style:2pt;border-bottom:none;border-right:none"><b>
				<xsl:call-template name="europrijs">
          <xsl:with-param name="prijs" select="sum(//facilitor/rapport/rapport_data/data_row[FCLT_F_GEMEENTE=$p_gemeente]/SUBTOTAAL[string(number(.))!='NaN'])"/>
      	</xsl:call-template>
      </b></td>
      <td style="text-align:left;border:none"><b>Totaal</b></td>
		</tr>

</xsl:template>

<xsl:template name="pgbfactuurtabel">
	<xsl:param name="p_bsn"/>

		<xsl:for-each select="//facilitor/rapport/rapport_data/data_row[BSN_CLIENT=$p_bsn]">
		<xsl:sort select="PRODUCT"/>
			<tr>
				<td style="text-align:center;border-top:none;border-left:none;border-bottom:none;border-right:none" width="10%"/>
				<td style="text-align:center;border-top:none;border-left:none;border-bottom:none"><xsl:value-of select="substring(BESCHIKKING_OMSCHR,1,10)"/> ( <xsl:value-of select="MELDING"/> )</td>
				<td style="text-align:center;border-top:none;border-bottom:none"><xsl:call-template name="europrijs"><xsl:with-param name="prijs" select="TARIEF"/></xsl:call-template></td>
				<td style="text-align:center;border-top:none;border-bottom:none"><xsl:value-of select="WEEK_UREN_BESTEED"/></td>
				<td style="text-align:center;border-top:none;border-bottom:none;border-right:none"><xsl:call-template name="europrijs"><xsl:with-param name="prijs" select="SUBTOTAAL"/></xsl:call-template></td>
			</tr>
		</xsl:for-each>

		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>
		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>
		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>
		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>

		<tr>
			<td style="text-align:center;border-top:none;border-left:none;border-bottom:none;border-right:none" width="10%"/>
			<td style="text-align:center;border-top:none;border-left:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top-style:2pt;border-bottom:none;border-right:none">
				<xsl:call-template name="europrijs">
          <xsl:with-param name="prijs" select="sum(//facilitor/rapport/rapport_data/data_row[BSN_CLIENT=$p_bsn]/SUBTOTAAL[string(number(.))!='NaN'])"/>
      	</xsl:call-template>
      </td>
      <td style="text-align:left;border:none">Subtotaal</td>
		</tr>

		<xsl:call-template name="factuurtabel_legeregel"></xsl:call-template>

		<tr>
			<td style="text-align:center;border-top:none;border-left:none;border-bottom:none;border-right:none" width="10%"/>
			<td style="text-align:center;border-top:none;border-left:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
			<td style="text-align:center;border-top-style:2pt;border-bottom:none;border-right:none"><b>
				<xsl:call-template name="europrijs">
          <xsl:with-param name="prijs" select="sum(//facilitor/rapport/rapport_data/data_row[BSN_CLIENT=$p_bsn]/SUBTOTAAL[string(number(.))!='NaN'])"/>
      	</xsl:call-template>
      </b></td>
      <td style="text-align:left;border:none"><b>Totaal</b></td>
		</tr>
</xsl:template>


<xsl:template name="factuurtabel_legeregel">
	<tr>
		<td style="text-align:center;border-top:none;border-left:none;border-bottom:none;border-right:none" width="10%"/>
		<td style="text-align:center;border-top:none;border-left:none;border-bottom:none">&#160;</td>
		<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
		<td style="text-align:center;border-top:none;border-bottom:none">&#160;</td>
		<td style="text-align:center;border-top:none;border-bottom:none;border-right:none">&#160;</td>
	</tr>
</xsl:template>

<xsl:template name="betalingsvoorwaarde">
	<table border="0" bordercolor="#ffffff" width="100%">
		<tr height="40px">
			<td colspan="2"/>
		</tr>
		<tr>
			<td width="10%"/>
			<td width="90%">Wij verzoeken u vriendelijk bovenstaand bedrag binnen 14 dagen na factuurdatum te voldoen</td>
		</tr>
		<tr height="40px">
			<td width="10%"/>
			<td><b><hr/></b></td>
		</tr>
	</table>
</xsl:template>


<xsl:template match="data_row" mode="zorgaanbieder">
	<table border="0" bordercolor="#ffffff" width="100%">
		<tr height="10px">
			<td width="10%">&#160;</td>
			<td width="30%" colspan="2"><xsl:value-of select="PRS_BEDRIJF_POST_ADRES"/></td>
			<td width="20%">&#160;</td>
			<td width="40%" colspan="2"><b>Voor meer informatie:</b></td>
		</tr>
		<tr height="10px">
			<td width="10%">&#160;</td>
			<td width="30%" colspan="2"><xsl:value-of select="PRS_BEDRIJF_POST_POSTCODE"/>&#160;&#160;<xsl:value-of select="PRS_BEDRIJF_POST_PLAATS"/></td>
			<td width="20%">&#160;</td>
			<td width="15%">Contactpersoon</td>
			<td width="25%"><xsl:value-of select="PRS_BEDRIJF_CONTACT_PERSOON"/></td>
		</tr>
		<tr height="10px">
			<td width="10%"></td>
			<td width="15%">WZA code</td>
			<td width="15%"><xsl:value-of select="WZACODE"/></td>
			<td width="20%">&#160;</td>
			<td width="15%">Telefoonnummer</td>
			<td width="25%"><xsl:value-of select="PRS_BEDRIJF_CONTACT_TELEFOON"/></td>
		</tr>
		<tr height="10px">
			<td width="10%"></td>
			<td width="15%">KvK</td>
			<td width="15%"><xsl:value-of select="PRS_BEDRIJF_KVK"/></td>
			<td width="20%">&#160;</td>
			<td width="15%">Faxnummer</td>
			<td width="25%"><xsl:value-of select="PRS_BEDRIJF_CONTACT_FAX"/></td>
		</tr>
		<tr height="10px">
			<td width="10%"></td>
			<td width="15%">Bankrekening</td>
			<td width="15%"><xsl:value-of select="PRS_BEDRIJF_BANKREKENINGNR"/></td>
			<td width="20%">&#160;</td>
			<td width="15%">e-mail</td>
			<td width="25%"><xsl:value-of select="PRS_BEDRIJF_EMAIL"/></td>

		</tr>

	</table>
</xsl:template>

</xsl:stylesheet>
