1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
|
<?php require_once('Connections/depalcement.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
$PPRV_Recordset1 = "-1";
if (isset($_POST['PPRV'])) {
$PPRV_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['PPRV'] : addslashes($_POST['PPRV']);
}
mysql_select_db($database_depalcement, $depalcement);
$query_Recordset1 = sprintf("SELECT * FROM agent WHERE ppr=%s", GetSQLValueString($PPRV_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $depalcement) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$colname_Recordset2 = "-1";
if (isset($_POST['PPRV'])) {
$colname_Recordset2 = (get_magic_quotes_gpc()) ? $_POST['PPRV'] : addslashes($_POST['PPRV']);
}
mysql_select_db($database_depalcement, $depalcement);
$query_Recordset2 = sprintf("SELECT *, taux(retour, depart) as taux, cast(tarif(retour, depart, groupe) as decimal(15,2)) as tarif FROM a WHERE ppr_ag=%s ", GetSQLValueString($colname_Recordset2, "text"));
$Recordset2 = mysql_query($query_Recordset2, $depalcement) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
mysql_select_db($database_depalcement, $depalcement);
$query_Recordset3 = "SELECT * ,taux(retour, depart) as taux,(case groupe when 'Groupe1' then cast( tarif(retour, depart,'Groupe1') as decimal(15,2)) when 'Groupe2' then cast(tarif(retour, depart,'Groupe2') as decimal(15,2)) when 'Groupe3' then cast(tarif(retour, depart,'Groupe3') as decimal(15,2)) when' Groupe4' then cast(tarif(retour, depart,'Groupe4') as decimal(15,2)) else cast(tarif(retour, depart,'Groupe5') as decimal(15,2)) end ) as tarif FROM a";
$Recordset3 = mysql_query($query_Recordset3, $depalcement) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
mysql_select_db($database_depalcement, $depalcement);
$query_ville = "SELECT * FROM ville ORDER BY ville";
$ville = mysql_query($query_ville, $depalcement) or die(mysql_error());
$row_ville = mysql_fetch_assoc($ville);
$totalRows_ville = mysql_num_rows($ville);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Traitement des Déplacements</title>
<link rel="icon" type="image/png" href="log1.png" />
</head>
<body>
<table width="1002" height="122" align="center">
<tr>
<td width="514" height="155" valign="top"><img src="images.jpg" width="227" height="103" /><span class="Style10">Traitement des déplacements </span></td>
<td width="444" align="center" valign="top"><p class="Style11"> </p>
</td>
</tr>
</table>
<form id="form1" name="form1" method="POST" action="index.php">
<label for="textfield"></label>
<table width="999" align="center">
<tr>
<td align="center"><p align="center">Entrer CNT N°:
<input name="PPRV" type="text" id="PPRV" />
<input type="submit" name="Submit2" value="Chercher" id="label7" />
<label for="Submit"></label>
<input name="Submit" type="button" id="Submit" onclick="flvFPW1('Ajout-ag.php','popupLink','width=50%,height=35%,status=yes',1,2,2);return document.MM_returnValue" value="Ajouter Agent" />
<input name="Submit3" type="button" id="label8" onclick="montre('dep_ajoout');" value="Ajouter Déplacement" />
</p>
<p align="center" >*</p>
<p>
<label for="label7"></label>
CNT N°
<label for="textfield"></label>
:
<input name="textfield" type="text" id="textfield" readonly="readonly" value="<?php echo $row_Recordset1['ppr']; ?>" />
Nom
:
<input name="textfield2" type="text" id="textfield2" readonly="readonly"value="<?php echo $row_Recordset1['nom']; ?>" />
Prenom
<label for="label8"></label>
:
<input name="textfield3" type="text" id="textfield3" readonly="readonly" value="<?php echo $row_Recordset1['prenom']; ?>" />
<label for="label"></label>
<p>
Grade
:
<input name="textfield6" type="text" id="lextefield6" readonly="readonly" value="<?php echo $row_Recordset1['grade']; ?>" size="60" />
Groupe :
<label for="label5"></label>
<input name="textfield5" type="text" id="label5" readonly="readonly" value="<?php echo $row_Recordset1['groupe']; ?>" />
<table width="853" id="table-1" "align="center">
<tr align="center" valign="middle" bgcolor="#D7E6FF">
<td width="132" nowrap="nowrap"><strong>Date/Heure Départ </strong></td>
<td width="129" nowrap="nowrap"><strong>Date/Heure Retour</strong></td>
<td width="163" nowrap="nowrap"><strong>Objet Déplacement </strong></td>
<td width="144" nowrap="nowrap"><strong>Lieu</strong></td>
<td width="117" nowrap="nowrap"><strong>Nombre Taux </strong></td>
<td width="115" nowrap="nowrap"><strong>Sommes Dues </strong></td>
<td width="21" nowrap="nowrap"> </td>
</tr>
<?php do { ?>
<tr>
<td align="center" nowrap="nowrap"><?php echo $row_Recordset2['depart']; ?></td>
<td align="center" valign="middle" nowrap="nowrap"><?php echo $row_Recordset2['retour']; ?></td>
<td width="163" align="left"> <?php echo wordwrap($row_Recordset2['objet'], 100, "<br />\n"); ?></td>
<td align="center" valign="middle"><?php echo $row_Recordset2['ville_dep'];?>-<?php echo $row_Recordset2['ville_ret']; ?></td>
<td align="center" valign="middle"><?php echo $row_Recordset2['taux']; ?></td>
<td align="center" valign="middle"><?php echo $row_Recordset2['tarif']; ?></td>
<td align="center" valign="middle"> </td>
</tr>
<?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
</table> </tr>
<tr> </tr>
</table>
</form>
<form id="form2" name="form2" method="POST" action="index.php">
<fieldset id="dep_ajoout" style="visibility:hidden;" legend="Deplacement">
<table width="783" height="55" align="center">
<tr align="center" valign="middle">
<td width="775">
<table width="665">
<tr>
<td width="169" align="right">Date départ :</td>
<td width="188"><input type="texte" name="datdeb" readonly="readonly"class="calendrier" id="label3" /></td>
<td width="100">Heure départ :
<label for="label10"></label></td>
<td width="188"><input type="time" name="heuredep" id="label" /></td>
</tr>
<tr>
<td align="right">Date retour :</td>
<td><input type="texte" name="datfin" id="label4" readonly="readonly"class="calendrier" /></td>
<td>Heure retour :</td>
<td><input type="time" name="heurer" id="label2" /></td>
</tr>
<tr>
<td align="right"> Ville départ : </td>
<td><label for="select"></label>
<select name="v_depart" id="v_depart">
<option value="0">Choisir une Ville</option>
<?php
do {
?>
<option value="<?php echo $row_ville['ville']?>"><?php echo $row_ville['ville']?></option>
<?php
} while ($row_ville = mysql_fetch_assoc($ville));
$rows = mysql_num_rows($ville);
if($rows > 0) {
mysql_data_seek($ville, 0);
$row_ville = mysql_fetch_assoc($ville);
}
?>
</select></td>
<td>Ville retour : </td>
<td><label for="label6"></label>
<select name="v_retour" id="label6">
<option value="0">Choisir une Ville</option>
<?php
do {
?>
<option value="<?php echo $row_ville['ville']?>"><?php echo $row_ville['ville']?></option>
<?php
} while ($row_ville = mysql_fetch_assoc($ville));
$rows = mysql_num_rows($ville);
if($rows > 0) {
mysql_data_seek($ville, 0);
$row_ville = mysql_fetch_assoc($ville);
}
?>
</select> <label for="label10"></label></td>
</tr>
<tr>
<td align="right">Objet de déplacement : </td>
<td colspan="3"><textarea name="objet" cols="60" rows="3" id="label9"></textarea></td>
</tr>
<tr>
<td align="right"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td><input name="Valider" type="submit" id="Valider" onclick="YY_checkform('form2','v_depart','#q','1','Choisir une ville départ !!!!','label6','#q','1','choisir une ville retour !!!!','label9','20','1','Objet Obligatoire !!!!');return document.MM_returnValue" value="Enregistrer" /></td>
<td> </td>
<td><input name="Annuler" type="button" id="Annuler" onclick="MM_goToURL('parent','index.php');return document.MM_returnValue" value="Annuler" /></td>
</tr>
</table>
<input name="PPR" type="hidden" id="PPR" value="<?php echo $row_Recordset1['ppr']; ?>" />
</p></td>
</tr>
</table>
<?php
// $NbrLigne : le nombre de lignes
// $NbrCol : calcul automatique
// --------------------------------
// (exemple)
//$NbrLigne = 4;
// La requete (exemple) : toutes les "CHOSE" commençant par un "b", classées par ordre alphabétique.
//*******************************Debut*****************************
//On traite le formulaire
if(isset($_POST['Valider'])){
$critere=$_POST['datdeb'];
$criteres=$_POST['datfin'];
$c_tribun=$_POST['PPR'];
$ville=$_POST['v_depart'];
$ville1=$_POST['v_retour'];
$hdep=$_POST['heuredep'];
$hret=$_POST['heurer'];
$lieu=mysql_real_escape_string(htmlspecialchars($_POST['objet']));
// On prépare la requête
//requête différente selon qu'on veut tout le champ
//ou un champ avec une condition
$query = 'SELECT * FROM a WHERE ppr_ag = "'.$c_tribun.'" and STR_TO_DATE("'.$critere.'","%d/%m/%Y")<= dat_fin and STR_TO_DATE("'.$criteres.'","%d/%m/%Y")>= dat_deb' ;
/* On lance la requête (mysql_query) et on impose un message d'erreur si la requête ne passe pas (or die)*/
$result = mysql_query($query) or die('Erreur SQL !<br />'.$query.'<br />'.mysql_error());
//********************************************END******************
//$query = "SELECT * FROM dossier ORDER BY N_dossier ASC;";
//$result = mysql_query($query);
// --------------------------------
// nombre de cellules a remplir
$NbrLigne = mysql_num_rows($result);
// affichage
$dat1=$_POST['datdeb'];
$dat2=$_POST['datfin'];
var_dump($dat1,$dat2);
if ($NbrLigne == 0) {
// on écrit la requête sql
$sql1 = "INSERT INTO deplacement_ag (n_dep, ppr_ag, dat_deb,heuredep,dat_fin,heurer,ville_dep,ville_ret,objet) VALUES('','$c_tribun',STR_TO_DATE('$critere','%d/%m/%Y'),'$hdep',STR_TO_DATE('$criteres','%d/%m/%Y'),'$hret','$ville','$ville1','$lieu')";
// on insère les informations du formulaire dans la table
mysql_query($sql1) or die('Erreur SQL !'.$sql1.'<br>'.mysql_error());
$delai=1;
$url='index.php';
header("Refresh: $delai;url=$url");
?>
<script language="javascript">
alert (" la période est prise en charge avec succès !!!!!!");
</script>
<?php
}
else {
?>
<script language="javascript">
alert ("cette Période est déjà prise en charge!!Prière de choisir une autre période");
</script>
<?php
}
}
?>
</fieldset>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
mysql_free_result($Recordset3);
?> |
Partager