예제 #1
0
function listeDesArticlestrs()
{
    $userName = getField('LOGIN', $_SESSION['GL_USER']['LOGIN'], 'LOGIN', 'compte');
    $ilang = getCodelangue($userName);
    isset($defaut) ? $where = " WHERE PRD_LIBELLE LIKE '{$defaut}%'" : ($where = "");
    $sql = "SELECT * FROM produit  {$where} ORDER BY PRD_LIBELLE ASC;";
    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
    $list = '';
    $i = 0;
    while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
        $in = '';
        $where = '';
        $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow");
        $qte = ProduitsQte($row['CODE_PRODUIT'], $valid = 1, $type = 'E') - ProduitsQte($row['CODE_PRODUIT'], $valid = 1, $type = 'S');
        //if($qte <= 0) $col = "tableFINIRow";
        //if($qte > 0){
        $list .= '<tr class="' . $col . '">
			<td align="left" valign="middle" class="text"><a href="#" onClick="pickUp(\'' . $row['CODE_PRODUIT'] . '\',\'' . addslashes($row['PRD_LIBELLE']) . '\',\'' . addslashes($row['ID_UNITE']) . '\',\'' . addslashes($row['PRD_PRIXACHAT']) . '\');">' . $row['CODE_PRODUIT'] . '</a></td>
			<td align="center" valign="middle" class="text"><a href="#" onClick="pickUp(\'' . $row['CODE_PRODUIT'] . '\',\'' . addslashes($row['PRD_LIBELLE']) . '\',\'' . addslashes($row['ID_UNITE']) . '\',\'' . addslashes($row['PRD_PRIXACHAT']) . '\');">' . $qte . '</a></td>
			<td align="center" valign="middle" class="text"><a href="#" onClick="pickUp(\'' . $row['CODE_PRODUIT'] . '\',\'' . addslashes($row['PRD_LIBELLE']) . '\',\'' . addslashes($row['ID_UNITE']) . '\',\'' . addslashes($row['PRD_PRIXACHAT']) . '\');">' . $row['PRD_PRIXVENTE'] . '</a></td>
			<td class="text" ><a href="#" onClick="pickUp(\'' . $row['CODE_PRODUIT'] . '\',\'' . addslashes($row['PRD_LIBELLE']) . '\',\'' . addslashes($row['ID_UNITE']) . '\',\'' . addslashes($row['PRD_PRIXACHAT']) . '\');">' . $row['PRD_LIBELLE'] . '</a></td>
			<td width="10%" align="left" valign="middle" class="text" ><a href="#" onClick="pickUp(\'' . $row['CODE_PRODUIT'] . '\',\'' . addslashes($row['PRD_LIBELLE']) . '\',\'' . addslashes($row['ID_UNITE']) . '\',\'' . addslashes($row['PRD_PRIXACHAT']) . '\');">' . $row['ID_UNITE'] . '</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>';
        }
    }
    return $list;
}
예제 #2
0
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     $row = $query->fetch(PDO::FETCH_ASSOC);
     //Data  CDE_STATUT
     $_SESSION['DATA_BDS'] = array('xid' => $row['CODE_BONSORTIE'], 'exercice' => $row['ID_EXERCICE'], 'datebonsortie' => frFormat2($row['SOR_DATE']), 'refbonsortie' => stripslashes($row['REF_BONSORTIE']), 'idbeneficiaire' => $row['CODE_BENEF'], 'beneficiaire' => stripslashes($row['BENEF_NOM']), 'libelle' => stripslashes($row['SOR_LIBELLE']), 'statut' => $row['SOR_VALIDE'], 'nbreLigne' => 0);
     //LIGNES
     $sql = "SELECT * FROM `detbonsortie` INNER JOIN produit ON (detbonsortie.CODE_PRODUIT LIKE produit.CODE_PRODUIT)\r\n\t\tWHERE CODE_BONSORTIE LIKE '" . addslashes($split[0]) . "'  ORDER BY ID_DETBONSORTIE ASC;";
     $query = $cnx->prepare($sql);
     //Prepare the SQL
     $query->execute();
     //Execute prepared SQL => $query
     //Ligne
     $_SESSION['DATA_BDS']['ligne'] = array();
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $dispo = ProduitsQte($row['CODE_PRODUIT'], $valid = 1, $type = 'E') - ProduitsQte($row['CODE_PRODUIT'], $valid = 1, $type = 'S');
         array_push($_SESSION['DATA_BDS']['ligne'], array('code_detbonsortie' => $row['CODE_DETBONSORTIE'], 'monlot' => $row['BSPRD_MONLOT'], 'codeproduit' => $row['CODE_PRODUIT'], 'produit' => stripslashes($row['PRD_LIBELLE']), 'qte' => $row['BSPRD_QTE'], 'dispo' => $dispo, 'unite' => $row['BSPRD_UNITE'], 'magasin' => $row['CODE_MAGASIN'], 'prix' => $row['BSPRD_PV'], 'reflot' => $row['BSPRD_REFLOT'], 'dateperemp' => preg_replace('[-]', '/', frFormat2($row['BSPRD_DATEPEREMP']))));
     }
     $_SESSION['DATA_BDS']['nbreLigne'] = $query->rowCount();
     header('location:validbonsortie.php?selectedTab=bds&rst=1');
     break;
 case 'delete':
     isset($_POST['rowSelection']) ? $id = $_POST['rowSelection'] : ($id = array());
     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');
     }