<?php
/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 0.9.9

Copyright (C) 2006-2009  Sylvain FATOME
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; 
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program
(in the directory docs); 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.

Contact : galawa@free.fr

Web : http://smitst.homelinux.com
****************************************************************************************/

session_start(); 
if (!isset($_SESSION["lng"])) $_SESSION["lng"]="fr";
include_once("../lng/".$_SESSION["lng"].".inc.php"); // Paramètres de language
include_once("../inc/config.inc.php");
include_once("../inc/func_log.inc.php");
if (CheckURLLog(FALSE)==FALSE) header("Location: ../index.php");
if (CheckNivLog("9")==FALSE) header("Location: ../index.php");
include_once("../inc/fic_cocl.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_time.inc.php");
include_once("../inc/func_txt.inc.php");
include_once("../inc/lst.inc.php");
Archivelog(@$_SESSION["code_log"]);

$pbm_maint=FALSE;

// Variables Formulaire
$type = $_GET["td"];

$tr=-1;
if (!isset($_GET["tr"]))
	$pbm_maint=TRUE;
else
{
	if (!is_numeric($_GET["tr"]))
		$pbm_maint=TRUE;
	else
		$tr = intval($_GET["tr"]);
}

$rep = FALSE;
if (isset($_GET["rep"]))
{
	switch ($_GET["rep"])
	{
		case "Y" :
			$rep=TRUE;
			break;
		case "N" :
			$rep=FALSE;
			break;
		default :
			$pbm_maint=TRUE;
			break;
	}
}

switch ($type)
{
	case "cli" :
		$titre = $titlein_maint_cli;
		if (($tr<0) OR ($tr>2))
			$pbm_maint=TRUE;
		break;
	case "conc" :
		$titre = $titlein_maint_cocli;
		if (($tr<0) OR ($tr>2))
			$pbm_maint=TRUE;
		break;
	case "int" :
		$titre = $titlein_maint_int;
		if (($tr<0) OR ($tr>1))
			$pbm_maint=TRUE;
		break;
	default :
		$pbm_maint=TRUE;
		break;
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SMI - <?PHP echo $title_esp_prive; ?> : <?PHP echo $title_maint; ?></title>

<!-- Feuille de style pour les affichages courants -->
<link href="../css/smi.css" rel="stylesheet" type="text/css">

<!-- Feuille de style & Script pour le menu -->

<script language="JavaScript" src="../jscript/coolmenus/coolmenus4.js"></script>

<!-- Scripts Javascript pour fenêtres -->
<script language="JavaScript" src="../jscript/fen.js"></script>

<!-- Scripts Javascript divers -->
<script language="JavaScript" src="../jscript/divers.js"></script>

</head>
<body onLoad="metFocus();">

<?php 
include_once("../inc/entete.inc.php"); 

if ($pbm_maint==FALSE)
{
?>
	
	<p align="center"><span class="titrepage"><?PHP echo $titre; ?></span></p>
	<?PHP
	echo "<p align=\"center\">";
	echo "<span class=\"annot_std_it\">";
	if ($rep==TRUE)
		echo $txt_div_modrep;
	else
		echo $txt_div_modana;
	echo "</span></p>";
	$errglob=FALSE;
	$conn = mysql_connect(DBHOST, DBUSER, DBPASS);
	mysql_select_db(DBNAME);
	switch ($type)
	{
		case "cli" :
			$rech = "SELECT * FROM `" .TBCLI. "` ORDER BY `cli_code`";
			$rs = mysql_query($rech) or die(mysql_error());
			if (mysql_num_rows($rs) <> 0)
			{
				// *** Vérification types de clients
				if (($tr==0) OR ($tr==1))
				{
					$rech = "SELECT * FROM `" .TBCLI. "` ORDER BY `cli_code`";
					$rs = mysql_query($rech) or die(mysql_error());
	
					echo "<span class=\"annot_gras_it\">";
					echo $txt_div_veriftcli;
					echo "</span>";
					echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";     
	
					// Création entête
					echo "<th>";
					echo "Code";
					echo "</th>";
					echo "<th>";
					echo "Type";
					echo "</th>";
					echo "<th>";
					echo $tab_ent_intask;
					echo "</th>";
					echo "<th>";
					echo $tab_ent_intclosask;
					echo "</th>";
					echo "<th>";
					echo $tab_ent_coheask;
					echo "</th>";
					if ($rep==TRUE)
					{
						echo "<th>";
						echo $tab_ent_repask;
						echo "</th>";
					}
	
					$i = 0;
	
					while ($row = mysql_fetch_assoc($rs)) 
					{         
						// Création de l'entête de ligne (TR)
						creetrlst($i);
				
						echo "<td align=\"center\">".$row["cli_code"]."</td>\n";
						echo "<td align=\"center\">";
						echo $typ_client[$row["cli_type"]];
						echo "</td>\n";
						$typcli=-1;
						$cliint=FALSE;
						$err=FALSE;
						// Déjà utilisé dans une intervention ?
						echo "<td align=\"center\">";
						$rech2 = "SELECT * FROM `" .TBINT. "` WHERE `int_codecli`='".$row["cli_code"]."'";
						$rs2 = mysql_query($rech2) or die(mysql_error());
						if (mysql_num_rows($rs2) <> 0)
						{
							$cliint=TRUE;
							echo $txt_div_oui;
							if ($row["cli_type"]==0)
							{
								$err=TRUE;
								$typcli=1;
							}
						}
						else
						{
							echo $txt_div_non;
							if ($row["cli_type"]>0)
							{
								$err=TRUE;
								$typcli=0;
							}
						}
						echo "</td>\n";
						// Déjà utilisé dans une intervention close ?
						echo "<td align=\"center\">";
						$rech2 = "SELECT * FROM `" .TBINT. "` WHERE `int_codecli`='".$row["cli_code"]."' AND `int_datefin`<>'0000-00-00'";
						$rs2 = mysql_query($rech2) or die(mysql_error());
						if (mysql_num_rows($rs2) <> 0)
						{
							echo $txt_div_oui;
							if ($row["cli_type"]<=1)
							{
								$err=TRUE;
								$typcli=2;
							}
						}
						else
						{
							echo $txt_div_non;
							if ($row["cli_type"]>1)
							{
								$err=TRUE;
								if ($cliint==TRUE)
									$typcli=1;
								else
									$typcli=0;
							}
						}
						echo "</td>\n";
	
	
						echo "<td align=\"center\">";
						if ($err==TRUE)
						{
							$errglob=TRUE;
							echo "<span class=\"annot_gras_it\">";
							echo $txt_div_nook;
							echo "</span>";
						}
						else	
							echo $txt_div_ok;
						echo "</td>\n";

						if ($rep==TRUE)
						{
							echo "<td align=\"center\">";
							// On ne met à jour que si erreur
							if ($err==TRUE)
							{
								$rech3 = "UPDATE `" .TBCLI. "` SET";
								$rech3.=" `cli_type`='".$typcli."'";
								$rech3.=" WHERE `cli_code` = '".$row["cli_code"]."'";
								$rs3 = mysql_query($rech3) or die(mysql_error());
								echo $txt_div_oui;
								echo "<span class=\"annot_petit_it\">";
								echo "<br />".$txt_div_passeen." '".$typ_client[$typcli]."'";
								echo "</span>";
							}
							else
								echo $txt_div_non;
							echo "</td>\n";
						}
						
						$i++;
					}
					
					echo "</table>";
					echo "<br>";
				}	
					
				// *** Vérification des répertoires clients
				if (($tr==0) OR ($tr==2))
				{
					// Vérification du répertoire principal pour les clients
					$rep_clients = $url_gfc."/clients";
					$desc_rep_clients = $txt_div_descrepspeclis;
					$detail_rep_clients = $txt_div_detrepspeclis;
					if (!is_dir($rep_clients)) // Si le sous-répertoire spécifique aux clients n'existe pas, on le crée
					{
						$cree_rep=@mkdir($rep_clients);
						if ($cree_rep)
						{
							$rech = "INSERT INTO " .TBFIC;
							$rech .= " (fic_nom,fic_type,fic_desc,fic_detail,fic_datecrea,fic_codecrea,fic_nbtel) VALUES";
							$rech .= " ('$rep_clients','0','$desc_rep_clients','$detail_rep_clients','$datea','$admin_code','')";
							$rs = mysql_query($rech) or die(mysql_error());
						}
					}

					$rech = "SELECT * FROM `" .TBCLI. "` ORDER BY `cli_code`";
					$rs = mysql_query($rech) or die(mysql_error());
	
					echo "<span class=\"annot_gras_it\">";
					echo $txt_div_vreppcli;
					echo "</span>";
					echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";     
	
					// Création entête
					echo "<th>";
					echo "Code";
					echo "</th>";
					echo "<th>";
					echo $tab_ent_rphysask;
					echo "</th>";
					echo "<th>";
					echo $tab_ent_rmysqlask;
					echo "</th>";
					echo "<th>";
					echo $tab_ent_coheask;
					echo "</th>";
					if ($rep==TRUE)
					{
						echo "<th>";
						echo $tab_ent_repask;
						echo "</th>";
					}
	
					$i = 0;
	
					while ($row = mysql_fetch_assoc($rs)) 
					{         
						// Création de l'entête de ligne (TR)
						creetrlst($i);
				
						echo "<td align=\"center\">".$row["cli_code"]."</td>\n";
						$err=FALSE;
						$repphys=TRUE;
						$repsql=TRUE;
						$rep_ce_client = $rep_clients."/".strtolower($row["cli_code"]);

						// Répertoire physique ?
						echo "<td align=\"center\">";
						if (is_dir($rep_ce_client))
							echo $txt_div_oui;
						else
						{
							echo $txt_div_non;
							$err=TRUE;
							$repphys=FALSE;
						}
						echo "</td>\n";

						// Répertoire MySQL ?
						echo "<td align=\"center\">";
						$rech2 = "SELECT * FROM `" .TBFIC. "` WHERE `fic_nom`='".$rep_ce_client."'";
						$rs2 = mysql_query($rech2) or die(mysql_error());
						if (mysql_num_rows($rs2) <> 0)
							echo $txt_div_oui;
						else
						{
							echo $txt_div_non;
							$err=TRUE;
							$repsql=FALSE;
						}
						echo "</td>\n";
	
						echo "<td align=\"center\">";
						if ($err==TRUE)
						{
							$errglob=TRUE;
							echo "<span class=\"annot_gras_it\">";
							echo $txt_div_nook;
							echo "</span>";
						}
						else	
							echo $txt_div_ok;
						echo "</td>\n";

						if ($rep==TRUE)
						{
							echo "<td align=\"center\">";
							// On ne met à jour que si erreur
							if ($err==TRUE)
							{
								$msg="";
								if ($row["cli_ste"] <> "")
								{
									$desc_rep_ce_client = $txt_div_descrepspecli.$row["cli_ste"]." (".$row["cli_code"].")";
									$detail_rep_ce_client = $txt_div_detrepspecli.$row["cli_ste"]." (".$row["cli_code"].")";
								}
								else
								{
									$desc_rep_ce_client = $txt_div_descrepspecli.$row["cli_nom"]." ".$row["cli_prenom"]." (".$row["cli_code"].")";
									$detail_rep_ce_client = $txt_div_detrepspecli.$row["cli_nom"]." ".$row["cli_prenom"]." (".$row["cli_code"].")";
								}

								if ($repphys==FALSE)
								{
									$cree_rep=@mkdir($rep_ce_client);
									if ($cree_rep) // On crée sous-répertoire spécifique à ce client
										$msg = $txt_fiche_rphys_add;
									else
										$msg = $txt_fiche_rphys_addnotok;
								}
								
								if ($repsql==FALSE)
								{								
									// On ajoute le détail dans le fichier MySQL
									$rech = "INSERT INTO " .TBFIC;
									$rech .= " (fic_nom,fic_type,fic_desc,fic_detail,fic_datecrea,fic_codecrea,fic_nbtel) VALUES";
									$rech .= " ('$rep_ce_client','0','$desc_rep_ce_client','$detail_rep_ce_client','$datea','$admin_code','')";
									$rs = mysql_query($rech) or die(mysql_error());
									if ($msg<>"")
										$msg.="<br />".$txt_fiche_rmysql_add;
									else
										$msg.=$txt_fiche_rmysql_add;
								}			
								echo $txt_div_oui;
								echo "<span class=\"annot_petit_it\">";
								echo "<br>".$msg;
								echo "</span>";
							}
							else
								echo $txt_div_non;
							echo "</td>\n";
						}
						
						$i++;
					}
					
					echo "</table>";
					echo "<br>";
				}	
			}
			else
				echo "<br /><span class=\"annot_std_gras\">".$alert_nocli."</span><br />";
			break;

		// Contrats clients
		case "conc" :
			$rech = "SELECT * FROM `" .TBCOCL. "` ORDER BY `cocl_code`";
			$rs = mysql_query($rech) or die(mysql_error());
			if (mysql_num_rows($rs) <> 0)
			{
				// *** Vérification signatures & réceptions
				if (($tr==0) OR ($tr==1))
				{
					$rech = "SELECT * FROM `" .TBCOCL. "` ORDER BY `cocl_code`";
					$rs = mysql_query($rech) or die(mysql_error());
	
					echo "<span class=\"annot_gras_it\">";
					echo $txt_div_verifcocli;
					echo "</span>";
					echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";     
	
					// Création entête
					echo "<th>";
					echo "Code";
					echo "</th>";
					echo "<th>";
					echo "Type";
					echo "</th>";
					echo "<th>";
					echo $tab_ent_sigle;
					echo "</th>";
					echo "<th>";
					echo $tab_ent_recle;
					echo "</th>";
					echo "<th>";
					echo $tab_ent_closle;
					echo "</th>";
					echo "<th>";
					echo $tab_ent_coheask;
					echo "</th>";
					if ($rep==TRUE)
					{
						echo "<th>";
						echo $tab_ent_repask;
						echo "</th>";
					}
	
					$i = 0;
	
					while ($row = mysql_fetch_assoc($rs)) 
					{         
						// Création de l'entête de ligne (TR)
						creetrlst($i);
				
						echo "<td align=\"center\">".$row["cocl_code"]."</td>\n";
						echo "<td align=\"center\">";
						if ($row["cocl_typh"]==0)
							echo $txt_div_tpsint;
						else
							echo $txt_div_quoth;
						echo "</td>\n";
						echo "<td align=\"center\">";
						if (formatedate($row["cocl_datesig"])<>"")
							echo formatedate($row["cocl_datesig"]);
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						if (formatedate($row["cocl_daterec"])<>"")
							echo formatedate($row["cocl_daterec"]);
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						if (formatedate($row["cocl_datefin"])<>"")
							echo formatedate($row["cocl_datefin"]);
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						$datesig="";
						$daterec="";
						$signepar="";
						// Déjà utilisé dans une intervention ?
						$rech2 = "SELECT MIN(int_datedde) AS mindate FROM `" .TBINT. "` WHERE `int_codecocl`='".$row["cocl_code"]."'";
						$rs2 = mysql_query($rech2) or die(mysql_error());
						if (mysql_num_rows($rs2) <> 0)
						{
							if ($row2 = mysql_fetch_assoc($rs2)) 
							{
							}
						}
	
						$err=FALSE;
	
						// Il y a une date de signature ?
						// Non
						if (formatedate($row["cocl_datesig"])=="")
						{
							// Déjà reçu ?
							// Oui : pas ok
							if (formatedate($row["cocl_daterec"])<>"")
							{
								$err=TRUE;
								// MAJ possible uniquement si déjà utilisé
								if (formatedate($row2["mindate"])<>"")
								{
									$datesig=$row2["mindate"]; // Au moins la 1ère date d'intervention
									// La date de signature ne doit pas dépasser celle de réception
									if (echeance_depassee_date($datesig,$row["cocl_daterec"])==TRUE)
										$daterec=$datesig;
								}
							}
	
							// Déjà fini ?
							// Oui : pas ok
							if (formatedate($row["cocl_datefin"])<>"")
							{
								$err=TRUE;
								// Déjà reçu ?
								// Non : pas ok
								if (formatedate($row["cocl_daterec"])=="")
								{
									if (formatedate($row2["mindate"])<>"")
									{
										$datesig=$row2["mindate"]; // Au moins la 1ère date d'intervention
										$daterec=$row2["mindate"]; // Au moins la 1ère date d'intervention
									}
								}
								else
									$datesig=$row["cocl_daterec"]; // Au moins la date de réception
							}
						}
						else // Oui
						{
							// Déjà reçu ?
							// Non : pas ok si déjà utilisé
							if ((formatedate($row["cocl_daterec"])=="") AND (formatedate($row2["mindate"])<>""))
							{
								$err=TRUE;
								$daterec=$row2["mindate"]; // Au moins la 1ère date d'intervention
							}
						}
	
						// Si date signature modifiée ou date signature existante, on vérifie signataire
						if (($datesig<>"") OR (formatedate($row["cocl_datesig"])<>""))
						{
							// Signé par ?
							if (trim($row["cocl_signe"])=="") // Si pas signé, on prend au moins le contact principal
							{
								$err=TRUE;
								$rech3 = "SELECT * FROM `" .TBCLI. "` WHERE `cli_code`='".$row["cocl_codecli"]."'";
								$rs3 = mysql_query($rech3) or die(mysql_error());
								if (mysql_num_rows($rs3) <> 0)
								{
									if ($row3 = mysql_fetch_assoc($rs3)) 
									{
										$signepar = $row3["cli_civilite"]." ".$row3["cli_prenom"]." ".$row3["cli_nom"];
									}
								}
							}
						}
						if ($err==TRUE)
						{
							$errglob=TRUE;
							echo "<span class=\"annot_gras_it\">";
							echo $txt_div_nook;
							echo "</span>";
						}
						else	
							echo $txt_div_ok;
						echo "</td>\n";
						if ($rep==TRUE)
						{
							echo "<td align=\"center\">";
							// On ne met à jour que si erreur
							if ($err==TRUE)
							{
								$rech3 = "UPDATE `" .TBCOCL. "` SET";
								if ($datesig<>"")
									$rech3.=" `cocl_datesig`='".$datesig."'";
								if ($daterec<>"")
								{
									if ($datesig<>"")
										$rech3.=",";
									$rech3.=" `cocl_daterec`='".$daterec."'";
								}
								if ($signepar<>"")
								{
									if (($daterec<>"") OR ($datesig<>""))
										$rech3.=",";
									$rech3.=" `cocl_signe`='".$signepar."'";
								}
								$rech3.=" WHERE `cocl_code` = '".$row["cocl_code"]."'";
								$rs3 = mysql_query($rech3) or die(mysql_error());
								echo $txt_div_oui;
								echo "<span class=\"annot_petit_it\">";
								if ($datesig<>"")
									echo "<br />".$txt_div_sigau." ".formatedate($datesig);
								if ($daterec<>"")
									echo "<br />".$txt_div_recle." ".formatedate($daterec);
								if ($signepar<>"")
									echo "<br />".$txt_div_sigpar." ".$signepar;
								echo "</span>";
							}
							else
								echo $txt_div_non;
							echo "</td>\n";
						}
						
						$i++;
					}
					
					echo "</table>";
					echo "<br>";
				}	

				// *** Vérification sites couverts
				if (($tr==0) OR ($tr==2))
				{
					$rech = "SELECT * FROM `" .TBCOCL. "` ORDER BY `cocl_code`";
					$rs = mysql_query($rech) or die(mysql_error());
	
					echo "<span class=\"annot_gras_it\">";
					echo $txt_div_sitcouv;
					echo "</span>";
					echo "<table class=\"Mtable\" border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";     
	
					// Création entête
					echo "<th>";
					echo "Code";
					echo "</th>";
					echo "<th>";
					echo "Type";
					echo "</th>";
					echo "<th>";
					echo $tab_ent_sitprinc;
					echo "</th>";
					echo "<th>";
					echo $tab_ent_sitsecs;
					echo "</th>";
					echo "<th>";
					echo $tab_ent_coheask;
					echo "</th>";
					if ($rep==TRUE)
					{
						echo "<th>";
						echo $tab_ent_repask;
						echo "</th>";
					}
	
					$i = 0;
	
					while ($row = mysql_fetch_assoc($rs)) 
					{         
						// Création de l'entête de ligne (TR)
						creetrlst($i);
				
						echo "<td align=\"center\">".$row["cocl_code"]."</td>\n";
						echo "<td align=\"center\">";
						if ($row["cocl_typh"]==0)
							echo $txt_div_tpsint;
						else
							echo $txt_div_quoth;
						echo "</td>\n";
						echo "<td align=\"center\">";
						$sitep=TRUE;
						if ($row["cocl_sitep"]==1)
							echo $txt_div_oui;
						else
						{
							echo "-";
							$sitep=FALSE;
						}
						echo "</td>\n";
						echo "<td align=\"center\">";
						$sites=FALSE;
						// Sites secondaires
						$rech2 = "SELECT * FROM `" .TBSCLIC. "` WHERE `sclic_codecocl`='".$row["cocl_code"]."'";
						$rs2 = mysql_query($rech2) or die(mysql_error());
						if (mysql_num_rows($rs2) > 0)
						{
							$sites=TRUE;
							echo $txt_div_oui;
						}
						else
							echo "-";
						echo "</td>\n";
						echo "<td align=\"center\">";
						$err=FALSE;
						if (($sitep==FALSE) AND ($sites==FALSE))
							$err=TRUE;
						if ($err==TRUE)
						{
							$errglob=TRUE;
							echo "<span class=\"annot_gras_it\">";
							echo $txt_div_nook;
							echo "</span>";
						}
						else	
							echo $txt_div_ok;
						echo "</td>\n";
						if ($rep==TRUE)
						{
							echo "<td align=\"center\">";
							// "Pas ok"...on répare
							if ($err==TRUE)
							{
								$rech3 = "UPDATE `" .TBCOCL. "` SET";
								$rech3.=" `cocl_sitep`='1'";
								$rech3.=" WHERE `cocl_code` = '".$row["cocl_code"]."'";
								$rs3 = mysql_query($rech3) or die(mysql_error());
								echo $txt_div_oui;
								echo "<span class=\"annot_petit_it\">";
								echo "<br />".$txt_div_sitpadd;
								echo "</span>";
							}
							else
								echo $txt_div_non;
							echo "</td>\n";
						}
						
						$i++;
					}
					
					echo "</table>";
					echo "<br>";
				}
			}
			else
				echo "<br /><span class=\"annot_std_gras\">".$alert_nococl."</span><br />";
		break;

		case "int" :
			$rech = "SELECT * FROM `" .TBITN. "` ORDER BY `int_code`";
			$rs = mysql_query($rech) or die(mysql_error());
			if (mysql_num_rows($rs) <> 0)
			{
			}
			else
				echo "<br /><span class=\"annot_std_gras\">".$alert_noint."</span><br />";
			break;
	}
	mysql_free_result($rs);
	mysql_close($conn);
	if (($rep==FALSE) AND ($errglob==TRUE))
	{
	?>
	<div align="center">
	<input name="repar" type="button" class="bton_std" id="repar" value="<?PHP echo $but_rep; ?>" onClick="javascript:; window.self.location.href=('maint_data.php?td=<?PHP echo $type; ?>&tr=<?PHP echo $tr; ?>&rep=Y');">
	</div>
<?PHP
	}
}
else
{
?>
	<script type="text/javascript">
	<!--
	setTimeout("self.location.href=('index.php');",2000)
	//-->
	</script>
	<p align="center" class="annot_std_it"><?PHP echo $alert_prm; ?></p>
<?php 
}
include_once("pied.php");
?>
