﻿<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xslc="http://xslcomponents.org/TR/WD-xslc">
	<xsl:import href="../../xslc.xsl"/>
	<xsl:import href="../../Common.xsl"/>
	<xsl:template match="/">
		<xsl:apply-templates select="document"/>
	</xsl:template>
	<xsl:template match="document">
		<xsl:call-template name="xslc:Page">
			<xsl:with-param name="BodyAttributes">
				<Attributes onload="SetTextFact();"/>
			</xsl:with-param>
			<xsl:with-param name="Head">
				<script language="javascript">
					<![CDATA[
function SetTextFact() {
var divFact = document.all ? document.all["zoneFact"] : document.getElementById ? document.getElementById("zoneFact") : ""
var txtFact = ']]>
					<xsl:value-of select="/document/GetFactS/GetFact/txtFichier"/>
					<![CDATA['; 
divFact.value =  txtFact.replace(/ /g,'').replace(/&lt;br&gt;/g,'\r\n').replace(/<br>/g,'\r\n').replace(/&#160;/g,' ').replace(/&#39;/g,"'");
} // SetTextFact]]>
				</script>
				<script language="javascript">
					<![CDATA[
function decimalToHex(d, padding) {
    var hex = Number(d).toString(16);
    while (hex.length < padding) {
        hex = "0" + hex;
    }
   return hex;
}
var cpt = 0;
// ==========================================================================
// Afficher la fenêtre popup pour la saisie des infos ProFid
// ==========================================================================
function PopFormAxVO(PopID, idVO) {
  if (popObj = getObjectById(PopID)) {
      popObj.src = XMLC_BaseHRef+'FormAxVO?idTVO='+idVO;
  }
}]]>
					<![CDATA[// ==========================================================================
// Afficher la fenêtre popup pour la saisie des infos ProFid
// ==========================================================================
function lPopFormAxVO(PopID, idClient, paramNav) {
if (paramNav!='MSIE') {
  nouveauTitre = document.title; 
  if (nouveauTitre.indexOf(' #')>-1) 
    nouveauTitre = nouveauTitre.substring(0,nouveauTitre.indexOf(' #'));
   nouveauTitre = nouveauTitre + ' #3' + decimalToHex(XMLC_HostID,1) + '#' + XMLC_Host + '#' + decimalToHex(XMLC_UserID,4) + '#' + decimalToHex(idClient,4) + '#' + XMLC_UserConcession + '#'; 
  
  document.title = nouveauTitre; 
}
if (paramNav=='MSIE') {
  args='0';
  evt = event;
  if (evt.shiftKey)
    args='1';
  if (popObj = getObjectById(PopID)) {
      popObj.src = XMLC_BaseHRef+'FormAxVO?idClient='+idClient+'&idVersion='+args;
  }
 }
}


function llPopFormAxVO(PopID, idpar1, idpar2, paramNav) {
cpt++;
if (paramNav!='MSIE') {
  nouveauTitre = document.title; 
  if (nouveauTitre.indexOf(' #')>-1) 
    nouveauTitre = nouveauTitre.substring(0,nouveauTitre.indexOf(' #'));
   nouveauTitre = nouveauTitre + ' #' + decimalToHex(idpar1,1) + decimalToHex(XMLC_HostID,1) + '#' + XMLC_Host + '#' + decimalToHex(XMLC_UserID,4) + '#' + decimalToHex(idpar2,4) + '#' + XMLC_UserConcession + '#' + decimalToHex(cpt,2)+ '#'; 
  
  document.title = nouveauTitre; 
}
if (paramNav=='MSIE') {
  args='0';
//  evt = event;
//  if (evt.shiftKey)
//    args='1';
  popObj = getObjectById(PopID);
  if (idpar1==1) {
      popObj.src = XMLC_BaseHRef+'FormAxVO?TypeVO=1&idTVO='+idpar2+'&idVersion='+args;
  }
  if (idpar1==3) {
      popObj.src = XMLC_BaseHRef+'FormAxVO?idClient='+idpar2+'&idVersion='+args;
  }
  if (idpar1==10) {
      popObj.src = XMLC_BaseHRef+'FormAx_Frevo?TypeVO=1&idFrevo='+idpar2+'&idVersion='+args;
  }
 }
}
]]>
				</script>
			</xsl:with-param>
			<xsl:with-param name="Title">
				<xsl:value-of select="/document/GetFactS/GetFact/typeDocument"/>&#160;<xsl:value-of select="/document/GetFactS/GetFact/nDocument"/>
			</xsl:with-param>
			<xsl:with-param name="Body">
				<xsl:variable name="stSiteValue">
					<xsl:choose>
						<xsl:when test="/document/GetFactS/GetFact/TypeDMS= '' or /document/GetFactS/GetFact/TypeDMS= '0' or /document/GetFactS/GetFact/TypeDMS= '1'">line-height:18px;</xsl:when>
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="/document/GetFactS/GetFact/TypeDMS= '2'">color:red; line-height:18px; </xsl:when>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<form action="{/document/Aliases/bdVODLL}CarFidShowFact" name="MainForm" method="post">
					<input type="hidden" name="idSPL_Docs" value="{/document/Params/idSPL_Docs}"/>
					<input type="hidden" name="cfTitle" value="{/document/Params/cfTitle}"/>
					<input type="hidden" name="fClause" value="{/document/Params/fClause}"/>
					<input type="hidden" name="sClause" value="{/document/Params/sClause}"/>
					<input type="hidden" size="200" name="wClause" value="{/document/Params/wClause}"/>
					<input type="hidden" name="oClause" value="{/document/Params/oClause}"/>
				</form>
				<form action="{/document/Aliases/bdVODLL}ReportSPLScan" name="PrintForm" method="post">
					<input type="hidden" name="GetXml" value="1"/>
					<input type="hidden" name="idSPL_Docs" value="{/document/Params/idSPL_Docs}"/>
					<input type="hidden" name="PName"/>
					<input type="hidden" name="idDocument" value="{/document/GetFactS/GetFact/idDocument}"/>
					<input type="hidden" name="nChassis" value="{/document/GetFactS/GetFact/sChassis}"/>
					<input type="hidden" name="nDocument" value="{/document/GetFactS/GetFact/sFichier}"/>
				</form>
				<xsl:call-template name="xslc:ApplicationMessages"/>
				<div id="vdivFormVO" class="BoxFrameVN" style="position: absolute; display: none; z-index:1000; PADDING-LEFT: 7 px; ">
					<button class="window-close" onclick="javascript: window.parent.ShowHideForm(vidPaneID);">
						<img border="0" src="{$XMLC_PictosPath}ico_closenew.gif" alt="pour quitter sans enregistrer ..."/>
					</button>Visualisation des données d'un Client<iframe id="FormVO" name="FormVO" border="0" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="{$XMLC_Portal}blank.htm" style="position: absolute; z-index:1000;PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; "/>
				</div>
				<div id="zoneTop" style="{$stSiteValue}">le <xsl:value-of select="/document/GetFactS/GetFact/dateImpression"/>, à <xsl:value-of select="/document/GetFactS/GetFact/Site"/>
					<xsl:if test="/document/XMLC_Params/XMLC_UserName = 'llebleu@free.fr' "> - <xsl:value-of select="/document/GetFactS/GetFact/sFichier"/>
					</xsl:if>
				</div>
				<xsl:apply-templates select="GetFactS"/>
				<table nowrap="nowrap">
					<tr>
						<td width="720px">
							<textarea id="zoneFact" rows="40" cols="144" style="{$stSiteValue}" readonly="">
								<br/>contenu de la facture</textarea>
						</td>
					</tr>
				</table>
				<xsl:call-template name="xslc:PoweredBy"/>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="GetFactS">
		<xsl:variable name="stChassisDoc">
			<xsl:choose>
				<xsl:when test="string-length(/document/GetFactS/GetFact/sChassis)=17">border:none;</xsl:when>
				<xsl:otherwise>border:none; color : red;</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="stChassisProfid">
			<xsl:choose>
				<xsl:when test="string-length(/document/GetVehicleS/GetVehicle/Chassis)=17">border:none;</xsl:when>
				<xsl:otherwise>border:none; color : red;</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<div id="zoneParams" style="display: none;">
			<xsl:value-of select="/document/Params/cfTitle"/>&amp;sClause=<xsl:value-of select="/document/Params/sClause"/>&amp;wClause=<xsl:value-of select="/document/Params/wClause"/>&amp;oClause=<xsl:value-of select="/document/Params/oClause"/>
		</div>
		<xsl:variable name="voIcoRun">
											<xsl:choose>
												<xsl:when test="(/document/XMLC_Params/XMLC_NavigatorName = 'MSIE')">
													<xsl:value-of select="$XMLC_PictosPath"/>voRun.gif
												</xsl:when>
												<xsl:otherwise><xsl:value-of select="$XMLC_PictosPath"/>voNewRun.gif</xsl:otherwise>
											</xsl:choose>
		</xsl:variable>
		<xsl:variable name="paramRun">
											<xsl:choose>
												<xsl:when test="(/document/XMLC_Params/XMLC_NavigatorName = 'MSIE')">
													"MSIE"
												</xsl:when>
												<xsl:otherwise>""</xsl:otherwise>
											</xsl:choose>
		</xsl:variable>
		
		<table width="720px" nowrap="nowrap" style="border-width:1px;border-color:#c8c8c8;">
			<tr>
				<td colspan="4" align="left">
					<xsl:value-of select="/document/GetFactS/GetFact/typeDocument"/> n° <xsl:value-of select="/document/GetFactS/GetFact/nDocument"/> du <xsl:value-of select="/document/GetFactS/GetFact/dateDocument"/>
				</td>
				<td align="right">
					<xsl:if test="/document/GetFirstFactS/GetFirstFact/idFirst='' or /document/GetFirstFactS/GetFirstFact/idFirst=/document/GetFactS/GetFact/idSPL_Docs">
						<img border="0" src="{$XMLC_PictosPath}Icons/Common/stepfirst_left_disabled.gif"/>
					</xsl:if>
					<xsl:if test="/document/GetFirstFactS/GetFirstFact/idFirst!='' and /document/GetFirstFactS/GetFirstFact/idFirst!=/document/GetFactS/GetFact/idSPL_Docs">
						<a href="#" onclick="javascript: SetField('MainForm', 'idSPL_Docs',  {/document/GetFirstFactS/GetFirstFact/idFirst});
  document.MainForm.submit(); 
  return false;">
							<img border="0" src="{$XMLC_PictosPath}Icons/Common/stepfirst_left.gif"/>
						</a>
					</xsl:if>
					<xsl:if test="/document/GetPrevFactS/GetPrevFact/idPrev=''">
						<img border="0" src="{$XMLC_PictosPath}Icons/Common/step_left_disabled.gif"/>
					</xsl:if>
					<xsl:if test="/document/GetPrevFactS/GetPrevFact/idPrev!=''">
						<a href="#" onclick="javascript: SetField('MainForm', 'idSPL_Docs',  {/document/GetPrevFactS/GetPrevFact/idPrev});
  document.MainForm.submit(); 
  return false;">
							<img border="0" src="{$XMLC_PictosPath}Icons/Common/step_left.gif"/>
						</a>
					</xsl:if>
					<xsl:if test="/document/GetNextFactS/GetNextFact/idNext=''">
						<img border="0" src="{$XMLC_PictosPath}Icons/Common/step_right_disabled.gif"/>
					</xsl:if>
					<xsl:if test="/document/GetNextFactS/GetNextFact/idNext!=''">
						<a href="#" onclick="javascript: SetField('MainForm', 'idSPL_Docs',  {/document/GetNextFactS/GetNextFact/idNext});
  document.MainForm.submit(); 
  return false;">
							<img border="0" src="{$XMLC_PictosPath}Icons/Common/step_right.gif"/>
						</a>
					</xsl:if>
					<xsl:if test="/document/GetLastFactS/GetLastFact/idLast='' or
/document/GetLastFactS/GetLastFact/idLast=/document/GetFactS/GetFact/idSPL_Docs">
						<img border="0" src="{$XMLC_PictosPath}Icons/Common/steplast_right_disabled.gif"/>
					</xsl:if>
					<xsl:if test="/document/GetLastFactS/GetLastFact/idLast!='' and
/document/GetLastFactS/GetLastFact/idLast!=/document/GetFactS/GetFact/idSPL_Docs">
						<a href="#" onclick="javascript: SetField('MainForm', 'idSPL_Docs',  {/document/GetLastFactS/GetLastFact/idLast});
  document.MainForm.submit(); 
  return false;">
							<img border="0" src="{$XMLC_PictosPath}Icons/Common/steplast_right.gif"/>
						</a>
					</xsl:if>
				</td>
			</tr>
			<tr>
				<td colspan="2" style="color:orange;" align="left">
					<xsl:if test="/document/GetFactS/GetFact/DateFinValiditeCarfid!=''">Carte de fidélité valide jusqu'au : <xsl:value-of select="/document/GetFactS/GetFact/DateFinValiditeCarfid"/>
					</xsl:if>
				</td>
				<td colspan="3" align="right">
					<xsl:value-of select="/document/Params/cfTitle"/>
				</td>
			</tr>
			<tr style="background: #c8c8c8;">
				<td width="100px"/>
				<td width="200px">dans le document</td>
				<td/>
				<td width="250px">dans ProFid II</td>
				<td/>
			</tr>
			<tr>
				<td width="100px">Immatriculation :</td>
				<td width="200px">
					<xsl:value-of select="/document/GetFactS/GetFact/sImmatriculation"/>
				</td>
				<td>
					<img width="6px" height="12px" border="0" src="{$XMLC_PictosPath}icoFlag{/document/GetFactS/GetFact/vCheckImmat}.gif"/>
				</td>
				<td width="250px">
					<xsl:value-of select="/document/GetVehicleS/GetVehicle/Immatriculation"/>
				</td>
				<td/>
			</tr>
			<tr>
				<td width="100px">n° de châssis:</td>
				<td width="200px" style="{$stChassisDoc}">
					<xsl:value-of select="/document/GetFactS/GetFact/sChassis"/>
				</td>
				<td width="10px">
					<img width="6px" height="12px" border="0" src="{$XMLC_PictosPath}icoFlag{/document/GetFactS/GetFact/vCheckChassis}.gif"/>
				</td>
				<td width="250px" style="{$stChassisProfid}">
					<xsl:value-of select="/document/GetVehicleS/GetVehicle/Chassis"/>
				</td>
				<td/>
			</tr>
			<tr>
				<td colspan="4"/>
			</tr>
			<tr>
				<td width="100px">Identité client :</td>
				<td width="200px">
					<xsl:value-of select="/document/GetFactS/GetFact/sClient"/>
				</td>
				<td width="10px">
					<img width="6px" height="12px" border="0" src="{$XMLC_PictosPath}icoFlag{/document/GetFactS/GetFact/vCheckIdentite}.gif"/>
				</td>
				<td width="250px">
					<xsl:if test="/document/GetClientS/GetClient/CliCivilite=1">Mme </xsl:if>
					<xsl:if test="/document/GetClientS/GetClient/CliCivilite=2">Melle </xsl:if>
					<xsl:if test="/document/GetClientS/GetClient/CliCivilite=3">M. </xsl:if>
					<xsl:if test="/document/GetClientS/GetClient/CliCivilite=4">M. &amp; Mme </xsl:if>
					<xsl:if test="/document/GetClientS/GetClient/CliCivilite=5">Sté </xsl:if>
					<xsl:value-of select="/document/GetClientS/GetClient/CliNom"/>&#160;<xsl:value-of select="/document/GetClientS/GetClient/CliPrenom"/>
				</td>
				<td>
					<xsl:if test="/document/GetClientS/GetClient/idClient!=0">
						<a href="#" onclick="javascript: llPopFormAxVO('FormVO', 3, {/document/GetClientS/GetClient/idClient}, {$paramRun}); return false;">
							<img alt="pour accéder aux informations du Client" border="0" src="{$voIcoRun}"/>
						</a>
					</xsl:if>
				</td>
			</tr>
			<tr>
				<td colspan="4"/>
			</tr>
			<tr>
				<td width="100px">Adresse :<br/>
					<xsl:if test="/document/GetFactS/GetFact/sAdresse2!=''">
						<br/>
					</xsl:if>CP - Ville:</td>
				<td width="200px">
					<xsl:value-of select="/document/GetFactS/GetFact/sAdresse1"/>
					<xsl:if test="/document/GetFactS/GetFact/sAdresse2!=''">
						<br/>
						<xsl:value-of select="/document/GetFactS/GetFact/sAdresse2"/>
					</xsl:if>
					<br/>
					<xsl:value-of select="/document/GetFactS/GetFact/sCP"/>&#160;<xsl:value-of select="/document/GetFactS/GetFact/sVille"/>
				</td>
				<td width="10px">
					<img width="6px" height="12px" border="0" src="{$XMLC_PictosPath}icoFlag{/document/GetFactS/GetFact/vCheckCPVille}.gif"/>
				</td>
				<td width="250px">
					<xsl:value-of select="/document/GetClientS/GetClient/CliAdresse1"/>
					<xsl:if test="/document/GetClientS/GetClient/CliAdresse2!=''">
						<br/>
						<xsl:value-of select="/document/GetClientS/GetClient/CliAdresse2"/>
					</xsl:if>
					<br/>
					<xsl:value-of select="/document/GetClientS/GetClient/CliCP"/>&#160;<xsl:value-of select="/document/GetClientS/GetClient/CliVille"/>
				</td>
				<td/>
			</tr>
			<tr>
				<td colspan="4"/>
			</tr>
			<tr>
				<td width="100px">Tél.fixe:</td>
				<td width="200px">
					<xsl:value-of select="/document/GetFactS/GetFact/nTelephone1"/>
				</td>
				<td width="10px">
					<img width="6px" height="12px" border="0" src="{$XMLC_PictosPath}icoFlag{/document/GetFactS/GetFact/vCheckTelDom}.gif"/>
				</td>
				<td width="250px">
					<xsl:value-of select="/document/GetClientS/GetClient/CliTelDom"/>
				</td>
				<td/>
			</tr>
			<tr>
				<td width="100px">Mobile:<br/>
				</td>
				<td width="200px">
					<xsl:value-of select="/document/GetFactS/GetFact/nTelephone2"/>
				</td>
				<td width="10px">
					<img width="6px" height="12px" border="0" src="{$XMLC_PictosPath}icoFlag{/document/GetFactS/GetFact/vCheckMobile}.gif"/>
				</td>
				<td width="250px">
					<xsl:value-of select="/document/GetClientS/GetClient/CliMobile"/>
				</td>
				<td/>
			</tr>
			<tr>
				<td width="100px">email:</td>
				<td width="200px">
					<xsl:value-of select="/document/GetFactS/GetFact/email"/>
				</td>
				<td width="10px">
					<img width="6px" height="12px" border="0" src="{$XMLC_PictosPath}icoFlag{/document/GetFactS/GetFact/vCheckEmail}.gif"/>
				</td>
				<td width="250px">
					<xsl:value-of select="/document/GetClientS/GetClient/CliEmail"/>
				</td>
				<td/>
			</tr>
			<xsl:if test="/document/XMLC_Params/XMLC_Authenticated != '0' and (/document/XMLC_Params/XMLC_Administrator = '1' or /document/XMLC_Params/XMLC_Supervisor = '1' or /document/XMLC_Params/User_RCarFid = '1' ) and /document/GetFactS/GetFact/DateFinValiditeCarfid!=''">
				<tr>
					<td colspan="5" style="color:orange;" align="right">Sélectionnez l'impression via le réseau pour la réimpression du badge : <select id="CBSPOOL" name="CBSPOOL" style="width:200px" onchange="javascript: document.PrintForm.PName.value=getObject('CBSPOOL').value;Show('idBtnPrint'); return false;" onkeypress="return handleKeyPress(event);">
							<option value=""/>
							<xsl:for-each select="/document/ListSpoolersS/ListSpoolers">
								<option value="{vSite}-{vName}">
									<xsl:value-of select="vSite"/>-<xsl:value-of select="vName"/>
								</option>
							</xsl:for-each>
						</select>
						<div id="idBtnPrint" style="display: none;">
							<xsl:call-template name="xslc:Button">
								<xsl:with-param name="Caption">réImprimer</xsl:with-param>
								<xsl:with-param name="OnClick">SubmitForm('PrintForm', 'TARGET', '_blank'); return false;</xsl:with-param>
								<xsl:with-param name="Width">200px</xsl:with-param>
							</xsl:call-template>
						</div>
					</td>
				</tr>
			</xsl:if>
		</table>
	</xsl:template>
</xsl:stylesheet>
