<?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">
		<xsl:value-of select="substring(translate('$Revision$', '$ ', ''), 10)"/>
	</xsl:variable>	
	
  <xsl:template name="cnt_endtext">
    <tr>
        <td height="20px"/>
    </tr>
    <tr>
      <td colspan="2" class="tekst"> 
      <xsl:element name="a"><xsl:attribute name="href">https://<xsl:value-of select="$FacilitorRoot"/>?SSO=1&amp;<xsl:value-of select="../bookmarks/contract"/><xsl:value-of select="key"/>&amp;urole=bo</xsl:attribute>Ga direct naar het contract</xsl:element>
      </td>
    </tr>
  </xsl:template>
  
  <xsl:template match="contract" mode="include">
    <table border="1" cellpadding="1">
      <tr>
        <td colspan="4" class="caption"><strong><xsl:value-of select="//lcl/CNT/contract"/>&#xA0;<xsl:value-of select="nummer_intern"/><xsl:if test="versie!=''">.<xsl:value-of select="versie"/></xsl:if></strong>
          &#xA0;<xsl:value-of select="eigenaar_afd/omschrijving"/>/<xsl:value-of select="bedrijf/naam"/></td>
      </tr>
      <xsl:call-template name="cnt_begintext"/>
      <tr>
        <td class="subcaption" colspan="2" width="50%"><xsl:value-of select="//lcl/CNT/algemene_gegevens"/></td>
        <td class="subcaption" colspan="2" width="50%"><xsl:value-of select="//lcl/CNT/data"/></td>
      </tr>
      <tr>
        <td colspan="2">
          <table border="0" id="administratief" width="100%">
            <tr>
              <td class="label" width="30%"><xsl:value-of select="//lcl/CNT/contractsoort"/>:</td>
              <td class="value">
                <xsl:value-of select="discipline/omschrijving"/>
              </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/beschrijving"/>:</td>
              <td class="value">
                <xsl:value-of select="omschrijving"/>
              </td>
            </tr>
            <xsl:if test="nummer!=''">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/CNT/extern_nr"/>:</td>
                <td class="value">
                  <xsl:value-of select="nummer"/>
                </td>
              </tr>
            </xsl:if>
            <xsl:if test="contract">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/CNT/mantel"/>:</td>
                <td class="value">
                  <xsl:value-of select="contract/nummer_intern"/>
                </td>
              </tr>
            </xsl:if>
            <xsl:if test="document!=''">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/FAC/omschrijving"/>:</td>
                <td class="value">
                  <xsl:value-of select="document"/>
                </td>
              </tr>
            </xsl:if>
          </table>
        </td>
        <td colspan="2">
          <table border="0" width="100%" id="datums">
            <tr>
              <td class="label" width="30%"><xsl:value-of select="//lcl/CNT/ingangsdatum"/>:</td>
              <td class="value">
                <xsl:value-of select="looptijd_van/datum"/>
              </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/rappeldatum"/>:</td>
              <td class="value">
                <xsl:value-of select="rappeldatum/datum"/>
              </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/opzegdatum"/>:</td>
              <td class="value">
                <xsl:value-of select="opzegdatum/datum"/>
              </td>
            </tr>
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/einddatum"/>:</td>
              <td class="value">
                <xsl:value-of select="looptijd_tot/datum"/>
              </td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td height="20px"/>
      </tr>

      <tr>
        <td class="subcaption" colspan="2"><xsl:value-of select="//lcl/CNT/eigenaar"/></td>
        <td class="subcaption" colspan="2"><xsl:value-of select="//lcl/CNT/contractpartij"/></td>
      </tr>
      <tr>
        <td colspan="2">
          <table border="0" id="eigenaar" width="100%">
            <tr>
              <td class="label" width="30%">Afdeling:</td>
              <td class="value">
                <xsl:value-of select="eigenaar_afd/omschrijving"/>
              </td>
            </tr>
            <tr>
              <td class="label">Beheerder:</td>
              <td class="value">
                <xsl:value-of select="eigenaar/naam_full"/>
              </td>
            </tr>            
            <tr>
              <td class="label">Administrateur:</td>
              <td class="value">
                <xsl:value-of select="beheerder/naam_full"/>
              </td>
            </tr>
          </table>
        </td>
        <td colspan="2">
          <table border="0" id="contractant" width="100%">
            <tr>
              <td class="label" width="30%"><xsl:value-of select="//lcl/CNT/uitvoerder"/>:</td>
              <td class="value">
                <xsl:value-of select="bedrijf/naam"/>
                <xsl:if test="bedrijf/bezoek_plaats!=''">&#xA0;
              -&#xA0;<xsl:value-of select="bedrijf/bezoek_plaats"/></xsl:if>
                <xsl:if test="bedrijf/leverancier_nr!=''">&#xA0;
              (<xsl:value-of select="bedrijf/leverancier_nr"/>)</xsl:if>
              </td>
            </tr>
            <tr>
              <td/>
              <td class="value">
                <xsl:value-of select="bedrijf/post_adres"/>
              </td>
            </tr>
            <tr>
              <td/>
              <td class="value">
                <xsl:value-of select="bedrijf/post_postcode"/>&#xA0;
                <xsl:value-of select="bedrijf/post_plaats"/>
              </td>
            </tr>
            <xsl:if test="contactpersoon">
                <tr>
                  <td class="label"><xsl:value-of select="//lcl/FAC/contactpersoon"/>:</td>
                  <td class="value">
                    <xsl:value-of select="contactpersoon/naam_full"/>
                  </td>
                </tr>
            </xsl:if>
            <xsl:if test="contactpersoon/telefoon1!=''">
                <tr>
                  <td class="label"><xsl:value-of select="//lcl/FAC/telefoon"/>:</td>
                  <td class="value">
                    <xsl:value-of select="contactpersoon/telefoon1"/>
                  </td>
                </tr>
            </xsl:if>
          </table>
        </td>
      </tr>
   
      <tr>
        <td height="20px"/>
      </tr>


      <tr>
        <td class="subcaption" colspan="2"><xsl:value-of select="//lcl/FAC/opmerkingen"/></td>
        <td class="subcaption" colspan="2"><xsl:value-of select="//lcl/CNT/financieel"/></td>
      </tr>
      <tr>
        <td colspan="2">
          <xsl:value-of select="opmerking"/>
        </td>
        <td colspan="2">
          <table border="0" id="financieel" width="100%">
           <xsl:if test="kostenplaats">
              <tr>
                <td class="label"><xsl:value-of select="//lcl/FAC/kostenplaats"/>:</td>
                <td class="value">
                  <xsl:value-of select="kostenplaats/nr"/>&#xA0;
                  <xsl:value-of select="kostenplaats/omschrijving"/>
                </td>
              </tr>
            </xsl:if> 
            <xsl:if test="kostensoort">
              <tr>
                <td class="label">Kostensoort:</td>
                <td class="value">
                  <xsl:value-of select="kostensoort/omschrijving"/>
                </td>
              </tr>
              </xsl:if>
              <xsl:if test="termijnkosten!=''">
                <tr>
                  <td class="label" width="30%"><xsl:value-of select="//lcl/CNT/termijnbedrag"/>:</td>
                  <td class="value">
                    <xsl:value-of select="termijnkosten"/>
                  </td>
                </tr>
            </xsl:if>           
            <tr>
              <td class="label"><xsl:value-of select="//lcl/CNT/contractbedrag"/>:</td>
              <td class="value">
                <xsl:value-of select="kosten"/>
              </td>
            </tr>
          </table>
        </td>
      </tr>

    <tr>
        <td height="20px"/>
    </tr>

      <tr>
        <td class="subcaption" colspan="4"><xsl:value-of select="//lcl/FAC/details"/></td>
      </tr>
      <tr>
        <td colspan="4">
          <table>
            <xsl:for-each select="kenmerk[count(@xmlnode)=0]">
              <xsl:sort select="@volgnummer" data-type="number"/>
              <xsl:if test=".!=''">
                <tr>
                  <td class="label">
                    <xsl:value-of select="@naam"/>:</td>
                  <td class="value">
                    <xsl:value-of select="."/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </td>
      </tr>
      <tr>
        <td height="20px"/>
      </tr>
      <tr>
        <td class="subcaption" colspan="4"><xsl:value-of select="//lcl/CNT/scope"/></td>
      </tr>
      <tr>
        <td colspan="4">
          <xsl:if test="contract_plaats/plaats">
            <table cellspacing="1" width="100%">
              <tr>
                <td>
                  <strong><xsl:value-of select="//lcl/FAC/locatie"/></strong>
                </td>
                <td>
                  <strong><xsl:value-of select="//lcl/FAC/adres"/></strong>
                </td>
                <td>
                  <strong><xsl:value-of select="//lcl/FAC/plaats"/></strong>
                </td>
                <td style="text-align:right">
                  <strong><xsl:value-of select="//lcl/CNT/bedrag"/></strong>
                </td>
              </tr>
              <xsl:for-each select="contract_plaats/plaats">
                <xsl:sort select="regio/district/locatie/omschrijving"/>
                <tr>
                  <td>
                    <xsl:value-of select="regio/district/locatie/omschrijving"/>&#xA0;<xsl:value-of select="regio/district/locatie/gebouw/omschrijving"/>
                  </td>
                  <td>
                    <xsl:value-of select="regio/district/locatie/adres"/>
                  </td>
                  <td>
                    <xsl:value-of select="regio/district/locatie/plaats"/>
                  </td>
                  <td style="text-align:right">
                    <xsl:call-template name="europrijs">
                    <xsl:with-param name="prijs" select="../kosten"/>
                    </xsl:call-template>
                  </td>
                </tr>
              </xsl:for-each>
            </table>
          </xsl:if>

          <xsl:if test="contract_object/srtdeel">
            <table cellspacing="1">
              <tr>
                <td>
                  <strong><xsl:value-of select="//lcl/CNT/betreft"/>:</strong>
                </td>
              </tr>
              <xsl:for-each select="contract_object/srtdeel">
                <xsl:sort select="omschrijving"/>
                <tr>
                  <td>
                    <xsl:value-of select="omschrijving"/>
                  </td>
                </tr>
              </xsl:for-each>
            </table>
          </xsl:if>
          <xsl:if test="contract_object/deel">
            <table cellspacing="1">
              <tr>
                <td>
                  <strong><xsl:value-of select="//lcl/CNT/objecten"/>:</strong>
                </td>
              </tr>
              <xsl:for-each select="contract_object/deel">
                <xsl:sort select="omschrijving"/>
                <tr>
                  <td>
                    <xsl:value-of select="omschrijving"/>
                  </td>
                </tr>
              </xsl:for-each>
            </table>
          </xsl:if>

          <!-- moet nog voor terreinen -->
          <xsl:if test="contract_onrgoed">
            <table cellspacing="1">
              <tr>
                <td>
                  <strong><xsl:value-of select="//lcl/CNT/gehuurd"/>:</strong>
                </td>
              </tr>
              <xsl:for-each select="contract_onrgoed">
                <xsl:sort select="ruimte/srtruimte/omschrijving"/>
                <tr>
                  <td>
                    <xsl:value-of select="ruimte/srtruimte/omschrijving"/>
                  </td>
                  <td>
                    <xsl:value-of select="ruimte/nr"/>
                  </td>
                  <td>
                    <xsl:value-of select="ruimte/omschrijving"/>
                  </td>
                  <td>
                    <xsl:value-of select="ruimte/prijs"/>
                  </td>
                </tr>
              </xsl:for-each>
            </table>
          </xsl:if>
        </td>
      </tr>
      <xsl:call-template name="cnt_endtext"/>
    </table>
  </xsl:template>  
  
</xsl:stylesheet>
