Ejemplo n.º 1
0
function ligneConLocalite($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 localite.ID_GRPLOC, ID_LOCALITE ASC");
    //Nombre d'éléments
    $returnTble['NE'] = nombreLocalite($where);
    if ($returnTble['NE'] > 0) {
        //Calcule des limites
        $i = ($page - 1) * $nelt;
        $sql = "SELECT * FROM localite INNER JOIN groupelocalite ON (localite.ID_GRPLOC LIKE groupelocalite.ID_GRPLOC) {$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
            $magasin = isUseNow('ID_LOCALITE', 'magasin', "WHERE ID_LOCALITE =" . $row['ID_LOCALITE']);
            $magasin > 0 ? $Use = 1 : ($Use = 0);
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
	            <td><input type="checkbox" name="rowSelection[]" value="' . $row['ID_LOCALITE'] . ' ' . $Use . '"></td>
                <td class="text" align="center">' . $row['ID_LOCALITE'] . '</td>
                <td class="text" >' . stripslashes($row['LOC_NOM']) . '</td>
				<td class="text" >' . stripslashes($row['GRPLOC_LIBELLE']) . '</td>
				<td class="text" >' . stripslashes(getDependance($row['LOC_LIEN'])) . '</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;
}
Ejemplo n.º 2
0
 isset($_POST['region']) && $_POST['region'] ? $region = $_POST['region'] : ($region = '0');
 isset($_POST['province']) && $_POST['province'] ? $province = $_POST['province'] : ($province = '');
 isset($_POST['service']) && $_POST['service'] ? $service = $_POST['service'] : ($service = '');
 $choix1 = getSiteCent($region);
 $choix2 = getSiteFour($province);
 $choix3 = getSiteBénéf($service);
 if ($region == '0') {
     $choix = 'Tous les sites (National)';
 } else {
     isset($_POST['region']) && $_POST['region'] ? $choix = $choix1 : ($region = '');
     isset($_POST['province']) && $_POST['province'] ? $choix = $choix2 : ($province = '');
     isset($_POST['service']) && $_POST['service'] ? $choix = $choix3 : ($service = '');
 }
 $_SESSION['DATA_ETAT']['choix'] = $choix;
 $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
 $ilang = getCodelangue($userName);
 if ($choix = '0') {
     if ($ilang == '1' && $ilang != '') {
         $_SESSION['DATA_ETAT']['choix'] = 'Tous les sites (National)';
     }
     if ($ilang == '2' && $ilang != '') {
         $_SESSION['DATA_ETAT']['choix'] = 'All the sites (National)';
     }
     if ($ilang == '3' && $ilang != '') {
         $_SESSION['DATA_ETAT']['choix'] = 'Todos os sítios (Nacional)';
     }
 }
 isset($_POST['datedebut']) && $_POST['datedebut'] ? $datedebut = $_POST['datedebut'] : ($datedebut = '');
 isset($_POST['datefin']) && $_POST['datefin'] ? $datefin = $_POST['datefin'] : ($datefin = '');
 $_SESSION['DATA_ETAT']['datedebut'] = $datedebut;
 $_SESSION['DATA_ETAT']['datefin'] = $datefin;
Ejemplo 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;
}
Ejemplo n.º 4
0
function ligneEtatListePersonne($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 NUM_MLLE  ASC");
    //Nombre d'éléments
    $nbre = nombrePersonnel($where);
    if ($nbre > 0) {
        //Calcule des limites
        $sql = "SELECT * FROM personnel INNER JOIN magasin ON (personnel.CODE_MAGASIN=magasin.CODE_MAGASIN) {$where} {$order};";
        //Exécution
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        $i = 1;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            //($i%2 == 0 ? $col = "tableOddRow" : $col = "tableEvenRow");
            $returnHTML .= '
			<tr align="left" valign="middle">
				<td class="botBorderTdall" align="center">' . $i . '</td>
	            <td class="botBorderTdall">' . stripslashes($row['NUM_MLLE']) . '&nbsp;</td>
				<td class="botBorderTdall">' . stripslashes($row['PERS_PRENOMS'] . ' ' . $row['PERS_NOM']) . '&nbsp;</td>
				<td class="botBorderTdall">' . stripslashes($row['SER_NOM']) . '&nbsp;</td>
				<td class="botBorderTdall">' . stripslashes($row['PERS_FONCTION']) . '&nbsp;</td>
				<td class="botBorderTdall" nowrap="nowrap">' . stripslashes($row['PERS_TEL']) . '&nbsp;</td>
				<td class="botBorderTdall">' . stripslashes($row['PERS_EMAIL']) . '&nbsp;</td>
            </tr>';
            $i++;
        }
    } 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 ligneEtatBeneficiaire($wh = '', $ord = '', $sens = 'ASC')
{
    $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");
    $sql = "SELECT * FROM beneficiaire INNER JOIN typebeneficiaire ON (beneficiaire.CODE_TYPEBENEF LIKE typebeneficiaire.CODE_TYPEBENEF)\r\n\tINNER JOIN province ON (beneficiaire.IDPROVINCE LIKE province.IDPROVINCE)  {$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
    $Teff = 0;
    $i = 1;
    while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
        //($key, $code, $field, $table){
        $returnHTML .= '
			<tr align="left" valign="middle">
	            <td class="botBorderTdall" align="center">' . $i . '-</td>
                <td class="botBorderTdall" align="center">' . $row['CODE_BENEF'] . '&nbsp;</td>
                <td class="botBorderTdall">' . stripslashes($row['BENEF_NOM']) . '&nbsp;</td>
                <td class="botBorderTdall" >' . stripslashes($row['NOM_TYPEBENEF']) . '&nbsp;</td>
				<td class="botBorderTdall" >' . stripslashes(getField('IDREGION', $row['IDREGION'], 'REGION', 'region')) . '&nbsp;</td>
				<td class="botBorderTdall" >' . stripslashes($row['PROVINCE']) . '&nbsp;</td>
           </tr>';
        $i++;
    }
    if ($returnHTML == '') {
        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 $returnHTML;
}
Ejemplo n.º 6
0
function ligneEtatListeLog($wh = '')
{
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    $returnHTML = '';
    //Where clause
    $where = '';
    isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = "");
    //Oerder condition
    $order = '';
    isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY LOG_DATE DESC");
    //Nombre d'éléments
    $nbre = nombreLog($where);
    if ($nbre > 0) {
        //Calcule des limites
        $sql = "SELECT * FROM logs  {$where} {$order} ";
        //Exécution
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        $i = 1;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $d1 = frFormat($row['LOG_DATE']);
            //Return  $ret = array(); // DFR, TFR
            $returnHTML .= '
			<tr align="left" valign="middle">
	            <td class="botBorderTdall" align="center">' . $i . '</td>
                <td class="botBorderTdall">' . stripslashes($row['LOGIN']) . '&nbsp;</td>
                <td class="botBorderTdall">' . stripslashes(getPersonnelName($row['MLLE'])) . '&nbsp;</td>
                <td class="botBorderTdall">' . stripslashes($d1['DFR']) . '&nbsp;</td>
                <td class="botBorderTdall">' . stripslashes($d1['TFR']) . '&nbsp;</td>
                <td class="botBorderTdall">' . stripslashes($row['LOG_DESCRIP']) . '&nbsp;</td>
           </tr>';
            $i++;
        }
    } 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;
}
Ejemplo n.º 7
0
function lignEtatGroupArticles1($idarticle = array(), $date = '')
{
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    $table1 = "stocks_article";
    $exercice = $_SESSION['GL_USER']['EXERCICE'];
    //Connection to Database server
    $idCon = mysql_connect(DBSERVER, DBUSER, DBPWD) or header('location:errorPage.php&code=');
    //Select Database
    mysql_select_db(DB, $idCon) or header('location:errorPage.php&code=');
    $list = '';
    $i = 1;
    foreach ($idarticle as $key => $val) {
        //($i%2 == 0 ? $col = "tableOddRow" : $col = "tableEvenRow");
        $col = '';
        $sE = etatArticleEntree($val, $exercice, $date);
        $sB = etatArticleBonus($val, $exercice, $date);
        $sS = etatArticleSortie($val, $exercice, $date);
        $sM = etatArticleMalus($val, $exercice, $date);
        $stock = $sE + $sB - $sM - $sS;
        isset($val) && $val != '' ? $where = " WHERE ID_ARTICLE LIKE '{$val}'" : ($where = "");
        $SQL = "SELECT * FROM {$table1} {$where} ORDER BY LIBELLE_ARTICLE ASC;";
        $result = mysql_query($SQL, $idCon);
        $row = mysql_fetch_array($result);
        $list .= '<tr class="' . $col . '">
            <td width="3%" height="22" align="center" valign="middle" class="botBorderTdallEtat">' . $i . '</td>
			<td width="10%" height="22" align="center" valign="middle" class="botBorderTdallEtat">' . $row['ID_ARTICLE'] . '&nbsp;</td>
			<td width="10%" height="22" align="left" valign="middle" class="botBorderTdallEtat">' . stripslashes($row['LIBELLE_ARTICLE']) . '</td>
            <td width="10%" height="22" align="center" valign="middle" class="botBorderTdallEtat">' . $sE . '&nbsp;</a></td>
			<td width="10%" height="22" align="center" valign="middle" class="botBorderTdallEtat">' . $sB . '&nbsp;</a></td>
			<td width="10%" height="22" align="center" valign="middle" class="botBorderTdallEtat">' . $sM . '&nbsp;</a></td>
			<td width="10%" height="22" align="center" valign="middle" class="botBorderTdallEtat">' . $sS . '&nbsp;</a></td>
			<td width="10%" height="22" align="center" valign="middle" class="botBorderTdallEtat">' . $stock . '&nbsp;</a></td>
	        </tr>';
        $i++;
    }
    if ($ilang == '1' && $ilang != '') {
        if ($list == '') {
            $list = '
		<tr class="tableOddRow">
            <td height="22" align="left" valign="middle" class="text" colspan="4">Aucun produit disponible ...</td>
        </tr>';
        }
    }
    if ($ilang == '2' && $ilang != '') {
        if ($list == '') {
            $list = '
		<tr class="tableOddRow">
            <td height="22" align="left" valign="middle" class="text" colspan="4">No data ...</td>
        </tr>';
        }
    }
    if ($ilang == '3' && $ilang != '') {
        if ($list == '') {
            $list = '
		<tr class="tableOddRow">
            <td height="22" align="left" valign="middle" class="text" colspan="4">Nenhum dado ...</td>
        </tr>';
        }
    }
    mysql_close($idCon);
    return $list;
}
function ligneEtatListeUtilisateur($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 LOGIN ASC");
    //Nombre d'éléments
    $nbre = nombreUser($where);
    if ($nbre > 0) {
        //Calcule des limites
        $sql = "SELECT * FROM compte INNER JOIN profil ON (compte.IDPROFIL=profil.IDPROFIL)  {$where} {$order};";
        //Exécution
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        $i = 1;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
            $row['ACTIVATED'] == 1 ? $etat = 'Activé' : ($etat = 'Déactivé');
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
	            <td class="botBorderTdall" align="center">' . $i . '</td>
                <td class="botBorderTdall">' . stripslashes($row['LOGIN']) . '&nbsp;</td>
				<td class="botBorderTdall">' . stripslashes($row['LIBPROFIL']) . '&nbsp;</td>
				<td class="botBorderTdall">' . stripslashes($row['NUM_MLLE']) . '&nbsp;</td>
				<td class="botBorderTdall">' . stripslashes(getPersonnelName($row['NUM_MLLE'])) . '&nbsp;</td>
				<td class="botBorderTdall">' . stripslashes($etat) . '</td>
				<td class="botBorderTdall">' . stripslashes(getUsermagasin($row['LOGIN'])) . '&nbsp;</td>
            </tr>';
            $i++;
        }
    } 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;
}
Ejemplo n.º 9
0
function ligneEtatExercice($wh = '', $ord = '', $sens = 'ASC')
{
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    $returnHTML = '';
    //Where clause
    $where = '';
    isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = "");
    //Oerder condition
    $order = '';
    isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY ID_EXERCICE DESC");
    //Nombre d'éléments
    $nbre = nombreExercice($where);
    if ($nbre > 0) {
        //Calcule des limites
        $sql = "SELECT * FROM exercice {$where} {$order};";
        //Exécution
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        $i = 0;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $d1 = frFormat($row['EX_DATEDEBUT']);
            //Return  $ret = array(); // DFR, TFR
            $d2 = frFormat($row['EX_DATEFIN']);
            $d3 = frFormat($row['EX_DATECLOTURE']);
            $nbre = NbJours(date('Y-m-d'), $row['EX_DATEFIN']);
            if ($nbre == 1) {
                $nbre = $nbre . ' jour';
            } elseif ($nbre > 1) {
                $nbre = $nbre . ' jours';
            } else {
                $nbre = '-';
            }
            $row['EX_CLOTURE'] == '0' ? $imgCl = '<img src="../images/encours.gif" width="16" height="16">' : ($imgCl = '<img src="../images/fermer.png" width="16" height="16">');
            $returnHTML .= '
			<tr align="left" valign="middle">
	            <td class="botBorderTdall" align="center">' . $row['ID_EXERCICE'] . '&nbsp;</td>
                <td class="botBorderTdall" >' . stripslashes($row['EX_LIBELLE']) . '&nbsp;</td>
				<td class="botBorderTdall" align="center">' . stripslashes($d1['DFR']) . '&nbsp;</td>
				<td class="botBorderTdall" align="center">' . stripslashes($d2['DFR']) . '&nbsp;</td>
				<td class="botBorderTdall" align="center">' . $imgCl . '</td>
				<td class="botBorderTdall" align="center">' . stripslashes($d3['DFR']) . '&nbsp;</td>
				<td class="botBorderTdall" align="center">' . stripslashes($nbre) . '&nbsp;</td>
            </tr>';
            $i++;
        }
    } 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;
}
Ejemplo n.º 10
0
function ligneEtatListeTransfert($wh = '', $ord = '')
{
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    $returnHTML = '';
    $returnTble = array();
    //HTML, nbreTotal,
    //Where clause
    $where = '';
    isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = "");
    //Oerder condition
    $order = '';
    isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY TRS_DATE DESC");
    //Nombre d'éléments
    $nbre = nombreTransfert($where);
    if ($nbre > 0) {
        //Calcule des limites
        $sql = "SELECT * FROM transfert  {$where} {$order};";
        //Exécution
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        $i = 1;
        $tranfert = array(1 => 'Transfert sortant', 2 => 'Transfert entrant');
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            //($i%2 == 0 ? $col = "tableOddRow" : $col = "tableEvenRow");
            $d1 = frFormat($row['TRS_DATE']);
            //Return  $ret = array(); // DFR, TFR
            if ($row['TRS_VALIDE'] == '0') {
                $imgCl = '<img src="../images/encours.gif" title="En cours" width="16" height="16">';
            } elseif ($row['TRS_VALIDE'] == '2') {
                $imgCl = '<img src="../images/cancel.png" title="Annulé" width="16" height="16">';
            } else {
                $imgCl = '<img src="../images/valider.gif" title="Validé" width="16" height="16">';
            }
            $t = $row['TRS_NATURE'];
            $returnHTML .= '
			<tr align="left" valign="middle">
	            <td class="botBorderTdall" align="center">' . $i . '</td>
                <td class="botBorderTdall">' . stripslashes($row['CODE_TRANSFERT']) . '&nbsp;</td>
                <td class="botBorderTdall">' . stripslashes($d1['DFR']) . '&nbsp;</td>
                <td class="botBorderTdall">' . stripslashes($tranfert[$t]) . '&nbsp;</td>
                <td class="botBorderTdall">' . stripslashes(getmagasinName($row['MAG_CODE_MAGASIN_SRCE'])) . '&nbsp;</td>
                <td class="botBorderTdall">' . stripslashes(getmagasinName($row['MAG_CODE_MAGASIN_DEST'])) . '&nbsp;</td>
            </tr>';
            $i++;
        }
    } 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;
}
Ejemplo n.º 11
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;
}
Ejemplo n.º 12
0
function basededonneesMenus($tab = '', $droit = '')
{
    isset($droit['data_vid']['VISIBLE']) ? $data_vid = $droit['data_vid']['VISIBLE'] : ($data_vid = 0);
    isset($droit['data_exp']['VISIBLE']) ? $data_exp = $droit['data_exp']['VISIBLE'] : ($data_exp = 0);
    isset($droit['data_imp']['VISIBLE']) ? $data_imp = $droit['data_imp']['VISIBLE'] : ($data_imp = 0);
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    if ($ilang == '1' && $ilang != '') {
        $TOPMENUS = array('0' => array('0' => 'Base de données', '1' => array('Vider la base de données', 'vider.php?selectedTab=data&rst=1', $data_vid, 'data'), '2' => array('Sauvegarde de la base', 'sauvegarde.php?selectedTab=data&rst=1', $data_exp, 'data'), '3' => array('Importer de la base', 'import.php?selectedTab=data&rst=1', $data_imp, 'data')));
    }
    if ($ilang == '2' && $ilang != '') {
        $TOPMENUS = array('0' => array('0' => 'Database', '1' => array('Empty database', 'vider.php?selectedTab=data&rst=1', $data_vid, 'data'), '2' => array('Database backup', 'sauvegarde.php?selectedTab=data&rst=1', $data_exp, 'data'), '3' => array('Import the base', 'import.php?selectedTab=data&rst=1', $data_imp, 'data')));
    }
    if ($ilang == '3' && $ilang != '') {
        $TOPMENUS = array('0' => array('0' => 'Base de dados', '1' => array('Esvaziar a base de dados', 'vider.php?selectedTab=data&rst=1', $data_vid, 'data'), '2' => array('Guardar a base de dados', 'sauvegarde.php?selectedTab=data&rst=1', $data_exp, 'data'), '3' => array('Importar da basse', 'import.php?selectedTab=data&rst=1', $data_imp, 'data')));
    }
    $menuHTML1 = '';
    foreach ($TOPMENUS as $key => $val) {
        $menuHTML1 .= '<tr><td><table width="185" border="0" align="left" cellpadding="1" cellspacing="1">';
        foreach ($val as $key1 => $val1) {
            //B 1
            if (!is_array($val1)) {
                $menuHTML1 .= '
				<tr>
            		<td width="175" height="20" colspan="2" class="leftHeader"><nobr>' . stripslashes($val[0]) . '</nobr></td>
          		</tr>
          		';
            }
            if (is_array($val1) && $val1[2] == 1) {
                //B 2
                $menuHTML1 .= '
				<tr>
            		<td class="leftLink" width="2">&nbsp;</td>
					<td class="leftLink" height="20" width="175" ><a href="' . stripslashes($val1[1]) . '" />' . stripslashes($val1[0]) . '</a></td>
				</tr>
				';
            }
            //B 2
        }
        $menuHTML1 .= '
			<tr>
            	<td class="leftLink" width="2"></td>
				<td class="leftLink" height="10" width="175" ></td>
			</tr>
			</table> </td></tr>';
    }
    return $menuHTML1;
}
Ejemplo n.º 13
0
function ligneConRapDetailleSortie($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 = " {$wh} " : ($where = "");
    //Oerder condition
    $order = '';
    isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY MVT_DATEVALID DESC");
    //Nombre d'éléments
    $returnTble['NE'] = nombreJournal($where);
    if ($returnTble['NE'] > 0) {
        //Calcule des limites
        $i = ($page - 1) * $nelt;
        $sql = "SELECT mouvement.`CODE_PRODUIT`,`MVT_NATURE`,`MVT_TIME`, `MVT_VALID`, `MVT_UNITE`, MVT_DATE, `MVT_QUANTITE`,MVT_REFLOT,\r\n\t \t`CODE_MAGASIN`, ID_SOURCE, produit.PRD_LIBELLE,MVT_DATEPEREMP, MVT_PV, MVT_PA\r\n\t \tFROM mouvement INNER JOIN produit ON (mouvement.CODE_PRODUIT LIKE produit.CODE_PRODUIT) {$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;
        $_SESSION['DATA_ETAT']['ligne'] = array();
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
            if ($row['MVT_VALID'] == '0') {
                $imgCl = '<img src="../images/encours.gif" title="En cours" width="16" height="16">';
            } elseif ($row['MVT_VALID'] == '2') {
                $imgCl = '<img src="../images/cancel.png" title="Annulée" width="16" height="16">';
            } else {
                $imgCl = '<img src="../images/valider.gif" title="Validée" width="16" height="16">';
            }
            $datemvt = frFormat2($row['MVT_DATE']);
            array_push($_SESSION['DATA_ETAT']['ligne'], array('codeproduit' => $row['CODE_PRODUIT'], 'produit' => $row['PRD_LIBELLE'], 'reflot' => $row['MVT_REFLOT'], 'nature' => $row['MVT_NATURE'], 'qte' => $row['MVT_QUANTITE'], 'prix' => $row['MVT_PV'], 'datemvt' => $datemvt, 'timemvt' => $row['MVT_TIME'], 'valide' => $row['MVT_VALID'], 'unite' => $row['MVT_UNITE']));
            if ($row['MVT_DATEPEREMP'] < date('Y-m-d')) {
                $col = "tableFINIRow";
            }
            $d = preg_replace('/-/', '/', $row['MVT_DATEPEREMP']);
            $d = substr($d, 0, 7);
            isset($row['MVT_PV']) && $row['MVT_PV'] > 0 ? $prix = $row['MVT_PV'] : ($prix = 0);
            isset($row['MVT_QUANTITE']) && $row['MVT_QUANTITE'] > 0 ? $qte = $row['MVT_QUANTITE'] : ($qte = 0);
            $prix > 0 ? $Aprix = number_format($prix, 0, ',', ' ') : ($Aprix = '');
            $total = $prix * $qte;
            $total > 0 ? $Atotal = number_format($total, 0, ',', ' ') : ($Atotal = '');
            $row['MVT_QUANTITE'] > 0 ? $row['MVT_QUANTITE'] = number_format($row['MVT_QUANTITE'], 0, ',', ' ') : ($row['MVT_QUANTITE'] = '');
            $i++;
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
				<td class="text" align="center" nowrap>' . $i . '</td>
	        	<td height="22" class="text" align="left">' . stripslashes($row['CODE_PRODUIT']) . '</td>
            	<td class="text" >' . stripslashes($row['PRD_LIBELLE']) . '</td>
				<td class="text" align="left">' . stripslashes($row['MVT_REFLOT']) . '</td>
            	<td class="text" align="left" nowrap="nowrap">' . stripslashes($row['MVT_NATURE']) . '</td>
            	<td class="text" align="center">' . stripslashes(frFormat2($row['MVT_DATE'])) . '</td>
            	<td class="text" align="right">' . stripslashes($row['MVT_QUANTITE']) . '</td>
            	<td class="text" align="left">' . stripslashes($row['MVT_UNITE']) . '</td>
				<td class="text" align="right">' . stripslashes($Aprix) . '</td>
				<td class="text" align="right">' . stripslashes($Atotal) . '</td>
       		</tr>';
        }
        $_SESSION['DATA_ETAT']['nbreLigne'] = $i;
    } 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 ligneEtatTypeFournisseur($wh = '', $ord = '', $sens = 'ASC')
{
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    $returnHTML = '';
    //Where clause
    $where = '';
    isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = "");
    //Order condition
    $order = '';
    isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY TYPEFOUR_NOM ASC");
    //Nombre d'éléments
    $nbre = nombreTypeFournisseur($where);
    if ($nbre > 0) {
        $sql = "SELECT * FROM typefournisseur {$where} {$order};";
        //Exécution
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        $i = 0;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            $returnHTML .= '
			<tr align="left" valign="middle">
	            <td height="22" class="botBorderTdall" align="left">' . $row['CODE_TYPEFOUR'] . '&nbsp;</td>
                <td class="botBorderTdall" >' . stripslashes($row['TYPEFOUR_NOM']) . '&nbsp;</td>
            </tr>';
            $i++;
        }
    } 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 ligneEtatListeDeclassement($wh = '', $ord = '', $sens = 'ASC')
{
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    $returnHTML = '';
    //Where clause
    $where = '';
    isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = "");
    //Oerder condition
    $order = '';
    isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY DCL_DATE DESC");
    //Nombre d'éléments
    $returnTble['NE'] = nombreDeclassement($where);
    if ($returnTble['NE'] > 0) {
        $sql = "SELECT * FROM declass\r\n\t\tINNER JOIN natdeclass ON (declass.CODENATDECLASS LIKE natdeclass.CODENATDECLASS)   {$where} {$order};";
        //Exécution
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        $i = 1;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            //($i%2 == 0 ? $col = "tableOddRow" : $col = "tableEvenRow");
            $col = '';
            $d1 = frFormat($row['DCL_DATE']);
            $row['DCL_VALIDE'] == '0' ? $imgCl = '<img src="../images/encours.gif" title="En cours" width="16" height="16">' : ($imgCl = '<img src="../images/valider.gif" title="Validée" width="16" height="16">');
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
	            <td class="botBorderTdall"  align="center">' . $i . '&nbsp;</td>
 				<td class="botBorderTdall" align="center" >' . $imgCl . '<input type="hidden" name="rowValid[]" id="rowValid[]"value="' . $row['DCL_VALIDE'] . '"></td>
                <td height="22" class="botBorderTdall" align="center">' . stripslashes($row['CODE_DECLASS']) . '&nbsp;</td>
                <td class="botBorderTdall" >' . stripslashes($d1['DFR']) . '&nbsp;</td>
                <td class="botBorderTdall" >' . stripslashes($row['LIBNATDECLASS']) . '</td>
            </tr>';
            $i++;
        }
    } 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;
}
Ejemplo n.º 16
0
function ligneEtatListeBonsortie($wh = '', $ord = '', $sens = 'ASC')
{
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    $returnHTML = '';
    //Where clause
    $where = '';
    isset($wh) and $wh != '' ? $where = " WHERE {$wh} " : ($where = "");
    //Oerder condition
    $order = '';
    isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY SOR_DATE DESC");
    //Nombre d'éléments
    $nbre = nombreBonsortie($where);
    if ($nbre > 0) {
        //Calcule des limites
        $sql = "SELECT * FROM bonsortie INNER JOIN beneficiaire ON (bonsortie.CODE_BENEF=beneficiaire.CODE_BENEF)  {$where} {$order};";
        //Exécution
        try {
            $cnx = new PDO(DBD, DBUSER, DBPWD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
            //Connexion to database
        } catch (PDOException $error) {
            //Treat error
            //("Erreur de connexion : " . $error->getMessage() );
            header('location:errorPage.php');
        }
        $query = $cnx->prepare($sql);
        //Prepare the SQL
        $query->execute();
        //Execute prepared SQL => $query
        $i = 1;
        while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
            //($i%2 == 0 ? $col = "tableOddRow" : $col = "tableEvenRow");
            $col = '';
            $d1 = frFormat($row['SOR_DATE']);
            //Return  $ret = array(); // DFR, TFR
            if ($row['SOR_VALIDE'] == '0') {
                $imgCl = '<img src="../images/encours.gif" title="En cours" width="16" height="16">';
            } elseif ($row['SOR_VALIDE'] == '2') {
                $imgCl = '<img src="../images/cancel.png" title="Annulée" width="16" height="16">';
            } else {
                $imgCl = '<img src="../images/valider.gif" title="Validée" width="16" height="16">';
            }
            $returnHTML .= '
			<tr align="left" valign="middle" class="' . $col . '">
	            <td class="botBorderTdall" align="center">' . $i . '</td>
                <td class="botBorderTdall" align="center">' . $imgCl . '</td>
				<td class="botBorderTdall" >' . stripslashes($row['CODE_BONSORTIE']) . '&nbsp;</td>
                <td class="botBorderTdall" align="center">' . stripslashes($d1['DFR']) . '&nbsp;</td>
				<td class="botBorderTdall" >' . stripslashes($row['SOR_LIBELLE']) . '&nbsp;</td>
               <td class="botBorderTdall" >' . stripslashes($row['BENEF_NOM']) . '&nbsp;</td>
             </tr>';
            $i++;
        }
    } 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;
}
Ejemplo n.º 17
0
function page($nbreEng, $engPage, $page, $url)
{
    $nbreEng % $engPage == 0 ? $nbrePage = (int) ($nbreEng / $engPage) : ($nbrePage = (int) ($nbreEng / $engPage + 1));
    $Premier = '';
    $Dernier = '';
    $nbreEng < $engPage ? $engPage = $nbreEng : ($engPage = $engPage);
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    if ($ilang == '1' && $ilang != '') {
        if ($page == 1) {
            //Première page  Affichage de 1 &agrave; 25 of 50 | Premier | Pr&eacute;c&eacute;dente | <a href=''>Derni&egrave;re</a></
            $i = ($page - 1) * $engPage + 1;
            $j = $page * $engPage;
            $page < $nbrePage ? $k = $page + 1 : ($k = $page);
            $Premier .= 'Affichage de ' . $i . ' &agrave; ' . $j . ' sur ' . $nbreEng . ' | Premi&egrave;re | Pr&eacute;c&eacute;dente | ';
            $Dernier .= '<a href="' . $url . '&page=' . $k . '">Suivante</a> | <a href="' . $url . '&page=' . $nbrePage . '">Derni&egrave;re</a> ';
        } else {
            if ($page == $nbrePage) {
                //Dernière page
                $i = ($page - 1) * $engPage + 1;
                $j = $page * $engPage;
                $page > 2 ? $k = $page - 1 : ($k = $page);
                $Premier .= 'Affichage de ' . $i . ' &agrave; ' . $j . ' sur ' . $nbreEng . ' | <a href="' . $url . '&page=1">Premi&egrave;re</a> | <a href="' . $url . '&page=' . $k . '">Pr&eacute;c&eacute;dente</a> | ';
                $Dernier .= 'Suivante | Derni&egrave;re ';
            } else {
                if ($page > 1 && $page < $nbrePage) {
                    $i = ($page - 1) * $engPage + 1;
                    $j = $page * $engPage;
                    $page < $nbrePage ? $l = $page + 1 : ($l = $page);
                    $page > 2 ? $k = $page - 1 : ($k = $page);
                    //$k = $page-1;
                    //$l = $page+1;
                    $Premier .= 'Affichage de ' . $i . ' &agrave; ' . $j . ' sur ' . $nbreEng . ' | <a href="' . $url . '&page=1">Premi&egrave;re</a> | <a href="' . $url . '&page=' . $k . '">Pr&eacute;c&eacute;dente</a> | ';
                    $Dernier .= '<a href="' . $url . '&page=' . $l . '">Suivante</a> | <a href="' . $url . '&page=' . $nbrePage . '">Derni&egrave;re</a> ';
                }
            }
        }
    }
    if ($ilang == '2' && $ilang != '') {
        if ($page == 1) {
            //Première page  Affichage de 1 &agrave; 25 of 50 | Premier | Pr&eacute;c&eacute;dente | <a href=''>Derni&egrave;re</a></
            $i = ($page - 1) * $engPage + 1;
            $j = $page * $engPage;
            $page < $nbrePage ? $k = $page + 1 : ($k = $page);
            $Premier .= 'View of ' . $i . ' to ' . $j . ' from ' . $nbreEng . ' | First | Previous | ';
            $Dernier .= '<a href="' . $url . '&page=' . $k . '">Next</a> | <a href="' . $url . '&page=' . $nbrePage . '">Last</a> ';
        } else {
            if ($page == $nbrePage) {
                //Dernière page
                $i = ($page - 1) * $engPage + 1;
                $j = $page * $engPage;
                $page > 2 ? $k = $page - 1 : ($k = $page);
                $Premier .= 'View of ' . $i . ' &agrave; ' . $j . ' from ' . $nbreEng . ' | <a href="' . $url . '&page=1">First</a> | <a href="' . $url . '&page=' . $k . '">Previous</a> | ';
                $Dernier .= 'Next | Last ';
            } else {
                if ($page > 1 && $page < $nbrePage) {
                    $i = ($page - 1) * $engPage + 1;
                    $j = $page * $engPage;
                    $page < $nbrePage ? $l = $page + 1 : ($l = $page);
                    $page > 2 ? $k = $page - 1 : ($k = $page);
                    //$k = $page-1;
                    //$l = $page+1;
                    $Premier .= 'View of ' . $i . ' to ' . $j . ' from ' . $nbreEng . ' | <a href="' . $url . '&page=1">First</a> | <a href="' . $url . '&page=' . $k . '">Previous</a> | ';
                    $Dernier .= '<a href="' . $url . '&page=' . $l . '">Next</a> | <a href="' . $url . '&page=' . $nbrePage . '">Last</a> ';
                }
            }
        }
    }
    if ($ilang == '3' && $ilang != '') {
        if ($page == 1) {
            //Première page  Affichage de 1 &agrave; 25 of 50 | Premier | Pr&eacute;c&eacute;dente | <a href=''>Derni&egrave;re</a></
            $i = ($page - 1) * $engPage + 1;
            $j = $page * $engPage;
            $page < $nbrePage ? $k = $page + 1 : ($k = $page);
            $Premier .= 'View de ' . $i . ' to ' . $j . ' de ' . $nbreEng . ' | Primeiro | Anterior | ';
            $Dernier .= '<a href="' . $url . '&page=' . $k . '">Next</a> | <a href="' . $url . '&page=' . $nbrePage . '">Último</a> ';
        } else {
            if ($page == $nbrePage) {
                //Dernière page
                $i = ($page - 1) * $engPage + 1;
                $j = $page * $engPage;
                $page > 2 ? $k = $page - 1 : ($k = $page);
                $Premier .= 'View de ' . $i . ' to ' . $j . ' de ' . $nbreEng . ' | <a href="' . $url . '&page=1">Primeiro</a> | <a href="' . $url . '&page=' . $k . '">Anterior</a> | ';
                $Dernier .= 'Next | Último ';
            } else {
                if ($page > 1 && $page < $nbrePage) {
                    $i = ($page - 1) * $engPage + 1;
                    $j = $page * $engPage;
                    $page < $nbrePage ? $l = $page + 1 : ($l = $page);
                    $page > 2 ? $k = $page - 1 : ($k = $page);
                    //$k = $page-1;
                    //$l = $page+1;
                    $Premier .= 'View de ' . $i . ' to ' . $j . ' de ' . $nbreEng . ' | <a href="' . $url . '&page=1">Primeiro</a> | <a href="' . $url . '&page=' . $k . '">Anterior</a> | ';
                    $Dernier .= '<a href="' . $url . '&page=' . $l . '">Next</a> | <a href="' . $url . '&page=' . $nbrePage . '">Último</a> ';
                }
            }
        }
    }
    return $Premier . $Dernier;
}