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

	<xsl:template match="bestelling" mode="include">
		<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
			<TR>
				<TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"></TD>
				<TD>
					<table border="0" width="100%" bordercolor="#000000">
						<tr>
							<td align="left" width="100%" class="caption" colspan="2"><xsl:value-of select="//lcl/BES/bestelaanvraag"/>&#xA0;<xsl:value-of select="key"/></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>
						<tr>
							<td class="label"><xsl:value-of select="//lcl/FAC/kostenplaats"/></td>
							<td class="value">:
								<xsl:if test="kostenplaats/nr=''">-</xsl:if>
								<xsl:value-of select="kostenplaats/nr"/>
							</td>
						</tr>
						<tr>
							<td height="20px"/>
						</tr>
						<tr>
							<td class="label"><xsl:value-of select="//lcl/BES/aanvraagdatum"/></td>
							<td class="value">:
								<xsl:value-of select="datum/datum"/>&#xA0;
								<xsl:value-of select="datum/tijd"/>
							</td>
						</tr>
						<tr>
							<td class="label"><xsl:value-of select="//lcl/BES/aanvraagstatus"/></td>
							<td class="value">: <xsl:value-of select="status"/></td>
						</tr>
						<tr>
							<td colspan="2" class="label"><xsl:value-of select="//lcl/BES/afleveradres"/>:</td>
						</tr>
						<tr>
							<td colspan="2" class="value">
								<xsl:value-of select="aanvrager/kenmerk[@naam='Afleveradres']"/>
								<br/>
								<xsl:value-of select="aanvrager/kenmerk[@naam='Afleverpostcode']"/>&#xA0;
								<xsl:value-of select="aanvrager/kenmerk[@naam='Afleverplaats']"/>
							</td>
						</tr>
						<tr>
							<td height="20px"/>
						</tr>
						<xsl:for-each select="kenmerk">
						<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>
						<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">
												<xsl:if test="(@type!='L' and @type!='l')">
													<xsl:value-of select="@naam"/>:
													<xsl:value-of select="."/>
													<br/>
												</xsl:if>	
												</xsl:for-each>&#xA0;</td>
											<td class="result" style="text-align:right">
												<xsl:value-of select="aantal"/>
											</td>
											<td class="result" style="text-align:right">
												<xsl:value-of select="format-number(prijs, '0,00', 'european')"/>
											</td>
											<td class="result" style="text-align:right">
												<xsl:value-of select="format-number(aantal*prijs, '0,00', 'european')"/>
											</td>
										</tr>
									</xsl:for-each>
									<tr>
										<td height="6px" style="border-style:solid;border-width:0px;"/>
									</tr>
									<tr>
										<td class="tekstkop" style="text-align:right;border-style:solid;border-width:0px;" colspan="5"><xsl:value-of select="//lcl/FAC/totaal"/>:</td>
										<td class="tekstkop" style="text-align:right;border-style:solid;border-width:0px;">
											<xsl:value-of select="format-number(sum(/facilitor/bestelling/bestelitem/totaal), '0,00', 'european')"/>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</TD>
				<TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
			</TR>
		</TABLE>
	</xsl:template>

	<xsl:template match="bestelopdracht" mode="include">
		<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
			<TR>
				<TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"></TD>
				<TD>
					<!-- Bestelopdracht -->
					<table border="0" bordercolor="#ffffff" width="100%">
						<tr>
							<td colspan="5" class="caption" style="text-align:center">
								<b><xsl:value-of select="//lcl/BES/inkooporder"/></b>
							</td>
						</tr>
						<tr>
							<td colspan="5" style="height:30"/>
						</tr>
						<tr>
							<td colspan="2" style="width:47%">
								<b><xsl:value-of select="//lcl/BES/factuur_aan"/>:</b>
							</td>
							<td style="width:6%"></td>
							<td colspan="2" style="width:47%">
								<b><xsl:value-of select="//lcl/BES/leverancier"/>:</b>
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<xsl:value-of select="factuuradres/naam"/>
								<br/>
								<xsl:value-of select="factuuradres/post_adres"/>
								<br/>
								<xsl:value-of select="factuuradres/post_postcode"/>&#xA0;
								<xsl:value-of select="factuuradres/post_plaats"/>
								<br/>
								<xsl:value-of select="factuuradres/post_land"/>
							</td>
							<td/>
							<td colspan="2">
								<xsl:value-of select="bedrijf/naam"/>
								<br/>
								<xsl:value-of select="bedrijf/post_adres"/>
								<br/>
								<xsl:value-of select="bedrijf/post_postcode"/>&#xA0;
								<xsl:value-of select="bedrijf/post_plaats"/>
								<br/>
								<xsl:value-of select="bedrijf/post_land"/>
							</td>
						</tr>
						<tr>
							<td colspan="5" style="height:20"/>
						</tr>
						<tr>
							<td colspan="2">
								<b><xsl:value-of select="//lcl/FAC/contactgegevens"/>:</b>
							</td>
							<td/>
							<td colspan="2">
								<b/>
							</td>
						</tr>
						<tr>
							<td colspan="2" style="vertical-align:top">
								<b><xsl:value-of select="//lcl/BES/besteller"/>: </b>
								<xsl:value-of select="bestelling/voor/naam_full"/>
								<br/>
								<b><xsl:value-of select="//lcl/FAC/e-mail"/>: </b>
								<xsl:value-of select="bestelling/voor/email"/>
								<br/>
								<b><xsl:value-of select="//lcl/FAC/telefoon"/>: </b>
								<xsl:value-of select="bestelling/voor/telefoonnr"/>
								<br/>
								<b><xsl:value-of select="//lcl/FAC/kostenplaats"/>: </b>
								<xsl:value-of select="bestelling/kostenplaats/nr"/>
								<br/>
								<b><xsl:value-of select="//lcl/FAC/werkplek"/>: </b>
								<xsl:value-of select="bestelling/plaats"/>
							</td>
							<td/>
							<td colspan="2" style="vertical-align:top">
								<b><xsl:value-of select="//lcl/BES/aanvraagnummers"/>: </b>
								<xsl:value-of select="bestelling/key"/>
								<br/>
								<b><xsl:value-of select="//lcl/BES/opdrachtnummer"/>: </b>
								<xsl:value-of select="id"/>
								<br/>
								<b><xsl:value-of select="//lcl/BES/orderdatum"/>: </b>
								<xsl:value-of select="datum/datum"/>
								<br/>
								<xsl:comment>
									<b><xsl:value-of select="//lcl/BES/gewenste_afleverdatum"/>:</b>*leverdatum*</xsl:comment>
							</td>
						</tr>
						<tr>
							<td colspan="5" style="height:20"/>
						</tr>
						<tr>
							<td colspan="2">
								<b><xsl:value-of select="//lcl/BES/afleveradres"/>:</b>
							</td>
							<td/>
							<td colspan="2">
								<b/>
							</td>
						</tr>
						<tr>
							<td colspan="2" style="vertical-align:top">
								<xsl:value-of select="bestelling/voor/kenmerk[@naam='Afleveradres']"/>
								<br/>
								<xsl:value-of select="bestelling/voor/kenmerk[@naam='Afleverpostcode']"/>&#xA0;
								<xsl:value-of select="bestelling/voor/kenmerk[@naam='Afleverplaats']"/>
							</td>
							<td/>
							<td colspan="2" style="vertical-align:top">
								<xsl:for-each select="bestelling/kenmerk">
									<b>
										<xsl:value-of select="@naam"/>: </b>
									<xsl:value-of select="."/>
									<br/>
								</xsl:for-each>&#xA0;</td>
						</tr>
						<tr>
							<td colspan="5" style="height:20"/>
						</tr>
						<TR>
							<TD colspan="5">
								<TABLE cellpadding="0" cellspacing="0" border="1" bordercolor="#303030" width="100%">
									<tr>
										<th style="width:20"><xsl:value-of select="//lcl/BES/regel"/></th>
										<th style="width:20"><xsl:value-of select="//lcl/BES/artikelnr"/></th>
										<th style="width:200"><xsl:value-of select="//lcl/FAC/omschrijving"/></th>
										<th style="width:20"><xsl:value-of select="//lcl/FAC/eenheid"/></th>
										<th style="width:20; text-align:right"><xsl:value-of select="//lcl/FAC/aantal"/></th>
										<xsl:if test="aantal_geleverd &gt; 0">
											<th style="width:20; text-align:right"><xsl:value-of select="//lcl/BES/geleverd"/></th>
										</xsl:if>
										<th style="width:20; text-align:right"><xsl:value-of select="//lcl/FAC/prijs"/></th>
										<th style="width:20; text-align:right"><xsl:value-of select="//lcl/FAC/totaal"/></th>
									</tr>
									<xsl:for-each select="bestelopdrachtitem">
										<xsl:sort select="srtdeel/omschrijving"/>
										<xsl:sort select="posnr" data-type="number"/>
										<tr>
											<td class="result">
												<xsl:value-of select="posnr"/>
											</td>
											<td class="result">
												<xsl:value-of select="bestelitem/srtdeel/artikel_nummer"/>
											</td>
											<td class="result">
												<xsl:value-of select="bestelitem/srtdeel/omschrijving"/>&#xA0;
												<xsl:for-each select="bestelitem/kenmerk">
												<xsl:if test="(@type!='L' and @type!='l')">
													<br/>
													<xsl:value-of select="@naam"/>: <xsl:value-of select="."/>
													</xsl:if>
												</xsl:for-each>
											</td>
											<td class="result">
												<xsl:value-of select="bestelitem/srtdeel/eenheid"/>
											</td>
											<td class="result" style="text-align:right">
												<xsl:value-of select="aantal"/>
											</td>
											<xsl:if test="../aantal_geleverd &gt; 0">
												<td class="result" style="text-align:right">
													<xsl:value-of select="aantalontv"/>
												</td>
											</xsl:if>
											<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(totaal, '0,00', 'european')"/>
											</td>
										</tr>
									</xsl:for-each>
									<tr>
										<td colspan="6"/>
										<xsl:if test="aantal_geleverd &gt; 0">
											<td/>
										</xsl:if>
										<td style="text-align:right">
											<b>
												<xsl:value-of select="format-number(sum(bestelopdrachtitem/totaal), '0,00', 'european')"/>
											</b>
										</td>
									</tr>
								</TABLE>
							</TD>
						</TR>
						<tr>
							<td colspan="5" style="text-align:right"><xsl:value-of select="//lcl/BES/inclusief"/></td>
						</tr>
						<tr>
							<td colspan="5" style="height:40"/>
						</tr>
						<xsl:if test="aantal_geleverd &gt; 0">
							<tr>
								<td colspan="5"><xsl:value-of select="//lcl/BES/order_geleverd_op1"/><xsl:value-of select="leverdatum"/><xsl:value-of select="//lcl/BES/order_geleverd_op2"/></td>
							</tr>
							<tr>
								<td colspan="5"><xsl:value-of select="//lcl/BES/order_status_is"/><xsl:value-of select="status"/></td>
							</tr>
							<tr>
								<td colspan="5" style="height:40"/>
							</tr>
						</xsl:if>
						<tr>
							<td colspan="5" style="text-align:center; font-size:9px"><xsl:value-of select="//lcl/BES/order_disclaimer1"/>(<xsl:value-of select="id"/>)<xsl:value-of select="//lcl/BES/order_disclaimer2"/></td>
						</tr>
					</table>
				</TD>
				<TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
			</TR>
		</TABLE>
	</xsl:template>

</xsl:stylesheet>
