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

Copyright (C) 2006  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
****************************************************************************************/

session_start(); 
?>
<?php if ((@$HTTP_SESSION_VARS["etat_log"] <> "connecte") or ((@$HTTP_SESSION_VARS["niv_log"] <> 9) AND (@$HTTP_SESSION_VARS["niv_log"] <> 5))) header("Location: ../index.php") ?>
<?php include ("../inc/config.inc.php") ?>
<?php include ("../inc/func.inc.php") ?>
<?php include ("../inc/func_log.inc.php") ?>
<?php include ("../inc/fic.inc.php") ?>
<?PHP
	Archivelog(@$HTTP_SESSION_VARS["code_log"]);
?>
<?php
	$conn2 = mysql_connect(DBHOST, DBUSER, DBPASS);
	mysql_select_db(DBNAME);
	$rcons = "SELECT * FROM " .TBCONS;
	$rscons = mysql_query($rcons) or die(mysql_error());
	if (mysql_num_rows($rscons) == 1) // Uniquement UN SEUL enregistrement !
	{
		 while ($rowcons = mysql_fetch_array($rscons)) 
		{
			extract ($rowcons);
		}
	
		mysql_free_result($rscons);
		mysql_close($conn2);  
	}
?>

<!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 - ESPACE PRIVE : Pr&eacute;avis &amp; num&eacute;rotations</title>

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

<!-- Feuille de style & Script pour le menu -->
<link href="../inc/menu.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../coolmenus/coolmenus4.js"></script>

<!-- Scripts Javascript pour affichages -->
<script language="JavaScript" src="../inc/aff.js"></script>

<!-- Scripts Javascript pour validation des formulaires -->
<script language="JavaScript" src="../inc/validator.js"></script>

</head>
<body>

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

<p align="center"><span class="titrepage">PREAVIS &amp; NUMEROTATIONS</span></p>
<p align="center" class="annot_gras_it">&nbsp;</p>
<form name="num_maj" method="post" action="num_enr.php" onsubmit="return v.exec()">
  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><div align="center"><span class="annot_gras_it">Veuillez saisir le minimum et le maximum (en jours) pour les pr&eacute;avis de relance sur les contrats </span></div></td>
    </tr>
    <tr>
      <td class="annot_petit_it"><div align="center">Minimum = nombre de jours &agrave; partir desquels on peut commencer &agrave; relancer.<br>
      Maximum = nombre de jours &agrave; partir desquels on ne peut plus relancer. </div></td>
    </tr>
    <tr>
      <td  class="tfvNormal" id="f_relmin">Minimum (en jours) pour les pr&eacute;avis </td>
    </tr>
    <tr>
      <td><div align="center">
        <input name="relmin" type="text" id="relmin" value="<?PHP echo $cons_relmin ?>" size="10" maxlength="10">
      </div></td>
    </tr>
    <tr>
      <td class="tfvNormal" id="f_relmax">Maximum (en jours) pour les pr&eacute;avis </td>
    </tr>
    <tr>
      <td><div align="center">
        <input name="relmax" type="text" id="relmax" value="<?PHP echo $cons_relmax ?>" size="10" maxlength="10">
      </div></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <table width="100%"  border="0">
    <tr>
      <td colspan="2" align="center">
	  
	  <span class="annot_gras_it">Veuillez saisir le radical et le num&eacute;ro pour chaque type de num&eacute;rotation</span>
	  <br>
	  <span class="annot_petit_it">(Il n'est pas possible de modifier un num&eacute;ro sur un type s'il y a d&eacute;j&agrave; eu des saisies effectu&eacute;es sur ce type) </span></td>
    </tr>
    <tr>
      <td width="50%">&nbsp;</td>
      <td width="50%">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_ntec">Type de num&eacute;rotation pour les techniciens</td>
    </tr>
    <tr>
      <td align="right">
        <input name="rtec" type="text" id="rtec" value="<?PHP echo $cons_rtec ?>" size="10" maxlength="10">
      </td>
      <td>
	  <?PHP
	  	if (nb_tec("") == 0)
		{
	  ?>
			<input name="ntec" type="text" id="ntec" value="<?PHP echo $cons_ntec ?>" size="10" maxlength="10">
	  <?PHP
	  	}
		else
		{
	  ?>
			<input name="ntec" type="text" id="ntec" value="<?PHP echo $cons_ntec ?>" size="10" maxlength="10" readonly="1">
	  <?PHP
		}
	  ?>
	  </td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_ncli">Type de num&eacute;rotation pour les clients</td>
    </tr>
    <tr>
      <td align="right">
        <input name="rcli" type="text" id="rcli" value="<?PHP echo $cons_rcli ?>" size="10" maxlength="10">
      </td>
      <td>
	  <?PHP
	  	if (nb_cli("") == 0)
		{
	  ?>
			<input name="ncli" type="text" id="ncli" value="<?PHP echo $cons_ncli ?>" size="10">
	  <?PHP
	  	}
		else
		{
	  ?>
			<input name="ncli" type="text" id="ncli" value="<?PHP echo $cons_ncli ?>" size="10" readonly="1">
	  <?PHP
		}
	  ?>
	</td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_nint">Type de num&eacute;rotation pour les interventions</td>
    </tr>
    <tr>
      <td align="right">
        <input name="rint" type="text" id="rint" value="<?PHP echo $cons_rint ?>" size="10" maxlength="10">
      </td>
      <td>
	  <?PHP
	  	if (nb_int("") == 0)
		{
	  ?>
			<input name="nint" type="text" id="nint" value="<?PHP echo $cons_nint ?>" size="10" maxlength="10">
	  <?PHP
	  	}
		else
		{
	  ?>
			<input name="nint" type="text" id="nint" value="<?PHP echo $cons_nint ?>" size="10" maxlength="10" readonly="1">
	  <?PHP
		}
	  ?>
	  </td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_nope">Type de num&eacute;rotation pour les op&eacute;rateurs t&eacute;l&eacute;phoniques </td>
    </tr>
    <tr>
      <td align="right">
        <input name="rope" type="text" id="rope" value="<?PHP echo $cons_rope ?>" size="10" maxlength="10">
      </td>
      <td>
	  <?PHP
	  	if (nb_ope() == 0)
		{
	  ?>
			<input name="nope" type="text" id="nope" value="<?PHP echo $cons_nope ?>" size="10" maxlength="10">
	  <?PHP
	  	}
		else
		{
	  ?>
			<input name="nope" type="text" id="nope" value="<?PHP echo $cons_nope ?>" size="10" maxlength="10" readonly="1">
	  <?PHP
		}
	  ?>
		</td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_ncon">Type de num&eacute;rotation pour les contrats</td>
    </tr>
    <tr>
      <td align="right">
        <input name="rcon" type="text" id="rcon" value="<?PHP echo $cons_rcon ?>" size="10" maxlength="10">
      </td>
      <td>
	  <?PHP
	  	if (nb_cocl("") == 0)
		{
	  ?>
			<input name="ncon" type="text" id="ncon" value="<?PHP echo $cons_ncon ?>" size="10" maxlength="10">
	  <?PHP
	  	}
		else
		{
	  ?>
			<input name="ncon" type="text" id="ncon" value="<?PHP echo $cons_ncon ?>" size="10" maxlength="10" readonly="1">
	  <?PHP
		}
	  ?>
	  </td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_ncon">Type de num&eacute;rotation pour les certificats de destruction </td>
    </tr>
    <tr>
      <td align="right">
        <input name="rcer" type="text" id="rcer" value="<?PHP echo $cons_rcer ?>" size="10" maxlength="10">
      </td>
      <td><input name="ncer" type="text" id="ncer" value="<?PHP echo $cons_ncer ?>" size="10" maxlength="10"></td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_ndde">Type de num&eacute;rotation pour les demandes </td>
    </tr>
    <tr>
      <td align="right">
        <input name="rdde" type="text" id="rdde" value="<?PHP echo $cons_rdde ?>" size="10" maxlength="10">
      </td>
      <td>
	  <?PHP
	  	if (nb_dde() == 0)
		{
	  ?>
			<input name="ndde" type="text" id="ndde" value="<?PHP echo $cons_ndde ?>" size="10" maxlength="10">
	  <?PHP
	  	}
		else
		{
	  ?>
			<input name="ndde" type="text" id="ndde" value="<?PHP echo $cons_ndde ?>" size="10" maxlength="10" readonly="1">
	  <?PHP
		}
	  ?>
	  </td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_nrel">Type de num&eacute;rotation pour les dossiers de relev&eacute;s</td>
    </tr>
    <tr>
      <td align="right">
        <input name="rrel" type="text" id="rrel" value="<?PHP echo $cons_rrel ?>" size="10" maxlength="10">
      </td>
      <td>
	  <?PHP
	  	if (nb_rela("") == 0)
		{
	  ?>
			<input name="nrel" type="text" id="nrel" value="<?PHP echo $cons_nrel ?>" size="10" maxlength="10">
	  <?PHP
	  	}
		else
		{
	  ?>
			<input name="nrel" type="text" id="nrel" value="<?PHP echo $cons_nrel ?>" size="10" maxlength="10" readonly="1">
	  <?PHP
		}
	  ?>
	  </td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_nrlic">Type de num&eacute;rotation pour les relev&eacute;s de licences </td>
    </tr>
    <tr>
      <td align="right">
        <input name="rrlic" type="text" id="rrlic" value="<?PHP echo $cons_rrlic ?>" size="10" maxlength="10">
      </td>
      <td>
	  <?PHP
	  	if (nb_rlica("") == 0)
		{
	  ?>
			<input name="nrlic" type="text" id="nrlic" value="<?PHP echo $cons_nrlic ?>" size="10" maxlength="10">
	  <?PHP
	  	}
		else
		{
	  ?>
			<input name="nrlic" type="text" id="nrlic" value="<?PHP echo $cons_nrlic ?>" size="10" maxlength="10">
	  <?PHP
		}
	  ?>
	  </td>
    </tr>
    <tr>
      <td colspan="2" class="tfvNormal" id="f_nrpdt">Type de num&eacute;rotation pour les relev&eacute;s de mat&eacute;riels </td>
    </tr>
    <tr>
      <td align="right">
        <input name="rrpdt" type="text" id="rrpdt" value="<?PHP echo $cons_rrpdt ?>" size="10" maxlength="10">
      </td>
      <td>
	  <?PHP
	  	if (nb_rpdta("") == 0)
		{
	  ?>
			<input name="nrpdt" type="text" id="nrpdt" value="<?PHP echo $cons_nrpdt ?>" size="10" maxlength="10">
	  <?PHP
	  	}
		else
		{
	  ?>
			<input name="nrpdt" type="text" id="nrpdt" value="<?PHP echo $cons_nrpdt ?>" size="10" maxlength="10" readonly="1">
	  <?PHP
		}
	  ?>
	  </td>
    </tr>
  </table>
  <p align="center">
    <input name="RAZ" type="reset" id="RAZ" value="R&eacute;initialiser">
    <input name="submit" type="submit" id="submit" value="Enregistrer">
  </p>
</form>

<script>
// form fields description structure
var a_fields = {
	'rtec':{'l':'Numérotation Techniciens','r':true,'f':'alphanum','t':'f_ntec','mx':10},
	'relmin':{'l':'Minimum pour les préavis','r':true,'f':'unsigned','t':'f_relmin','mx':10},
	'relmax':{'l':'Maximum pour les préavis','r':true,'f':'unsigned','t':'f_relmax','mx':10},
	'ntec':{'l':'Numérotation Techniciens','r':true,'f':'unsigned','t':'f_ntec','mx':10},
	'rcli':{'l':'Numérotation Clients','r':true,'f':'alphanum','t':'f_ncli','mx':10},
	'ncli':{'l':'Numérotation Clients','r':true,'f':'unsigned','t':'f_ncli','mx':10},
	'rint':{'l':'Numérotation Interventions','r':true,'f':'alphanum','t':'f_nint','mx':10},
	'nint':{'l':'Numérotation Interventions','r':true,'f':'unsigned','t':'f_nint','mx':10},
	'rope':{'l':'Numérotation Opérateurs','r':true,'f':'alphanum','t':'f_nope','mx':10},
	'nope':{'l':'Numérotation Opérateurs','r':true,'f':'unsigned','t':'f_nope','mx':10},
	'rcon':{'l':'Numérotation Contrats','r':true,'f':'alphanum','t':'f_ncon','mx':10},
	'ncon':{'l':'Numérotation Contrats','r':true,'f':'unsigned','t':'f_ncon','mx':10},
	'rdde':{'l':'Numérotation Demandes','r':true,'f':'alphanum','t':'f_ndde','mx':10},
	'ndde':{'l':'Numérotation Demandes','r':true,'f':'unsigned','t':'f_ndde','mx':10},
	'rrel':{'l':'Numérotation Dossiers Relevés','r':true,'f':'alphanum','t':'f_nrel','mx':10},
	'nrel':{'l':'Numérotation Dossiers Relevés','r':true,'f':'unsigned','t':'f_nrel','mx':10}
	'rrlic':{'l':'Numérotation Relevés Licences','r':true,'f':'alphanum','t':'f_nrlic','mx':10},
	'nrlic':{'l':'Numérotation Relevés Licences','r':true,'f':'unsigned','t':'f_nrlic','mx':10}
	'rrpdt':{'l':'Numérotation Relevés Machines','r':true,'f':'alphanum','t':'f_nrpdt','mx':10},
	'nrpdt':{'l':'Numérotation Relevés Machines','r':true,'f':'unsigned','t':'f_nrpdt','mx':10}
},

o_config = {
	'to_disable' : ['submit', 'RAZ'],
	'alert' : 1
}

// validator constructor call
var v = new validator('num_maj', a_fields, o_config);
</script>

<?php 
	include_once ("pied.php")
?>
