Пример #1
0
function show_results($dbh, $nbr_lignes = 0, $page = 0)
{
    global $nb_per_page;
    global $base_url;
    global $caller;
    global $charset;
    global $msg;
    global $id_fou;
    // on récupére le nombre de lignes qui vont bien
    $nbr_lignes = types_produits::countTypes();
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        // on lance la vraie requête
        $q = types_produits::listTypes($debut, $nb_per_page);
        $res = mysql_query($q, $dbh);
        while ($row = mysql_fetch_object($res)) {
            $typ = $row->id_produit;
            $lib_typ = $row->libelle;
            $taux_tva = new tva_achats($row->num_tva_achat);
            $lib_tva = htmlentities($taux_tva->taux_tva, ENT_QUOTES, $charset);
            $offre = new offres_remises($id_fou, $row->id_produit);
            if ($offre->remise) {
                $lib_rem = htmlentities($offre->remise, ENT_QUOTES, $charset);
            } else {
                $lib_rem = '0';
            }
            print pmb_bidi("\n\t\t\t<a href='#' onclick=\"set_parent('{$caller}', '{$row->id_produit}', '" . htmlentities(addslashes($lib_typ), ENT_QUOTES, $charset) . "', '{$lib_rem}', '{$lib_tva}'  )\">{$lib_typ}</a>");
            print "<br />";
        }
        mysql_free_result($res);
        // constitution des liens
        $nbepages = ceil($nbr_lignes / $nb_per_page);
        $suivante = $page + 1;
        $precedente = $page - 1;
        // affichage du lien précédent si nécessaire
        print '<hr /><div align=center>';
        if ($precedente > 0) {
            print "<a href='{$base_url}&page={$precedente}&nbr_lignes={$nbr_lignes}&no_display={$no_display}'><img src='./images/left.gif' border='0' title='{$msg['48']}' alt='[{$msg['48']}]' hspace='3' align='middle' /></a>";
        }
        for ($i = 1; $i <= $nbepages; $i++) {
            if ($i == $page) {
                print "<b>{$i}/{$nbepages}</b>";
            }
        }
        if ($suivante <= $nbepages) {
            print "<a href='{$base_url}&page={$suivante}&nbr_lignes={$nbr_lignes}&no_display={$no_display}'><img src='./images/right.gif' border='0' title='{$msg['49']}' alt='[{$msg['49']}]' hspace='3' align='middle' /></a>";
        }
    }
    print '</div>';
}
Пример #2
0
function show_list_type()
{
    global $dbh, $msg, $charset;
    global $acquisition_gestion_tva;
    $aff = '';
    $aff .= "<table>\n\t<tr>\n\t\t<th>" . htmlentities($msg[103], ENT_QUOTES, $charset) . "</th>\n\t\t<th>" . htmlentities($msg['acquisition_num_cp_compta'], ENT_QUOTES, $charset) . "</th>";
    if ($acquisition_gestion_tva) {
        $aff .= "<th>" . htmlentities($msg['acquisition_num_tva_achat'], ENT_QUOTES, $charset) . "</th>";
    }
    $aff .= "</tr>";
    $q = types_produits::listTypes();
    $res = pmb_mysql_query($q, $dbh);
    $nbr = pmb_mysql_num_rows($res);
    $tab_tva = array();
    if ($acquisition_gestion_tva) {
        $q2 = tva_achats::listTva();
        $r2 = pmb_mysql_query($q2, $dbh);
        while ($row = pmb_mysql_fetch_object($r2)) {
            $tab_tva[$row->id_tva] = $row->libelle;
        }
    }
    $parity = 1;
    for ($i = 0; $i < $nbr; $i++) {
        $row = pmb_mysql_fetch_object($res);
        if ($parity % 2) {
            $pair_impair = "even";
        } else {
            $pair_impair = "odd";
        }
        $parity += 1;
        $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=acquisition&sub=type&action=modif&id={$row->id_produit}';\" ";
        $aff .= "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>";
        $aff .= "<td><i>" . htmlentities($row->libelle, ENT_QUOTES, $charset) . "</i></td>";
        $aff .= "<td><i>" . htmlentities($row->num_cp_compta, ENT_QUOTES, $charset) . "</i></td>";
        if ($acquisition_gestion_tva) {
            $aff .= "<td><i>" . htmlentities($tab_tva[$row->num_tva_achat], ENT_QUOTES, $charset) . "</i></td>";
        }
        $aff .= "</tr>";
    }
    $aff .= "</table>\n\t\t<input class='bouton' type='button' value=' " . $msg[acquisition_ajout_type] . " ' onClick=\"document.location='./admin.php?categ=acquisition&sub=type&action=add'\" />";
    print $aff;
}
Пример #3
0
     $array_selector = $p_perso->get_ajax_list($persofield, $start);
     $origine = 'ARRAY';
     break;
 case 'perso_collstate':
     require_once $class_path . '/parametres_perso.class.php';
     $p_perso = new parametres_perso('notices');
     $array_selector = $p_perso->get_ajax_list($persofield, $start);
     $origine = 'ARRAY';
     break;
 case 'types_produits':
     // $param1 : id_fournisseur
     $array_selector = array();
     require_once $class_path . '/types_produits.class.php';
     require_once $class_path . '/tva_achats.class.php';
     require_once $class_path . '/offres_remises.class.php';
     $q = types_produits::listTypes();
     $res = pmb_mysql_query($q, $dbh);
     while ($row = pmb_mysql_fetch_object($res)) {
         $typ = $row->id_produit;
         $lib_typ = $row->libelle;
         $taux_tva = new tva_achats($row->num_tva_achat);
         $lib_tva = htmlentities($taux_tva->taux_tva, ENT_QUOTES, $charset);
         $offre = new offres_remises($linkfield, $row->id_produit);
         if ($offre->remise) {
             $lib_rem = htmlentities($offre->remise, ENT_QUOTES, $charset);
         } else {
             $lib_rem = '0';
         }
         $array_selector[$typ . ',' . $lib_rem . ',' . $lib_tva] = htmlentities($lib_typ, ENT_QUOTES, $charset);
     }
     $origine = "ARRAY";