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

	<xsl:template name="pageheader">
		<table width="100%" border="0">
			<tr>
				<td width="33%"></td>
				<td width="34%" style="text-align:center">
					<xsl:choose>
						<xsl:when test="$mode='email'">
							<img src="cid:tmpl_logo.gif"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:element name="img">
								<xsl:attribute name="src">../../cust/<xsl:value-of select="//header/custId"/>/tmpl_logo.gif</xsl:attribute>
							</xsl:element>
						</xsl:otherwise>
					</xsl:choose>
				</td>
				<td width="33%" style="text-align:right">
					<xsl:if test="geprint=1"><b>Afdrukdatum:&#xA0;</b><xsl:value-of select="//header/dateTime"/></xsl:if>
				</td>
			</tr>
		</table>
	</xsl:template>

  <xsl:template match="bestelling" mode="include">
    <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
      <TR>
        <TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"></TD>
        <TD>
          <table border="0" width="100%" bordercolor="#000000">
            <tr>
              <td colspan="2" class="caption"><xsl:value-of select="//lcl/BES/bestelaanvraag"/>&#xA0;<xsl:value-of select="key"/>
                <xsl:if test="ismutatie=1">&#xA0;(WIJZIGING)</xsl:if>
                <xsl:if test="isretour=1">&#xA0;(RETOUR)</xsl:if>
              </td>
            </tr>
            <tr>
              <td width="20%" class="label"><xsl:value-of select="//lcl/FAC/aanvrager"/></td>
              <td width="80%" class="value">: <xsl:value-of select="voor/naam_full"/></td>
            </tr>
            <xsl:if test="string(voor/email)!=''">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/FAC/e-mail"/></td>
                <td class="value">: <xsl:value-of select="voor/email"/></td>
              </tr>
            </xsl:if>
            <xsl:if test="voor/telefoonnr!=''">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/FAC/telefoon"/></td>
                <td class="value">: <xsl:value-of select="voor/telefoonnr"/></td>
              </tr>
            </xsl:if>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/FAC/afdeling"/></td>
              <td class="value">: <xsl:if test="voor/afdeling/omschrijving=''">-</xsl:if><xsl:value-of select="voor/afdeling/omschrijving"/></td>
            </tr>
            <xsl:if test="string(voor/naam_full)!=string(voor/naam_full)">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/BES/bestelvoor"/></td>
                <td class="value">: <xsl:value-of select="voor/naam_full"/></td>
              </tr>
            </xsl:if>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/FAC/kostenplaats"/></td>
              <td class="value">: <xsl:if test="kostenplaats/nr=''">-</xsl:if><xsl:value-of select="kostenplaats/nr"/></td>
            </tr>
            <tr><td height="20px"/></tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/BES/aanvraagdatum"/></td>
              <td class="value">: <xsl:value-of select="datum/datum"/><xsl:text> </xsl:text><xsl:value-of select="datum/tijd"/></td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/BES/gewenste_afleverdatum"/></td>
              <td class="value">: <xsl:value-of select="leverdatum/datum"/></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" style="vertical-align:top"><xsl:value-of select="//lcl/BES/afleveradres"/></td>
              <td class="value">:
                <xsl:value-of select="afleveradres/naam"/>
                <br/>&#xA0;
                <xsl:value-of select="afleveradres/bezoek_adres"/>
                <br/>&#xA0;
                <xsl:value-of select="afleveradres/bezoek_postcode"/><xsl:text> </xsl:text><xsl:value-of select="afleveradres/bezoek_plaats"/>
                <br/>&#xA0;
                <xsl:value-of select="afleveradres/bezoek_land"/>
              </td>
            </tr>
            <tr><td height="20px"/></tr>
            <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
              <xsl:if test="(@type!='L' and @type!='l' and @type!='Q')">
                <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 border="0" style="border-collapse:collapse;">
                  <tr>
                    <th style="border:1px solid grey;"><xsl:value-of select="//lcl/BES/artikelnr"/></th>
                    <th style="border:1px solid grey;"><xsl:value-of select="//lcl/FAC/omschrijving"/></th>
                    <th style="border:1px solid grey;"><xsl:value-of select="//lcl/FAC/opmerkingen"/></th>
                    <th style="text-align:right;border:1px solid grey;"><xsl:value-of select="//lcl/FAC/aantal"/></th>
                    <th style="text-align:right;border:1px solid grey;"><xsl:value-of select="//lcl/FAC/prijs"/></th>
                    <th style="text-align:right;border:1px solid grey;"><xsl:value-of select="//lcl/FAC/totaal"/></th>
                  </tr>
                  <xsl:for-each select="bestelitem">
                    <tr>
                      <td class="result" style="border:1px solid grey;"><xsl:value-of select="srtdeel/artikel_nummer"/>&#xA0;</td>
                      <td class="result" style="border:1px solid grey;"><xsl:value-of select="srtdeel/omschrijving"/></td>
                      <td class="result" style="border:1px solid grey;">
                        <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
                          <xsl:if test="(@type!='L' and @type!='l' and @type!='Q')">
                            <xsl:value-of select="@naam"/>:&#xA0;<xsl:value-of select="."/><br/>
                          </xsl:if>
                        </xsl:for-each>&#xA0;
                      </td>
                      <td class="result" style="text-align:right;border:1px solid grey;"><xsl:value-of select="aantal"/></td>
                      <td class="result" style="text-align:right;border:1px solid grey;"><xsl:value-of select="format-number(prijs, '0,00', 'european')"/></td>
                      <td class="result" style="text-align:right;border:1px solid grey;"><xsl:value-of select="format-number(aantal*prijs, '0,00', 'european')"/></td>
                    </tr>
                  </xsl:for-each>
                  <tr><td colspan="6" height="6px"/></tr>
                  <tr>
                    <td colspan="5" class="tekstkop" style="text-align:right;"><xsl:value-of select="//lcl/FAC/totaal"/>:</td>
                    <td class="tekstkop" style="text-align:right;"><xsl:value-of select="format-number(sum(/facilitor/bestelling/bestelitem/totaal), '0,00', 'european')"/></td>
                  </tr>
                </table>
              </td>
            </tr>
            <tr><td height="40px"/></tr>
            <tr>
              <td colspan="2" class="tekst" style="color:red;">Klik <a href="https://allv.facilitor.nl" style="color:red">HIER</a> om rechtstreeks naar FACILITOR te gaan.</td>
            </tr>
          </table>
        </TD>
        <TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
      </TR>
    </TABLE>
  </xsl:template>

	<xsl:template match="bestelopdracht" mode="include">
		<xsl:variable name="intern">
			<xsl:choose>
				<xsl:when test="bedrijf/key='170'">1</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>		
		<xsl:choose>
			<xsl:when test="1 = 1">
				<table width="98%" border="0" style="border-collapse:collapse;">
					<tr>
						<td colspan="2" rowspan="2" valign="top" style="width:18%;border-left:1px solid black;border-top:2px solid black;border-bottom:1px solid black;padding:3px;">
							<b style="font-size:12pt">Orderformulier</b>
						</td>
						<td colspan="2" rowspan="2" valign="top" style="width:58%;text-align:center;border-top:2px solid black;border-bottom:1px solid black;padding:3px;">
							Datum: <xsl:value-of select="datum/datum"/>
						</td>
						<td style="width:6%;border-top:2px solid black;padding:3px;"></td>
						<td colspan="2" style="width:18%;border-left:1px solid black;border-right:1px solid black;border-top:2px solid black;border-bottom:1px solid black;padding:3px;">
							<b>Ordernr. <xsl:value-of select="id"/></b>&#xA0;<xsl:if test="geprint = 1">(kopie)</xsl:if>
						</td>
					</tr>
					<tr>
						<td colspan="3" style="border-right:1px solid black;border-bottom:1px solid black;padding:3px;">
							<b style="font-size:6pt">ordernr. altijd op factuur vermelden</b>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="border-left:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;"><b>Leverancier:</b></td>
						<td colspan="2" style="border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b>Centraal Magazijn Allévo</b></xsl:when>
								<xsl:otherwise><b><xsl:value-of select="bedrijf/naam"/></b></xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="3" style="border-right:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;"><b>Contactpersoon:</b></td>
					</tr>
					<tr>
						<td colspan="2" style="border-left:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;"><b>T.a.v.</b></td>
						<td colspan="2" style="border-top:1px solid black;border-bottom:1px solid black;padding:3px;"><b></b></td>
						<td colspan="3" style="border-right:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><xsl:value-of select="bestelling/voor/naam_full"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="besteller/naam_full"/></xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="border-left:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b>Telefoon:</b></xsl:when>
								<xsl:otherwise><b>Adres:</b></xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="2" style="border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b>0111-439913</b></xsl:when>
								<xsl:otherwise><b><xsl:value-of select="bedrijf/post_adres"/>, <xsl:value-of select="bedrijf/post_postcode"/><xsl:text> </xsl:text><xsl:value-of select="bedrijf/post_plaats"/></b></xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="3" style="border-right:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><xsl:value-of select="bestelling/voor/telefoonnr"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="besteller/telefoonnr"/></xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="border-left:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b>Email:</b></xsl:when>
								<xsl:otherwise><b>Fax:</b></xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="2" style="border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b>centraal.voorraadmagazijn@allevo.nl</b></xsl:when>
								<xsl:otherwise><b><xsl:value-of select="bedrijf/fax"/></b></xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="3" style="border-right:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><xsl:value-of select="bestelling/voor/email"/></xsl:when>
								<xsl:otherwise>
							    <xsl:choose>
							      <xsl:when test="bestelling/voor/afdeling='541'">centraal.voorraadmagazijn@allevo.nl</xsl:when>
								    <xsl:otherwise>inkoop@allevo.nl</xsl:otherwise>
							    </xsl:choose>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<xsl:choose>
						<xsl:when test="$intern='1'">
							<tr>
								<td colspan="2" style="border-left:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;"><b>&#xA0;</b></td>
								<td colspan="5" style="border-right:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;"><b>&#xA0;</b></td>
							</tr>
						</xsl:when>
						<xsl:otherwise>
							<tr>
								<td colspan="2" style="border-left:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;"><b>Klantnr.:</b></td>
								<td colspan="5" style="border-right:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;"><b><xsl:value-of select="bedrijf/overeenkomst_nr"/></b></td>
							</tr>
						</xsl:otherwise>
					</xsl:choose>
					<tr>
						<td style="width:12%;text-align:center;border:1px solid black;padding:3px;"><b>Art.nr.</b></td>
						<td style="width:6%;text-align:center;border:1px solid black;padding:3px;"><b>Aantal</b></td>
						<td colspan="2" style="width:58%;text-align:center;border:1px solid black;padding:3px;"><b>Productgegevens</b></td>
						<td colspan="2" style="width:12%;text-align:center;border:1px solid black;padding:3px;"><b>Prijs per stuk</b></td>
						<td style="width:12%;text-align:center;border:1px solid black;padding:3px;"><b>Prijs</b></td>
					</tr>
					<!--tr>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
					</tr-->
<xsl:for-each select="bestelopdrachtitem">
<xsl:sort select="srtdeel/omschrijving"/>
<xsl:sort select="posnr" data-type="number"/>
					<tr>
						<td style="text-align:left;border:1px solid black;padding:3px;"><xsl:value-of select="bestelitem/srtdeel/artikel_nummer"/></td>
						<td style="text-align:left;border:1px solid black;padding:3px;"><xsl:value-of select="aantal"/></td>
						<td colspan="2" style="text-align:left;border:1px solid black;padding:3px;">
							<xsl:value-of select="bestelitem/srtdeel/omschrijving"/> [<xsl:value-of select="bestelitem/srtdeel/eenheid"/>]
							<xsl:for-each select="bestelitem/kenmerk"><br/><xsl:value-of select="@naam"/>: <xsl:value-of select="."/></xsl:for-each>
						</td>
						<td colspan="2" style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number(prijs, '0,00', 'european')"/></td>
						<td style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number(totaal, '0,00', 'european')"/></td>
					</tr>
					<!--tr>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
					</tr-->
</xsl:for-each>
<!--xsl:variable name="totexclbtw">
  <xsl:value-of select="sum(bestelopdrachtitem/totaal) * 0.9"/>
</xsl:variable>

<xsl:variable name="korting10p">
  <xsl:value-of select="sum(bestelopdrachtitem/totaal) * 0.1"/>
</xsl:variable>

<xsl:variable name="tmpinclbtw">
  <xsl:for-each select="bestelopdrachtitem">
    <item>
    	<xsl:value-of select="aantal * brutoprijs * 0.9"/>
    </item>
  </xsl:for-each>
</xsl:variable>
<xsl:variable name="cpyinclbtw" select="msxml:node-set($tmpinclbtw)"/>
<xsl:variable name="totinclbtw">
  <xsl:value-of select="sum($cpyinclbtw/item)"/>
</xsl:variable-->
<xsl:choose>
  <xsl:when test="$intern='1'">
<xsl:variable name="totinclbtw">
  <xsl:value-of select="sum(bestelopdrachtitem/totaal)"/>
</xsl:variable>

					<tr>
						<td style="border:1px solid black;padding:3px;"/>
						<td style="border:1px solid black;padding:3px;"/>
						<td colspan="4" style="text-align:right;border:1px solid black;padding:3px;"><b>totaal incl. btw</b></td>
						<td style="text-align:right;border:1px solid black;padding:3px;"><b>€ <xsl:value-of select="format-number($totinclbtw, '0,00', 'european')"/></b></td>
					</tr>
					<!--tr>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
					</tr-->
  </xsl:when>
  <xsl:otherwise>
<xsl:variable name="totexclbtw">
  <xsl:value-of select="sum(bestelopdrachtitem/totaal)"/>
</xsl:variable>

<xsl:variable name="tmpinclbtw">
  <xsl:for-each select="bestelopdrachtitem">
    <item>
    	<xsl:value-of select="aantal * brutoprijs * 1.21"/>
    </item>
  </xsl:for-each>
</xsl:variable>
<xsl:variable name="cpyinclbtw" select="msxml:node-set($tmpinclbtw)"/>
<xsl:variable name="totinclbtw">
  <xsl:value-of select="sum($cpyinclbtw/item)"/>
</xsl:variable>

					<!--tr>
						<td style="border:1px solid black;padding:3px;"/>
						<td style="border:1px solid black;padding:3px;"/>
						<td colspan="4" style="text-align:right;border:1px solid black;padding:3px;">10% korting</td>
						<td style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number($korting10p, '0,00', 'european')"/></td>
					</tr-->
					<tr>
						<td style="border:1px solid black;padding:3px;"/>
						<td style="border:1px solid black;padding:3px;"/>
						<td colspan="4" style="text-align:right;border:1px solid black;padding:3px;">totaal excl. btw</td>
						<td style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number($totexclbtw, '0,00', 'european')"/></td>
					</tr>
					<tr>
						<td style="border:1px solid black;padding:3px;"/>
						<td style="border:1px solid black;padding:3px;"/>
						<td colspan="4" style="text-align:right;border:1px solid black;padding:3px;">21% btw</td>
						<td style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number($totinclbtw - $totexclbtw, '0,00', 'european')"/></td>
					</tr>
					<!--tr>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
					</tr-->
					<tr>
						<td style="border:1px solid black;padding:3px;"/>
						<td style="border:1px solid black;padding:3px;"/>
						<td colspan="4" style="text-align:right;border:1px solid black;padding:3px;"><b>totaal incl. btw</b></td>
						<td style="text-align:right;border:1px solid black;padding:3px;"><b>€ <xsl:value-of select="format-number($totinclbtw, '0,00', 'european')"/></b></td>
					</tr>
					<!--tr>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
					</tr-->
  </xsl:otherwise>
</xsl:choose>
					<tr>
						<td colspan="7" style="border-left:1px solid black;border-right:1px solid black;border-top:2px solid black;border-bottom:2px solid black;padding:3px;">
							<b>Opmerkingen:<br/><p style="text-align:center">Bij correspondentie/fakturering altijd ons ordernummer vermelden!<br/>Bij het niet vermelden van het ordernummer kan niet tot betaling overgegaan worden.</p><br/></b>
						</td>
					</tr>
					<xsl:choose>
						<xsl:when test="$intern='1'">
					    <tr>
						    <td colspan="3" style="border-left:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;">
							    <b>Afleveradres:<br/><br/>
							    Allévo<br/>
							    <xsl:value-of select="afleveradres/naam"/><br/>
							    <xsl:value-of select="bestelling/plaats"/><br/><br/></b>
						    </td>
						    <td colspan="4" style="border-right:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;">
							    <b><br/><br/>
							    <br/>
							    <br/><br/></b>
						    </td>
					   </tr>
						</xsl:when>
						<xsl:otherwise>
					    <tr>
						    <td colspan="3" style="border-left:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;">
							    <b>Afleveradres:<br/><br/>
							    Allévo<br/>
							    <xsl:choose>
								    <xsl:when test="afleveradres/key='3'">T.a.v. Centraal Magazijn</xsl:when>
								    <xsl:otherwise>T.a.v. Receptie</xsl:otherwise>
							    </xsl:choose><br/>
							    <xsl:value-of select="afleveradres/bezoek_adres"/><br/>
							    <xsl:value-of select="afleveradres/bezoek_postcode"/><xsl:text> </xsl:text><xsl:value-of select="afleveradres/bezoek_plaats"/><br/><br/></b>
						    </td>
						    <td colspan="4" style="border-right:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;">
							    <b>Faktuuradres:<br/><br/>
							    Allévo<br/>
							    T.a.v. <xsl:value-of select="factuuradres/contactpersoon"/><br/>
							    <xsl:value-of select="factuuradres/post_adres"/><br/>
							    <xsl:value-of select="factuuradres/post_postcode"/><xsl:text> </xsl:text><xsl:value-of select="factuuradres/post_plaats"/><br/><br/></b>
						    </td>
					   </tr>
						</xsl:otherwise>
					</xsl:choose>
					<tr>
						<td colspan="7" style="height:10px"/>
					</tr>
				</table>
			</xsl:when>
			<xsl:otherwise>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="bestelopdracht" mode="full">
	 <xsl:choose>
		<xsl:when test="$mode='summary'"></xsl:when>
		<xsl:otherwise>
		<html>
			<xsl:comment>================================ BESTELOPDRACHTEN ==============================</xsl:comment>
			<xsl:call-template name="htmlhead"/>
			<xsl:element name="body">
				<xsl:if test="$mode!='email'">
					<xsl:attribute name="onload">window.print();</xsl:attribute>
				</xsl:if>
				<xsl:call-template name="pageheader"/>
				<xsl:apply-templates select="." mode="include"/>
			</xsl:element>
		</html>
		</xsl:otherwise>
	 </xsl:choose>
	</xsl:template>

	<xsl:template match="opdracht" mode="include">
		<xsl:variable name="intern">
			<xsl:choose>
				<xsl:when test="uitvoerende/bedrijf/key='170'">1</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>		
		<xsl:choose>
			<!-- Opdrachten anders dan Incidentele bestellingen!!! -->
			<xsl:when test="opdrachttype/key != 1661">
				<table width="98%" border="0" style="border-collapse:collapse;">
					<tr>
						<td colspan="4" class="caption" style="padding-top:20px;padding-bottom:20px">
							<b><xsl:value-of select="opdrachttype/omschrijving"/>&#xA0;</b>
							<b style="color:#FF6600"><xsl:value-of select="melding/discipline/srtdiscipline/prefix"/><xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/>&#xA0;</b>
							<xsl:if test="geprint = 1">(kopie)</xsl:if>
						</td>
					</tr>	
					<tr><td/></tr>
					<tr>
						<td colspan="4" class="caption" style="padding-top:20px;padding-bottom:20px"><xsl:if test="melding/spoed&lt;3"><b>SPOED!</b></xsl:if></td>    	
					</tr>
					<tr><td/></tr>
					<tr>
						<td width="16%" rowspan="2" valign="top"><b style="font-size:12pt">&#xA0;</b></td>
						<td width="34%" valign="bottom">&#xA0;</td>
						<td width="16%" rowspan="2" valign="top"><b style="font-size:12pt">Uitvoerder:</b></td>
						<td width="34%" valign="bottom">&#xA0;</td>
					</tr>
					<tr><td colspan="2"/></tr>
					<tr><td colspan="4" style="height:10px;"/></tr>
					<tr>
						<td colspan="2"/>
						<td><b>Opdracht aan:</b></td>
						<td><xsl:value-of select="uitvoerende/bedrijf/naam"/></td>
					</tr>
					<tr>
						<td colspan="2"/>
						<td><b>Uitvoerende:</b></td>
						<td><xsl:if test="contactpersoon/naam_full != ''"><xsl:value-of select="contactpersoon/naam_full"/></xsl:if></td>
					</tr>
					<tr>
						<td colspan="2"/>
						<td><b>Telefoon:</b></td>
						<td>
							<xsl:choose>
								<xsl:when test="contactpersoon/naam_full != '' and contactpersoon/telefoon1 != ''">
									<xsl:value-of select="contactpersoon/telefoon1"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="uitvoerende/bedrijf/telefoon"/>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td colspan="2"/>
						<td><b>Storingsnr:</b></td>
						<td><xsl:value-of select="uitvoerende/bedrijf/telefoon2"/></td>
					</tr>
					<tr>
						<td colspan="2"/>
						<td><b>Adres:</b></td>
						<td>
							<xsl:value-of select="uitvoerende/bedrijf/bezoek_adres"/>
						</td>
					</tr>
					<tr>
						<td colspan="2"/>
						<td><b>Plaats:</b></td>
						<td>
							<xsl:value-of select="uitvoerende/bedrijf/bezoek_plaats"/>
						</td>
					</tr>
					<tr>
						<td><b>Contactpersoon:</b></td>
						<td><xsl:value-of select="backoffice_contact/naam_full"/></td>
					</tr>
					<tr>
						<td><b>Telefoon:</b></td>
						<td><xsl:value-of select="backoffice_contact/telefoonnr"/></td>
					</tr>
					<tr><td colspan="4" style="height:20px;"/></tr>
				</table>
				<table width="100%" style="background-color:#EEEEEE;border: 2px solid blue" cellpadding="2">
					<tr>
						<td colspan="2" rowspan="2" valign="top"><b style="font-size:12pt">Gegevens melder:</b></td>
						<td colspan="2" rowspan="2" valign="top"></td>
					</tr>
					<tr><td colspan="2"/></tr>
					<tr><td colspan="4" style="height:10px;"/></tr>
					<tr>
						<td><b>Aanvrager:</b></td>
						<td><xsl:value-of select="melding/voor/naam_full"/></td>
						<td><b>Telefoon:</b></td>
						<td><xsl:value-of select="melding/voor/telefoonnr"/></td>
					</tr>
					<tr>
						<td><b>Locatie:</b></td>
						<td>
							<xsl:value-of select="melding/voor/werkplek/plaats/regio/district/locatie/code"/>&#xA0;
							<xsl:if test="melding/voor/werkplek/plaats/regio/district/locatie/omschrijving!=''">(<xsl:value-of select="melding/voor/werkplek/plaats/regio/district/locatie/omschrijving"/>)</xsl:if>
						</td>
						<td><b>Afdeling:</b></td>
						<td><xsl:value-of select="melding/voor/afdeling/omschrijving"/></td>
					</tr>
					<tr>
						<td><b>Werkplek:</b></td>
						<td>
							<xsl:value-of select="melding/melder/werkplek/plaats/regio/district/locatie/gebouw/code"/>-<xsl:value-of select="melding/voor/werkplek/plaats/regio/district/locatie/gebouw/naam"/><br/>
							<xsl:value-of select="melding/voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/code"/>.<xsl:value-of select="melding/voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"/>&#xA0;
							<xsl:if test="melding/voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving!=''">(<xsl:value-of select="melding/voor/werkplek/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/>)</xsl:if>
						</td>
						<td><b>Emailadres:</b></td>
						<td><xsl:value-of select="melding/voor/email"/></td>
					</tr>
					<tr><td colspan="4"><hr/></td></tr>
					<tr>
						<td colspan="2" rowspan="2" valign="top"><b style="font-size:12pt">Opdrachtgegevens:</b></td>
						<td colspan="2" rowspan="2" valign="top"></td>
					</tr>
					<tr><td colspan="2"/></tr>
					<tr><td colspan="4" style="height:10px;"/></tr>
					<tr>
						<td><b>Locatie:</b></td>
						<td>
							<xsl:value-of select="melding/plaats/regio/district/locatie/code"/>&#xA0;
							<xsl:if test="melding/plaats/regio/district/locatie/omschrijving!=''">(<xsl:value-of select="melding/plaats/regio/district/locatie/omschrijving"/>)</xsl:if>
						</td>
						<td><b>Melddatum:</b></td>
						<td><xsl:value-of select="melding/gemeld/datum"/><xsl:text> </xsl:text><xsl:value-of select="melding/gemeld/tijd"/></td>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="melding/plaats/@type='T'">
								<td align="right"><b>Terrein:</b></td>
								<td align="left"><xsl:value-of select="melding/plaats/regio/district/locatie/terrein/code"/>-<xsl:value-of select="melding/plaats/regio/district/locatie/terrein/naam"/></td>
							</xsl:when>
							<xsl:otherwise>
								<td align="right"><b>Gebouw:</b></td>
								<td align="left"><xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/code"/>-<xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/naam"/></td>
							</xsl:otherwise>
						</xsl:choose>
						<td><b>Datum gereed:</b></td>
						<td><b><xsl:value-of select="datumgereed/datum"/></b></td>
					</tr>
					<tr>
						<xsl:if test="melding/plaats/@type='T' or melding/plaats/@type='G'">
							<td colspan="2"/>
						</xsl:if>
						<xsl:if test="melding/plaats/@type!='T' and melding/plaats/@type!='G'">
							<td align="right"><b>Bouwlaag:</b></td>
							<td align="left">
								<xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/verdieping/code"/>&#xA0;
								<xsl:if test="melding/plaats/regio/district/locatie/gebouw/verdieping/omschrijving!=''">(<xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/verdieping/omschrijving"/>)</xsl:if>
							</td>
						</xsl:if>
					</tr>
					<tr>
						<xsl:if test="melding/plaats/@type='R'">
							<td align="right" valign="top"><b>Ruimte:</b></td>
							<td align="left">
								<xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/verdieping/ruimte/nr"/>&#xA0;
								<xsl:if test="melding/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving!=''">(<xsl:value-of select="melding/plaats/regio/district/locatie/gebouw/verdieping/ruimte/omschrijving"/>)</xsl:if>
							</td>
						</xsl:if>
						<xsl:if test="melding/plaats/@type!='R'">
							<td colspan="2"/>
						</xsl:if>
					</tr>
					<tr>
						<td><b>Melding:</b></td>
						<td><xsl:value-of select="melding/stdmelding/omschrijving"/></td>
						<td><b>Vakgroep:</b></td>
						<td><xsl:value-of select="melding/discipline/omschrijving"/></td>
					</tr>
					<xsl:if test="count(melding/deel)&gt;0">
						<xsl:for-each select="melding/deel">
							<xsl:sort select="omschrijving"/>
							<tr>
								<xsl:choose>
									<xsl:when test="position()=1">
										<td><b>Object(en):</b></td>
									</xsl:when>
									<xsl:otherwise>
										<td/>
									</xsl:otherwise>
								</xsl:choose>
								<td><xsl:value-of select="omschrijving"/></td>
								<td colspan="2"><xsl:comment>NADER TE DEFINIEREN</xsl:comment></td>
							</tr>
						</xsl:for-each>
					</xsl:if>
					<tr><td colspan="4" style="height:10px;"/></tr>
					<tr>
						<td><b>Omschrijving:</b></td>
						<td colspan="3"><b><xsl:call-template name="linebreaks"><xsl:with-param name="string" select="omschrijving"/></xsl:call-template></b></td>
					</tr>
				</table>
				<table width="100%" border="0" cellpadding="2">
					<tr><td style="height:20px;"/></tr>
				</table>
				<table width="100%" style="border: 2px solid #FF6600" cellpadding="2">
					<tr>
						<td width="32%"><b>Opmerkingen:<br/><br/><br/></b></td>
						<td width="17%"/>
						<td width="17%"/>
						<td width="17%"/>
						<td width="17%"/>
					</tr>
					<tr><td colspan="5"><hr/></td></tr>
					<tr>
						<td style="font-size:12pt;color:#FF6600;text-valign:baseline"><b>Opdracht gereed</b></td>
						<td colspan="2" style="text-valign:baseline">Naam:</td>
						<td colspan="2" style="text-valign:baseline">Handtekening:</td>
					</tr>
					<tr>
						<td/>
						<td colspan="4"><br/>Datum:<br/><br/><br/></td>
					</tr>
				</table>
				<table width="100%" border="0" cellpadding="2">
					<tr><td style="height:20px;"/></tr>
					<tr><td style="text-align:center"><b>Na uitvoering deze opdrachtbon (getekend) retour aan receptie / facilitair meldpunt!!!</b></td></tr>
				</table>
			</xsl:when>
			<!-- Opdracht nav. Incidentele bestelling!!! -->
			<xsl:when test="opdrachttype/key = 1661">
				<table width="98%" border="0" style="border-collapse:collapse;">
					<tr>
						<td colspan="2" rowspan="2" valign="top" style="width:18%;border-left:1px solid black;border-top:2px solid black;border-bottom:1px solid black;padding:3px;">
							<b style="font-size:12pt">Orderformulier</b>
						</td>
						<td colspan="2" rowspan="2" valign="top" style="width:54%;text-align:center;border-top:2px solid black;border-bottom:1px solid black;padding:3px;">
							Datum: <xsl:value-of select="datumbegin/datum"/>
						</td>
						<!--td style="width:6%;border-top:2px solid black;padding:3px;"></td-->
						<td colspan="2" style="width:28%;border-left:1px solid black;border-right:1px solid black;border-top:2px solid black;border-bottom:1px solid black;padding:3px;">
							<b>Ordernr. <xsl:value-of select="melding/key"/>/<xsl:value-of select="bedrijfopdr_volgnr"/></b>&#xA0;<xsl:if test="geprint = 1">(kopie)</xsl:if>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="border-right:1px solid black;border-bottom:1px solid black;padding:3px;">
							<b style="font-size:6pt">ordernr. altijd op factuur vermelden</b>
						</td>
					</tr>
					<tr>
						<td colspan="1" style="width:12%;border-left:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;"><b>Leverancier:</b></td>
						<td colspan="3" style="width:60%;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b>Centraal Magazijn Allévo</b></xsl:when>
								<xsl:otherwise><b><xsl:value-of select="uitvoerende/bedrijf/naam"/></b></xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="2" style="width:28%;border-right:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;"><b>Contactpersoon:</b></td>
					</tr>
					<tr>
						<td colspan="1" style="border-left:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;"><b>T.a.v.</b></td>
						<td colspan="3" style="border-top:1px solid black;border-bottom:1px solid black;padding:3px;"><b><xsl:value-of select="contactpersoon/naam_full"/></b></td>
						<td colspan="2" style="border-right:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
								<!--Als Inkoop een opdracht aanmaakt naar uitvoerende Allévo (kan nog niet), dan is Inkoop - namens interne klant - de aanvrager!-->
							  <xsl:when test="$intern='1'"><xsl:value-of select="backoffice_contact/naam_full"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="backoffice_contact/naam_full"/></xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td colspan="1" style="border-left:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b>Telefoon:</b></xsl:when>
								<xsl:otherwise><b>Adres:</b></xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="3" style="border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b><xsl:value-of select="contactpersoon/telefoonnr"/></b></xsl:when>
								<xsl:otherwise>
							    <xsl:choose>
							      <xsl:when test="uitvoerende/bedrijf/post_adres!=''"><b><xsl:value-of select="uitvoerende/bedrijf/post_adres"/>, <xsl:value-of select="uitvoerende/bedrijf/post_postcode"/><xsl:text> </xsl:text><xsl:value-of select="uitvoerende/bedrijf/post_plaats"/></b></xsl:when>
							      <xsl:when test="uitvoerende/bedrijf/bezoek_adres!=''"><b><xsl:value-of select="uitvoerende/bedrijf/bezoek_adres"/>, <xsl:value-of select="uitvoerende/bedrijf/bezoek_postcode"/><xsl:text> </xsl:text><xsl:value-of select="uitvoerende/bedrijf/bezoek_plaats"/></b></xsl:when>
								    <xsl:otherwise></xsl:otherwise>
							    </xsl:choose>
								</xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="2" style="border-right:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
								<!--Als Inkoop een opdracht aanmaakt naar uitvoerende Allévo (kan nog niet), dan is Inkoop - namens interne klant - de aanvrager!-->
							  <xsl:when test="$intern='1'"><xsl:value-of select="backoffice_contact/telefoonnr"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="backoffice_contact/telefoonnr"/></xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td colspan="1" style="border-left:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b>Email:</b></xsl:when>
								<xsl:otherwise><b>Fax:</b></xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="3" style="border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
							  <xsl:when test="$intern='1'"><b>centraal.voorraadmagazijn@allevo.nl</b></xsl:when>
								<xsl:otherwise><b><xsl:value-of select="uitvoerende/bedrijf/fax"/></b></xsl:otherwise>
							</xsl:choose>
						</td>
						<td colspan="2" style="border-right:1px solid black;border-top:1px solid black;border-bottom:1px solid black;padding:3px;">
							<xsl:choose>
								<!--Als Inkoop een opdracht aanmaakt naar uitvoerende Allévo (kan nog niet), dan is Inkoop - namens interne klant - de aanvrager!-->
							  <xsl:when test="$intern='1'">inkoop@allevo.nl</xsl:when>
								<xsl:otherwise>inkoop@allevo.nl</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<xsl:choose>
						<xsl:when test="$intern='1'">
							<tr>
								<td colspan="1" style="border-left:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;"><b>&#xA0;</b></td>
								<td colspan="5" style="border-right:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;"><b>&#xA0;</b></td>
							</tr>
						</xsl:when>
						<xsl:otherwise>
							<tr>
								<td colspan="1" style="border-left:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;"><b>Klantnr.:</b></td>
								<td colspan="5" style="border-right:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;"><b><xsl:value-of select="uitvoerende/bedrijf/overeenkomst_nr"/></b></td>
							</tr>
						</xsl:otherwise>
					</xsl:choose>
					<!--xsl:variable name="kaleprijs">
						<xsl:choose>
						<xsl:when test="kenmerk[@key='101']!=''"><xsl:value-of select="materiaal - kenmerk[@key='101']"/></xsl:when>
						<xsl:otherwise><xsl:value-of select="materiaal"/></xsl:otherwise>
						</xsl:choose>
					</xsl:variable-->		
					<xsl:variable name="prijszondercorrectie">
						<xsl:value-of select="(uren * uurloon) + materiaal"/>
					</xsl:variable>		
					<tr>
						<td style="width:12%;text-align:center;border:1px solid black;padding:3px;"><b>Art.nr.</b></td>
						<td style="width:6%;text-align:center;border:1px solid black;padding:3px;"><b>Aantal</b></td>
						<td colspan="2" style="width:54%;text-align:center;border:1px solid black;padding:3px;"><b>Productgegevens</b></td>
						<td style="width:14%;text-align:center;border:1px solid black;padding:3px;"><b>Prijs per stuk</b></td>
						<td style="width:14%;text-align:center;border:1px solid black;padding:3px;"><b>Prijs</b></td>
					</tr>
					<!--tr>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
					</tr-->
					<tr>
						<td style="text-align:left;border:1px solid black;padding:3px;"><xsl:value-of select="kenmerk[@key='61']"/></td>
						<!--td style="text-align:left;border:1px solid black;padding:3px;"><xsl:value-of select="kenmerk[@key='62']"/></td-->
						<td style="text-align:left;border:1px solid black;padding:3px;"><xsl:value-of select="uren"/></td>
						<td colspan="2" style="text-align:left;border:1px solid black;padding:3px;">
							<xsl:call-template name="linebreaks"><xsl:with-param name="string" select="kenmerk[@key='63']"/></xsl:call-template>
						</td>
						<td style="text-align:right;border:1px solid black;padding:3px;">
              <!--xsl:if test="kenmerk[@key='62']&gt;0">€ <xsl:value-of select="format-number($kaleprijs div kenmerk[@key='62'], '0,00', 'european')"/></xsl:if-->
              € <xsl:value-of select="format-number(uurloon, '0,00', 'european')"/>
						</td>
						<td style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number(uren * uurloon, '0,00', 'european')"/></td>
					</tr>
<xsl:if test="kosten&lt;$prijszondercorrectie">
					<tr>
						<td style="border:1px solid black;padding:3px;"/>
						<td style="border:1px solid black;padding:3px;"/>
						<td colspan="3" style="text-align:right;border:1px solid black;padding:3px;">Korting</td>
						<td style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number(kosten - $prijszondercorrectie, '0,00', 'european')"/></td>
					</tr>
</xsl:if>
<xsl:if test="kosten&gt;$prijszondercorrectie">
					<tr>
						<td style="border:1px solid black;padding:3px;"/>
						<td style="border:1px solid black;padding:3px;"/>
						<td colspan="3" style="text-align:right;border:1px solid black;padding:3px;">Opslag</td>
						<td style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number(kosten - $prijszondercorrectie, '0,00', 'european')"/></td>
					</tr>
</xsl:if>
<!--xsl:if test="kenmerk[@key='101']!=''"-->
<xsl:if test="materiaal&gt;0">
					<tr>
						<td style="border:1px solid black;padding:3px;"/>
						<td style="border:1px solid black;padding:3px;"/>
						<td colspan="3" style="text-align:right;border:1px solid black;padding:3px;">Verzendkosten</td>
						<!--td style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number(kenmerk[@key='101'], '0,00', 'european')"/></td-->
						<td style="text-align:right;border:1px solid black;padding:3px;">€ <xsl:value-of select="format-number(materiaal, '0,00', 'european')"/></td>
					</tr>
</xsl:if>
					<!--tr>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
					</tr-->
					<tr>
						<td style="border:1px solid black;padding:3px;"/>
						<td style="border:1px solid black;padding:3px;"/>
						<td colspan="3" style="text-align:right;border:1px solid black;padding:3px;"><b>Totaal incl. btw</b></td>
						<td style="text-align:right;border:1px solid black;padding:3px;"><b>€ <xsl:value-of select="format-number(kosten, '0,00', 'european')"/></b></td>
					</tr>
					<!--tr>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td colspan="2" style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
						<td style="border:1px solid black;padding:3px;">&#xA0;</td>
					</tr-->
					<tr>
						<td colspan="6" style="border-left:1px solid black;border-right:1px solid black;border-top:2px solid black;border-bottom:2px solid black;padding:3px;">
							<b>Opmerkingen:<br/><p style="text-align:center">Bij correspondentie/fakturering altijd ons ordernummer vermelden!<br/>Bij het niet vermelden van het ordernummer kan niet tot betaling overgegaan worden.</p><br/></b>
						</td>
					</tr>
					<xsl:choose>
						<xsl:when test="$intern='1'">
					    <tr>
						    <td colspan="3" style="border-left:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;">
							    <b>Afleveradres:<br/><br/>
							    Allévo<br/>
							    <xsl:value-of select="melding/aflever_adres/naam"/><br/>
							    <xsl:value-of select="melding/plaats/plaatsaanduiding"/><br/><br/></b>
						    </td>
						    <td colspan="3" style="border-right:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;">
							    <b><br/><br/>
							    <br/>
							    <br/><br/></b>
						    </td>
					    </tr>
						</xsl:when>
						<xsl:otherwise>
					    <tr>
						    <td colspan="3" style="border-left:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;">
							    <b>Afleveradres:<br/><br/>
							    Allévo<br/>
							    T.a.v. <xsl:value-of select="melding/voor/naam_full"/><br/>
							    <xsl:value-of select="melding/aflever_adres/bezoek_adres"/><br/>
							    <xsl:value-of select="melding/aflever_adres/bezoek_postcode"/><xsl:text> </xsl:text><xsl:value-of select="melding/aflever_adres/bezoek_plaats"/><br/><br/></b>
						    </td>
						    <td colspan="3" style="border-right:1px solid black;border-top:1px solid black;border-bottom:2px solid black;padding:3px;">
							    <b>Faktuuradres:<br/><br/>
							    Allévo<br/>
							    T.a.v. <xsl:value-of select="factuuradres/contactpersoon"/><br/>
							    <xsl:value-of select="factuuradres/post_adres"/><br/>
							    <xsl:value-of select="factuuradres/post_postcode"/><xsl:text> </xsl:text><xsl:value-of select="factuuradres/post_plaats"/><br/><br/></b>
						    </td>
					    </tr>
						</xsl:otherwise>
					</xsl:choose>
					<xsl:if test="$srtnotificatiecode='MLDAP1' or $srtnotificatiecode='ORD2GO'">
						<tr><td colspan="6" style="height:10px"/></tr>
						<tr>
							<td colspan="6" class="tekst" style="color:red;">Klik <a href="https://allv.facilitor.nl" style="color:red">HIER</a> om rechtstreeks naar FACILITOR te gaan.</td>
						</tr>
					</xsl:if>
				</table>
			</xsl:when>
			<xsl:otherwise>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template match="opdracht" mode="full">
		<html>
			<xsl:comment>================================ OPDRACHTEN ==============================</xsl:comment>
			<xsl:call-template name="htmlhead"/>
			<xsl:element name="body">
				<xsl:if test="$mode!='email'">
					<xsl:attribute name="onload">window.print();</xsl:attribute>
				</xsl:if>
				<xsl:call-template name="pageheader"/>
				<xsl:apply-templates select="." mode="include"/>
			</xsl:element>
		</html>
	</xsl:template>

	<xsl:template match="reservering" mode="include">
		<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
			<TR>
				<TD WIDTH="40" ROWSPAN="30" ID="LINKERMARGE"/>
				<TD>
					<xsl:choose>
						<xsl:when test="not(boolean(rsv_ruimte))">
							<table>
								<tr>
									<td height="20"/>
								</tr>
								<tr>
									<td class="caption">Annulering</td>
								</tr>
								<tr>
									<td>
										<b>Op uw naam heeft een reservering<xsl:if test="key!=''"> onder nummer <xsl:value-of select="key"/></xsl:if> plaatsgevonden, die vervolgens direct weer is verwijderd.</b>
										<br/>
										<br/>Deze reservering wordt niet verder verwerkt.<br/><br/>
                  Wilt u toch een reservering aanmaken voeg dan een nieuwe reservering toe waarbij een zaal, voorziening of artikel gereserveerd is.</td>
								</tr>
							</table>
						</xsl:when>
						<xsl:otherwise>
							<!-- Bevestiging reservering -->

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

							<table border="0" bordercolor="#ffffff" width="100%">
								<tr>
									<td class="caption" valign="top" colspan="2">
										<xsl:choose>
											<xsl:when test="@content='complete'">Reservering <xsl:value-of select="key"/></xsl:when>
											<xsl:otherwise>Deelreservering <xsl:value-of select="key"/> / <xsl:value-of select="$min_volgnr"/></xsl:otherwise>
										</xsl:choose>
									</td>
								</tr>
								<tr>
									<td width="20%" class="label">Aanvrager</td>
									<td width="80%" class="value">: <xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/contact_user/naam_full"/></td>
								</tr>
								<tr>
									<td width="20%" class="label">Omschrijving</td>
									<td width="80%" class="value">:
										<xsl:if test="string(rsv_ruimte[volgnr=$min_volgnr]/omschrijving)!=''">(<xsl:value-of select="rsv_ruimte[volgnr=$min_volgnr]/omschrijving"/>)</xsl:if>&#xA0;</td>
								</tr>
								<xsl:if test="string(rsv_ruimte[volgnr=$min_volgnr]/opmerking)!=''">
									<tr>
										<td height="5px"/>
									</tr>
									<tr>
										<td colspan="2" class="label">Opmerking</td>
									</tr>
									<tr>
										<td colspan="2" class="value">
											<xsl:call-template name="linebreaks">
												<xsl:with-param name="string" select="rsv_ruimte[volgnr=$min_volgnr]/opmerking"/>
											</xsl:call-template>
										</td>
									</tr>
								</xsl:if>
								<tr>
									<td height="30px"/>
								</tr>
								<xsl:if test="rsv_ruimte[volgnr=$min_volgnr]/contact_user/key!=ingevoerd_user/key">
									<tr>
										<td width="20%" class="label">Behandeld door</td>
										<td width="80%" class="value">: <xsl:value-of select="ingevoerd_user/naam_full"/></td>
									</tr>
									<tr>
										<td width="20%" class="label">Datum</td>
										<td width="80%" class="value">: <xsl:value-of select="datum/datum"/></td>
									</tr>
									<tr>
										<td height="30px"/>
									</tr>
								</xsl:if>
								<tr>
									<td colspan="2" class="tekst">
										<xsl:choose>
											<xsl:when test="$srtnotificatiecode='RESNEW'"/>
											<xsl:when test="$srtnotificatiecode='RESDEL'">DE RESERVERING IS VERVALLEN</xsl:when>
											<xsl:otherwise>
												<xsl:call-template name="res_begintext"/>
											</xsl:otherwise>
										</xsl:choose>
									</td>
								</tr>
								<tr>
									<td height="10px"/>
								</tr>
								<tr>
									<td class="tekstkop" colspan="2" style="text-decoration:underline">Reserveringsgegevens</td>
								</tr>
								<tr>
									<td height="5px"/>
								</tr>
								<tr>
									<td colspan="2">
										<table cellpadding="0" cellspacing="0" border="1" bordercolor="#000000" frame="box">
											<!-- rsv_ruimte -->
											<xsl:for-each select="rsv_ruimte">
												<xsl:sort select="volgnr" data-type="number"/>
												<xsl:call-template name="rsv_ruimte">
													<xsl:with-param name="min_volgnr" select="$min_volgnr"/>
												</xsl:call-template>
											</xsl:for-each>
											<!-- totaal reservering -->
											<tr>
												<td height="10px" style="border-style:solid;border-width:0px;"/>
											</tr>
											<tr>
												<td class="tekstkop" align="right" colspan="2" style="border-style:solid;border-width:0px;">Totaalprijs reservering:</td>
												<td class="tekstkop" style="text-align:right;border-style:solid;border-width:0px;">
													<xsl:call-template name="europrijs">
														<xsl:with-param name="prijs"
														                select="sum(rsv_ruimte/prijs[string(number(.))!='NaN'])+sum(rsv_ruimte/rsv_deel/prijs[string(number(.))!='NaN'])+sum(rsv_ruimte/rsv_artikel/prijs[string(number(.))!='NaN'])"/>
													</xsl:call-template>
												</td>
											</tr>
										</table>
									</td>
								</tr>
								<xsl:call-template name="res_endtext">
									<xsl:with-param name="min_volgnr" select="$min_volgnr"/>
								</xsl:call-template>
							</table>
							<!-- Bevestiging reservering -->
						</xsl:otherwise>
					</xsl:choose>
				</TD>
				<TD WIDTH="30" ROWSPAN="30" ID="RECHTERMARGE"/>
			</TR>
		</TABLE>
	</xsl:template>

	<xsl:template match="rapport">
		<style>th {
      border: 1px solid #808080;
    }</style>

		<xsl:if test="@view='allv_v_rap_voorraad' and $srtnotificatiecode!='CUST01' and $srtnotificatiecode!='CUST02'">
			<table width="100%" class="rstable" border="1" cellpadding="0" cellspacing="0">
				<colgroup>
					<col width="15%"/>
					<col width="10%"/>
					<col width="30%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
				</colgroup>

				<xsl:if test="count(rapport_data/data_row)=0">
					<tr><td><center><b>Geen gegevens gevonden</b></center></td></tr>
				</xsl:if>

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

				<xsl:for-each select="msxml:node-set($sorted)/data_row">
					<xsl:if test="position() = 1">
						<tr>
							<th style="text-align:left">
								<b>Catalogusnaam</b>
							</th>
							<th style="text-align:center">
								<b>Artikelnummer<br/>(inkoop)</b>
							</th>
							<th style="text-align:left">
								<b>Artikelomschrijving<br/>(intern/inkoop)</b>
							</th>
							<th style="text-align:center">
								<b>Artikel-<br/>prijs</b>
							</th>
							<th style="text-align:center">
								<b>Min.<br/>voorraad</b>
							</th>
							<th style="text-align:center">
								<b>Max.<br/>voorraad</b>
							</th>
							<th style="text-align:center">
								<b>Inkoop<br/>geleverd</b>
							</th>
							<th style="text-align:center">
								<b>Intern<br/>geleverd</b>
							</th>
							<th style="text-align:center">
								<b>Voorraad</b>
							</th>
							<th style="text-align:center">
								<b>Inkoop<br/>onderweg</b>
							</th>
							<th style="text-align:center">
								<b>Intern<br/>onderweg</b>
							</th>
							<th style="text-align:center">
								<b>Inkoop<br/>gewenst</b>
							</th>
						</tr>
					</xsl:if>

					<tr>
						<td style="text-align:left">
							<xsl:value-of select="FCLT_F_CATALOGUS"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:center">
							<!--xsl:value-of select="INT_ARTIKEL_NR"/>&#xA0;<br/--><xsl:value-of select="EXT_ARTIKEL_NR"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:left">
							<xsl:value-of select="INT_ARTIKEL_OMS"/>&#xA0;<br/><xsl:value-of select="EXT_ARTIKEL_OMS"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:if test="INT_ARTIKEL_PRIJS!=''">
								<xsl:value-of select="format-number(INT_ARTIKEL_PRIJS, '0,00', 'european')"/>
							</xsl:if>&#xA0;<br/>
							<xsl:if test="EXT_ARTIKEL_PRIJS!=''">
								<xsl:value-of select="format-number(EXT_ARTIKEL_PRIJS, '0,00', 'european')"/>
							</xsl:if>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="MIN_VOORRAAD"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="MAX_VOORRAAD"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="INKOOP_GELEVERD"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:if test="INTERN_EXTERN='1'"><xsl:value-of select="INTERN_GELEVERD"/></xsl:if>
							<xsl:if test="INTERN_EXTERN!='1'"><xsl:value-of select="INTERN_GELEVERD"/> => <xsl:value-of select="format-number(INTERN_GELEVERD div INTERN_EXTERN, '0,00', 'european')"/></xsl:if>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:if test="VOORRAAD!='0'"><xsl:value-of select="VOORRAAD"/></xsl:if>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="INKOOP_BESTELD"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:if test="INTERN_EXTERN='1'"><xsl:value-of select="INTERN_BESTELD"/></xsl:if>
							<xsl:if test="INTERN_EXTERN!='1'"><xsl:value-of select="INTERN_BESTELD"/> => <xsl:value-of select="format-number(INTERN_BESTELD div INTERN_EXTERN, '0,00', 'european')"/></xsl:if>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="INKOOP_GEWENST"/>
							<xsl:if test="$mode != 'excel'">&#xA0;</xsl:if>
						</td>
					</tr>
				</xsl:for-each>
			</table>
		</xsl:if>

		<xsl:if test="@view='allv_v_rap_voorraad' and ($srtnotificatiecode='CUST01' or $srtnotificatiecode='CUST02')">
      Reminder dat onderstaand(e) artikel(en) onder de ingestelde minimale voorraad zitten.<br/><br/>
			<table width="100%" border="1" cellpadding="0" cellspacing="0">
				<colgroup>
					<col width="15%"/>
					<col width="10%"/>
					<col width="30%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
					<col width="5%"/>
				</colgroup>

				<xsl:if test="count(rapport_data/data_row)=0">
					<tr><td><center><b>Geen gegevens gevonden</b></center></td></tr>
				</xsl:if>

				<xsl:variable name="filtered">
					<xsl:for-each select="rapport_data/data_row">
						<xsl:sort select="FCLT_F_CATALOGUS"/>
						<xsl:sort select="INT_ARTIKEL_NR"/>
						<xsl:if test="VOORRAAD &lt; MIN_VOORRAAD and MIN_VOORRAAD &lt; HIDE_F_VOORRAAD_GISTEREN">
							<xsl:copy-of select="."/>
						</xsl:if>
					</xsl:for-each>
				</xsl:variable>

				<xsl:for-each select="msxml:node-set($filtered)/data_row">
					<xsl:if test="position() = 1">
						<tr>
							<td style="text-align:left">
								<b>Catalogusnaam</b>
							</td>
							<td style="text-align:center">
								<b>Artikelnummer<br/>(inkoop)</b>
							</td>
							<td style="text-align:left">
								<b>Artikelomschrijving<br/>(intern/inkoop)</b>
							</td>
							<td style="text-align:center">
								<b>Artikel-<br/>prijs</b>
							</td>
							<td style="text-align:center">
								<b>Min.<br/>voorraad</b>
							</td>
							<td style="text-align:center">
								<b>Max.<br/>voorraad</b>
							</td>
							<td style="text-align:center">
								<b>Inkoop<br/>geleverd</b>
							</td>
							<td style="text-align:center">
								<b>Intern<br/>geleverd</b>
							</td>
							<td style="text-align:center">
								<b>Voorraad</b>
							</td>
							<td style="text-align:center">
								<b>Inkoop<br/>onderweg</b>
							</td>
							<td style="text-align:center">
								<b>Intern<br/>onderweg</b>
							</td>
							<td style="text-align:center">
								<b>Inkoop<br/>gewenst</b>
							</td>
						</tr>
					</xsl:if>

					<tr>
						<td style="text-align:left">
							<xsl:value-of select="FCLT_F_CATALOGUS"/>
						</td>
						<td style="text-align:center">
							<!--xsl:value-of select="INT_ARTIKEL_NR"/>&#xA0;<br/--><xsl:value-of select="EXT_ARTIKEL_NR"/>
						</td>
						<td style="text-align:left">
							<xsl:value-of select="INT_ARTIKEL_OMS"/>&#xA0;<br/><xsl:value-of select="EXT_ARTIKEL_OMS"/>
						</td>
						<td style="text-align:right">
							<xsl:if test="INT_ARTIKEL_PRIJS!=''">
								<xsl:value-of select="format-number(INT_ARTIKEL_PRIJS, '0,00', 'european')"/>
							</xsl:if>&#xA0;<br/>
							<xsl:if test="EXT_ARTIKEL_PRIJS!=''">
								<xsl:value-of select="format-number(EXT_ARTIKEL_PRIJS, '0,00', 'european')"/>
							</xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="MIN_VOORRAAD"/>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="MAX_VOORRAAD"/>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="INKOOP_GELEVERD"/>
						</td>
						<td style="text-align:right">
							<xsl:if test="INTERN_EXTERN='1'"><xsl:value-of select="INTERN_GELEVERD"/></xsl:if>
							<xsl:if test="INTERN_EXTERN!='1'"><xsl:value-of select="INTERN_GELEVERD"/> => <xsl:value-of select="format-number(INTERN_GELEVERD div INTERN_EXTERN, '0,00', 'european')"/></xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:if test="VOORRAAD!='0'"><xsl:value-of select="VOORRAAD"/></xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="INKOOP_BESTELD"/>
						</td>
						<td style="text-align:right">
							<xsl:if test="INTERN_EXTERN='1'"><xsl:value-of select="INTERN_BESTELD"/></xsl:if>
							<xsl:if test="INTERN_EXTERN!='1'"><xsl:value-of select="INTERN_BESTELD"/> => <xsl:value-of select="format-number(INTERN_BESTELD div INTERN_EXTERN, '0,00', 'european')"/></xsl:if>
						</td>
						<td style="text-align:right">
							<xsl:value-of select="INKOOP_GEWENST"/>
						</td>
					</tr>
				</xsl:for-each>
			</table>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>
