} //Date fin if ($Ref != '') { $Ref = "Inventaire n°" . substr($Ref, 0, strlen($Ref) - 2); } $_SESSION['ETAT_INVENTAIRE']['libelle'] = "Etat des inventaires"; $_SESSION['ETAT_INVENTAIRE']['critere'] = $Ref . $Art . $Per; $_SESSION['ETAT_INVENTAIRE']['data'] = array(); while ($row = mysql_fetch_array($ptr)) { $fils = array(); while ($row1 = mysql_fetch_array($result)) { if ($row['ID_INVENTAIRE'] == $row1['ID_INVENTAIRE']) { array_push($fils, array('id' => $row1['ID_INVENTAIRE'], 'idArticle' => $row1['ID_ARTICLE'], 'designat' => $row1['LIBELLE_ARTICLE'], 'qte' => $row1['TYPE_INVENTAIRE'] . $row1['QTE_INVENTAIRE'], 'prixUnit' => $row1['PU_INVENTAIRE'], 'unite' => $row1['UNITE'])); } } $pere = array('id' => $row['ID_INVENTAIRE'], 'd' => frFormat($row['DATE_INVENTAIRE']), 'lib' => $row['LIBELLE_INVENTAIRE'], 'fils' => $fils); array_push($_SESSION['ETAT_INVENTAIRE']['data'], $pere); mysql_data_seek($result, 0); } mysql_close(); header('location:etatinventaireso1.php?selectedTab=outputs'); break; default: //echo 'Fonctionnement incorrect...'; } isset($_GET['test']) ? $test = $_GET['test'] : ($test = ''); switch ($test) { case 'VALIDER': $table1 = "stocks_inventaire"; if (isset($_POST["code"])) { //Connection to Database server
function ligneEtatListeBonsortie($wh = '', $ord = '', $sens = 'ASC') { $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte'); $ilang = getCodelangue($userName); $returnHTML = ''; //Where clause $where = ''; isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = ""); //Oerder condition $order = ''; isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY SOR_DATE DESC"); //Nombre d'éléments $nbre = nombreBonsortie($where); if ($nbre > 0) { //Calcule des limites $sql = "SELECT * FROM bonsortie INNER JOIN beneficiaire ON (bonsortie.CODE_BENEF=beneficiaire.CODE_BENEF) {$where} {$order};"; //Exécution try { $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database } catch (PDOException $error) { //Treat error //("Erreur de connexion : " . $error->getMessage() ); header('location:errorPage.php'); } $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query $i = 1; while ($row = $query->fetch(PDO::FETCH_ASSOC)) { //($i%2 == 0 ? $col = "tableOddRow" : $col = "tableEvenRow"); $col = ''; $d1 = frFormat($row['SOR_DATE']); //Return $ret = array(); // DFR, TFR if ($row['SOR_VALIDE'] == '0') { $imgCl = '<img src="../images/encours.gif" title="En cours" width="16" height="16">'; } elseif ($row['SOR_VALIDE'] == '2') { $imgCl = '<img src="../images/cancel.png" title="Annulée" width="16" height="16">'; } else { $imgCl = '<img src="../images/valider.gif" title="Validée" width="16" height="16">'; } $returnHTML .= ' <tr align="left" valign="middle" class="' . $col . '"> <td class="botBorderTdall" align="center">' . $i . '</td> <td class="botBorderTdall" align="center">' . $imgCl . '</td> <td class="botBorderTdall" >' . stripslashes($row['CODE_BONSORTIE']) . ' </td> <td class="botBorderTdall" align="center">' . stripslashes($d1['DFR']) . ' </td> <td class="botBorderTdall" >' . stripslashes($row['SOR_LIBELLE']) . ' </td> <td class="botBorderTdall" >' . stripslashes($row['BENEF_NOM']) . ' </td> </tr>'; $i++; } } else { if ($ilang == '1' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Aucune donnée...</td></tr>'; } if ($ilang == '2' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">No data...</td></tr>'; } if ($ilang == '3' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Nenhum dado...</td></tr>'; } } return $returnHTML; }
function ligneEtatListeLog($wh = '') { $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte'); $ilang = getCodelangue($userName); $returnHTML = ''; //Where clause $where = ''; isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = ""); //Oerder condition $order = ''; isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY LOG_DATE DESC"); //Nombre d'éléments $nbre = nombreLog($where); if ($nbre > 0) { //Calcule des limites $sql = "SELECT * FROM logs {$where} {$order} "; //Exécution try { $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database } catch (PDOException $error) { //Treat error //("Erreur de connexion : " . $error->getMessage() ); header('location:errorPage.php'); } $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query $i = 1; while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $d1 = frFormat($row['LOG_DATE']); //Return $ret = array(); // DFR, TFR $returnHTML .= ' <tr align="left" valign="middle"> <td class="botBorderTdall" align="center">' . $i . '</td> <td class="botBorderTdall">' . stripslashes($row['LOGIN']) . ' </td> <td class="botBorderTdall">' . stripslashes(getPersonnelName($row['MLLE'])) . ' </td> <td class="botBorderTdall">' . stripslashes($d1['DFR']) . ' </td> <td class="botBorderTdall">' . stripslashes($d1['TFR']) . ' </td> <td class="botBorderTdall">' . stripslashes($row['LOG_DESCRIP']) . ' </td> </tr>'; $i++; } } else { if ($ilang == '1' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Aucune donnée...</td></tr>'; } if ($ilang == '2' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">No data...</td></tr>'; } if ($ilang == '3' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Nenhum dado...</td></tr>'; } } return $returnHTML; }
$cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database } catch (PDOException $error) { //Treat error //("Erreur de connexion : " . $error->getMessage() ); header('location:errorPage.php'); } //PERTE $sql = "SELECT * FROM `declass` INNER JOIN natdeclass ON (natdeclass.CODENATDECLASS LIKE declass.CODENATDECLASS)\r\n\t\tWHERE CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND `CODE_DECLASS` LIKE '" . addslashes($split[0]) . "'"; $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query $row = $query->fetch(PDO::FETCH_ASSOC); //Data CDE_STATUT $_SESSION['DATA_DEC'] = array('xid' => $row['CODE_DECLASS'], 'exercice' => $row['ID_EXERCICE'], 'datedeclassement' => frFormat2($row['DCL_DATE']), 'refdeclassement' => $row['REF_DECLAS'], 'natdeclassement' => $row['CODENATDECLASS'], 'raison' => $row['LIBNATDECLASS'], 'libelle' => $row['DCL_LIBELLE'], 'cabinet' => $row['DCL_CABINET'], 'refrapport' => $row['DCL_REFRAPPORT'], 'datevalid' => frFormat($row['DCL_DATEVALID']), 'statut' => $row['DCL_VALIDE'], 'nbreLigne' => 0); //LIGNES PERTE $sql = "SELECT detdeclass.*, produit.CODE_PRODUIT, produit.PRD_LIBELLE FROM `detdeclass`\r\n\t\tINNER JOIN produit ON (produit.CODE_PRODUIT LIKE detdeclass.CODE_PRODUIT) WHERE CODE_DECLASS LIKE '" . addslashes($split[0]) . "'\r\n\t\tORDER BY ID_DETDECLASS ASC;"; $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query //Ligne $_SESSION['DATA_DEC']['ligne'] = array(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { array_push($_SESSION['DATA_DEC']['ligne'], array('code_detdeclass' => $row['CODE_DETDECLASS'], 'monlot' => $row['DECL_MONLOT'], 'codeproduit' => $row['CODE_PRODUIT'], 'produit' => stripslashes($row['PRD_LIBELLE']), 'qte' => $row['DECL_QTE'], 'unite' => $row['DECL_UNITE'], 'prix' => $row['DECL_PA'], 'reflot' => $row['DECL_REFLOT'], 'dateperemp' => preg_replace('[-]', '/', frFormat2($row['DECL_DATEPEREMP'])))); } $_SESSION['DATA_DEC']['nbreLigne'] = $query->rowCount(); header('location:validdeclassement.php?selectedTab=bds&rs=3'); break; case 'annul':
function ligneEtatListeDeclassement($wh = '', $ord = '', $sens = 'ASC') { $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte'); $ilang = getCodelangue($userName); $returnHTML = ''; //Where clause $where = ''; isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = ""); //Oerder condition $order = ''; isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY DCL_DATE DESC"); //Nombre d'éléments $returnTble['NE'] = nombreDeclassement($where); if ($returnTble['NE'] > 0) { $sql = "SELECT * FROM declass\r\n\t\tINNER JOIN natdeclass ON (declass.CODENATDECLASS LIKE natdeclass.CODENATDECLASS) {$where} {$order};"; //Exécution try { $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database } catch (PDOException $error) { //Treat error //("Erreur de connexion : " . $error->getMessage() ); header('location:errorPage.php'); } $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query $i = 1; while ($row = $query->fetch(PDO::FETCH_ASSOC)) { //($i%2 == 0 ? $col = "tableOddRow" : $col = "tableEvenRow"); $col = ''; $d1 = frFormat($row['DCL_DATE']); $row['DCL_VALIDE'] == '0' ? $imgCl = '<img src="../images/encours.gif" title="En cours" width="16" height="16">' : ($imgCl = '<img src="../images/valider.gif" title="Validée" width="16" height="16">'); $returnHTML .= ' <tr align="left" valign="middle" class="' . $col . '"> <td class="botBorderTdall" align="center">' . $i . ' </td> <td class="botBorderTdall" align="center" >' . $imgCl . '<input type="hidden" name="rowValid[]" id="rowValid[]"value="' . $row['DCL_VALIDE'] . '"></td> <td height="22" class="botBorderTdall" align="center">' . stripslashes($row['CODE_DECLASS']) . ' </td> <td class="botBorderTdall" >' . stripslashes($d1['DFR']) . ' </td> <td class="botBorderTdall" >' . stripslashes($row['LIBNATDECLASS']) . '</td> </tr>'; $i++; } } else { if ($ilang == '1' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Aucune donnée...</td></tr>'; } if ($ilang == '2' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">No data...</td></tr>'; } if ($ilang == '3' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Nenhum dado...</td></tr>'; } } return $returnHTML; }
function lignSearchLog($cr1, $cr2, $cr3, $page = 1, $nelt) { $ret = ''; $t = array(); $table1 = "stocks_logs"; //Connection to Database server mysql_connect(DBSERVER, DBUSER, DBPWD) or header('location:errorPage.php&code='); //Select Database mysql_select_db(DB) or header('location:errorPage.php&code='); //SQL $where = ''; isset($cr1) and $cr1 != '' ? $where .= " {$table1}.LOGIN LIKE '{$cr1}' AND " : ($where .= ""); if (isset($cr2) && $cr2 != '' && isset($cr2) && $cr3 != '') { $where .= " ({$table1}.DATE_LOG >='" . mysqlFormat($cr2) . "' AND {$table1}.DATE_LOG <='" . mysqlFormat($cr3) . "') OR "; } //Date fin if (isset($cr2) && $cr2 != '' && $cr3 == '') { $where .= " {$table1}.DATE_LOG ='" . mysqlFormat($cr2) . "' OR "; } //Date début if (isset($cr3) && $cr3 != '' && $cr2 == '') { $where .= " {$table1}.DATE_LOG ='" . mysqlFormat($cr3) . "' OR "; } //Date fin if ($where != '') { $where = substr(" WHERE {$where}", 0, strlen(" WHERE {$where}") - 4); } $order = ''; isset($ord) and $wh != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY DATE_LOG ASC "); $SQL = "SELECT {$table1}.* FROM {$table1} {$where} {$order};"; $result = mysql_query($SQL); $t['NE'] = mysql_num_rows($result); $i = ($page - 1) * $nelt; $SQL = "SELECT {$table1}.* FROM {$table1} {$where} {$order} LIMIT {$i}, {$nelt};"; $result = mysql_query($SQL); $i = 0; $j = 4; while ($row = mysql_fetch_array($result)) { $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow"); $matricule = numMatricule($row['LOGIN']); $d = preg_split('/[-\\.\\/ ]/', $row['DATE_LOG']); $date = frFormat($d[0]) . ' ' . $d[1]; $ret .= '<tr align="left" valign="middle" class="' . $col . '"> <td width="3%"><input type="checkbox" name="rowSelection[]" value="' . $row['ID_LOG'] . '" onClick="go(' . $row['ID_LOG'] . ',' . $j . ');"></td> <td width="5%" height="22" class="text" align="center">' . ($i + 1 + ($page - 1) * $nelt) . '</td> <td width="20%" class="text" align="left" nowrap>' . $row['LOGIN'] . ': ' . stripslashes(nomUser($matricule)) . '</td> <td width="15%" class="text" align="center">' . $date . '</td> <td width="60%" height="22" class="text" align="left">' . stripslashes($row['DESCRIPTION']) . '</td> </tr>'; $i++; $j++; } $t['L'] = $ret; //mysql_close); return $t; }
function ligneEtatListeLivraison($wh = '', $ord = '', $sens = 'ASC') { $returnHTML = ''; //Where clause $where = ''; isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = ""); //Oerder condition $order = ''; isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY CDE_DATE DESC"); //Nombre d'éléments $nbre = nombredelivery($where); if ($nbre > 0) { //Calcule des limites $sql = "SELECT * FROM livraison INNER JOIN commande ON (commande.ID_COMMANDE = livraison.ID_COMMANDE) {$where} {$order};"; //Exécution try { $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database } catch (PDOException $error) { //Treat error //("Erreur de connexion : " . $error->getMessage() ); header('location:errorPage.php'); } $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query $i = 1; while ($row = $query->fetch(PDO::FETCH_ASSOC)) { //($i%2 == 0 ? $col = "tableOddRow" : $col = "tableEvenRow"); $col = ''; $d1 = frFormat($row['CDE_DATE']); //Return $ret = array(); // DFR, TFR $d2 = frFormat($row['LVR_DATE']); //Return $ret = array(); // DFR, TFR if ($row['LVR_VALIDE'] == '0') { $imgCl = '<img src="../images/encours.gif" title="En cours" width="16" height="16">'; } elseif ($row['LVR_VALIDE'] == '2') { $imgCl = '<img src="../images/cancel.png" title="Annulée" width="16" height="16">'; } else { $imgCl = '<img src="../images/valider.gif" title="Validée" width="16" height="16">'; } $returnHTML .= ' <tr align="left" valign="middle" class="' . $col . '"> <td class="botBorderTdall" align="center">' . $i . '</td> <td class="botBorderTdall" align="center">' . $imgCl . '</td> <td class="botBorderTdall" >' . stripslashes('Cde n°' . $row['CODE_COMMANDE'] . ' du ' . $d1['DFR']) . ' </td> <td class="botBorderTdall" >' . stripslashes($row['CDE_LIBELLE']) . ' </td> <td class="botBorderTdall" align="center">' . stripslashes($row['CODE_LIVRAISON']) . ' </td> <td class="botBorderTdall" align="center">' . stripslashes($d2['DFR']) . ' </td> <td class="botBorderTdall" >' . stripslashes(getFournisseur($row['CODE_FOUR'])) . ' </td> </tr>'; $i++; } } else { $returnHTML .= '<tr><td colspan="4" class="text">Aucune donnée</td></tr>'; } return $returnHTML; }
function ligneEtatListeTransfert($wh = '', $ord = '') { $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte'); $ilang = getCodelangue($userName); $returnHTML = ''; $returnTble = array(); //HTML, nbreTotal, //Where clause $where = ''; isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = ""); //Oerder condition $order = ''; isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY TRS_DATE DESC"); //Nombre d'éléments $nbre = nombreTransfert($where); if ($nbre > 0) { //Calcule des limites $sql = "SELECT * FROM transfert {$where} {$order};"; //Exécution try { $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database } catch (PDOException $error) { //Treat error //("Erreur de connexion : " . $error->getMessage() ); header('location:errorPage.php'); } $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query $i = 1; $tranfert = array(1 => 'Transfert sortant', 2 => 'Transfert entrant'); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { //($i%2 == 0 ? $col = "tableOddRow" : $col = "tableEvenRow"); $d1 = frFormat($row['TRS_DATE']); //Return $ret = array(); // DFR, TFR if ($row['TRS_VALIDE'] == '0') { $imgCl = '<img src="../images/encours.gif" title="En cours" width="16" height="16">'; } elseif ($row['TRS_VALIDE'] == '2') { $imgCl = '<img src="../images/cancel.png" title="Annulé" width="16" height="16">'; } else { $imgCl = '<img src="../images/valider.gif" title="Validé" width="16" height="16">'; } $t = $row['TRS_NATURE']; $returnHTML .= ' <tr align="left" valign="middle"> <td class="botBorderTdall" align="center">' . $i . '</td> <td class="botBorderTdall">' . stripslashes($row['CODE_TRANSFERT']) . ' </td> <td class="botBorderTdall">' . stripslashes($d1['DFR']) . ' </td> <td class="botBorderTdall">' . stripslashes($tranfert[$t]) . ' </td> <td class="botBorderTdall">' . stripslashes(getmagasinName($row['MAG_CODE_MAGASIN_SRCE'])) . ' </td> <td class="botBorderTdall">' . stripslashes(getmagasinName($row['MAG_CODE_MAGASIN_DEST'])) . ' </td> </tr>'; $i++; } } else { if ($ilang == '1' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Aucune donnée...</td></tr>'; } if ($ilang == '2' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">No data...</td></tr>'; } if ($ilang == '3' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Nenhum dado...</td></tr>'; } } return $returnHTML; }
function ligneEtatExercice($wh = '', $ord = '', $sens = 'ASC') { $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte'); $ilang = getCodelangue($userName); $returnHTML = ''; //Where clause $where = ''; isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = ""); //Oerder condition $order = ''; isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY ID_EXERCICE DESC"); //Nombre d'éléments $nbre = nombreExercice($where); if ($nbre > 0) { //Calcule des limites $sql = "SELECT * FROM exercice {$where} {$order};"; //Exécution try { $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database } catch (PDOException $error) { //Treat error //("Erreur de connexion : " . $error->getMessage() ); header('location:errorPage.php'); } $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query $i = 0; while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $d1 = frFormat($row['EX_DATEDEBUT']); //Return $ret = array(); // DFR, TFR $d2 = frFormat($row['EX_DATEFIN']); $d3 = frFormat($row['EX_DATECLOTURE']); $nbre = NbJours(date('Y-m-d'), $row['EX_DATEFIN']); if ($nbre == 1) { $nbre = $nbre . ' jour'; } elseif ($nbre > 1) { $nbre = $nbre . ' jours'; } else { $nbre = '-'; } $row['EX_CLOTURE'] == '0' ? $imgCl = '<img src="../images/encours.gif" width="16" height="16">' : ($imgCl = '<img src="../images/fermer.png" width="16" height="16">'); $returnHTML .= ' <tr align="left" valign="middle"> <td class="botBorderTdall" align="center">' . $row['ID_EXERCICE'] . ' </td> <td class="botBorderTdall" >' . stripslashes($row['EX_LIBELLE']) . ' </td> <td class="botBorderTdall" align="center">' . stripslashes($d1['DFR']) . ' </td> <td class="botBorderTdall" align="center">' . stripslashes($d2['DFR']) . ' </td> <td class="botBorderTdall" align="center">' . $imgCl . '</td> <td class="botBorderTdall" align="center">' . stripslashes($d3['DFR']) . ' </td> <td class="botBorderTdall" align="center">' . stripslashes($nbre) . ' </td> </tr>'; $i++; } } else { if ($ilang == '1' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Aucune donnée...</td></tr>'; } if ($ilang == '2' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">No data...</td></tr>'; } if ($ilang == '3' && $ilang != '') { $returnHTML .= '<tr><td colspan="4" class="text">Nenhum dado...</td></tr>'; } } return $returnHTML; }