<?xml version="1.0"?>                
 <xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
				 
<xsl:output method="html"
     encoding="ISO-8859-1" 
     doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
 
 <xsl:template match="ImportPaie">
    <html> 
      <head> 
        <title>Contr&#244;le des donn&#233;es de paie</title>
		<style>
		  h1 {color:#007F64;text-align:center;font-size:32pt;}
		  table { border-spacing: 0; border-collapse: collapse;}	
	      body {font-size:12px; color:#333;font-family:arial;}
		  .table-section {padding-top:150px}
		  .table-section h2 {background-color:white;color:#007F64;width:700px;padding:10px;}
		  #toc a{color:#007F64}
		  .tableau {border: 1px solid #dbdbde;cellpadding:0px;border-spacing:0px;font-size:12px}
		  .tableau td:nth-child(even) {bgcolor:#d5d5d5;}
		  .tableau tr td{padding:5px;}
		  .tableau tr th{background-color:#4d4f53;color:white;border-left: 1px solid #dbdbde;font-weight:bold;}
		  .titre {cellpadding:0px;border-spacing:0px}
		  .titre tr th {color:#007F64;}
       </style>
       <script src="jquery-1.10.2.min.js"></script>
     </head>
     <body bgcolor="#ffffff">
	   <div id="content">
        <table class="titre">
         <tr>
		   <th width="1030px" height="80px"><h1>Contr&#244;le des donn&#233;es de paie</h1></th>
         </tr>
        </table> 
 		 <br></br>   
	     Date du jour : <xsl:value-of select="NoDS/Date_NODSN"/> Heure : <xsl:value-of select="NoDS/Heure_NODSN"/>
		 <br></br>
		 <br></br>
         P&#233;riode du : <xsl:value-of select="concat(substring(DateDebutPeriode,9,2),'/',substring(DateDebutPeriode,6,2),'/',substring(DateDebutPeriode,1,4))"/> au : <xsl:value-of select="concat(substring(DateFinPeriode,9,2),'/',substring(DateFinPeriode,6,2),'/',substring(DateFinPeriode,1,4))"/>	 
		 <br></br>
		 <br></br>
	     Soci&#233;t&#233; : <xsl:value-of select="NoDS/RaisonSociale_NODSN"/>
		 <br></br>
		 <br></br>
         <table class="tableau">
         <tr height="40">
		   <th>Code</th>
		   <th>El&#233;ment</th>
           <th>Valeur PPS</th>
		   <th>Valeur dossier</th>
		   <th>Date d&#39;effet</th>
		   <th>Ecart</th>
		 </tr>
 	     <xsl:apply-templates select="Variable" mode="constante"/>	
 	     <xsl:apply-templates select="Rubrique" mode="rubrique"/>	
        </table> 
	   </div>
       <script>
         $("tr:odd").css("background-color","#f5f5f5");
       </script>   
     </body>
    </html>
 </xsl:template>
 

<xsl:template match="Variable" mode="constante">
  <xsl:variable name="datefinperiode" select="concat(substring(../DateFinPeriode,1,4),substring(../DateFinPeriode,6,2),substring(../DateFinPeriode,9,2))"/>
  <xsl:variable name="dateeffetpps" select="concat(substring(NoDS/DateEffetPPS_NoDSN,1,4),substring(NoDS/DateEffetPPS_NoDSN,6,2),substring(NoDS/DateEffetPPS_NoDSN,9,2))"/>
  <xsl:variable name="ecartvaleurvariable" select="($dateeffetpps &#60;= $datefinperiode) and ((NoDS/ValeurVariablePPS_NoDSN != NoDS/ValeurVariable_NoDSN) or (not(NoDS/ValeurVariable_NoDSN)))"/>  
  <xsl:if test = "($ecartvaleurvariable) or (../NoDS/EcartSeulement_NODSN != 1)" >
    <xsl:element name="tr">
      <xsl:attribute name="height">24</xsl:attribute>
      <td width="350px">
        <xsl:value-of select="CodeVariable"/>
        <xsl:text> - </xsl:text>
        <xsl:value-of select="LibelleVariable"/>
      </td>
      <td width="120px">Valeur</td>
      <td width="120px" align="right">
        <xsl:value-of select="NoDS/ValeurVariablePPS_NoDSN"/>
      </td>
      <xsl:if test = "NoDS/ValeurVariable_NoDSN" >
        <td width="120px" align="right">
          <xsl:value-of select="NoDS/ValeurVariable_NoDSN"/>
        </td>
        <td width="120px" align="center">
          <xsl:value-of select="concat(substring(NoDS/DateEffetPPS_NoDSN,9,2),'/',substring(NoDS/DateEffetPPS_NoDSN,6,2),'/',substring(NoDS/DateEffetPPS_NoDSN,1,4))"/>
        </td>
        <td width="80px" align="center">
          <xsl:if test = "$ecartvaleurvariable">
            <xsl:text> X </xsl:text>
          </xsl:if>	 
        </td>
      </xsl:if>	 
      <xsl:if test = "not(NoDS/ValeurVariable_NoDSN)" >
        <td colspan="3" width="380px">
          <xsl:text>Constante absente ou pr&#233;sente sous un autre code</xsl:text>
        </td>
      </xsl:if>	 
    </xsl:element> 
  </xsl:if>	 
</xsl:template>

<xsl:template match="Rubrique" mode="rubrique">
  <xsl:variable name="datefinperiode" select="concat(substring(../DateFinPeriode,1,4),substring(../DateFinPeriode,6,2),substring(../DateFinPeriode,9,2))"/>
  <xsl:variable name="dateeffetpps" select="concat(substring(NoDS/DateEffetPPS_NoDSN,1,4),substring(NoDS/DateEffetPPS_NoDSN,6,2),substring(NoDS/DateEffetPPS_NoDSN,9,2))"/>
  <xsl:variable name="deltatauxsalarial" select="(NoDS/TauxSalarialPPS_NoDSN != NoDS/TauxSalarial_NoDSN) or ((not (NoDS/TauxSalarial_NoDSN)) and (NoDS/TauxSalarialPPS_NoDSN) and (NoDS/TauxSalarialPPS_NoDSN != 0)) or ((NoDS/TauxSalarial_NoDSN) and (not (NoDS/TauxSalarialPPS_NoDSN)))"/>
  <xsl:variable name="deltatauxpatronal" select="(NoDS/TauxPatronalPPS_NoDSN != NoDS/TauxPatronal_NoDSN) or ((not (NoDS/TauxPatronal_NoDSN)) and (NoDS/TauxPatronalPPS_NoDSN) and (NoDS/TauxPatronalPPS_NoDSN != 0)) or ((NoDS/TauxPatronal_NoDSN) and (not (NoDS/TauxPatronalPPS_NoDSN)))"/>
  <xsl:variable name="ecarttauxsalarial" select="($dateeffetpps &#60;= $datefinperiode) and ($deltatauxsalarial)"/> 
  <xsl:variable name="ecarttauxpatronal" select="($dateeffetpps &#60;= $datefinperiode) and ($deltatauxpatronal)"/>  
  <xsl:variable name="ExistTauxSalarial" select="((NoDS/TauxSalarial_NoDSN) and (NoDS/TauxSalarialPPS_NoDSN))"/> 
  <xsl:variable name="ExistTauxPatronal" select="((NoDS/TauxPatronal_NoDSN) and (NoDS/TauxPatronalPPS_NoDSN))"/> 
  <xsl:if test = "($ecarttauxsalarial) or ((../NoDS/EcartSeulement_NODSN != 1) and ($ExistTauxSalarial))" >
    <xsl:element name="tr">
      <xsl:attribute name="height">24</xsl:attribute>
       <td width="350px">
        <xsl:value-of select="CodeRubrique"/>
        <xsl:text> - </xsl:text>
        <xsl:value-of select="LibelleRubrique"/>
      </td>
      <td width="120px">Taux salarial</td>
      <td width="120px" align="right">
        <xsl:value-of select="NoDS/TauxSalarialPPS_NoDSN"/>
      </td>
	  <xsl:if test = "NoDS/TauxSalarial_NoDSN">
        <td width="120px" align="right">
          <xsl:value-of select="NoDS/TauxSalarial_NoDSN"/>
        </td>
        <td width="120px" align="center">
          <xsl:value-of select="concat(substring(NoDS/DateEffetPPS_NoDSN,9,2),'/',substring(NoDS/DateEffetPPS_NoDSN,6,2),'/',substring(NoDS/DateEffetPPS_NoDSN,1,4))"/>
        </td>
        <td width="80px" align="center">
          <xsl:if test = "$ecarttauxsalarial">
            <xsl:text> X </xsl:text>
          </xsl:if>	 
        </td>
      </xsl:if>	 
	  <xsl:if test = "not(NoDS/TauxSalarial_NoDSN)">
       <td width="120px" align="right">
        </td>
        <td width="120px" align="center">
          <xsl:value-of select="concat(substring(NoDS/DateEffetPPS_NoDSN,9,2),'/',substring(NoDS/DateEffetPPS_NoDSN,6,2),'/',substring(NoDS/DateEffetPPS_NoDSN,1,4))"/>
        </td>
        <td width="80px" align="center">
          <xsl:text> X </xsl:text>
        </td>
      </xsl:if>	 
    </xsl:element> 
  </xsl:if>	 
  <xsl:if test = "($ecarttauxpatronal) or ((../NoDS/EcartSeulement_NODSN != 1) and ($ExistTauxPatronal))" >
    <xsl:element name="tr">
      <xsl:attribute name="height">24</xsl:attribute>
      <td width="350px">
        <xsl:value-of select="CodeRubrique"/>
        <xsl:text> - </xsl:text>
        <xsl:value-of select="LibelleRubrique"/>
      </td>
      <td width="120px">Taux patronal</td>
      <td width="120px" align="right">
        <xsl:value-of select="NoDS/TauxPatronalPPS_NoDSN"/>
      </td>
	  <xsl:if test = "NoDS/TauxPatronal_NoDSN">
        <td width="120px" align="right">
          <xsl:value-of select="NoDS/TauxPatronal_NoDSN"/>
        </td>
        <td width="120px" align="center">
          <xsl:value-of select="concat(substring(NoDS/DateEffetPPS_NoDSN,9,2),'/',substring(NoDS/DateEffetPPS_NoDSN,6,2),'/',substring(NoDS/DateEffetPPS_NoDSN,1,4))"/>
        </td>
        <td width="80px" align="center">
          <xsl:if test = "$ecarttauxpatronal">
            <xsl:text> X </xsl:text>
          </xsl:if>	 
        </td>
      </xsl:if>	 
	  <xsl:if test = "not(NoDS/TauxPatronal_NoDSN)">
        <td width="120px" align="right">
        </td>
        <td width="120px" align="center">
          <xsl:value-of select="concat(substring(NoDS/DateEffetPPS_NoDSN,9,2),'/',substring(NoDS/DateEffetPPS_NoDSN,6,2),'/',substring(NoDS/DateEffetPPS_NoDSN,1,4))"/>
        </td>
        <td width="80px" align="center">
          <xsl:text> X </xsl:text>
        </td>
       </xsl:if>	 
    </xsl:element> 
  </xsl:if>	 
</xsl:template>

 
</xsl:stylesheet>