function stockQte($exercice, $nature, $prd, $date, $valid) { //ID_MOUVEMENT ID_CONDIT ID_EXERCICE CODE_MAGASIN ID_SOURCE MVT_DATE MVT_QUANTITE MVT_UNITE MVT_NATURE MVT_VALID $where = ""; isset($exercice) && $exercice != '' ? $where .= "mouvement.ID_EXERCICE = '" . addslashes($exercice) . "' AND " : ($where .= ""); isset($nature) && $nature != '' ? $where .= "mouvement.MVT_NATURE LIKE '" . addslashes($nature) . "' AND " : ($where .= ""); isset($prd) && $prd != '' ? $where .= "mouvement.ID_CONDIT = '" . addslashes($prd) . "' AND " : ($where .= ""); isset($date) && $date != '' ? $where .= "mouvement.ID_CONDIT = '" . addslashes(mysqlFormat($date)) . "' AND " : ($where .= ""); isset($valid) && $valid != '' ? $where .= "mouvement.MVT_VALID = '" . addslashes($valid) . "' AND " : ($where .= ""); if ($where != '') { $where = 'WHERE ' . substr($where, 0, strlen($where) - 4); } $sql = "SELECT SUM(MVT_QUANTITE), ID_CONDIT, ID_EXERCICE, MVT_UNITE, MVT_NATURE, MVT_VALID\r\n\tFROM `mouvement` {$where}; "; 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 if ($query->rowCount()) { $row = $query->fetch(PDO::FETCH_ASSOC); return $row; } else { return array(); } }
if ($in != '') { $in = substr($in, 0, strlen($in) - 2); $in = 'mouvement.CODE_PRODUIT IN (' . $in . ') AND '; } if ($where != '') { $where = substr($where, 0, strlen($where) - 4); } $whereAll = 'AND ' . $in . $where; if ($in != '') { $in = ' WHERE ' . substr($in, 0, strlen($in) - 4); } $_SESSION['DATA_ETAT']['exercice'] = $_POST['exercice']; $_SESSION['DATA_ETAT']['ligne'] = array(); $_SESSION['DATA_ETAT']['WHERE'] = $whereAll; isset($_POST['datedebut']) && $_POST['datedebut'] != '' ? $d1 = mysqlFormat(trim($_POST['datedebut'])) : ($d1 = ''); isset($_POST['datefin']) && $_POST['datefin'] != '' ? $d2 = mysqlFormat(trim($_POST['datefin'])) : ($d2 = ''); $sql = "SELECT * FROM mouvement INNER JOIN produit ON (mouvement.CODE_PRODUIT LIKE produit.CODE_PRODUIT)\r\n\t\t\tINNER JOIN magasin ON (mouvement.CODE_MAGASIN LIKE magasin.CODE_MAGASIN)\r\n\t\t\tWHERE mouvement.MVT_TYPE LIKE 'S' AND mouvement.MVT_NATURE LIKE 'DECLASSEMENT' {$whereAll} ORDER BY produit.PRD_LIBELLE ASC; "; $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query while ($row = $query->fetch(PDO::FETCH_ASSOC)) { //getField($key, $code, $field, $table) $codenature = getField('CODE_DECLASS', $row['ID_SOURCE'], 'CODENATDECLASS', 'declass'); $nature = getField('CODENATDECLASS', $codenature, 'LIBNATDECLASS', 'natdeclass'); //echo 'Ent'.$entree.' Sort'.$sortie.'<br>'; array_push($_SESSION['DATA_ETAT']['ligne'], array('codeproduit' => $row['CODE_PRODUIT'], 'reflot' => $row['MVT_REFLOT'], 'produit' => addslashes($row['PRD_LIBELLE']), 'nature' => $nature, 'qte' => $row['MVT_QUANTITE'], 'unite' => $row['ID_UNITE'], 'prix' => $row['PRD_PRIXVENTE'])); } $_SESSION['DATA_ETAT']['nbreLigne'] = $query->rowCount(); //print_r($_SESSION['DATA_ETAT']); header('location:rapdeclassement1.php?selectedTab=rap');
while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $in .= "'" . $row['CODE_MAGASIN'] . "', "; } if ($in != '') { $in = substr($in, 0, strlen($in) - 2); $in = " mouvement.CODE_MAGASIN IN (" . $in . ") AND "; } } } } } $where = ""; $whereAll = ""; isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "mouvement.ID_EXERCICE = '" . addslashes(trim($_POST['exercice'])) . "' AND " : ($where .= ""); isset($_POST['datedebut']) && $_POST['datedebut'] != '' ? $where .= "mouvement.MVT_DATE >= '" . addslashes(mysqlFormat(trim($_POST['datedebut']))) . "' AND " : ($where .= ""); isset($_POST['datefin']) && $_POST['datefin'] != '' ? $where .= "mouvement.MVT_DATE <= '" . addslashes(mysqlFormat(trim($_POST['datefin']))) . "' AND " : ($where .= ""); 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'); } $sql = "SELECT * FROM produit ORDER BY PRD_LIBELLE ASC; "; $query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query if ($in != '') { $where = $in . $where;
updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], "Ajout stock entrant (" . $insert_id . ', livraison n° ' . $codelivraison . ')'); //updateLog($username, $idcust, $action='' ) } //echo $sql2; unset($_SESSION['DATA_LOT']); header('location:lots.php?selectedTab=bde&rst=1'); break; case 'update': isset($_POST['xid']) && $_POST['xid'] != '' ? $xid = trim($_POST['xid']) : ($xid = ''); isset($_POST['exercice']) && $_POST['exercice'] != '' ? $exercice = trim($_POST['exercice']) : ($exercice = ''); isset($_POST['datelivraison']) && $_POST['datelivraison'] != '' ? $datelivraison = trim($_POST['datelivraison']) : ($datelivraison = ''); isset($_POST['libelle']) && $_POST['libelle'] != '' ? $libelle = trim($_POST['libelle']) : ($libelle = ''); isset($_POST['commande']) && $_POST['commande'] != '0' ? $commande = trim($_POST['commande']) : ($commande = ''); isset($_POST['codelivraison']) && $_POST['codelivraison'] != '' ? $codelivraison = trim($_POST['codelivraison']) : ($codelivraison = ''); isset($_POST['statut']) && $_POST['statut'] != '' ? $statut = trim($_POST['statut']) : ($statut = ''); $datelivraison = mysqlFormat($datelivraison); $magasin = $_SESSION['GL_USER']['MAGASIN']; $exercice = $_SESSION['GL_USER']['EXERCICE']; if ($commande != '') { //Insert $sql = "UPDATE `livraison` SET `ID_EXERCICE`='" . addslashes($exercice) . "' ,`CODE_LIVRAISON`='" . addslashes($codelivraison) . "',\r\n\t\t\t`ID_COMMANDE`='" . addslashes($commande) . "' ,`LVR_LIBELLE`='" . addslashes($libelle) . "',\t`LVR_DATE`='" . addslashes($datelivraison) . "' ,`LVR_VALIDE`='" . addslashes($statut) . "'\r\n\t\t\tWHERE ID_LIVRAISON='{$xid}'"; } else { $sql = "UPDATE `livraison` SET `ID_EXERCICE`='" . addslashes($exercice) . "' ,`CODE_LIVRAISON`='" . addslashes($codelivraison) . "',\r\n\t\t\t`ID_COMMANDE`=NULL ,`LVR_DATE`='" . addslashes($datelivraison) . "' ,`LVR_LIBELLE`='" . addslashes($libelle) . "', `LVR_VALIDE`='" . addslashes($statut) . "'\r\n\t\t\tWHERE ID_LIVRAISON='{$xid}'"; } 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');
} elseif ($code_detlivraison == '' && $oldcodeproduit == '' && $codeproduit != '' && $produit != '' && $qtelvr != '') { if ($commande != '') { $numautoDetLiv++; $codeDetLiv = "{$numautoDetLiv}/{$magasin}"; $monlot = "LOT/{$numautoDetLiv}/{$i}"; $sql1 .= "INSERT INTO `detlivraison` (`CODE_DETLIVRAISON`, `CODE_PRODUIT`, `CODE_LIVRAISON`, `CODE_MAGASIN`, `ID_DETLIVRAISON`, `LVR_PRDQTE`,\r\n\t\t\t\t\t`LVR_PRDRECU`, `LVR_UNITE`, `LVR_IDCOMMANDE`, `LVR_MAGASIN`, `LVR_PA`, `LVR_REFLOT`, `LVR_DATEPEREMP`, `LVR_MONLOT`)\r\n\t\t\t\t\tVALUES ('" . addslashes($codeDetLiv) . "', '" . addslashes($codeproduit) . "', '" . addslashes($xid) . "', '" . addslashes($magasin) . "', '" . addslashes($numautoDetLiv) . "',\r\n\t\t\t\t\t'" . addslashes($qte) . "' , '" . addslashes($qtelvr) . "', '" . addslashes($unite) . "', '" . addslashes($commande) . "','" . addslashes($magasin) . "',\r\n\t\t\t\t\t'" . addslashes($prix) . "', '" . addslashes($reflot) . "', '" . addslashes(mysqlFormat($dateperemp)) . "', '" . addslashes($monlot) . "'); "; } else { $numautoDetLiv++; $codeDetLiv = "{$numautoDetLiv}/{$magasin}"; $monlot = "LOT/{$numautoDetLiv}/{$i}"; $sql1 .= "INSERT INTO `detlivraison` (`CODE_DETLIVRAISON`, `CODE_PRODUIT`, `CODE_LIVRAISON`, `CODE_MAGASIN`, `ID_DETLIVRAISON`, `LVR_PRDQTE`,\r\n\t\t\t\t\t`LVR_PRDRECU`, `LVR_UNITE`, `LVR_IDCOMMANDE`, `LVR_MAGASIN`, `LVR_PA`, `LVR_REFLOT`, `LVR_DATEPEREMP`, `LVR_MONLOT`)\r\n\t\t\t\t\tVALUES ('" . addslashes($codeDetLiv) . "', '" . addslashes($codeproduit) . "', '" . addslashes($xid) . "', '" . addslashes($magasin) . "', '" . addslashes($numautoDetLiv) . "',\r\n\t\t\t\t\t'" . addslashes($qte) . "' , '" . addslashes($qtelvr) . "', '" . addslashes($unite) . "', '" . addslashes($commande) . "','" . addslashes($magasin) . "',\r\n\t\t\t\t\t'" . addslashes($prix) . "', '" . addslashes($reflot) . "', '" . addslashes(mysqlFormat($dateperemp)) . "', '" . addslashes($monlot) . "'); "; } $numautoMvt++; $numautoDetLiv = myDbLastId('detlivraison', 'ID_DETLIVRAISON', $magasin); $codeMvt = "{$numautoMvt}/{$magasin}"; $sql2 .= "INSERT INTO `mouvement` (`CODE_MOUVEMENT`, `ID_EXERCICE`, `CODE_PRODUIT`, `CODE_MAGASIN`, `ID_MOUVEMENT`, `ID_SOURCE`,\r\n\t\t\t\t`MVT_DATE`, `MVT_TIME`, `MVT_QUANTITE`, `MVT_UNITE`, `MVT_NATURE`, `MVT_VALID`, `MVT_DATEVALID`, `MVT_TYPE`, `MVT_REFLOT`,\r\n\t\t\t\t`MVT_DATEPEREMP`, `MVT_PA`, `MVT_MONLOT`)\r\n\t\t\t\tVALUES ('" . addslashes($codeMvt) . "', '" . addslashes($exercice) . "','" . addslashes($codeproduit) . "',\t'" . addslashes($magasin) . "',\r\n\t\t\t\t'" . addslashes($numautoMvt) . "', '" . addslashes($xid) . "', '" . addslashes($datelivraison) . "' ,'" . addslashes(date('H:i:s')) . "' ,\r\n\t\t\t\t'" . addslashes($qtelvr) . "' ,\t'" . addslashes($unite) . "', 'LIVRAISON', '{$statut}', '" . date('Y-m-d H:i:s') . "','E','" . addslashes($reflot) . "',\r\n\t\t\t\t'" . addslashes(mysqlFormat($dateperemp)) . "', '" . addslashes($prix) . "', '" . addslashes($monlot) . "') ; "; } } if ($sql1 != '') { $query = $cnx->prepare($sql1); //Prepare the SQL $query->execute(); //Execute prepared SQL => updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification des lignes de livraison(' . $xid . ', Livraison n°' . $reflivraison . ')'); //updateLog($username, $idcust, $action='' ) $query = $cnx->prepare($sql2); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], "Modification d'un mouvement(" . $xid . ', livraison n°' . $reflivraison . ')'); //updateLog($username, $idcust, $action='' )
isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { $where = " autrelivr.CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND "; isset($_POST['datelivraison']) && $_POST['datelivraison'] != '' ? $date1 = $_POST['datelivraison'] : ($date1 = ''); isset($_POST['datelivraison1']) && $_POST['datelivraison1'] != '' ? $date2 = $_POST['datelivraison1'] : ($date2 = ''); isset($_POST['codelivraison']) && $_POST['codelivraison'] != '' ? $where .= "autrelivr.CODE_AUTRELIVR LIKE '" . addslashes(trim($_POST['codelivraison'])) . "' AND " : ($where .= ""); isset($_POST['codesourcelivraison']) && $_POST['codesourcelivraison'] != '' ? $where .= "autrelivr.AUL_SOUCRE LIKE '" . addslashes(trim($_POST['codesourcelivraison'])) . "' AND " : ($where .= ""); //(isset($_POST['datelivraison']) && $_POST['datelivraison']!='' ? $where .="autrelivr.AUL_DATE = '".addslashes(mysqlFormat(trim($_POST['datelivraison'])))."' AND " : $where .=""); if ($date1 != '' && $date2 != '') { $where .= "autrelivr.AUL_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND autrelivr.AUL_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 == '' && $date2 != '') { $where .= "autrelivr.AUL_DATE >= '" . addslashes(mysqlFormat(trim($date2))) . "' AND autrelivr.AUL_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 != '' && $date2 == '') { $where .= "autrelivr.AUL_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND autrelivr.AUL_DATE <= '" . addslashes(mysqlFormat(trim($date1))) . "' AND "; } isset($_POST['autreinfo']) && $_POST['autreinfo'] != '' ? $where .= "autrelivr.AUL_DETAIL LIKE '" . addslashes(trim($_POST['autreinfo'])) . "%' AND " : ($where .= ""); isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "autrelivr.AUL_VALIDE = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'otherdelivery.php?selectedTab=cde&do=search'; $retour = ligneConOtherdelivery($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'otherdelivery.php?selectedTab=cde'; $retour = ligneConOtherdelivery('autrelivr.ID_EXERCICE=' . $_SESSION['GL_USER']['EXERCICE'] . " AND CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "'", '', '', $page, $_SESSION['GL_USER']['ELEMENT']);
isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { $where = " livraison.CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND "; isset($_POST['datelivraison']) && $_POST['datelivraison'] != '' ? $date1 = $_POST['datelivraison'] : ($date1 = ''); isset($_POST['datelivraison1']) && $_POST['datelivraison1'] != '' ? $date2 = $_POST['datelivraison1'] : ($date2 = ''); isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "livraison.ID_EXERCICE = '" . addslashes(trim($_POST['exercice'])) . "' AND " : ($where .= ""); isset($_POST['commande']) && $_POST['commande'] != '0' ? $where .= "livraison.ID_COMMANDE = '" . addslashes(trim($_POST['commande'])) . "' AND " : ($where .= ""); isset($_POST['codelivraison']) && $_POST['codelivraison'] != '' ? $where .= "livraison.CODE_LIVRAISON = '" . addslashes(trim($_POST['codelivraison'])) . "' AND " : ($where .= ""); if ($date1 != '' && $date2 != '') { $where .= "livraison.LVR_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND livraison.LVR_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 == '' && $date2 != '') { $where .= "livraison.LVR_DATE >= '" . addslashes(mysqlFormat(trim($date2))) . "' AND livraison.LVR_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 != '' && $date2 == '') { $where .= "livraison.LVR_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND livraison.LVR_DATE <= '" . addslashes(mysqlFormat(trim($date1))) . "' AND "; } isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "livraison.LVR_VALIDE = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'lot.php?selectedTab=bde&do=search'; $retour = ligneConLot($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'lot.php?selectedTab=bde'; $retour = ligneConLot('livraison.ID_EXERCICE=' . $_SESSION['GL_USER']['EXERCICE'] . " AND livraison.CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "'", '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt
} isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { isset($_POST['datereversement']) && $_POST['datereversement'] != '' ? $date1 = $_POST['datereversement'] : ($date1 = ''); isset($_POST['datereversement1']) && $_POST['datereversement1'] != '' ? $date2 = $_POST['datereversement1'] : ($date2 = ''); $where = " CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND "; isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "reversement.ID_EXERCICE = '" . addslashes(trim($_POST['exercice'])) . "' AND " : ($where .= ""); //(isset($_POST['datereversement']) && $_POST['datereversement']!='' ? $where .="reversement.REV_DATE = '".addslashes(mysqlFormat(trim($_POST['datereversement'])))."' AND " : $where .=""); if ($date1 != '' && $date2 != '') { $where .= "reversement.REV_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND reversement.REV_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 == '' && $date2 != '') { $where .= "reversement.REV_DATE >= '" . addslashes(mysqlFormat(trim($date2))) . "' AND reversement.REV_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 != '' && $date2 == '') { $where .= "reversement.REV_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND reversement.REV_DATE <= '" . addslashes(mysqlFormat(trim($date1))) . "' AND "; } isset($_POST['programmation']) && $_POST['programmation'] != '0' ? $where .= "reversement.ID_PROGR = '" . addslashes(trim($_POST['programmation'])) . "' AND " : ($where .= ""); isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "reversement.REV_VALID = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'reversement.php?selectedTab=prg&do=search'; $retour = ligneConReversement($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'reversement.php?selectedTab=prg'; $retour = ligneConReversement('reversement.ID_EXERCICE=' . $_SESSION['GL_USER']['EXERCICE'] . " AND CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' ", '', '', $page, $_SESSION['GL_USER']['ELEMENT']);
$text = "Une erreur s'est produite"; $msg = '<div class="errorMsg">' . stripslashes($text) . '</div>'; } isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { $where = " (report.CODE_MAGASIN LIKE '" . addslashes(trim($_SESSION['GL_USER']['MAGASIN'])) . "' OR report.MAG_CODE_MAGASIN LIKE '" . addslashes(trim($_SESSION['GL_USER']['MAGASIN'])) . "') AND "; isset($_POST['datereport']) && $_POST['datereport'] != '' ? $date1 = $_POST['datereport'] : ($date1 = ''); isset($_POST['datereport1']) && $_POST['datereport1'] != '' ? $date2 = $_POST['datereport1'] : ($date2 = ''); if ($date1 != '' && $date2 != '') { $where .= "report.REP_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND report.REP_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 == '' && $date2 != '') { $where .= "report.REP_DATE >= '" . addslashes(mysqlFormat(trim($date2))) . "' AND report.REP_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 != '' && $date2 == '') { $where .= "report.REP_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND report.REP_DATE <= '" . addslashes(mysqlFormat(trim($date1))) . "' AND "; } isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "report.TRS_VALIDE = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'report.php?selectedTab=bds&do=search'; $retour = ligneConreport($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'report.php?selectedTab=bds'; $retour = ligneConreport('report.ID_EXERCICE=' . $_SESSION['GL_USER']['EXERCICE'] . " AND (report.CODE_MAGASIN LIKE '" . addslashes(trim($_SESSION['GL_USER']['MAGASIN'])) . "' OR report.MAG_CODE_MAGASIN LIKE '" . addslashes(trim($_SESSION['GL_USER']['MAGASIN'])) . "') ", '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt
} unset($_SESSION['DATA_TRS']); //echo $sql1, '<br><br>',$sql2; header('location:transfert.php?selectedTab=bds&rst=1'); break; case 'validate2': isset($_POST['xid']) && $_POST['xid'] != '' ? $xid = trim($_POST['xid']) : ($xid = ''); isset($_POST['exercice']) && $_POST['exercice'] != '' ? $exercice = trim($_POST['exercice']) : ($exercice = ''); isset($_POST['datetransfert']) && $_POST['datetransfert'] != '' ? $datetransfert = trim($_POST['datetransfert']) : ($datetransfert = ''); isset($_POST['reftransfert']) && $_POST['reftransfert'] != '' ? $reftransfert = trim($_POST['reftransfert']) : ($reftransfert = ''); isset($_POST['magasin_srce']) && $_POST['magasin_srce'] != '' ? $magasin_srce = trim($_POST['magasin_srce']) : ($magasin_srce = ''); isset($_POST['nature']) && $_POST['nature'] != '0' ? $nature = trim($_POST['nature']) : ($nature = ''); isset($_POST['libelleetat']) && $_POST['libelleetat'] != '' ? $libelleetat = trim($_POST['libelleetat']) : ($libelleetat = ''); isset($_POST['nbreLigne']) && $_POST['nbreLigne'] != '' ? $nbreLigne = trim($_POST['nbreLigne']) : ($nbreLigne = ''); isset($_POST['statut']) && $_POST['statut'] == '1' ? $statut = trim($_POST['statut']) : ($statut = '0'); $datetransfert = mysqlFormat($datetransfert); $vdate = '0000-00-00'; $magasin = $_SESSION['GL_USER']['MAGASIN']; //Insert $sql = "UPDATE `transfert` SET `TRS_VALIDE`= '{$statut}',`TRS_DATEVALID`='" . date('Y-m-d H:i:s') . "' WHERE CODE_TRANSFERT LIKE '" . addslashes($xid) . "'; "; //echo $sql; 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
require_once '../lib/phpfuncLib.php'; //All commun functions require_once 'menus.php'; require_once 'funcresponsable.php'; $droit = getDroit('GRP_PERSONNEL ,GRP_UTILISATEUR, GRP_GROUPE, GRP_LOG, GRP_CATEGORIE, GRP_PRODUIT, GRP_CONDITIONNEMENT, GRP_UNITE, GRP_BAREME, GRP_REGION, GRP_PROVINCE, GRP_TYPESERVICE, GRP_SERVICE, GRP_MAGASIN, GRP_RESPONSABLE, GRP_FOURNISSEUR, GRP_TYPEBENEFICIAIRE, GRP_BENEFICIAIRE, GRP_AFFECTATION, GRP_DONNANNUELLE, GRP_EXERCICE, GRP_TYPEDOTATION, GRP_PARAMETRE, GRP_DB', $_SESSION['GL_USER']['GROUPE']); $droitTOPMENUS = getDroitTOPMENUS($_SESSION['GL_USER']['GROUPE']); $droitMAJ = getDroitMAJ('GRP_RESPONSABLE', $_SESSION['GL_USER']['GROUPE']); isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { $where = ""; isset($_POST['personnel']) && $_POST['personnel'] != '0' ? $where .= "respmagasin.NUM_MLLE = '" . addslashes(trim($_POST['personnel'])) . "' AND " : ($where .= ""); isset($_POST['magasin']) && $_POST['magasin'] != '0' ? $where .= "respmagasin.CODE_MAGASIN LIKE '" . addslashes(trim($_POST['magasin'])) . "' AND " : ($where .= ""); isset($_POST['datedebut']) && $_POST['datedebut'] != '' ? $where .= "respmagasin.RES_DATEDEBUT >= '" . mysqlFormat(trim($_POST['datedebut'])) . "' AND " : ($where .= ""); isset($_POST['datefin']) && $_POST['datefin'] != '' ? $where .= "respmagasin.RES_DATEFIN <= '" . mysqlFormat(trim($_POST['datefin'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'magasin.php?selectedTab=par&do=search'; $retour = ligneConResponsable($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'magasin.php?selectedTab=par'; $retour = ligneConResponsable('', '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } $pageLengh = pageLengh($_SESSION['GL_USER']['ELEMENT']);
$msg = '<div class="errorMsg">' . stripslashes($text) . '</div>'; } isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { $where = " (transfert.CODE_MAGASIN LIKE '" . addslashes(trim($_SESSION['GL_USER']['MAGASIN'])) . "' ) AND "; isset($_POST['codetransfert']) && $_POST['codetransfert'] != '' ? $where .= "transfert.CODE_TRANSFERT LIKE '" . addslashes(trim($_POST['codetransfertement'])) . "' AND " : ($where .= ""); isset($_POST['datetransfert']) && $_POST['datetransfert'] != '' ? $date1 = $_POST['datetransfert'] : ($date1 = ''); isset($_POST['datetransfert1']) && $_POST['datetransfert1'] != '' ? $date2 = $_POST['datetransfert1'] : ($date2 = ''); if ($date1 != '' && $date2 != '') { $where .= "transfert.TRS_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND transfert.TRS_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 == '' && $date2 != '') { $where .= "transfert.TRS_DATE >= '" . addslashes(mysqlFormat(trim($date2))) . "' AND transfert.TRS_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 != '' && $date2 == '') { $where .= "transfert.TRS_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND transfert.TRS_DATE <= '" . addslashes(mysqlFormat(trim($date1))) . "' AND "; } isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "transfert.TRS_VALIDE = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'transfert.php?selectedTab=bds&do=search'; $retour = ligneConTransfert($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'transfert.php?selectedTab=bds'; $retour = ligneConTransfert('transfert.ID_EXERCICE=' . $_SESSION['GL_USER']['EXERCICE'] . " AND (transfert.CODE_MAGASIN LIKE '" . addslashes(trim($_SESSION['GL_USER']['MAGASIN'])) . "' ) ", '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt
//Execute prepared SQL => $query updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'un mouvement(' . $xid . ', déclassement n°' . $codereconditionnement . ')'); //updateLog($username, $idcust, $action='' ) } unset($_SESSION['DATA_RECD']); header('location:reconditionnement.php?selectedTab=mvt&rst=1'); break; case 'update': isset($_POST['xid']) && $_POST['xid'] != '' ? $xid = trim($_POST['xid']) : ($xid = ''); isset($_POST['exercice']) && $_POST['exercice'] != '' ? $exercice = trim($_POST['exercice']) : ($exercice = ''); isset($_POST['datesortie']) && $_POST['datesortie'] != '' ? $datesortie = trim($_POST['datesortie']) : ($datesortie = ''); isset($_POST['codereconditionnement']) && $_POST['codereconditionnement'] != '' ? $codereconditionnement = trim($_POST['codereconditionnement']) : ($codereconditionnement = ''); isset($_POST['raison']) && $_POST['raison'] != '' ? $raison = trim($_POST['raison']) : ($raison = ''); isset($_POST['nbreLigne']) && $_POST['nbreLigne'] != '' ? $nbreLigne = trim($_POST['nbreLigne']) : ($nbreLigne = ''); isset($_POST['statut']) && $_POST['statut'] == '1' ? $statut = trim($_POST['statut']) : ($statut = '0'); $datesortie = mysqlFormat($datesortie); $magasin = 'MAG0'; //Insert $sql = "UPDATE `recondit` SET `ID_EXERCICE`='" . addslashes($exercice) . "' ,`REC_RAISON`='" . addslashes($raison) . "' ,`REC_DATESORTIE`='" . addslashes($datesortie) . "' ,`REC_VALIDE`='{$statut}' ,`CODE_RECOND`='" . addslashes($codereconditionnement) . "') "; $sql .= "WHERE ID_RECONDIT='{$xid}'"; 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();
} elseif (isset($_GET['rs']) && $_GET['rs'] == 4) { $text = "Les données ont été supprimées"; $msg = '<div class="okMsg">' . stripslashes($text) . '</div>'; } elseif (isset($_GET['rs']) && $_GET['rs'] == 0) { $text = "Une erreur s'est produite"; $msg = '<div class="errorMsg">' . stripslashes($text) . '</div>'; } isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { $where = " CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND "; isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "inventaire.ID_EXERCICE = '" . addslashes(trim($_POST['exercice'])) . "' AND " : ($where .= ""); isset($_POST['inventaire']) && $_POST['inventaire'] != '' ? $where .= "livraison.INV_LIBELLE = '" . addslashes(trim($_POST['inventaire'])) . "%' AND " : ($where .= ""); isset($_POST['codeinventaire']) && $_POST['codeinventaire'] != '' ? $where .= "inventaire.CODE_INVENTAIRE = '" . addslashes(trim($_POST['codeinventaire'])) . "' AND " : ($where .= ""); isset($_POST['dateinventaire']) && $_POST['dateinventaire'] != '' ? $where .= "inventaire.INV_DATE = '" . addslashes(mysqlFormat(trim($_POST['dateinventaire']))) . "' AND " : ($where .= ""); isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "inventaire.INV_VALIDE = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'inventaire.php?selectedTab=cde&do=search'; $retour = ligneConInventarie($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'inventaire.php?selectedTab=cde'; $retour = ligneConInventarie('inventaire.ID_EXERCICE=' . $_SESSION['GL_USER']['EXERCICE'] . " AND CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "'", '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt }
//Prepare the SQL $query->execute(); //Execute prepared SQL => $query updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Ajout d\'un responsable (' . $personnel . ', ' . $personnel . ')'); //updateLog($username, $idcust, $action='' ) header('location:responsable.php?selectedTab=par&rs=1'); break; //SERVICE //SERVICE case 'update': isset($_POST['magasin']) && $_POST['magasin'] != '0' ? $magasin = trim($_POST['magasin']) : ($magasin = ''); isset($_POST['personnel']) && $_POST['personnel'] != '0' ? $personnel = trim($_POST['personnel']) : ($personnel = ''); isset($_POST['datedebut']) && $_POST['datedebut'] != '' ? $datedebut = trim($_POST['datedebut']) : ($datedebut = ''); isset($_POST['datefin']) && $_POST['datefin'] != '' ? $datefin = trim($_POST['datefin']) : ($datefin = ''); $datedebut = mysqlFormat($datedebut); $datefin = mysqlFormat($datefin); isset($_POST['id']) && $_POST['id'] != '' ? $id = trim($_POST['id']) : ($id = ''); //SQL $sql = "UPDATE `respmagasin` SET `NUM_MLLE`='" . addslashes($personnel) . "' ,`CODE_MAGASIN`='" . addslashes($magasin) . "' ,`RES_DATEDEBUT`='" . addslashes($datedebut) . "' ,\r\n\t\t`RES_DATEFIN`='" . addslashes($datefin) . "' WHERE ID_RESPO={$id}"; 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
// if (isset($_GET['do']) && $_GET['do'] == "search") { $_SESSION['WHERE'] = ''; $where = " "; isset($_POST['datebonsortie']) && $_POST['datebonsortie'] != '' ? $date1 = $_POST['datebonsortie'] : ($date1 = ''); isset($_POST['datebonsortie1']) && $_POST['datebonsortie1'] != '' ? $date2 = $_POST['datebonsortie1'] : ($date2 = ''); $where = " bonsortie.CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND "; isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "bonsortie.ID_EXERCICE = '" . addslashes(trim($_POST['exercice'])) . "' AND " : ($where .= ""); isset($_POST['idbeneficiaire']) && $_POST['idbeneficiaire'] != '' ? $where .= "bonsortie.ID_BENEF = '" . addslashes(trim($_POST['idbeneficiaire'])) . "' AND " : ($where .= ""); isset($_POST['codebonsortie']) && $_POST['codebonsortie'] != '' ? $where .= "bonsortie.CODE_bonsortie LIKE '" . addslashes(trim($_POST['codebonsortie'])) . "' AND " : ($where .= ""); if ($date1 != '' && $date2 != '') { $where .= "bonsortie.SOR_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND bonsortie.SOR_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 == '' && $date2 != '') { $where .= "bonsortie.SOR_DATE >= '" . addslashes(mysqlFormat(trim($date2))) . "' AND bonsortie.SOR_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 != '' && $date2 == '') { $where .= "bonsortie.SOR_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND bonsortie.SOR_DATE <= '" . addslashes(mysqlFormat(trim($date1))) . "' AND "; } isset($_POST['idbeneficiaire']) && $_POST['idbeneficiaire'] != '' ? $where .= "bonsortie.ID_BENEF = '" . addslashes(trim($_POST['idbeneficiaire'])) . "' AND " : ($where .= ""); isset($_POST['libelle']) && $_POST['libelle'] != '' ? $where .= "bonsortie.DOT_LIBELLE = '" . addslashes(trim($_POST['libelle'])) . "' AND " : ($where .= ""); isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "bonsortie.DOT_VALIDE = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'bonsortie.php?selectedTab=bds&do=search'; $retour = ligneConBonsortie($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'bonsortie.php?selectedTab=bds';
if (isset($_GET['do']) && $_GET['do'] == "search") { $_SESSION['WHERE'] = ''; $where = " dotation.CODE_NDOTATION NOT LIKE 'ADOT' AND "; isset($_POST['datedotation']) && $_POST['datedotation'] != '' ? $date1 = $_POST['datedotation'] : ($date1 = ''); isset($_POST['datedotation1']) && $_POST['datedotation1'] != '' ? $date2 = $_POST['datedotation1'] : ($date2 = ''); $where = " dotation.CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND "; isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "dotation.ID_EXERCICE = '" . addslashes(trim($_POST['exercice'])) . "' AND " : ($where .= ""); $where = " dotation.CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND "; isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "dotation.ID_EXERCICE = '" . addslashes(trim($_POST['exercice'])) . "' AND " : ($where .= ""); isset($_POST['codedotation']) && $_POST['codedotation'] != '' ? $where .= "dotation.CODE_CODE_DOTATION LIKE '" . addslashes(trim($_POST['codedotation'])) . "' AND " : ($where .= ""); if ($date1 != '' && $date2 != '') { $where .= "dotation.DOT_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND dotation.DOT_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 == '' && $date2 != '') { $where .= "dotation.DOT_DATE >= '" . addslashes(mysqlFormat(trim($date2))) . "' AND dotation.DOT_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 != '' && $date2 == '') { $where .= "dotation.DOT_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND dotation.DOT_DATE <= '" . addslashes(mysqlFormat(trim($date1))) . "' AND "; } isset($_POST['typedotation']) && $_POST['typedotation'] != '0' ? $where .= "dotation.CODE_NDOTATION LIKE '" . addslashes(trim($_POST['typedotation'])) . "' AND " : ($where .= ""); isset($_POST['beneficiaire']) && $_POST['beneficiaire'] != '0' ? $where .= "dotation.ID_BENEF = '" . addslashes(trim($_POST['beneficiaire'])) . "' AND " : ($where .= ""); isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "dotation.DOT_VALIDE = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'autredotation.php?selectedTab=mvt&do=search'; $retour = ligneConAutreDotation($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'autredotation.php?selectedTab=mvt';
$query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query $insert_id = $cnx->lastInsertId(); updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'un reversement (' . $xid . ', programmation ' . $programmation . ')'); //updateLog($username, $idcust, $action='' ) unset($_SESSION['DATA_REV']); header('location:reversement.php?selectedTab=prg&rst=1'); break; case 'validate': isset($_POST['xid']) && $_POST['xid'] != '' ? $xid = trim($_POST['xid']) : ($xid = ''); isset($_POST['exercice']) && $_POST['exercice'] != '' ? $exercice = trim($_POST['exercice']) : ($exercice = ''); isset($_POST['datereversement']) && $_POST['datereversement'] != '' ? $datereversement = trim($_POST['datereversement']) : ($datereversement = ''); isset($_POST['programmation']) && $_POST['programmation'] != '0' ? $programmation = trim($_POST['programmation']) : ($programmation = ''); $datereversement = mysqlFormat($datereversement); isset($_POST['mnttotal']) && $_POST['mnttotal'] != '' ? $mnttotal = trim($_POST['mnttotal']) : ($mnttotal = ''); isset($_POST['mntregle']) && $_POST['mntregle'] != '' ? $mntregle = trim($_POST['mntregle']) : ($mntregle = ''); isset($_POST['mntverse']) && $_POST['mntverse'] != '' ? $mntverse = trim($_POST['mntverse']) : ($mntverse = ''); isset($_POST['quittance']) && $_POST['quittance'] != '' ? $quittance = trim($_POST['quittance']) : ($quittance = ''); isset($_POST['statut']) && $_POST['statut'] == '1' ? $statut = trim($_POST['statut']) : ($statut = '0'); $magasin = $_SESSION['GL_USER']['MAGASIN']; $exercice = $_SESSION['GL_USER']['EXERCICE']; //Insert $sql = "UPDATE `reversement` SET `ID_PROGR`='" . addslashes($programmation) . "' ,`ID_EXERCICE`='" . addslashes($exercice) . "' ,`REV_DATE`='" . addslashes($datereversement) . "' ,`REV_VALID`='" . addslashes($statut) . "' ,"; $sql .= "`REV_DATEVALID`='" . date('Y-m-d') . "' ,`REV_MNTTOTAL`='" . addslashes($mnttotal) . "' ,`REV_MNTVERSE`='" . addslashes($mntverse) . "' WHERE ID_REVERSEMENT={$xid};"; try { $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); //Connexion to database } catch (PDOException $error) { //Treat error
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; }
//echo $sql, $sql1, $sql2; header('location:reconditionnement.php?selectedTab=bds&rst=1'); break; case 'validate': isset($_POST['xid']) && $_POST['xid'] != '' ? $xid = trim($_POST['xid']) : ($xid = ''); isset($_POST['exercice']) && $_POST['exercice'] != '' ? $exercice = trim($_POST['exercice']) : ($exercice = ''); isset($_POST['datesortie']) && $_POST['datesortie'] != '' ? $datesortie = trim($_POST['datesortie']) : ($datesortie = ''); isset($_POST['dateentree']) && $_POST['dateentree'] != '' ? $dateentree = trim($_POST['dateentree']) : ($dateentree = ''); isset($_POST['codereconditionnement']) && $_POST['codereconditionnement'] != '' ? $codereconditionnement = trim($_POST['codereconditionnement']) : ($codereconditionnement = ''); isset($_POST['raison']) && $_POST['raison'] != '' ? $raison = trim($_POST['raison']) : ($raison = ''); isset($_POST['nbreLigne']) && $_POST['nbreLigne'] != '' ? $nbreLigne = trim($_POST['nbreLigne']) : ($nbreLigne = ''); isset($_POST['controleur']) && $_POST['controleur'] != '' ? $controleur = trim($_POST['controleur']) : ($controleur = ''); isset($_POST['libelleetat']) && $_POST['libelleetat'] != '' ? $libelleetat = trim($_POST['libelleetat']) : ($libelleetat = ''); isset($_POST['statut']) && $_POST['statut'] == '1' ? $statut = trim($_POST['statut']) : ($statut = '0'); $datesortie = mysqlFormat($datesortie); $dateentree = mysqlFormat($dateentree); $magasin = $_SESSION['GL_USER']['MAGASIN']; //Insert $sql = "UPDATE `recondit` SET `ID_EXERCICE`='" . addslashes($exercice) . "' ,`REC_RAISON`='" . addslashes($raison) . "' ,`REC_DATESORTIE`='" . addslashes($datesortie) . "', `REC_DATERETOUR`='" . addslashes($dateentree) . "' ,"; $sql .= "`REC_VALIDE`='{$statut}' , `CODE_MAGASIN`='" . addslashes($magasin) . "', `CODE_RECOND`='" . addslashes($codereconditionnement) . "',`REC_LIBELLE`='" . addslashes($libelleetat) . "' WHERE ID_RECONDIT='{$xid}'"; 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();
} // if (isset($_GET['do']) && $_GET['do'] == "search") { $where = ''; $_SESSION['WHERE'] = ''; isset($_POST['datecommande']) && $_POST['datecommande'] != '' ? $date1 = $_POST['datecommande'] : ($date1 = ''); isset($_POST['datecommande1']) && $_POST['datecommande1'] != '' ? $date2 = $_POST['datecommande1'] : ($date2 = ''); $where = " CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND "; isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "commande.ID_EXERCICE = '" . addslashes(trim($_POST['exercice'])) . "' AND " : ($where .= ""); isset($_POST['codecommande']) && $_POST['codecommande'] != '' ? $where .= "commande.CODE_COMMANDE LIKE '" . addslashes(trim($_POST['codecommande'])) . "' AND " : ($where .= ""); if ($date1 != '' && $date2 != '') { $where .= "commande.CDE_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND commande.CDE_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 == '' && $date2 != '') { $where .= "commande.CDE_DATE >= '" . addslashes(mysqlFormat(trim($date2))) . "' AND commande.CDE_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 != '' && $date2 == '') { $where .= "commande.CDE_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND commande.CDE_DATE <= '" . addslashes(mysqlFormat(trim($date1))) . "' AND "; } isset($_POST['libellecde']) && $_POST['libellecde'] != '' ? $where .= "commande.CDE_LIBELLE LIKE '" . addslashes(trim($_POST['libellecde'])) . "%' AND " : ($where .= ""); isset($_POST['fournisseur']) && $_POST['fournisseur'] != '0' ? $where .= "commande.CODE_FOUR = '" . addslashes(trim($_POST['fournisseur'])) . "' AND " : ($where .= ""); isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "commande.CDE_STATUT = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'order.php?selectedTab=cde&do=search'; $retour = ligneConCommande($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'order.php?selectedTab=cde';
updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], "Ajout des lignes de commandes ({$codeCde}, {$libellecde})"); //updateLog($username, $idcust, $action='' ) } unset($_SESSION['DATA_CDE']); header('location:commande.php?selectedTab=bde&rs=1'); break; case 'update': isset($_POST['xid']) && $_POST['xid'] != '' ? $xid = trim($_POST['xid']) : ($xid = ''); isset($_POST['exercice']) && $_POST['exercice'] != '' ? $exercice = trim($_POST['exercice']) : ($exercice = ''); isset($_POST['datecommande']) && $_POST['datecommande'] != '' ? $datecommande = trim($_POST['datecommande']) : ($datecommande = ''); isset($_POST['refcommande']) && $_POST['refcommande'] != '' ? $refcommande = trim($_POST['refcommande']) : ($refcommande = ''); isset($_POST['libellecde']) && $_POST['libellecde'] != '' ? $libellecde = trim($_POST['libellecde']) : ($libellecde = ''); isset($_POST['fournisseur']) && $_POST['fournisseur'] != '0' ? $fournisseur = trim($_POST['fournisseur']) : ($fournisseur = ''); isset($_POST['nbreLigne']) && $_POST['nbreLigne'] != '' ? $nbreLigne = trim($_POST['nbreLigne']) : ($nbreLigne = ''); isset($_POST['statut']) && $_POST['statut'] == '1' ? $statut = trim($_POST['statut']) : ($statut = '0'); $datecommande = mysqlFormat($datecommande); $magasin = $_SESSION['GL_USER']['MAGASIN']; $exercice = $_SESSION['GL_USER']['EXERCICE']; //$statut = 1; //Update $sql = "UPDATE `commande` SET `ID_EXERCICE`='" . addslashes($exercice) . "' ,`CODE_FOUR`='" . addslashes($fournisseur) . "' ,`REF_COMMANDE`='" . addslashes($refcommande) . "' ,\r\n\t\t`CDE_LIBELLE`='" . addslashes($libellecde) . "' ,`CDE_DATE`='" . addslashes($datecommande) . "' ,`CDE_STATUT`= '{$statut}' WHERE CODE_COMMANDE LIKE '" . addslashes($xid) . "'"; 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
isset($_POST['service']) && $_POST['service'] != '' ? $service = trim($_POST['service']) : ($service = ''); isset($_POST['csps']) && $_POST['csps'] != '' ? $csps = trim($_POST['csps']) : ($csps = ''); isset($_POST['pays']) && $_POST['pays'] != '' ? $pays = trim($_POST['pays']) : ($pays = ''); isset($_POST['ville']) && $_POST['ville'] != '' ? $ville = trim($_POST['ville']) : ($ville = ''); isset($_POST['devise']) && $_POST['devise'] != '' ? $devise = trim($_POST['devise']) : ($devise = ''); isset($_POST['signateur1']) && $_POST['signateur1'] != '' ? $signateur1 = trim($_POST['signateur1']) : ($signateur1 = ''); isset($_POST['nomsignateur1']) && $_POST['nomsignateur1'] != '' ? $nomsignateur1 = trim($_POST['nomsignateur1']) : ($nomsignateur1 = ''); isset($_POST['signateur2']) && $_POST['signateur2'] != '' ? $signateur2 = trim($_POST['signateur2']) : ($signateur2 = ''); isset($_POST['nomsignateur2']) && $_POST['nomsignateur2'] != '' ? $nomsignateur2 = trim($_POST['nomsignateur2']) : ($nomsignateur2 = ''); isset($_POST['signateur3']) && $_POST['signateur3'] != '' ? $signateur3 = trim($_POST['signateur3']) : ($signateur3 = ''); isset($_POST['nomsignateur3']) && $_POST['nomsignateur3'] != '' ? $nomsignateur3 = trim($_POST['nomsignateur3']) : ($nomsignateur3 = ''); isset($_POST['signateur4']) && $_POST['signateur4'] != '' ? $signateur4 = trim($_POST['signateur4']) : ($signateur4 = ''); isset($_POST['nomsignateur4']) && $_POST['nomsignateur4'] != '' ? $nomsignateur4 = trim($_POST['nomsignateur4']) : ($nomsignateur4 = ''); isset($_POST['validauto']) && $_POST['validauto'] != '' ? $validauto = trim($_POST['validauto']) : ($validauto = ''); isset($_POST['magasin']) && $_POST['magasin'] != '0' ? $magasin = trim($_POST['magasin']) : ($magasin = ''); $dateacq = mysqlFormat($dateacq); $magasin = $_SESSION['GL_USER']['MAGASIN']; $extensions_valides = array("image/jpg" => 'jpg', "image/gif" => 'gif', "image/png" => 'png', "image/x-png" => 'png'); $flogo = ''; if (isset($oldcodeinfogle) && $oldcodeinfogle != '') { if ($_FILES["logo"]["error"] > 0) { //echo "Error: " . $_FILES["logo"]["error"] . "<br>"; } else { $flogo = ''; if (isset($_FILES["logo"]["name"]) && ($_FILES["logo"]["type"] == "image/gif" || $_FILES["logo"]["type"] == "image/jpg" || $_FILES["logo"]["type"] == "image/x-png" || $_FILES["logo"]["type"] == "image/png") && $_FILES["logo"]["size"] < 50000) { $flogo = "logo_" . trim($id) . '.' . $extensions_valides[$_FILES["logo"]["type"]]; move_uploaded_file($_FILES["logo"]["tmp_name"], "../upload/{$flogo}"); } $sql = "UPDATE `infogenerale` SET CODE_MAGASIN ='" . addslashes($magasin) . "', `INF_CLIENT`='" . addslashes($client) . "', `INF_DATEACQ`='" . addslashes($dateacq) . "', `INF_LICENCE`='" . addslashes($licence) . "', `INF_MINISTERE`='" . addslashes($ministere) . "',\r\n\t\t\t `INF_SECRETARIAT`='" . addslashes($secretariat) . "', `LOGO`='" . addslashes($flogo) . "', `INF_DIRECTION`='" . addslashes($direction) . "', `INF_SERVICE`='" . addslashes($service) . "', `INF_CSPS`='" . addslashes($csps) . "',`INF_PAYS`='" . addslashes($pays) . "', `INF_DEVISE`='" . addslashes($devise) . "',\r\n\t\t\t `INF_VILLE`='" . addslashes($ville) . "', `INF_SIGNATEUR1`='" . addslashes($signateur1) . "', `INF_NOMSIGNATEUR1`='" . addslashes($nomsignateur1) . "', `INF_SIGNATEUR2`='" . addslashes($signateur2) . "', `INF_NOMSIGNATEUR2`='" . addslashes($nomsignateur2) . "',\r\n\t\t\t `INF_SIGNATEUR3`='" . addslashes($signateur3) . "', `INF_NOMSIGNATEUR3`='" . addslashes($nomsignateur3) . "',`INF_SIGNATEUR4`='" . addslashes($signateur4) . "', `INF_NOMSIGNATEUR4`='" . addslashes($nomsignateur4) . "',\r\n\t\t\t `INF_VALIDAUTO`='" . addslashes($validauto) . "', `INF_MAGASIN`='" . addslashes($magasin) . "' WHERE CODE_INFGLE LIKE '{$oldcodeinfogle}' ;"; } } else {
} isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { isset($_POST['datedeclassement']) && $_POST['datedeclassement'] != '' ? $date1 = $_POST['datedeclassement'] : ($date1 = ''); isset($_POST['datedeclassement1']) && $_POST['datedeclassement1'] != '' ? $date2 = $_POST['datedeclassement1'] : ($date2 = ''); $where = " CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "' AND "; isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "declass.ID_EXERCICE = '" . addslashes(trim($_POST['exercice'])) . "' AND " : ($where .= ""); isset($_POST['codedeclassement']) && $_POST['codedeclassement'] != '' ? $where .= "declass.CODE_DECLAS LIKE '" . addslashes(trim($_POST['codedeclassement'])) . "' AND " : ($where .= ""); if ($date1 != '' && $date2 != '') { $where .= "declass.DCL_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND declass.DCL_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 == '' && $date2 != '') { $where .= "declass.DCL_DATE >= '" . addslashes(mysqlFormat(trim($date2))) . "' AND declass.DCL_DATE <= '" . addslashes(mysqlFormat(trim($date2))) . "' AND "; } elseif ($date1 != '' && $date2 == '') { $where .= "declass.DCL_DATE >= '" . addslashes(mysqlFormat(trim($date1))) . "' AND declass.DCL_DATE <= '" . addslashes(mysqlFormat(trim($date1))) . "' AND "; } isset($_POST['raison']) && $_POST['raison'] != '' ? $where .= "declass.DCL_RAISON LIKE '" . addslashes(trim($_POST['raison'])) . "%' AND " : ($where .= ""); isset($_POST['statut']) && $_POST['statut'] == '1' ? $where .= "declass.DCL_VALIDE = '" . addslashes(trim($_POST['statut'])) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'declassement.php?selectedTab=cde&do=search'; $retour = ligneConDeclassement($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'declassement.php?selectedTab=cde'; $retour = ligneConDeclassement('declass.ID_EXERCICE=' . $_SESSION['GL_USER']['EXERCICE'] . " AND CODE_MAGASIN LIKE '" . $_SESSION['GL_USER']['MAGASIN'] . "'", '', '', $page, $_SESSION['GL_USER']['ELEMENT']);
$Ref = ''; $Per = ''; foreach ($xreference as $key => $val) { isset($val) && $val != '' ? $Ref .= " {$table1}.ID_INVENTAIRE='{$val}' OR " : ($Ref .= ''); } //Référence if (isset($xdateDebut) && $xdateDebut != '' && isset($xdateFin) && $xdateFin != '') { $Per .= " ({$table1}.DATE_INVENTAIRE >='" . addslashes(mysqlFormat($xdateDebut)) . "' AND {$table1}.DATE_INVENTAIRE <='" . addslashes(mysqlFormat($xdateFin)) . "') OR "; } //Date fin if (isset($xdateFin) && $xdateFin != '' && $xdateDebut == '') { $Per .= " {$table1}.DATE_INVENTAIRE ='" . addslashes(mysqlFormat($xdateFin)) . "' OR "; } //Date début if (isset($xdateDebut) && $xdateDebut != '' && $xdateFin == '') { $Per .= " {$table1}.DATE_INVENTAIRE ='" . addslashes(mysqlFormat($xdateDebut)) . "' OR "; } //Date fin if ($Ref != '') { $Where .= "(" . substr($Ref, 0, strlen($Ref) - 3) . ") AND "; } if ($Per != '') { $Where .= "(" . substr($Per, 0, strlen($Per) - 3) . ") AND "; } if ($Where != '') { $Where = substr($Where, 0, strlen($Where) - 4); } //SQL $SQL = "SELECT * FROM {$table1}, {$table2}, {$table3} {$Where};"; $result = mysql_query($SQL) or header('location:errorPage.php&code='); $SQL = "SELECT * FROM {$table1}, {$table2}, {$table3} {$Where} GROUP BY {$table1}.ID_INVENTAIRE;";
$leftMenu = parametersMenus($selectedTab, $_SESSION['GL_USER']['DROIT']); //DOIT MAJ $droitMAJ = $_SESSION['GL_USER']['DROIT']['par_log']; //Rsest if (isset($_GET['rst']) && $_GET['rst'] == 1) { $_SESSION['WHERE'] = ""; } isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { $where = ""; $_SESSION['WHERE'] = ''; isset($_POST['utilisateur']) && $_POST['utilisateur'] != '0' ? $where .= "logs.LOGIN LIKE '" . addslashes(trim($_POST['utilisateur'])) . "' AND " : ($where .= ""); isset($_POST['datelog1']) && $_POST['datelog1'] != '' ? $where .= "logs.LOG_DATE >= '" . addslashes(trim(mysqlFormat($_POST['datelog1']))) . "' AND " : ($where .= ""); isset($_POST['datelog2']) && $_POST['datelog2'] != '' ? $where .= "logs.LOG_DATE <= '" . addslashes(trim(mysqlFormat($_POST['datelog2']))) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'log.php?selectedTab=par&do=search'; $retour = ligneConLog($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'log.php?selectedTab=par'; $retour = ligneConLog('', '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } $pageLengh = pageLengh($_SESSION['GL_USER']['ELEMENT']);
$query = $cnx->prepare($sql); //Prepare the SQL $query->execute(); //Execute prepared SQL => $query $row = $query->fetch(PDO::FETCH_ASSOC); if ($row['NBRE'] > 0) { $msg = '<BR><img src="../images/alarm_un.gif" width="16" height="16" align="absmiddle"> Ce code existe déjà, veuillez entrer un autre code transfert.'; } } echo $msg; break; case 'sendDate': $msg = ""; isset($_POST['code']) && $_POST['code'] != '' ? $code = trim($_POST['code']) : ($code = ''); if ($code != '') { $_SESSION['GL_USER']['JOUR'] = mysqlFormat($code); } echo 1; break; default: ///Nothing //header('location:../index.php'); } } elseif ($myaction != '') { //myaction switch ($myaction) { case 'addline': isset($_POST['exercice']) && $_POST['exercice'] != '' ? $exercice = trim($_POST['exercice']) : ($exercice = ''); isset($_POST['datetransfert']) && $_POST['datetransfert'] != '' ? $datetransfert = trim($_POST['datetransfert']) : ($datetransfert = ''); isset($_POST['reftransfert']) && $_POST['reftransfert'] != '' ? $reftransfert = trim($_POST['reftransfert']) : ($reftransfert = ''); isset($_POST['magasin_srce']) && $_POST['magasin_srce'] != '' ? $magasin_srce = trim($_POST['magasin_srce']) : ($raison = '');
header('location:beneficiaire.php?selectedTab=par&rs=1'); break; //UPDATE BENEFICIAIRE //UPDATE BENEFICIAIRE case 'update': isset($_POST['oldcodebeneficiaire']) && $_POST['oldcodebeneficiaire'] != '' ? $oldcodebeneficiaire = trim($_POST['oldcodebeneficiaire']) : ($oldcodebeneficiaire = ''); isset($_POST['codebeneficiaire']) && $_POST['codebeneficiaire'] != '' ? $codebeneficiaire = trim($_POST['codebeneficiaire']) : ($codebeneficiaire = ''); isset($_POST['beneficiaire']) && $_POST['beneficiaire'] != '' ? $beneficiaire = trim($_POST['beneficiaire']) : ($beneficiaire = ''); isset($_POST['abbrege']) && $_POST['abbrege'] != '' ? $abbrege = trim($_POST['abbrege']) : ($abbrege = ''); isset($_POST['typebeneficiaire']) && $_POST['typebeneficiaire'] != '0' ? $typebeneficiaire = trim($_POST['typebeneficiaire']) : ($typebeneficiaire = ''); isset($_POST['tel']) && $_POST['tel'] != '' ? $tel = trim($_POST['tel']) : ($tel = ''); isset($_POST['email']) && $_POST['email'] != '' ? $email = trim($_POST['email']) : ($email = ''); isset($_POST['province']) && $_POST['province'] != '0' ? $province = trim($_POST['province']) : ($province = ''); isset($_POST['ville']) && $_POST['ville'] != '' ? $ville = trim($_POST['ville']) : ($ville = ''); isset($_POST['id']) && $_POST['id'] != '' ? $id = trim($_POST['id']) : ($id = ''); $dateintegration = mysqlFormat($dateintegration); //SQL $sql = "UPDATE `beneficiaire` SET `CODE_TYPEBENEF`='" . addslashes($typebeneficiaire) . "' ,`CODE_BENEF`='" . addslashes($codebeneficiaire) . "' ,`BENEF_NOM`='" . addslashes($beneficiaire) . "' ,\r\n\t\t`BENEF_EBREVIATION`='" . addslashes($abbrege) . "' ,`BENEF_TEL`='" . addslashes($tel) . "' ,`BENEF_VILLE`='" . addslashes($ville) . "' ,\r\n\t\t`BENEF_EMAIL`='" . addslashes($email) . "',`IDPROVINCE`='" . addslashes($province) . "' WHERE CODE_BENEF LIKE '" . addslashes($oldcodebeneficiaire) . "' "; 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 updateLog($_SESSION['GL_USER']['MAGASIN'], $_SESSION['GL_USER']['LOGIN'], $_SESSION['GL_USER']['MLLE'], 'Modification d\'un bénéficiaire (' . $codebeneficiaire . ', ' . $beneficiaire . ')');
$menu = topMenus($selectedTab, $_SESSION['GL_USER']['DROIT']); //Left Menu $leftMenu = parametersMenus($selectedTab, $_SESSION['GL_USER']['DROIT']); //DOIT MAJ $droitMAJ = $_SESSION['GL_USER']['DROIT']['par_bud']; isset($_GET['page']) ? $page = $_GET['page'] : ($page = 1); isset($_POST['viewLength']) ? $_SESSION['GL_USER']['ELEMENT'] = $_POST['viewLength'] : ''; // if (isset($_GET['do']) && $_GET['do'] == "search") { $where = ""; isset($_POST['codeexercice']) && $_POST['codeexercice'] != '' ? $where .= "exercice.ID_EXERCICE LIKE '" . addslashes(trim($_POST['codeexercice'])) . "' AND " : ($where .= ""); isset($_POST['exercice']) && $_POST['exercice'] != '' ? $where .= "exercice.EX_LIBELLE LIKE '" . addslashes(trim($_POST['exercice'])) . "%' AND " : ($where .= ""); isset($_POST['datedebut']) && $_POST['datedebut'] != '' ? $where .= "exercice.EX_DATEDEBUT = '" . addslashes(mysqlFormat(trim($_POST['datedebut']))) . "' AND " : ($where .= ""); isset($_POST['datefin']) && $_POST['datefin'] != '' ? $where .= "exercice.EX_DATEFIN = '" . addslashes(mysqlFormat(trim($_POST['datefin']))) . "' AND " : ($where .= ""); isset($_POST['cloture']) && $_POST['cloture'] != '' ? $where .= "exercice.EX_CLOTURE = '" . addslashes(trim($_POST['cloture'])) . "' AND " : ($where .= ""); isset($_POST['datecloture']) && $_POST['datecloture'] != '' ? $where .= "exercice.EX_DATECLOTURE = '" . addslashes(mysqlFormat(trim($_POST['datecloture']))) . "' AND " : ($where .= ""); if ($where != '') { $where = substr($where, 0, strlen($where) - 4); $_SESSION['WHERE'] = $where; } elseif ($_SESSION['WHERE'] != '') { $where = $_SESSION['WHERE']; } $link = 'exercice.php?selectedTab=par&do=search'; $retour = ligneConExercice($where, '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } else { $link = 'exercice.php?selectedTab=par'; $retour = ligneConExercice('', '', '', $page, $_SESSION['GL_USER']['ELEMENT']); //$where, $order, $sens, $page=1, $nelt } $pageLengh = pageLengh($_SESSION['GL_USER']['ELEMENT']);
//Top Menu $selectedTab = $_GET['selectedTab']; $menu = topMenus($selectedTab, $_SESSION['GL_USER']['DROIT']); //Left Menu $leftMenu = parametersMenus($selectedTab, $_SESSION['GL_USER']['DROIT']); //DOIT MAJ $droitMAJ = $_SESSION['GL_USER']['DROIT']['par_ben']; isset($_SESSION['DATA_BE']['CODE_BENEF']) ? $codebeneficiaire = $_SESSION['DATA_BE']['CODE_BENEF'] : ($codebeneficiaire = ''); isset($_SESSION['DATA_BE']['BENEF_NOM']) ? $beneficiaire = $_SESSION['DATA_BE']['BENEF_NOM'] : ($beneficiaire = ''); isset($_SESSION['DATA_BE']['BENEF_EBREVIATION']) ? $abbrege = $_SESSION['DATA_BE']['BENEF_EBREVIATION'] : ($abbrege = ''); isset($_SESSION['DATA_BE']['CODE_TYPEBENEF']) ? $typebeneficiaire = $_SESSION['DATA_BE']['CODE_TYPEBENEF'] : ($typebeneficiaire = ''); isset($_SESSION['DATA_BE']['BENEF_TEL']) ? $tel = $_SESSION['DATA_BE']['BENEF_TEL'] : ($tel = ''); isset($_SESSION['DATA_BE']['BENEF_EMAIL']) ? $email = $_SESSION['DATA_BE']['BENEF_EMAIL'] : ($email = ''); isset($_SESSION['DATA_BE']['ID_LOCALITE']) ? $localite = $_SESSION['DATA_BE']['ID_LOCALITE'] : ($localite = ''); isset($_SESSION['DATA_BE']['BENEF_DIST']) && $_SESSION['DATA_BE']['BENEF_DIST'] != 0 ? $distance = $_SESSION['DATA_BE']['BENEF_DIST'] : ($distance = ''); isset($_SESSION['DATA_BE']['BENEF_DATEINT']) && $_SESSION['DATA_BE']['BENEF_DATEINT'] != '0000-00-00' ? $dateinteg = mysqlFormat($_SESSION['DATA_BE']['BENEF_DATEINT']) : ($dateinteg = ''); isset($_SESSION['DATA_BE']['BENEF_VILLE']) ? $ville = $_SESSION['DATA_BE']['BENEF_VILLE'] : ($ville = ''); isset($_SESSION['DATA_BE']['IDPROVINCE']) ? $province = $_SESSION['DATA_BE']['IDPROVINCE'] : ($province = ''); $xlocalite = getLocalite($localite); ?> <!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" lang="fr" xml:lang="fr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <META HTTP-EQUIV="refresh" CONTENT="" > <title><?php echo TITLE; ?> </title> <LINK REL="SHORTCUT ICON" HREF="../images/favicon0.ico"> <link href="../css/neutralcss.css" rel="stylesheet" type="text/css">