Exemplo n.º 1
0
     //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 transfert (' . $xid . ', ' . $reftransfert . ')');
 //updateLog($username, $idcust, $action='' )
 //Data
 $_SESSION['DATA_TRS'] = array('xid' => $xid, 'exercice' => $exercice, 'datetransfert' => $datetransfert, 'reftransfert' => $reftransfert, 'magasin_srce' => $magasin, 'magasin_dest' => $magasin_dest, 'libelleetat' => $libelleetat, 'nature' => $nature, 'ligne' => array(), 'nbreLigne' => $nbreLigne);
 $sql1 = "";
 $sql2 = "";
 $numautoDetTrs = myDbLastId('dettransfert', 'ID_DETTRANSFERT', $magasin);
 $numautoMvt = myDbLastId('mouvement', 'ID_MOUVEMENT', $magasin);
 //Collect Data
 $_SESSION['DATA_TRS']['ligne'] = array();
 for ($i = 1; $i <= $_SESSION['DATA_TRS']['nbreLigne']; $i++) {
     isset($_POST['code_dettransfert' . $i]) && $_POST['code_dettransfert' . $i] ? $code_dettransfert = $_POST['code_dettransfert' . $i] : ($code_dettransfert = '');
     isset($_POST['monlot' . $i]) && $_POST['monlot' . $i] ? $monlot = $_POST['monlot' . $i] : ($monlot = '');
     isset($_POST['oldcodeproduit' . $i]) ? $oldcodeproduit = $_POST['oldcodeproduit' . $i] : ($oldcodeproduit = '');
     isset($_POST['codeproduit' . $i]) ? $codeproduit = $_POST['codeproduit' . $i] : ($codeproduit = '');
     isset($_POST['produit' . $i]) ? $produit = $_POST['produit' . $i] : ($produit = '');
     isset($_POST['qte' . $i]) ? $qte = $_POST['qte' . $i] : ($qte = '');
     isset($_POST['unite' . $i]) && $_POST['unite' . $i] ? $unite = $_POST['unite' . $i] : ($unite = '');
     isset($_POST['prix' . $i]) && $_POST['prix' . $i] ? $prix = $_POST['prix' . $i] : ($prix = '');
     isset($_POST['reflot' . $i]) && $_POST['reflot' . $i] ? $reflot = $_POST['reflot' . $i] : ($reflot = '');
     isset($_POST['dateperemp' . $i]) && $_POST['dateperemp' . $i] ? $dateperemp = $_POST['dateperemp' . $i] : ($dateperemp = '');
     if ($oldcodeproduit != '' && $codeproduit != '' && $produit != '' && $qte != '') {
         $sql1 .= "UPDATE `dettransfert` SET `CODE_PRODUIT`='" . addslashes($codeproduit) . "'  ,`TRS_PRDQTE`='" . addslashes($qte) . "' ,\r\n\t\t\t\t`TRS_UNITE`='" . addslashes($unite) . "', CODE_MAGASIN='" . addslashes($magasin) . "',  TRS_MONLOT='" . addslashes($monlot) . "'\r\n\t\t\t\tWHERE CODE_DETTRANSFERT='" . addslashes($code_dettransfert) . "';";
Exemplo n.º 2
0
         }
         $sql2 .= "UPDATE `mouvement` SET `CODE_PRODUIT`='" . addslashes($codeproduit) . "' ,`ID_EXERCICE`='" . addslashes($exercice) . "' ,`CODE_MAGASIN`='" . addslashes($magasin) . "' ,\r\n\t\t\t\t`MVT_DATE`='" . addslashes($datelivraison) . "' ,`MVT_TIME`='" . addslashes(date('H:i:s')) . "' ,`MVT_QUANTITE`='" . addslashes($qtelvr) . "' ,`MVT_UNITE`='" . addslashes($unite) . "',\r\n\t\t\t\t`MVT_PA`='" . addslashes($prix) . "', `MVT_VALID`='{$statut}', `MVT_TYPE`='E', MVT_REFLOT='" . addslashes($reflot) . "', MVT_DATEPEREMP= '" . addslashes(mysqlFormat($dateperemp)) . "',  MVT_MONLOT='" . addslashes($monlot) . "'\r\n\t\t\t\tWHERE `CODE_PRODUIT`='" . addslashes($oldcodeproduit) . "' AND `MVT_NATURE`='LIVRAISON' AND ID_SOURCE LIKE '" . addslashes($xid) . "' AND `MVT_TYPE`='E'; ";
     } 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
Exemplo n.º 3
0
function updateLog($service = '', $username = '', $nmlle = '', $action = '')
{
    $id = myDbLastId('logs', 'ID_LOG', $service) + 1;
    $sql = "INSERT INTO `logs` (CODE_LOG, ID_LOG, `LOGIN` ,`MLLE`,`LOG_DATE` ,`LOG_DESCRIP`, `CODE_MAGASIN` )\r\n\tVALUES ('" . addslashes("{$id}/{$service}") . "',  '" . addslashes($id) . "','" . addslashes($username) . "',\r\n\t'" . addslashes($nmlle) . "', '" . date("Y-m-d H:i:s") . "', '" . addslashes($action) . "','" . addslashes($service) . "') ";
    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() );
        die($error->getMessage() . ' ' . __LINE__);
    }
    $query = $cnx->prepare($sql);
    //Prepare the SQL
    $query->execute();
    //Execute prepared SQL => $query
}
Exemplo n.º 4
0
 $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 {
     $id = myDbLastId('infogenerale', 'ID', $magasin) + 1;
     if ($_FILES["logo"]["error"] > 0) {
         //echo "Error: " . $_FILES["logo"]["error"] . "<br>";
     } else {
         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) {
             $logo = "logo_" . trim($id) . '.' . $extensions_valides[$_FILES["logo"]["type"]];
             move_uploaded_file($_FILES["logo"]["tmp_name"], "../upload/{$logo}");
         }
     }
     //Insert
     $sql = "INSERT INTO `infogenerale` (CODE_INFGLE, CODE_MAGASIN, ID, `INF_CLIENT`, `INF_DATEACQ`, `INF_LICENCE`, `INF_MINISTERE`, `INF_SECRETARIAT`, `INF_DIRECTION`, `INF_SERVICE`,`INF_CSPS`, `INF_PAYS`, `INF_DEVISE`, `INF_VILLE`, `LOGO`,\r\n\t\t\t`INF_SIGNATEUR1`, `INF_NOMSIGNATEUR1`, `INF_SIGNATEUR2`, `INF_NOMSIGNATEUR2`, `INF_SIGNATEUR3`, `INF_NOMSIGNATEUR3`,`INF_SIGNATEUR4`, `INF_NOMSIGNATEUR4`, `INF_VALIDAUTO`, `INF_MAGASIN`)\r\n\t\t\tVALUES ('" . addslashes("{$id}/{$magasin}") . "', '" . addslashes($magasin) . "',  '" . addslashes($id) . "', '" . addslashes($client) . "', '" . addslashes($dateacq) . "', '" . addslashes($licence) . "' , '" . addslashes($ministere) . "' ,'" . addslashes($secretariat) . "' ,\r\n\t\t\t'" . addslashes($direction) . "','" . addslashes($service) . "','" . addslashes($csps) . "','" . addslashes($pays) . "','" . addslashes($devise) . "', '" . addslashes($ville) . "',\r\n\t\t\t'" . addslashes($logo) . "', '" . addslashes($signateur1) . "', '" . addslashes($nomsignateur1) . "', '" . addslashes($signateur2) . "', '" . addslashes($nomsignateur2) . "',\r\n\t\t\t'" . addslashes($signateur3) . "','" . addslashes($nomsignateur3) . "','" . addslashes($signateur4) . "','" . addslashes($nomsignateur4) . "','" . addslashes($validauto) . "','" . addslashes($magasin) . "');";
 }
 try {
     $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
     //Connexion to database
 } catch (PDOException $error) {
Exemplo n.º 5
0
     break;
     //Ajout COMMANDES
 //Ajout COMMANDES
 case 'add':
     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;
     $numauto = myDbLastId('commande', 'ID_COMMANDE', $magasin) + 1;
     //Dernier ID Cde
     $codeCde = "{$numauto}/{$magasin}";
     //Data
     $_SESSION['DATA_CDE'] = array('exercice' => $exercice, 'datecommande' => $datecommande, 'refcommande' => $refcommande, 'libellecde' => $libellecde, 'fournisseur' => $fournisseur, 'statut' => $statut, 'nbreLigne' => $nbreLigne);
     //Insert
     $sql = "INSERT INTO `commande` (CODE_COMMANDE, ID_COMMANDE, `ID_EXERCICE` ,`CODE_FOUR` ,`REF_COMMANDE` ,`CDE_LIBELLE` ,`CDE_DATE` ,`CDE_STATUT`, `CODE_MAGASIN`)\r\n\t\tVALUES ('" . addslashes($codeCde) . "','" . addslashes($numauto) . "','" . addslashes($exercice) . "', '" . addslashes($fournisseur) . "',\r\n\t\t'" . addslashes($refcommande) . "' , '" . addslashes($libellecde) . "' , '" . addslashes($datecommande) . "' , '{$statut}','" . addslashes($magasin) . "')";
     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);