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

</xsl:stylesheet>





























