par
Michel6359 » 27 sept. 2013, 18:56
Bonsoir
Merci pour ton aide , mais alors là je vois du tout ou et cette ligne ou un fichier ?
<?php
//------------------------------------------------------------------------ GESTION DES ETAT DES PRETS MATERIELS - ACTION 11 ---------------------------------------------//
if($_GET['action'] == 11 ){ /// ACTION 11 - GESTION DES ETAT DES PRETS MATERIELS - //
echo '<h3 class="tit">Messages Systèmes</h3>
<p class="msg done">Vous êtes sur les Etats des Prêts Matériels</p>';
$db = mysql_connect('localhost', 'iden, 'pass);
mysql_select_db('michelte_Gestion_Materiels', $db);
mysql_query("SET NAMES UTF8");
$sql = "SELECT *,DATE_FORMAT(date_affiche, '%d/%m/%Y %Hh:%i' ) AS 'datef',DATE_FORMAT(date_sortie, '%d/%m/%Y' ) AS 'date_de_sortie' FROM materiels3 WHERE disponibilite >= 2 ORDER BY designation"; // ON RECHERCHE LE MATERIEL EN DISPONIBILITE = 2 DONC SUR CHANTIER //
$datedujour = date('Y/m/d') ;
echo '<form action="accueil.php?action=11" method="post">';
$req = mysql_query($sql) or die (mysql_error());
mysql_query("SET NAMES UTF8");
mysql_query("'encoding' => 'utf8'");
echo '<table width="100%" border="1" cellspacing="0" cellpadding="0" id="menuTable" class="display">';
echo '<thead><tr>';
echo '<th style="color:#046380;text-align:center;"><strong>Mise à jour</strong>
</th>
<th style="color:#046380; text-align:center;">Designation du Matériel</th>
<th style="color:#046380; text-align:center;">Identification</th>
<th style="color:#046380; text-align:center;">Etat</th>
<th style="color:#046380; text-align:center;">Disponibilité</th>
<th style="color:#046380; text-align:center;">Attribution</th>
<th style="color:#B9121B; text-align:center;">Chantier</th>
<th style="color:#B9121B; text-align:center;">Date de Sortie</th>
<th style="color:#B9121B; text-align:center;">Prêt/J</th>
<th style="color:#B9121B; text-align:center;">Action</th>
<th style="color:#B9121B; text-align:center;">R</th>
</tr></thead>';
echo '<tbody>';
while ($datas = mysql_fetch_assoc($req)) {
mysql_query("SET NAMES UTF8");
mysql_query("'encoding' => 'utf8'");
echo '<tr>';
?>
<td width="9%" class="rouge" id="datef-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'datef', 'texte')">
<?php echo $datas['datef']?></td>
<td class="noir" id="designation-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'designation', 'texte')">
<?php echo $datas['designation']?></td>
<td class="vert" id="reference-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'reference', 'texte')">
<?php echo $datas['reference']?></td>
<td class="vert">
<?php
if( $datas['etat'] == 0 ) // CONFORME //
{ echo '<img name="ok" src="png/ok.png" width="40" height="40" alt="" /> </td>';
}
if( $datas['etat'] == 1 ) { // NON CONFORME //
echo '<img name="ok" src="png/attention1.png" width="40" height="40" alt="" /></td>';
}
if( $datas['etat'] == 5 ) { // CONTROLE A - 30 JOURS //
echo '<img name="ok" src="png/J30.png" width="40" height="40" alt="" /></td>';
}
if( $datas['etat'] == 3 ) { // HORS SERVICE //
echo '<img name="ok" src="png/hors_service.png" width="40" height="40" alt="" /></td>';
}
if( $datas['etat'] == 2 ) { // EN REPARATION //
echo '<img name="ok" src="png/reparation (1).png" width="50" height="50" alt="" /></td>';
}
?>
<?php // if( $datas['disponibilite'] ==2) { // PRET INFERIEUR A 60 JOURS TEXTE NOIR // ?>
<td class="vert" id="disponibilite-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'disponibilite', 'texte')">
<?php echo $datas['disponibilite']?></td>
<?php //} // FERME CONDITION ?>
<?php // if( $datas['disponibilite'] ==3) { // PRET SUPERIEUR A 60 JOURS TEXTE ROUGE // ?>
<?php // } // FERME CONDITION ?>
<td width="8%" class="noir" id="nom_retrait-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'nom_retrait', 'texte')">
<?php echo $datas['nom_retrait']?></td>
<td class="noir" id="chantier-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'chantier', 'texte')">
<?php echo $datas['chantier']?></td>
<td class="vert" id="date_sortie-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'date_sortie', 'texte')">
<?php echo $datas['date_de_sortie']?></td>
<?php
$date_pret = $datas['date_sortie']; // Date de sortie format français >> 00/00/0000 //
// $date_sortie = date('Y-m-d', strtotime($date_pret)); // On met la date au format anglais pour calcul //
$datedujour = date('Y-m-d') ; // Date du jour //
$nbjours = floor((strtotime($datedujour) - strtotime($date_pret)+60*60*1)/(60*60*24));
$dispo = $datas['disponibilite'];
if ($dispo = '0' ){
$id = $datas['id'];
mysql_query("UPDATE materiels3 SET date_sortie='0000-00-00 00:00:00' WHERE id='$id' LIMIT 1");
}
?>
<?php if( $nbjours < 60 ) { // PRET INFERIEUR A 60 JOURS TEXTE NOIR // ?>
<td class="noir"><center><?php echo $nbjours; ?></td>
<?php } // FERME CONDITION ?>
<?php if( $nbjours > 60 ) { // PRET SUPERIEUR A 60 JOURS TEXTE ROUGE // ?>
<td class="rouge"><center><?php echo $nbjours; ?></td>
<?php } // FERME CONDITION ?>
<td width="6%" class="noir">
<a href="javascript:BRB_PHP_DelWithCon('Ajout_Materiels/sortie.php','id',<?php echo $datas['id']; ?>,'Vous allez modifier une fiche Matériels ? ');"><img name="supprimer" src="images/fleche10.png" width="20" height="20" alt="" /></a>
<a href="javascript:BRB_PHP_DelWithCon('Fonction_php/pointage-retour2.php','id',<?php echo $datas['id']; ?>,'Voulez-vous saisir le pointage du retour de ce Matériel ? ');"><img name="Retour Matériels" src="images/retour.png" width="20" height="20" alt="" /></a>
<a href="javascript:BRB_PHP_DelWithCon('Fonction_php/Supprimer2.php','id',<?php echo $datas['id']; ?>,'Êtes-vous sûr de vouloir supprimer la fiche Matériel ? ');"><img name="supprimer" src="images/file_delete.png" width="17" height="17" alt="" /></a>
</td>
<td width="1%" class="noir">
<?php
echo '<input type="checkbox" name="check[]" value="'. $datas['id'].' "/>';
?>
</td>
<?php
echo '</tr>';
}
echo '</tbody>';
echo '<tfoot><tr><th colspan="12"> </th></tr></tfoot>';
echo '</table>';
echo '<table><tr><td><input name="Update" value="Valider les Retours Matériels" type="submit" /></form></td></tr></table>';
mysql_free_result($req);
// ENREGISTREMENT ARCHIVE //
//parcours du array des ids reçus
if (isset($_POST['Update'])) {
$id = implode(',', $_POST['check']); // On cherche les boites cocher //
//var_dump($_POST['check']); // test //
foreach($_POST['check'] as $val) {
$list_retour = mysql_query("SELECT id,designation,reference,date_sortie,nom_retrait,chantier FROM materiels3 WHERE id='$val' LIMIT 1");
$materiel_retour = mysql_fetch_array($list_retour);
// VARIABLES //
$designation = $materiel_retour[1];
$reference = $materiel_retour[2];
$date_sortie = $materiel_retour[3];
$nom_retrait = $materiel_retour[4];
$chantier = $materiel_retour[5];
$date_retour = date('Y/m/d') ; // date du jour du retour Matériel //
$insertSql= "INSERT INTO Archive_sortie VALUES('',now(),'$designation','$reference','$date_sortie','$nom_retrait','$chantier','$date_retour')";
$result2=mysql_query($insertSql);
} // ferme foreach //
} // condition //
if (isset($_POST['Update'])) {
$id = implode(',', $_POST['check']);
$sql = "UPDATE materiels3 SET disponibilite='',chantier='',nom_retrait='',date_sortie='' WHERE id IN (".$id.")";
$result=mysql_query($sql);
//en cas d'échec de la mise à jour, on affiche le message d'erreur
if (!$result) {
echo "erreur sql liée à la mise à jour:\n" ;
die( mysql_error());
}
}
mysql_close(); // FERME LA BDD //
} // ON FERME GESTION DES ETATS DES PRETS MATERIELS - ACTION 11 //
?>
Bonsoir
Merci pour ton aide , mais alors là je vois du tout ou et cette ligne ou un fichier ?
[php]
<?php
//------------------------------------------------------------------------ GESTION DES ETAT DES PRETS MATERIELS - ACTION 11 ---------------------------------------------//
if($_GET['action'] == 11 ){ /// ACTION 11 - GESTION DES ETAT DES PRETS MATERIELS - //
echo '<h3 class="tit">Messages Systèmes</h3>
<p class="msg done">Vous êtes sur les Etats des Prêts Matériels</p>';
$db = mysql_connect('localhost', 'iden, 'pass);
mysql_select_db('michelte_Gestion_Materiels', $db);
mysql_query("SET NAMES UTF8");
$sql = "SELECT *,DATE_FORMAT(date_affiche, '%d/%m/%Y %Hh:%i' ) AS 'datef',DATE_FORMAT(date_sortie, '%d/%m/%Y' ) AS 'date_de_sortie' FROM materiels3 WHERE disponibilite >= 2 ORDER BY designation"; // ON RECHERCHE LE MATERIEL EN DISPONIBILITE = 2 DONC SUR CHANTIER //
$datedujour = date('Y/m/d') ;
echo '<form action="accueil.php?action=11" method="post">';
$req = mysql_query($sql) or die (mysql_error());
mysql_query("SET NAMES UTF8");
mysql_query("'encoding' => 'utf8'");
echo '<table width="100%" border="1" cellspacing="0" cellpadding="0" id="menuTable" class="display">';
echo '<thead><tr>';
echo '<th style="color:#046380;text-align:center;"><strong>Mise à jour</strong>
</th>
<th style="color:#046380; text-align:center;">Designation du Matériel</th>
<th style="color:#046380; text-align:center;">Identification</th>
<th style="color:#046380; text-align:center;">Etat</th>
<th style="color:#046380; text-align:center;">Disponibilité</th>
<th style="color:#046380; text-align:center;">Attribution</th>
<th style="color:#B9121B; text-align:center;">Chantier</th>
<th style="color:#B9121B; text-align:center;">Date de Sortie</th>
<th style="color:#B9121B; text-align:center;">Prêt/J</th>
<th style="color:#B9121B; text-align:center;">Action</th>
<th style="color:#B9121B; text-align:center;">R</th>
</tr></thead>';
echo '<tbody>';
while ($datas = mysql_fetch_assoc($req)) {
mysql_query("SET NAMES UTF8");
mysql_query("'encoding' => 'utf8'");
echo '<tr>';
?>
<td width="9%" class="rouge" id="datef-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'datef', 'texte')">
<?php echo $datas['datef']?></td>
<td class="noir" id="designation-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'designation', 'texte')">
<?php echo $datas['designation']?></td>
<td class="vert" id="reference-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'reference', 'texte')">
<?php echo $datas['reference']?></td>
<td class="vert">
<?php
if( $datas['etat'] == 0 ) // CONFORME //
{ echo '<img name="ok" src="png/ok.png" width="40" height="40" alt="" /> </td>';
}
if( $datas['etat'] == 1 ) { // NON CONFORME //
echo '<img name="ok" src="png/attention1.png" width="40" height="40" alt="" /></td>';
}
if( $datas['etat'] == 5 ) { // CONTROLE A - 30 JOURS //
echo '<img name="ok" src="png/J30.png" width="40" height="40" alt="" /></td>';
}
if( $datas['etat'] == 3 ) { // HORS SERVICE //
echo '<img name="ok" src="png/hors_service.png" width="40" height="40" alt="" /></td>';
}
if( $datas['etat'] == 2 ) { // EN REPARATION //
echo '<img name="ok" src="png/reparation (1).png" width="50" height="50" alt="" /></td>';
}
?>
<?php // if( $datas['disponibilite'] ==2) { // PRET INFERIEUR A 60 JOURS TEXTE NOIR // ?>
<td class="vert" id="disponibilite-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'disponibilite', 'texte')">
<?php echo $datas['disponibilite']?></td>
<?php //} // FERME CONDITION ?>
<?php // if( $datas['disponibilite'] ==3) { // PRET SUPERIEUR A 60 JOURS TEXTE ROUGE // ?>
<?php // } // FERME CONDITION ?>
<td width="8%" class="noir" id="nom_retrait-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'nom_retrait', 'texte')">
<?php echo $datas['nom_retrait']?></td>
<td class="noir" id="chantier-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'chantier', 'texte')">
<?php echo $datas['chantier']?></td>
<td class="vert" id="date_sortie-<?php echo $datas['id']; ?>" ondblclick="enregistre_controle(<?php echo $datas['id']; ?>, this, 'date_sortie', 'texte')">
<?php echo $datas['date_de_sortie']?></td>
<?php
$date_pret = $datas['date_sortie']; // Date de sortie format français >> 00/00/0000 //
// $date_sortie = date('Y-m-d', strtotime($date_pret)); // On met la date au format anglais pour calcul //
$datedujour = date('Y-m-d') ; // Date du jour //
$nbjours = floor((strtotime($datedujour) - strtotime($date_pret)+60*60*1)/(60*60*24));
$dispo = $datas['disponibilite'];
if ($dispo = '0' ){
$id = $datas['id'];
mysql_query("UPDATE materiels3 SET date_sortie='0000-00-00 00:00:00' WHERE id='$id' LIMIT 1");
}
?>
<?php if( $nbjours < 60 ) { // PRET INFERIEUR A 60 JOURS TEXTE NOIR // ?>
<td class="noir"><center><?php echo $nbjours; ?></td>
<?php } // FERME CONDITION ?>
<?php if( $nbjours > 60 ) { // PRET SUPERIEUR A 60 JOURS TEXTE ROUGE // ?>
<td class="rouge"><center><?php echo $nbjours; ?></td>
<?php } // FERME CONDITION ?>
<td width="6%" class="noir">
<a href="javascript:BRB_PHP_DelWithCon('Ajout_Materiels/sortie.php','id',<?php echo $datas['id']; ?>,'Vous allez modifier une fiche Matériels ? ');"><img name="supprimer" src="images/fleche10.png" width="20" height="20" alt="" /></a>
<a href="javascript:BRB_PHP_DelWithCon('Fonction_php/pointage-retour2.php','id',<?php echo $datas['id']; ?>,'Voulez-vous saisir le pointage du retour de ce Matériel ? ');"><img name="Retour Matériels" src="images/retour.png" width="20" height="20" alt="" /></a>
<a href="javascript:BRB_PHP_DelWithCon('Fonction_php/Supprimer2.php','id',<?php echo $datas['id']; ?>,'Êtes-vous sûr de vouloir supprimer la fiche Matériel ? ');"><img name="supprimer" src="images/file_delete.png" width="17" height="17" alt="" /></a>
</td>
<td width="1%" class="noir">
<?php
echo '<input type="checkbox" name="check[]" value="'. $datas['id'].' "/>';
?>
</td>
<?php
echo '</tr>';
}
echo '</tbody>';
echo '<tfoot><tr><th colspan="12"> </th></tr></tfoot>';
echo '</table>';
echo '<table><tr><td><input name="Update" value="Valider les Retours Matériels" type="submit" /></form></td></tr></table>';
mysql_free_result($req);
// ENREGISTREMENT ARCHIVE //
//parcours du array des ids reçus
if (isset($_POST['Update'])) {
$id = implode(',', $_POST['check']); // On cherche les boites cocher //
//var_dump($_POST['check']); // test //
foreach($_POST['check'] as $val) {
$list_retour = mysql_query("SELECT id,designation,reference,date_sortie,nom_retrait,chantier FROM materiels3 WHERE id='$val' LIMIT 1");
$materiel_retour = mysql_fetch_array($list_retour);
// VARIABLES //
$designation = $materiel_retour[1];
$reference = $materiel_retour[2];
$date_sortie = $materiel_retour[3];
$nom_retrait = $materiel_retour[4];
$chantier = $materiel_retour[5];
$date_retour = date('Y/m/d') ; // date du jour du retour Matériel //
$insertSql= "INSERT INTO Archive_sortie VALUES('',now(),'$designation','$reference','$date_sortie','$nom_retrait','$chantier','$date_retour')";
$result2=mysql_query($insertSql);
} // ferme foreach //
} // condition //
if (isset($_POST['Update'])) {
$id = implode(',', $_POST['check']);
$sql = "UPDATE materiels3 SET disponibilite='',chantier='',nom_retrait='',date_sortie='' WHERE id IN (".$id.")";
$result=mysql_query($sql);
//en cas d'échec de la mise à jour, on affiche le message d'erreur
if (!$result) {
echo "erreur sql liée à la mise à jour:\n" ;
die( mysql_error());
}
}
mysql_close(); // FERME LA BDD //
} // ON FERME GESTION DES ETATS DES PRETS MATERIELS - ACTION 11 //
?>
[/php]