function ligneConTypeFournisseur($wh = '', $ord = '', $sens = 'ASC', $page = 1, $nelt)
{
    $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 TYPEFOUR_NOM ASC");
    //Nombre d'éléments
    $returnTble['NE'] = nombreTypeFournisseur($where);
    if ($returnTble['NE'] > 0) {
        //Calcule des limites
        $i = ($page - 1) * $nelt;
        $sql = "SELECT * FROM typefournisseur {$where} {$order} LIMIT {$i}, {$nelt};";
        //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;
        $j = 6;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
            //Is use
            $Fournisseur = isUseNow('CODE_TYPEFOUR', 'fournisseur', "WHERE CODE_TYPEFOUR LIKE '" . $row['CODE_TYPEFOUR'] . "'");
            $Fournisseur > 0 ? $Use = 1 : ($Use = 0);
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
	            <td width="3%"><input type="checkbox" name="rowSelection[]" value="' . $row['CODE_TYPEFOUR'] . '@' . $Use . '"></td>
                <td width="10%" height="22" class="text" align="left">' . $row['CODE_TYPEFOUR'] . '</td>
                <td width="30%" class="text" >' . stripslashes($row['TYPEFOUR_NOM']) . '</td>
            </tr>';
            $i++;
            $j++;
        }
    } else {
        if ($ilang == '1' && $ilang != '') {
            $returnHTML .= '<tr><td colspan="4" class="text">Aucune donn&eacute;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>';
        }
    }
    $returnTble['L'] = $returnHTML;
    return $returnTble;
}
function ligneConBeneficiaire($wh = '', $ord = '', $sens = 'ASC', $page = 1, $nelt)
{
    $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  province.IDREGION, beneficiaire.IDPROVINCE, BENEF_NOM  ASC");
    //Nombre d'éléments
    $returnTble['NE'] = nombreBeneficiaire($where);
    if ($returnTble['NE'] > 0) {
        //Calcule des limites
        $i = ($page - 1) * $nelt;
        $sql = "SELECT * FROM beneficiaire INNER JOIN typebeneficiaire ON (beneficiaire.CODE_TYPEBENEF LIKE typebeneficiaire.CODE_TYPEBENEF)\r\n\t\tINNER JOIN province ON (beneficiaire.IDPROVINCE LIKE province.IDPROVINCE) {$where} {$order} LIMIT {$i}, {$nelt};";
        //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;
        $j = 6;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
            // onClick="go('.$row['ID_BENEF'].','.$j.');"
            //Is use
            $bonsortie = isUseNow('CODE_BENEF', 'bonsortie', "WHERE CODE_BENEF LIKE " . $row['CODE_BENEF']);
            $bonsortie > 0 ? $Use = 1 : ($Use = 0);
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
	            <td><input type="checkbox" name="rowSelection[]" value="' . $row['CODE_BENEF'] . '@' . $Use . '"></td>
                <td class="text" align="left">' . $row['CODE_BENEF'] . '</td>
                <td class="text" >' . stripslashes($row['BENEF_NOM']) . '</td>
				<td class="text" >' . stripslashes($row['NOM_TYPEBENEF']) . '</td>
				<td class="text" >' . stripslashes($row['PROVINCE']) . '</td>
				<td class="text" >' . stripslashes($row['BENEF_TEL']) . '</td>
				<td class="text" >' . stripslashes($row['BENEF_EMAIL']) . '</td>
           </tr>';
            $i++;
            $j++;
        }
    } else {
        if ($ilang == '1' && $ilang != '') {
            $returnHTML .= '<tr><td colspan="4" class="text">Aucune donn&eacute;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>';
        }
    }
    $returnTble['L'] = $returnHTML;
    return $returnTble;
}
Exemplo n.º 3
0
/**
 * @author KG
 *
 * @version $Id$
 * @copyright 2012
 * @date 08/06/2012
 *
 * What is it about?
 * Here you will find all functions used in profil
 */
function ligneConMenu($wh = '', $ord = '', $sens = 'ASC', $page = 1, $nelt)
{
    $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 menu.IDMENU  ASC");
    //Nombre d'éléments
    $returnTble['NE'] = nombreElement($where, 'menu');
    if ($returnTble['NE'] > 0) {
        //Calcule des limites
        $i = ($page - 1) * $nelt;
        //SQL
        $sql = "SELECT * FROM menu {$where} {$order} LIMIT {$i}, {$nelt};";
        //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;
        $j = 6;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
            //Is use
            $compte = isUseNow('IDMENU', 'profil_menu', "WHERE IDMENU LIKE '" . $row['IDMENU'] . "'");
            $compte > 0 ? $Use = 1 : ($Use = 0);
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
	            <td><input type="checkbox" name="rowSelection[]" value="' . $row['IDMENU'] . '@' . $Use . '"></td>
                <td class="text" >' . stripslashes($row['IDMENU']) . '</td>
                <td class="text" >' . stripslashes($row['LIBMENU']) . '</td>
           </tr>';
            $i++;
            $j++;
        }
        //				<td class="text" ><a href="detailfonctionnalite.php?do=detail&xid='.$row['IDMENU'].'"><img src="../images/b_browse1.png" title="Afficher" align="absmiddle"></a></td>
    } else {
        if ($ilang == '1' && $ilang != '') {
            $returnHTML .= '<tr><td colspan="4" class="text">Aucune donn&eacute;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>';
        }
    }
    $returnTble['L'] = $returnHTML;
    return $returnTble;
}
Exemplo n.º 4
0
function ligneConUnites($wh = '', $ord = '', $sens = 'ASC', $page = 1, $nelt)
{
    $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 ID_UNITE ASC");
    //Nombre d'éléments
    $returnTble['NE'] = nombreUnite($where);
    if ($returnTble['NE'] > 0) {
        //Calcule des limites
        $i = ($page - 1) * $nelt;
        $sql = "SELECT * FROM unite {$where} {$order} LIMIT {$i}, {$nelt};";
        //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;
        $j = 6;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
            //Is use
            $cde_prd = isUseNow('CDE_UNITE', 'cde_prd', "WHERE CDE_UNITE ='" . $row['ID_UNITE'] . "'");
            $cnd_autreliv = isUseNow('CNDAUL_UNITE', 'cnd_autreliv', "WHERE CNDAUL_UNITE ='" . $row['ID_UNITE'] . "'");
            $cnd_invt = isUseNow('INV_UNITE', 'cnd_invt', "WHERE INV_UNITE ='" . $row['ID_UNITE'] . "'");
            $condit = isUseNow('ID_UNITE', 'conditionmt', "WHERE ID_UNITE ='" . $row['ID_UNITE'] . "'");
            $convert = isUseNow('ID_UNITE', 'conversion', "WHERE ID_UNITE ='" . $row['ID_UNITE'] . "'");
            $declass_cnd = isUseNow('DEC_UNITE', 'declass_cnd', "WHERE DEC_UNITE ='" . $row['ID_UNITE'] . "'");
            $dot_cnd = isUseNow('DOT_UNITE', 'dot_cnd', "WHERE DOT_UNITE ='" . $row['ID_UNITE'] . "'");
            $lvr_prd = isUseNow('LIV_UNITE', 'lvr_prd', "WHERE LIV_UNITE ='" . $row['ID_UNITE'] . "'");
            $mouvement = isUseNow('MVT_UNITE', 'mouvement', "WHERE MVT_UNITE ='" . $row['ID_UNITE'] . "'");
            $produit = isUseNow('ID_UNITE', 'produit', "WHERE ID_UNITE ='" . $row['ID_UNITE'] . "'");
            $recond_cnd = isUseNow('CNDREC_UNITEE', 'recond_cnd', "WHERE CNDREC_UNITEE ='" . $row['ID_UNITE'] . "'");
            $trs_cnd = isUseNow('TRS_UNITE', 'trs_cnd', "WHERE TRS_UNITE ='" . $row['ID_UNITE'] . "'");
            $cde_prd + $cnd_autreliv + $cnd_invt + $cnd_invt + $condit + $convert + $declass_cnd + $dot_cnd + $lvr_prd + $produit + $mouvement + $recond_cnd + $trs_cnd > 0 ? $Use = 1 : ($Use = 0);
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
	            <td width="3%"><input type="checkbox" name="rowSelection[]" value="' . $row['ID_UNITE'] . '@' . $Use . '"></td>
                <td width="10%" height="22" class="text" align="center">' . $row['ID_UNITE'] . '</td>
                <td width="30%" class="text" >' . stripslashes($row['UT_LIBELLE']) . '</td>
            </tr>';
            $i++;
            $j++;
        }
    } else {
        if ($ilang == '1' && $ilang != '') {
            $returnHTML .= '<tr><td colspan="4" class="text">Aucune donn&eacute;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>';
        }
    }
    $returnTble['L'] = $returnHTML;
    return $returnTble;
}
Exemplo n.º 5
0
//PHP Session
session_start();
//MySQL Parameters
require_once '../lib/global.inc';
//PHP functions librairy
require_once '../lib/phpfuncLib.php';
isset($_GET['do']) && $_GET['do'] != '' ? $do = $_GET['do'] : ($do = '');
isset($_POST['myaction']) && $_POST['myaction'] != '' ? $myaction = $_POST['myaction'] : ($myaction = '');
if ($myaction == '' && $do != '') {
    switch ($do) {
        case 'save':
            isset($_POST['etab']) && $_POST['etab'] != '' ? $etab = trim($_POST['etab']) : ($etab = '');
            isset($_POST['effectif']) && $_POST['effectif'] != '' ? $effectif = trim($_POST['effectif']) : ($effectif = '');
            isset($_POST['rationnel']) && $_POST['rationnel'] != '' ? $rationnel = trim($_POST['rationnel']) : ($rationnel = '');
            $magasin = $_SESSION['GL_USER']['MAGASIN'];
            if (isUseNow('ID_BENEF', 'donnee_annuelle', "WHERE ID_BENEF={$etab} AND CODE_MAGASIN LIKE '{$magasin}' AND ID_EXERCICE=" . $_SESSION['GL_USER']['EXERCICE']) > 0) {
                //SQL
                $sql = "UPDATE `donnee_annuelle` SET `ID_BENEF`='" . addslashes($etab) . "' ,`CODE_MAGASIN`='" . addslashes($_SESSION['GL_USER']['MAGASIN']) . "',\r\n\t\t\t`ID_EXERCICE`='" . addslashes($_SESSION['GL_USER']['EXERCICE']) . "' ,`EFFECTIF`='" . addslashes($effectif) . "' ,`MOY_RATIONNEL`='" . addslashes($rationnel) . "' ,\r\n\t\t\t`DATECREAT`='" . date('Y-m-d H:i:s') . "' WHERE ID_BENEF={$etab} AND CODE_MAGASIN LIKE '{$magasin}' AND ID_EXERCICE=" . $_SESSION['GL_USER']['EXERCICE'];
            } else {
                //SQL
                $sql = "INSERT INTO `donnee_annuelle` (`ID_BENEF` ,`CODE_MAGASIN` ,`ID_EXERCICE` ,`EFFECTIF` ,`MOY_RATIONNEL` ,`DATECREAT`) VALUES (\r\n\t\t\t'" . addslashes($etab) . "','" . addslashes($_SESSION['GL_USER']['MAGASIN']) . "' ,'" . addslashes($_SESSION['GL_USER']['EXERCICE']) . "' ,'" . addslashes($effectif) . "' ,\r\n\t\t\t'" . addslashes($rationnel) . "', '" . date('Y-m-d H:i:s') . "');";
            }
            //Mise à jour du tableau
            $_SESSION['DATA_DON'][$etab] = array('effectif' => $effectif, 'rationnel' => $rationnel);
            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');
Exemplo n.º 6
0
function ligneConExercice($wh = '', $ord = '', $sens = 'ASC', $page = 1, $nelt)
{
    $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 ID_EXERCICE DESC");
    //Nombre d'éléments
    $returnTble['NE'] = nombreExercice($where);
    if ($returnTble['NE'] > 0) {
        //Calcule des limites
        $i = ($page - 1) * $nelt;
        $sql = "SELECT * FROM exercice {$where} {$order} LIMIT {$i}, {$nelt};";
        //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;
        $j = 6;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
            $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 = '-';
            }
            //Is use
            $order = isUseNow('ID_EXERCICE', 'commande', "WHERE ID_EXERCICE = " . $row['ID_EXERCICE']);
            $livr = isUseNow($row['ID_EXERCICE'], 'livraison', "WHERE ID_EXERCICE =" . $row['ID_EXERCICE']);
            $autrelivr = isUseNow($row['ID_EXERCICE'], 'conditionmt', "WHERE ID_EXERCICE =" . $row['ID_EXERCICE']);
            $mouvement = isUseNow($row['ID_EXERCICE'], 'mouvement', "WHERE ID_EXERCICE =" . $row['ID_EXERCICE']);
            $declass = isUseNow($row['ID_EXERCICE'], 'declass', "WHERE ID_EXERCICE =" . $row['ID_EXERCICE']);
            $report = isUseNow($row['ID_EXERCICE'], 'report', "WHERE ID_EXERCICE =" . $row['ID_EXERCICE']);
            $dotation = isUseNow($row['ID_EXERCICE'], 'dotation', "WHERE ID_EXERCICE =" . $row['ID_EXERCICE']);
            $transfert = isUseNow($row['ID_EXERCICE'], 'transfert', "WHERE ID_EXERCICE =" . $row['ID_EXERCICE']);
            $inventaire = isUseNow($row['ID_EXERCICE'], 'inventaire', "WHERE ID_EXERCICE =" . $row['ID_EXERCICE']);
            $programm = isUseNow($row['ID_EXERCICE'], 'programmation', "WHERE ID_EXERCICE =" . $row['ID_EXERCICE']);
            $order + $livr + $autrelivr + $mouvement + $declass + $report + $dotation + $transfert + $inventaire + $programm > 0 ? $Use = 1 : ($Use = 0);
            $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" class="' . $col . '">
	            <td><input type="checkbox" name="rowSelection[]" value="' . $row['ID_EXERCICE'] . '@' . $Use . '@' . $row['EX_CLOTURE'] . '" onClick="IsCloturer(' . $row['EX_CLOTURE'] . ', ' . $j . ');">	</td>
                <td class="text" align="center">' . $row['ID_EXERCICE'] . '</td>
                <td class="text" >' . stripslashes($row['EX_LIBELLE']) . '</td>
				<td class="text" align="center">' . stripslashes($d1['DFR']) . '</td>
				<td class="text" align="center">' . stripslashes($d2['DFR']) . '</td>
				<td class="text" align="center">' . $imgCl . '</td>
				<td class="text" align="center">' . stripslashes($d3['DFR']) . '</td>
				<td class="text" align="center">' . stripslashes($nbre) . '</td>
            </tr>';
            $i++;
            $j++;
        }
    } else {
        if ($ilang == '1' && $ilang != '') {
            $returnHTML .= '<tr><td colspan="4" class="text">Aucune donn&eacute;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>';
        }
    }
    $returnTble['L'] = $returnHTML;
    return $returnTble;
}
Exemplo n.º 7
0
function ligneEtatListeProduit($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 produit.CODE_SOUSCATEGORIE, CODE_PRODUIT ASC");
    //Nombre d'éléments
    $nbre = nombreProduit($where);
    if ($nbre > 0) {
        //Calcule des limites
        $sql = "SELECT * FROM produit INNER JOIN souscategorie ON (produit.CODE_SOUSCATEGORIE LIKE souscategorie.CODE_SOUSCATEGORIE)\r\n\t\tINNER JOIN categorie ON (categorie.CODE_CATEGORIE LIKE souscategorie.CODE_CATEGORIE)   {$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;
        $j = 5;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $row['PRD_TRACEUR'] != '' ? $cdt = "Produit traceur" : ($cdt = "Produit non traceur");
            //Is use
            $bareme = isUseNow('CODE_PRODUIT', 'bareme', "WHERE CODE_PRODUIT LIKE '" . $row['CODE_PRODUIT'] . "'");
            $conditionnement = isUseNow('CODE_PRODUIT', 'conditionmt', "WHERE CODE_PRODUIT LIKE '" . $row['CODE_PRODUIT'] . "'");
            $returnHTML .= '
			<tr align="left" valign="middle" >
	            <td class="botBorderTdall" align="center">' . $row['CODE_PRODUIT'] . '</td>
                <td class="botBorderTdall" >' . stripslashes($row['PRD_LIBELLE']) . '</td>
				<td class="botBorderTdall" >' . stripslashes($row['CAT_LIBELLE']) . '</td>
				<td class="botBorderTdall" align="center">' . stripslashes($row['ID_UNITE']) . '</td>
				<td class="botBorderTdall" >' . stripslashes($cdt) . '</td>
				<!-- <td class="botBorderTdall" align="center" ><a href="conditionnement.php?selectedTab=par&codeproduit=' . $row['CODE_PRODUIT'] . '">' . stripslashes('Conditionnement') . '</a></td> -->
            </tr>';
            $i++;
            $j++;
        }
    } else {
        if ($ilang == '1' && $ilang != '') {
            $returnHTML .= '<tr><td colspan="4" class="text">Aucune donn&eacute;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 ligneConAffectation($wh = '', $ord = '', $sens = 'ASC', $page = 1, $nelt)
{
    $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 LOGIN ASC");
    //Nombre d'éléments
    $returnTble['NE'] = nombreUser($where);
    if ($returnTble['NE'] > 0) {
        //Calcule des limites
        $i = ($page - 1) * $nelt;
        $sql = "SELECT * FROM compte INNER JOIN profil ON (compte.IDPROFIL=profil.IDPROFIL) {$where} {$order} LIMIT {$i}, {$nelt};";
        //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;
        $j = 6;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
            $row['ACTIVATED'] == 1 ? $etat = 'Activé' : ($etat = 'Déactivé');
            //Is use
            $compte = isUseNow('LOGIN', 'logs', "WHERE LOGIN LIKE '" . $row['LOGIN'] . "'");
            //(($compte) > 0 ? $Use = 1 : $Use = 0);
            $Use = 0;
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
	            <td><input type="checkbox" name="rowSelection[]" value="' . $row['LOGIN'] . '@' . $Use . '"></td>
                <td class="text" >' . stripslashes($row['LOGIN']) . '</td>
				<td class="text" >' . stripslashes($row['NUM_MLLE']) . '</td>
				<td class="text" >' . stripslashes(getPersonnelName($row['NUM_MLLE'])) . '</td>
				<td class="text" >' . stripslashes(getUsermagasin($row['LOGIN'])) . '</td>
            </tr>';
            $i++;
            $j++;
        }
    } else {
        if ($ilang == '1' && $ilang != '') {
            $returnHTML .= '<tr><td colspan="4" class="text">Aucune donn&eacute;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>';
        }
    }
    $returnTble['L'] = $returnHTML;
    return $returnTble;
}