Example #1
0
function show_list_biblio()
{
    global $msg, $charset;
    global $tab_bib, $nb_bib;
    global $current_module;
    //Affiche de la liste des etablissements auxquels a acces l'utilisateur si > 1
    if ($nb_bib == '1') {
        show_list_bud($tab_bib[0][0]);
        exit;
    }
    $def_bibli = entites::getSessionBibliId();
    if (in_array($def_bibli, $tab_bib[0])) {
        show_list_bud($def_bibli);
        exit;
    }
    $aff = "<form class='form-" . $current_module . "' id='list_biblio_form' name='list_biblio_form' method='post' action=\"\" >";
    $aff .= "<h3>" . htmlentities($msg['acquisition_menu_chx_ent'], ENT_QUOTES, $charset) . "</h3><div class='row'></div>";
    $aff .= "<table>";
    $parity = 1;
    foreach ($tab_bib[0] as $k => $v) {
        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.forms['list_biblio_form'].setAttribute('action','./acquisition.php?categ=ach&sub=bud&action=list&id_bibli=" . $v . "');document.forms['list_biblio_form'].submit(); \" ";
        $aff .= "<tr class='" . $pair_impair . "' " . $tr_javascript . " style='cursor: pointer'><td><i>" . htmlentities($tab_bib[1][$k], ENT_QUOTES, $charset) . "</i></td></tr>";
    }
    $aff .= " </table></form>";
    print $aff;
}
function show_list_biblio()
{
    global $dbh;
    global $msg;
    global $charset;
    //Récupération de l'utilisateur
    $requete_user = "******" . SESSlogin . "' limit 1 ";
    $res_user = pmb_mysql_query($requete_user, $dbh);
    $row_user = pmb_mysql_fetch_row($res_user);
    $user_userid = $row_user[0];
    //Affichage de la liste des etablissements auxquels a acces l'utilisateur
    $aff = "<table>";
    $q = entites::list_biblio($user_userid);
    $res = pmb_mysql_query($q, $dbh);
    $nbr = pmb_mysql_num_rows($res);
    if (!$nbr) {
        //Pas d'etablissements définis pour l'utilisateur
        $error = true;
        $error_msg .= htmlentities($msg["acquisition_err_coord"], ENT_QUOTES, $charset) . "<div class='row'></div>";
    }
    if ($error) {
        error_message($msg[321], $error_msg . htmlentities($msg["acquisition_err_par"], ENT_QUOTES, $charset), '1', './admin.php?categ=acquisition');
        die;
    }
    if ($nbr == '1') {
        $row = pmb_mysql_fetch_object($res);
        show_list_exer($row->id_entite);
    } else {
        $parity = 1;
        while ($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=compta&action=list&ent={$row->id_entite}';\" ";
            $aff .= "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td><i>{$row->raison_sociale}</i></td></tr>";
        }
        $aff .= "</table>";
        print $aff;
    }
}
Example #3
0
function print_dev($id_bibli = 0, $id_dev = 0, $by_mail = FALSE)
{
    global $dbh, $charset, $base_path, $acquisition_pdfdev_print;
    global $acquisition_pdfdev_obj_mail, $acquisition_pdfdev_text_mail;
    global $acquisition_pdfdev_by_mail, $PMBuseremailbcc;
    if (!($id_bibli && $id_dev)) {
        return;
    }
    $bib = new entites($id_bibli);
    $bib_coord = pmb_mysql_fetch_object(entites::get_coordonnees($id_bibli, 1));
    $dev = new actes($id_dev);
    $id_fou = $dev->num_fournisseur;
    $fou = new entites($id_fou);
    $fou_coord = pmb_mysql_fetch_object(entites::get_coordonnees($id_fou, 1));
    $no_mail = FALSE;
    if ($by_mail == FALSE || !($acquisition_pdfdev_by_mail && strpos($bib_coord->email, '@') && strpos($fou_coord->email, '@'))) {
        $no_mail = TRUE;
    } else {
        $dest_name = '';
        if ($fou_coord->libelle) {
            $dest_name = $fou_coord->libelle;
        } else {
            $dest_name = $fou->raison_sociale;
        }
        if ($fou_coord->contact) {
            $dest_name .= " " . $fou_coord->contact;
        }
        $dest_mail = $fou_coord->email;
        $obj_mail = $acquisition_pdfdev_obj_mail;
        $text_mail = $acquisition_pdfdev_text_mail;
        $bib_name = $bib_coord->raison_sociale;
        $bib_mail = $bib_coord->email;
        $lettre = lettreDevis_factory::make();
        $lettre->doLettre($id_bibli, $id_dev);
        $piece_jointe = array();
        $piece_jointe[0]['contenu'] = $lettre->getLettre('S');
        $piece_jointe[0]['nomfichier'] = $lettre->getFileName();
        //         mailpmb($to_nom="", $to_mail,   $obj="",   $corps="",  $from_name="", $from_mail, $headers, $copie_CC="", $copie_BCC="", $faire_nl2br=0, $pieces_jointes=array())
        $res_envoi = mailpmb($dest_name, $dest_mail, $obj_mail, $text_mail, $bib_name, $bib_mail, "Content-Type: text/plain; charset=\"{$charset}\"", '', $PMBuseremailbcc, 1, $piece_jointe);
        if (!$res_envoi) {
            $no_mail = TRUE;
        }
    }
    if ($no_mail) {
        print "\t\n\t\t\t<form name='print_dev' action='pdf.php?pdfdoc=devi' target='lettre' method='post'>\t\t\n\t\t\t\t<input type='hidden' name='id_bibli' value='" . $id_bibli . "'/>\n\t\t\t\t<input type='hidden' name='id_dev' value='" . $id_dev . "'/>\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\topenPopUp('','lettre', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\n\t\t\t\t\tdocument.print_dev.submit();\n\t\t\t\t</script>\n\t\t\t</form>";
    }
}
Example #4
0
function show_list_fac($id_bibli)
{
    global $msg, $charset;
    global $search_form_actes, $faclist_form, $faclist_bt_chk, $faclist_script;
    global $faclist_bt_pay;
    global $nb_per_page_acq, $nb_per_page;
    global $class_path;
    global $user_input, $statut, $page, $nbr_lignes, $tri_param, $limit_param, $last_param, $sortBy;
    global $tab_bib;
    //gestion du tri
    if (!isset($sortBy)) {
        if (trim($_SESSION["acquisition_fac_sort"])) {
            $sortBy = $_SESSION["acquisition_fac_sort"];
        } else {
            $sortBy = "";
        }
    } else {
        $_SESSION["acquisition_fac_sort"] = $sortBy;
    }
    //Creation selecteur etablissement
    $sel_bibli = "<select class='saisie-50em' id='id_bibli' name='id_bibli' onchange=\"submit();\" >";
    foreach ($tab_bib[0] as $k => $v) {
        $sel_bibli .= "<option value='" . $v . "' ";
        if ($v == $id_bibli) {
            $sel_bibli .= "selected='selected' ";
        }
        $sel_bibli .= ">" . htmlentities($tab_bib[1][$k], ENT_QUOTES, $charset) . "</option>";
    }
    $sel_bibli .= "</select>";
    $search_form_actes = str_replace('<!-- sel_bibli -->', $sel_bibli, $search_form_actes);
    //Creation selecteur statut
    $sel_statut = "<select class='saisie-25em' id='statut' name='statut' onchange=\"submit();\" >";
    $list_statut = actes::getStatelist(TYP_ACT_FAC);
    foreach ($list_statut as $k => $v) {
        $sel_statut .= "<option value='" . $k . "'>" . htmlentities($v, ENT_QUOTES, $charset) . "</option>";
    }
    $sel_statut .= "</select>";
    $search_form_actes = str_replace('<!-- sel_statut -->', $sel_statut, $search_form_actes);
    //Affichage form de recherche
    $titre = htmlentities($msg['recherche'] . ' : ' . $msg['acquisition_ach_fac'], ENT_QUOTES, $charset);
    $action = "./acquisition.php?categ=ach&sub=fact&action=list&user_input=";
    $search_form_actes = str_replace('!!form_title!!', $titre, $search_form_actes);
    $search_form_actes = str_replace('!!action!!', $action, $search_form_actes);
    $search_form_actes = str_replace('!!user_input!!', $user_input, $search_form_actes);
    $search_form_actes = str_replace('!!sortBy!!', $sortBy, $search_form_actes);
    print $search_form_actes;
    if (!$statut) {
        $statut = getSessionFacState();
        //Recuperation du statut courant
    } else {
        setSessionFacState($statut);
    }
    print "<script type='text/javascript' >document.forms['search'].elements['statut'].value = " . $statut . ";document.forms['search'].elements['user_input'].focus();\n\tdocument.forms['search'].elements['user_input'].select();</script>";
    //Prise en compte du formulaire de recherche
    // nombre de références par pages
    if (!isset($nb_per_page)) {
        if ($nb_per_page_acq != "") {
            $nb_per_page = $nb_per_page_acq;
        } else {
            $nb_per_page = 10;
        }
    }
    // traitement de la saisie utilisateur
    require_once $class_path . "/analyse_query.class.php";
    // on récupére le nombre de lignes qui vont bien
    if (!$nbr_lignes) {
        if (!$user_input) {
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_FAC, $statut);
        } else {
            $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
            if ($aq->error) {
                error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
                exit;
            }
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_FAC, $statut, $aq, $user_input);
        }
    } else {
        $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
    }
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        $url_base = "{$PHP_SELF}?categ=ach&sub=fact&action=list&id_bibli={$id_bibli}&user_input=" . rawurlencode(stripslashes($user_input)) . "&statut={$statut}&sortBy={$sortBy}";
        // on lance la vraie requête
        if (!$user_input) {
            $res = entites::listActes($id_bibli, TYP_ACT_FAC, $statut, $debut, $nb_per_page, 0, '', $sortBy);
        } else {
            $res = entites::listActes($id_bibli, TYP_ACT_FAC, $statut, $debut, $nb_per_page, $aq, $user_input, $sortBy);
        }
        //Affichage liste des factures
        $fac_list = "";
        $nbr = pmb_mysql_num_rows($res);
        $parity = 1;
        for ($i = 0; $i < $nbr; $i++) {
            $row = pmb_mysql_fetch_object($res);
            $st = $row->statut & ~STA_ACT_ARC;
            switch ($st) {
                case STA_ACT_REC:
                    $st_fac = htmlentities($msg['acquisition_fac_rec'], ENT_QUOTES, $charset);
                    break;
                case STA_ACT_PAY:
                    $st_fac = htmlentities($msg['acquisition_fac_pay'], ENT_QUOTES, $charset);
                    break;
                default:
                    $st_fac = '';
            }
            if (($row->statut & STA_ACT_ARC) == STA_ACT_ARC) {
                $st_fac = '<s>' . $st_fac . '</s>';
            }
            if ($parity % 2) {
                $pair_impair = "even";
            } else {
                $pair_impair = "odd";
            }
            $parity += 1;
            $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='" . $pair_impair . "'\" ";
            $dn_javascript = "onmousedown=\"document.location='./acquisition.php?categ=ach&sub=fact&action=modif&id_bibli=" . $id_bibli . "&id_fac=" . $row->id_acte . "' \" ";
            $fac_list .= "<tr class='" . $pair_impair . "' " . $tr_javascript . " style='cursor: pointer' >\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $row->numero . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $row->num_acte_parent . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . htmlentities($row->raison_sociale, ENT_QUOTES, $charset) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . formatdate($row->date_acte) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>{$st_fac}</i></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<a href=# onclick=\"openPopUp('./pdf.php?pdfdoc=fact&id_fac=" . $row->id_acte . "' ,'print_PDF', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\" >\n\t\t\t\t\t\t\t\t<img src='./images/print.gif' border='0' align='center' alt='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' />\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</td>";
            if ($statut == STA_ACT_REC) {
                $fac_list .= "<td><input type='checkbox' name='chk[]' id='chk[" . $row->id_acte . "]' value='" . $row->id_acte . "'/></td>";
            }
            $fac_list .= "</tr>";
        }
        if (!$last_param) {
            $nav_bar = aff_pagination($url_base, $nbr_lignes, $nb_per_page, $page, 10, true, true);
        } else {
            $nav_bar = "";
        }
        $fieldList = array("1" => "numero", "2" => "num_acte_parent", "3" => "raison_sociale", "4" => "date_acte");
        foreach ($fieldList as $k => $field) {
            if ($sortBy == $field) {
                $faclist_form = str_replace('!!sortBy_' . $k . '_1!!', "-" . $field, $faclist_form);
                $faclist_form = str_replace('!!sortBy_' . $k . '_2!!', "&nbsp;&#x25B4;", $faclist_form);
            } elseif ($sortBy == "-" . $field) {
                $faclist_form = str_replace('!!sortBy_' . $k . '_1!!', $field, $faclist_form);
                $faclist_form = str_replace('!!sortBy_' . $k . '_2!!', "&nbsp;&#x25BE;", $faclist_form);
            } else {
                $faclist_form = str_replace('!!sortBy_' . $k . '_1!!', $field, $faclist_form);
                $faclist_form = str_replace('!!sortBy_' . $k . '_2!!', "", $faclist_form);
            }
        }
        $faclist_form = str_replace('<!-- fac_list -->', $fac_list, $faclist_form);
        $faclist_form = str_replace('<!-- nav_bar -->', $nav_bar, $faclist_form);
        $bt_list = '';
        $bt_sup = '';
        if ($statut == STA_ACT_REC) {
            //colonne chk
            $faclist_form = str_replace("<!-- chk_th -->", "<th class='act_cell_chkbox'>&nbsp;</th>", $faclist_form);
            //Bouton Sélectionner
            $faclist_form = str_replace('<!-- bt_chk -->', $faclist_bt_chk, $faclist_form);
            //JavaScript
            $faclist_form = str_replace('<!-- script -->', $faclist_script, $faclist_form);
            //bouton payer
            $bt_list = $faclist_bt_pay;
        }
        $faclist_form = str_replace('<!-- bt_list -->', $bt_list, $faclist_form);
        $faclist_form = str_replace('<!-- bt_sup -->', $bt_sup, $faclist_form);
        print $faclist_form;
    } else {
        // la requête n'a produit aucun résultat
        error_message($msg['acquisition_fac_rech'], str_replace('!!fac_cle!!', stripslashes($user_input), $msg['acquisition_fac_rech_error']), 0, './categ=ach&sub=fact&action=list&id_bibli=' . $id_bibli);
    }
}
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: acquisition.inc.php,v 1.15 2015-08-13 08:06:36 jpermanne Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once "{$class_path}/entites.class.php";
require_once "{$class_path}/paiements.class.php";
require_once "{$class_path}/frais.class.php";
require_once "{$class_path}/types_produits.class.php";
require_once "{$class_path}/offres_remises.class.php";
require_once "{$class_path}/tva_achats.class.php";
//Recherche des etablissements auxquels a acces l'utilisateur
$q = entites::list_biblio(SESSuserid);
$list_bib = pmb_mysql_query($q, $dbh);
$nb_bib = pmb_mysql_num_rows($list_bib);
$tab_bib = array();
while ($row = pmb_mysql_fetch_object($list_bib)) {
    $tab_bib[0][] = $row->id_entite;
    $tab_bib[1][] = $row->raison_sociale;
}
//si on arrive par print_acquisition.php, pas d'entêtes
if (!$acquisition_no_html) {
    echo window_title($database_window_title . $msg[acquisition_menu] . $msg[1003] . $msg[1001]);
}
switch ($categ) {
    case 'ach':
        if (!$nb_bib) {
            //Pas de bibliothèques définies pour l'utilisateur
function show_rem_form($id_bibli, $id_fou, $id_prod)
{
    global $msg;
    global $charset;
    global $rem_form, $bt_sup;
    $bibli = new entites($id_bibli);
    $fou = new entites($id_fou);
    $rem_form = str_replace('!!raison!!', htmlentities($fou->raison_sociale, ENT_QUOTES, $charset), $rem_form);
    if (!$id_prod) {
        $id_prod = 0;
        $rem_form = str_replace('!!form_title!!', htmlentities($msg['acquisition_rem_add'], ENT_QUOTES, $charset), $rem_form);
        //Produits non remisés pour le selecteur
        $list_no_cond = entites::listNoOffres($id_fou);
        $sel_prod = "<select name='sel_prod' id='sel_prod'>";
        while ($row = pmb_mysql_fetch_object($list_no_cond)) {
            $sel_prod .= "<option value='" . $row->id_produit . "' >" . htmlentities($row->libelle, ENT_QUOTES, $charset) . "</option>";
        }
        $sel_prod .= "</select>";
        $rem_form = str_replace('!!lib_prod!!', $sel_prod, $rem_form);
        $rem_form = str_replace('!!rem!!', '0.00', $rem_form);
        $rem_form = str_replace('!!commentaires!!', '', $rem_form);
        $rem_form = str_replace('!!bouton_sup!!', '', $rem_form);
    } else {
        $typ = new types_produits($id_prod);
        $rem_form = str_replace('!!form_title!!', htmlentities($msg['acquisition_rem_mod'], ENT_QUOTES, $charset), $rem_form);
        $rem_form = str_replace('!!lib_prod!!', htmlentities($typ->libelle, ENT_QUOTES, $charset), $rem_form);
        $offre = new offres_remises($id_fou, $id_prod);
        $rem_form = str_replace('!!rem!!', number_format($offre->remise, 2, '.', ''), $rem_form);
        $rem_form = str_replace('!!commentaires!!', htmlentities($offre->condition_remise, ENT_QUOTES, $charset), $rem_form);
        $rem_form = str_replace('!!bouton_sup!!', $bt_sup, $rem_form);
    }
    $rem_form = str_replace('!!id_fou!!', $id_fou, $rem_form);
    $rem_form = str_replace('!!id_bibli!!', $id_bibli, $rem_form);
    $rem_form = str_replace('!!lib_bibli!!', htmlentities($bibli->raison_sociale, ENT_QUOTES, $charset), $rem_form);
    $rem_form = str_replace('!!id_prod!!', $id_prod, $rem_form);
    print $rem_form;
}
Example #7
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_bibli;
    // on récupére le nombre de lignes qui vont bien
    $nbr_lignes = entites::count_coordonnees($id_bibli);
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        // on lance la vraie requête
        $res = entites::get_coordonnees($id_bibli, '-1', $debut, $nb_per_page);
        while ($row = mysql_fetch_object($res)) {
            $adresse = '';
            $adresse1 = '';
            if ($row->libelle != '') {
                $adresse = htmlentities(addslashes($row->libelle), ENT_QUOTES, $charset) . "\\n";
                $adresse1 = htmlentities($row->libelle, ENT_QUOTES, $charset);
            }
            if ($row->contact != '') {
                $adresse .= htmlentities(addslashes($row->contact), ENT_QUOTES, $charset) . "\\n";
            }
            $adresse1 .= ' (';
            if ($row->adr1 != '') {
                $adresse .= htmlentities(addslashes($row->adr1), ENT_QUOTES, $charset) . "\\n";
                $adresse1 .= htmlentities($row->adr1, ENT_QUOTES, $charset) . ' ';
            }
            if ($row->adr2 != '') {
                $adresse .= htmlentities(addslashes($row->adr2), ENT_QUOTES, $charset) . "\\n";
                $adresse1 .= htmlentities($row->adr2, ENT_QUOTES, $charset) . ' ';
            }
            if ($row->cp != '') {
                $adresse .= htmlentities(addslashes($row->cp), ENT_QUOTES, $charset) . ' ';
                $adresse1 .= htmlentities($row->cp, ENT_QUOTES, $charset) . ' ';
            }
            if ($row->ville != '') {
                $adresse .= htmlentities(addslashes($row->ville), ENT_QUOTES, $charset);
                $adresse1 .= htmlentities($row->ville, ENT_QUOTES, $charset);
            }
            $adresse1 .= ')';
            print pmb_bidi("\n\t\t\t<a href='#' onclick=\"set_parent('{$caller}', '{$row->id_contact}', '{$adresse}' )\">{$adresse1}</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>';
}
Example #8
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_bibli, $id_exer;
    global $acquisition_budget_show_all;
    global $elt_query;
    // on récupére le nombre de lignes qui vont bien
    $nbr_lignes = entites::countRubriquesFinales($id_bibli, $id_exer, true, $elt_query);
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        // on lance la vraie requête
        if (!$acquisition_budget_show_all) {
            $res = entites::listRubriquesFinales($id_bibli, $id_exer, true, $debut, $nb_per_page, $elt_query);
        } else {
            $res = entites::listRubriquesFinales($id_bibli, $id_exer, true, 0, 0, $elt_query);
        }
        $id_bud = 0;
        print "<div class=\"row\"><table><tr><th>" . htmlentities($msg['acquisition_rub'], ENT_QUOTES, $charset) . "</th><th>" . htmlentities($msg['acquisition_rub_sol'], ENT_QUOTES, $charset) . "</th></tr>";
        while ($row = mysql_fetch_object($res)) {
            $new_id_bud = $row->num_budget;
            if ($new_id_bud != $id_bud) {
                $id_bud = $new_id_bud;
                print pmb_bidi("<tr><td>" . htmlentities($row->lib_bud, ENT_QUOTES, $charset) . "</td>");
                if ($row->type_budget) {
                    $aff_glo = true;
                    $mnt = $row->montant_global;
                    $cal = budgets::calcEngagement($id_bud);
                    if ($cal > $mnt) {
                        $sol = 0;
                    } else {
                        $sol = $mnt - $cal;
                    }
                    $sol = number_format($sol, 2, '.', '');
                    if ($cal > $mnt * ($row->seuil_alerte / 100)) {
                        $alert = true;
                    } else {
                        $alert = false;
                    }
                } else {
                    $aff_glo = false;
                }
                print "<td></td></tr>";
            }
            $tab_rub = rubriques::listAncetres($row->id_rubrique, true);
            $lib_rub = '';
            $lib_rub_no_html = "";
            foreach ($tab_rub as $dummykey => $value) {
                $lib_rub .= htmlentities($value[1], ENT_QUOTES, $charset);
                $lib_rub_no_html .= $value[1];
                if ($value[0] != $row->id_rubrique) {
                    $lib_rub .= ":";
                }
            }
            if (!$aff_glo) {
                $mnt = $row->montant;
                $cal = rubriques::calcEngagement($row->id_rubrique);
                if ($cal > $mnt) {
                    $sol = 0;
                } else {
                    $sol = $mnt - $cal;
                }
                $sol = number_format($sol, 2, '.', '');
                if ($cal >= $mnt * ($row->seuil_alerte / 100)) {
                    $alert = true;
                } else {
                    $alert = false;
                }
            }
            if ($alert) {
                $cl = "class='erreur' ";
            } else {
                $cl = '';
            }
            print "<tr><td><div class='child_tab'>";
            print pmb_bidi("\n\t\t\t<a href='#' onclick=\"set_parent('{$caller}', '{$row->id_rubrique}', '" . htmlentities(addslashes($row->lib_bud . ":" . $lib_rub_no_html), ENT_QUOTES, $charset) . "' )\" ><span " . $cl . ">" . $lib_rub . "</span></a>\n\t\t\t</div></td><td style='text-align:right;'><span " . $cl . ">" . $sol . "</span></td></tr>");
        }
        print "</table>";
        mysql_free_result($res);
        // affichage pagination
        print "<hr /><div align='center'>";
        if (!$acquisition_budget_show_all) {
            $base_url .= "&elt_query=" . $elt_query;
            $nav_bar = aff_pagination($base_url, $nbr_lignes, $nb_per_page, $page, 10, true, true);
            print $nav_bar;
        }
        print "</div></div>";
    }
}
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: liste_relances.inc.php,v 1.7 2015-04-03 11:16:26 jpermanne Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
// popup d'impression PDF pour liste des relances de receptions
// reçoit : tab_no_mail
require_once "{$class_path}/entites.class.php";
require_once "{$class_path}/receptions_relances.class.php";
$tab_fou = unserialize(rawurldecode($tab_no_mail));
if (count($tab_fou) && $id_bibli) {
    switch ($acquisition_pdfrel_pdfrtf) {
        case '1':
            $lettre = new lettreRelance_RTF();
            break;
        default:
            $lettre = new lettreRelance_PDF();
            break;
    }
    foreach ($tab_fou as $id_fou => $tab_act) {
        $bib = new entites($id_bibli);
        $bib_coord = pmb_mysql_fetch_object(entites::get_coordonnees($id_bibli, 1));
        $fou = new entites($id_fou);
        $fou_coord = pmb_mysql_fetch_object(entites::get_coordonnees($id_fou, 1));
        $lettre->doLettre($bib, $bib_coord, $fou, $fou_coord, $tab_act);
    }
    $lettre->getLettre();
}
Example #10
0
         $array_selector[$typ . ',' . $lib_rem . ',' . $lib_tva] = htmlentities($lib_typ, ENT_QUOTES, $charset);
     }
     $origine = "ARRAY";
     break;
 case 'fournisseurs':
     // $param1 : id_bibli
     $array_selector = array();
     require_once $class_path . '/entites.class.php';
     $requete = "select raison_sociale, id_entite from entites where type_entite='0' ";
     $requete .= "and num_bibli='" . $param1 . "' ";
     $requete .= "and raison_sociale like '" . addslashes($start) . "%' order by 1";
     $res = pmb_mysql_query($requete, $dbh);
     while ($row = pmb_mysql_fetch_object($res)) {
         $adresse = "";
         $idAdresse = 0;
         $coord = entites::get_coordonnees($row->id_entite, '1');
         if (pmb_mysql_num_rows($coord) != 0) {
             $coord = pmb_mysql_fetch_object($coord);
             $idAdresse = $coord->id_contact;
             if ($coord->libelle != '') {
                 $adresse = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n";
             }
             if ($coord->contact != '') {
                 $adresse .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n";
             }
             if ($coord->adr1 != '') {
                 $adresse .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n";
             }
             if ($coord->adr2 != '') {
                 $adresse .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n";
             }
Example #11
0
 function doLettre($id_bibli, $id_dev)
 {
     global $msg, $pmb_pdf_font;
     //On récupère les infos du devis
     $dev = new actes($id_dev);
     $lignes = actes::getLignes($id_dev);
     $bib = new entites($dev->num_entite);
     $coord_liv = new coordonnees($dev->num_contact_livr);
     $coord_fac = new coordonnees($dev->num_contact_fact);
     $fou = new entites($dev->num_fournisseur);
     $coord_fou = entites::get_coordonnees($dev->num_fournisseur, '1');
     $coord_fou = mysql_fetch_object($coord_fou);
     $this->PDF->AddPage();
     $this->PDF->setFont($pmb_pdf_font);
     $this->PDF->npage = 1;
     //Affichage logo
     if ($bib->logo != '') {
         $this->PDF->Image($bib->logo, $this->x_logo, $this->y_logo, $this->l_logo, $this->h_logo);
     }
     //Affichage raison sociale
     $raison = $bib->raison_sociale;
     $this->PDF->setFontSize($this->fs_raison);
     $this->PDF->SetXY($this->x_raison, $this->y_raison);
     $this->PDF->MultiCell($this->l_raison, $this->h_raison, $raison, 0, 'L', 0);
     //Affichage date $ville
     $ville_end = stripos($coord_fac->ville, "cedex");
     if ($ville_end !== false) {
         $ville = trim(substr($coord_fac->ville, 0, $ville_end));
     } else {
         $ville = $coord_fac->ville;
     }
     $date = $ville . $this->sep_ville_date . format_date($dev->date_acte);
     $this->PDF->setFontSize($this->fs_date);
     $this->PDF->SetXY($this->x_date, $this->y_date);
     $this->PDF->Cell($this->l_date, $this->h_date, $date, 0, 0, 'L', 0);
     //Affichage coordonnees fournisseur
     //si pas de raison sociale définie, on reprend le libellé
     //si il y a une raison sociale, pas besoin
     if ($fou->raison_sociale != '') {
         $adr_fou = $fou->raison_sociale . "\n";
     } else {
         $adr_fou = $coord_fou->libelle . "\n";
     }
     if ($coord_fou->adr1 != '') {
         $adr_fou .= $coord_fou->adr1 . "\n";
     }
     if ($coord_fou->adr2 != '') {
         $adr_fou .= $coord_fou->adr2 . "\n";
     }
     if ($coord_fou->cp != '') {
         $adr_fou .= $coord_fou->cp . " ";
     }
     if ($coord_fou->ville != '') {
         $adr_fou .= $coord_fou->ville . "\n\n";
     }
     if ($coord_fou->contact != '') {
         $adr_fou .= $coord_fou->contact;
     }
     $this->PDF->setFontSize($this->fs_adr_fou);
     $this->PDF->SetXY($this->x_adr_fou, $this->y_adr_fou);
     $this->PDF->MultiCell($this->l_adr_fou, $this->h_adr_fou, $adr_fou, 0, 'L', 0);
     //Affichage adresse facturation
     $adr_fac = $this->text_adr_fac . "\n";
     if ($coord_fac->libelle != '') {
         $adr_fac .= $coord_fac->libelle . "\n";
     }
     if ($coord_fac->adr1 != '') {
         $adr_fac .= $coord_fac->adr1 . "\n";
     }
     if ($coord_fac->adr2 != '') {
         $adr_fac .= $coord_fac->adr2 . "\n";
     }
     if ($coord_fac->cp != '') {
         $adr_fac .= $coord_fac->cp . " ";
     }
     if ($coord_fac->ville != '') {
         $adr_fac .= $coord_fac->ville . "\n";
     }
     if ($coord_fac->tel1 != '') {
         $adr_fac .= $this->text_adr_fac_tel . " " . $coord_fac->tel1 . "\n";
     }
     if ($coord_fac->tel2 != '') {
         $adr_fac .= $this->text_adr_fac_tel2 . " " . $coord_fac->tel2 . "\n";
     }
     if ($coord_fac->fax != '') {
         $adr_fac .= $this->text_adr_fac_fax . " " . $coord_fac->fax . "\n";
     }
     if ($coord_fac->email != '') {
         $adr_fac .= $this->text_adr_fac_email . " " . $coord_fac->email . "\n";
     }
     $this->PDF->setFontSize($this->fs_adr_fac);
     $this->PDF->SetXY($this->x_adr_fac, $this->y_adr_fac);
     $this->PDF->MultiCell($this->l_adr_fac, $this->h_adr_fac, $adr_fac, 1, 'L', 0);
     //Affichage adresse livraison
     $adr_liv = '';
     if ($coord_liv->libelle != '') {
         $adr_liv .= $coord_liv->libelle . "\n";
     }
     if ($coord_liv->adr1 != '') {
         $adr_liv .= $coord_liv->adr1 . "\n";
     }
     if ($coord_liv->adr2 != '') {
         $adr_liv .= $coord_liv->adr2 . "\n";
     }
     if ($coord_liv->cp != '') {
         $adr_liv .= $coord_liv->cp . " ";
     }
     if ($coord_liv->ville != '') {
         $adr_liv .= $coord_liv->ville . "\n";
     }
     if ($coord_liv->tel1 != '') {
         $adr_liv .= $this->text_adr_liv_tel . " " . $coord_liv->tel1 . "\n";
     }
     if ($coord_liv->tel2 != '') {
         $adr_liv .= $this->text_adr_liv_tel2 . " " . $coord_liv->tel2 . "\n";
     }
     if ($adr_liv != '') {
         $adr_liv = $this->text_adr_liv . "\n" . $adr_liv;
         $this->PDF->setFontSize($this->fs_adr_liv);
         $this->PDF->SetXY($this->x_adr_liv, $this->y_adr_liv);
         $this->PDF->MultiCell($this->l_adr_liv, $this->h_adr_liv, $adr_liv, 1, 'L', 0);
     }
     //Affichage tiret pliage
     $this->PDF->Line(0, 105, 3, 105);
     //Affichage numero devis
     $numero = $this->text_num . $dev->numero;
     $this->PDF->SetFontSize($this->fs_num);
     $this->PDF->Cell($this->l_num, $this->h_num, $numero, 0, 0, 'L', 0);
     $this->PDF->Ln();
     //Affichage texte before + commentaires
     if ($dev->commentaires_i != '') {
         if ($this->text_before != '') {
             $this->text_before .= "\n\n";
         }
         $this->text_before .= $dev->commentaires_i;
     }
     if ($this->text_before != '') {
         $this->PDF->SetFontSize($this->fs);
         $this->PDF->MultiCell($this->w, $this->h_tab, $this->text_before, 0, 'J', 0);
         $this->PDF->Ln();
     }
     //Affichage lignes devis
     $this->PDF->SetAutoPageBreak(false);
     $this->PDF->AliasNbPages();
     $this->PDF->SetFontSize($this->fs_tab);
     $this->PDF->SetFillColor(230);
     $this->y = $this->PDF->GetY();
     $this->PDF->SetXY($this->x_tab, $this->y);
     $this->x_code = $this->x_tab;
     $this->w_code = round($this->w * 20 / 100);
     $this->x_lib = $this->x_code + $this->w_code;
     $this->w_lib = round($this->w * 60 / 100);
     $this->x_qte = $this->x_lib + $this->w_lib;
     $this->w_qte = round($this->w * 10 / 100);
     $this->doEntete();
     while ($row = mysql_fetch_object($lignes)) {
         $typ = new types_produits($row->num_type);
         $col1 = $typ->libelle . "\n" . $row->code;
         $this->h = $this->h_tab * max($this->PDF->NbLines($this->w_code, $col1), $this->PDF->NbLines($this->w_lib, $row->libelle), $this->PDF->NbLines($this->w_qte, $row->nb));
         $this->s = $this->y + $this->h;
         if ($this->s > $this->hauteur_page - $this->marge_bas) {
             $this->PDF->AddPage();
             $this->PDF->SetXY($this->x_tab, $this->y_tab);
             $this->y = $this->PDF->GetY();
             $this->doEntete();
         }
         $this->PDF->SetXY($this->x_code, $this->y);
         $this->PDF->Rect($this->x_code, $this->y, $this->w_code, $this->h);
         $this->PDF->MultiCell($this->w_code, $this->h_tab, $col1, 0, 'L');
         $this->PDF->SetXY($this->x_lib, $this->y);
         $this->PDF->Rect($this->x_lib, $this->y, $this->w_lib, $this->h);
         $this->PDF->MultiCell($this->w_lib, $this->h_tab, $row->libelle, 0, 'L');
         $this->PDF->SetXY($this->x_qte, $this->y);
         $this->PDF->Rect($this->x_qte, $this->y, $this->w_qte, $this->h);
         $this->PDF->MultiCell($this->w_qte, $this->h_tab, $row->nb, 0, 'L');
         $this->y = $this->y + $this->h;
     }
     $this->PDF->SetAutoPageBreak(true, $this->marge_bas);
     $this->PDF->SetX($this->marge_gauche);
     $this->PDF->SetY($this->y);
     $this->PDF->SetFontSize($this->fs);
     $this->PDF->Ln();
     //Affichage texte after
     if ($this->text_after != '') {
         $this->PDF->MultiCell($this->w, $this->h_tab, $this->text_after, 0, 'J', 0);
         $this->PDF->Ln();
     }
     //Affichage signature
     $this->PDF->Ln();
     $this->PDF->SetFontSize($this->fs_sign);
     $this->PDF->SetX($this->x_sign);
     $this->PDF->MultiCell($this->l_sign, $this->h_sign, $this->text_sign, 0, 'L', 0);
 }
 function doLettre($id_bibli, $id_cde)
 {
     global $msg, $acquisition_gestion_tva;
     //On récupère les infos de la commande
     $cde = new actes($id_cde);
     $lignes = actes::getLignes($id_cde);
     $bib = new entites($cde->num_entite);
     $coord_liv = new coordonnees($cde->num_contact_livr);
     $coord_fac = new coordonnees($cde->num_contact_fact);
     $fou = new entites($cde->num_fournisseur);
     $coord_fou = entites::get_coordonnees($cde->num_fournisseur, '1');
     $coord_fou = pmb_mysql_fetch_object($coord_fou);
     $this->PDF->AddPage();
     $this->PDF->npage = 1;
     //Affichage logo
     if ($bib->logo != '') {
         $this->PDF->Image($bib->logo, $this->x_logo, $this->y_logo, $this->l_logo, $this->h_logo);
     }
     //Affichage raison sociale
     $raison = $bib->raison_sociale;
     $this->PDF->setFontSize($this->fs_raison);
     $this->PDF->SetXY($this->x_raison, $this->y_raison);
     $this->PDF->MultiCell($this->l_raison, $this->h_raison, $raison, 0, 'L', 0);
     //Affichage date $ville
     $ville_end = stripos($coord_fac->ville, "cedex");
     if ($ville_end !== false) {
         $ville = trim(substr($coord_fac->ville, 0, $ville_end));
     } else {
         $ville = $coord_fac->ville;
     }
     if ($cde->date_valid != '0000-00-00') {
         $date = $ville . $this->sep_ville_date . format_date($cde->date_valid);
     } else {
         $date = $ville . $this->sep_ville_date . format_date($cde->date_acte);
     }
     $this->PDF->setFontSize($this->fs_date);
     $this->PDF->SetXY($this->x_date, $this->y_date);
     $this->PDF->Cell($this->l_date, $this->h_date, $date, 0, 0, 'L', 0);
     //Affichage coordonnees fournisseur
     //si pas de raison sociale définie, on reprend le libellé
     //si il y a une raison sociale, pas besoin
     if ($fou->raison_sociale != '') {
         $adr_fou = $fou->raison_sociale . "\n";
     } else {
         $adr_fou = $coord_fou->libelle . "\n";
     }
     if ($coord_fou->adr1 != '') {
         $adr_fou .= $coord_fou->adr1 . "\n";
     }
     if ($coord_fou->adr2 != '') {
         $adr_fou .= $coord_fou->adr2 . "\n";
     }
     if ($coord_fou->cp != '') {
         $adr_fou .= $coord_fou->cp . " ";
     }
     if ($coord_fou->ville != '') {
         $adr_fou .= $coord_fou->ville . "\n\n";
     }
     if ($coord_fou->contact != '') {
         $adr_fou .= $coord_fou->contact;
     }
     $this->PDF->setFontSize($this->fs_adr_fou);
     $this->PDF->SetXY($this->x_adr_fou, $this->y_adr_fou);
     $this->PDF->MultiCell($this->l_adr_fou, $this->h_adr_fou, $adr_fou, 0, 'L', 0);
     //Affichage adresse facturation
     $adr_fac = $this->text_adr_fac . "\n";
     if ($coord_fac->libelle != '') {
         $adr_fac .= $coord_fac->libelle . "\n";
     }
     if ($coord_fac->adr1 != '') {
         $adr_fac .= $coord_fac->adr1 . "\n";
     }
     if ($coord_fac->adr2 != '') {
         $adr_fac .= $coord_fac->adr2 . "\n";
     }
     if ($coord_fac->cp != '') {
         $adr_fac .= $coord_fac->cp . " ";
     }
     if ($coord_fac->ville != '') {
         $adr_fac .= $coord_fac->ville . "\n";
     }
     if ($coord_fac->tel1 != '') {
         $adr_fac .= $this->text_adr_fac_tel . " " . $coord_fac->tel1 . "\n";
     }
     if ($coord_fac->tel2 != '') {
         $adr_fac .= $this->text_adr_fac_tel2 . " " . $coord_fac->tel2 . "\n";
     }
     if ($coord_fac->fax != '') {
         $adr_fac .= $this->text_adr_fac_fax . " " . $coord_fac->fax . "\n";
     }
     if ($coord_fac->email != '') {
         $adr_fac .= $this->text_adr_fac_email . " " . $coord_fac->email . "\n";
     }
     if ($bib->tva) {
         $adr_fac .= $msg["acquisition_tva"] . ": " . $bib->tva . "\n";
     }
     $this->PDF->setFontSize($this->fs_adr_fac);
     $this->PDF->SetXY($this->x_adr_fac, $this->y_adr_fac);
     $this->PDF->MultiCell($this->l_adr_fac, $this->h_adr_fac, $adr_fac, 1, 'L', 0);
     //Affichage adresse livraison
     $adr_liv = '';
     if ($coord_liv->libelle != '') {
         $adr_liv .= $coord_liv->libelle . "\n";
     }
     if ($coord_liv->adr1 != '') {
         $adr_liv .= $coord_liv->adr1 . "\n";
     }
     if ($coord_liv->adr2 != '') {
         $adr_liv .= $coord_liv->adr2 . "\n";
     }
     if ($coord_liv->cp != '') {
         $adr_liv .= $coord_liv->cp . " ";
     }
     if ($coord_liv->ville != '') {
         $adr_liv .= $coord_liv->ville . "\n";
     }
     if ($coord_liv->tel1 != '') {
         $adr_liv .= $this->text_adr_liv_tel . " " . $coord_liv->tel1 . "\n";
     }
     if ($coord_liv->tel2 != '') {
         $adr_liv .= $this->text_adr_liv_tel2 . " " . $coord_liv->tel2 . "\n";
     }
     if ($coord_liv->email != '') {
         $adr_liv .= $this->text_adr_liv_email . " " . $coord_liv->email . "\n";
     }
     if ($adr_liv != '') {
         $adr_liv = $this->text_adr_liv . "\n" . $adr_liv;
         $this->PDF->setFontSize($this->fs_adr_liv);
         $this->PDF->SetXY($this->x_adr_liv, $this->y_adr_liv);
         $this->PDF->MultiCell($this->l_adr_liv, $this->h_adr_liv, $adr_liv, 1, 'L', 0);
     }
     //Affichage tiret pliage
     $this->PDF->Line(0, 105, 3, 105);
     $this->y = $this->PDF->GetY();
     $this->PDF->Ln();
     $this->PDF->Ln();
     //Affichage numero client
     $numero_cli = $this->text_num_cli . " " . $fou->num_cp_client;
     $this->PDF->SetFontSize($this->fs_num);
     $this->PDF->SetXY($this->x_num, $this->y_num);
     $this->PDF->Cell($this->l_num_cli, $this->h_num, $numero_cli, 0, 0, 'L', 0);
     $this->PDF->Ln();
     //Affichage numero commande
     $numero = $this->text_num . $cde->numero;
     $this->PDF->SetFontSize($this->fs_num);
     $this->PDF->Cell($this->l_num, $this->h_num, $numero, 0, 0, 'L', 0);
     $this->PDF->Ln();
     //Affichage reference
     if ($cde->reference != '') {
         $ref = $this->text_ref . $cde->reference;
         $this->PDF->SetFontSize($this->fs);
         $this->PDF->Cell($this->w, $this->h_tab, $ref, 0, 0, 'L', 0);
         $this->PDF->Ln();
         $this->PDF->Ln();
     }
     //Affichage texte before + commentaires
     if ($cde->commentaires_i != '') {
         if ($this->text_before != '') {
             $this->text_before .= "\n\n";
         }
         $this->text_before .= $cde->commentaires_i;
     }
     if ($this->text_before != '') {
         $this->PDF->SetFontSize($this->fs);
         $this->PDF->MultiCell($this->w, $this->h_tab, $this->text_before, 0, 'J', 0);
     }
     //Affichage lignes commandes
     $this->PDF->SetAutoPageBreak(false);
     $this->PDF->AliasNbPages();
     $this->PDF->SetFontSize($this->fs_tab);
     $this->PDF->SetFillColor(230);
     $this->y = $this->PDF->GetY();
     $this->PDF->SetXY($this->x_tab, $this->y);
     $tab_mnt = array();
     $i = 0;
     while ($row = pmb_mysql_fetch_object($lignes)) {
         $typ = new types_produits($row->num_type);
         $col1 = $typ->libelle;
         if ($row->code) {
             $col1 .= "\n" . $row->code;
         }
         $col2 = $row->libelle;
         $col3 = $row->nb;
         $col4 = number_format(round($row->prix, 2), 2, '.', '') . " " . $cde->devise;
         if ($acquisition_gestion_tva) {
             $col4 .= "\n" . number_format(round($row->tva, 2), 2, '.', '') . " %";
         }
         $col4 .= "\n" . number_format(round($row->remise, 2), 2, '.', '') . " %";
         $col5 = '';
         if ($row->date_ech != '0000-00-00') {
             $col5 = formatdate($row->date_ech);
         }
         if ($row->num_rubrique) {
             $rub = new rubriques($row->num_rubrique);
             if ($rub->num_cp_compta) {
                 $col5 .= "\n\n" . $rub->num_cp_compta;
             }
         }
         //Est ce qu'on dépasse ?
         $this->h = $this->h_tab * max($this->PDF->NbLines($this->w_col1, $col1), $this->PDF->NbLines($this->w_col2, $col2), $this->PDF->NbLines($this->w_col3, $col3), $this->PDF->NbLines($this->w_col4, $col4), $this->PDF->NbLines($this->w_col5, $col5));
         $this->s = $this->y + $this->h;
         if (!$this->p_header) {
             $this->s = $this->s + $this->h_header;
         }
         //Si oui, chgt page
         if ($this->s > $this->hauteur_page - $this->marge_bas - $this->fs_footer) {
             $this->PDF->AddPage();
             $this->y = $this->y_tab;
             $this->p_header = false;
         }
         if (!$this->p_header) {
             $this->doEntete();
             $this->y += $this->h_header;
         }
         $this->p_header = true;
         $this->PDF->SetXY($this->x_col1, $this->y);
         $this->PDF->Rect($this->x_col1, $this->y, $this->w_col1, $this->h);
         $this->PDF->MultiCell($this->w_col1, $this->h_tab, $col1, 0, 'L');
         $this->PDF->SetXY($this->x_col2, $this->y);
         $this->PDF->Rect($this->x_col2, $this->y, $this->w_col2, $this->h);
         $this->PDF->MultiCell($this->w_col2, $this->h_tab, $col2, 0, 'L');
         $this->PDF->SetXY($this->x_col3, $this->y);
         $this->PDF->Rect($this->x_col3, $this->y, $this->w_col3, $this->h);
         $this->PDF->MultiCell($this->w_col3, $this->h_tab, $col3, 0, 'R');
         $this->PDF->SetXY($this->x_col4, $this->y);
         $this->PDF->Rect($this->x_col4, $this->y, $this->w_col4, $this->h);
         $this->PDF->MultiCell($this->w_col4, $this->h_tab, $col4, 0, 'R');
         $this->PDF->SetXY($this->x_col5, $this->y);
         $this->PDF->Rect($this->x_col5, $this->y, $this->w_col5, $this->h);
         $this->PDF->MultiCell($this->w_col5, $this->h_tab, $col5, 0, 'R');
         $this->y += $this->h;
         $tab_mnt[$i]['q'] = $row->nb;
         $tab_mnt[$i]['p'] = $row->prix;
         $tab_mnt[$i]['r'] = $row->remise;
         $tab_mnt[$i]['t'] = $row->tva;
         $i++;
     }
     $this->PDF->SetAutoPageBreak(true, $this->marge_bas);
     $this->PDF->SetX($this->marge_gauche);
     $this->PDF->SetY($this->y);
     $this->PDF->SetFontSize($this->fs);
     $this->PDF->Ln();
     //affichage des montants ht, ttc, tva
     $tab_tot = calc($tab_mnt, 2);
     $this->y = $this->PDF->GetY();
     if ($acquisition_gestion_tva) {
         $this->h = $this->h_tot * 3;
     } else {
         $this->h = $this->h_tot;
     }
     $this->s = $this->y + $this->h;
     if ($this->s > $this->hauteur_page - $this->marge_bas) {
         $this->PDF->AddPage();
         $this->PDF->SetXY($this->x_tot, $this->marge_haut);
         $this->y = $this->PDF->GetY();
     }
     if ($acquisition_gestion_tva) {
         $this->PDF->Cell($this->l_tot, $this->h_tot, $msg['acquisition_total_ht'], 1, 0, 'L', 0);
         $this->PDF->Cell($this->l_tot, $this->h_tot, number_format($tab_tot['ht'], 2, '.', '') . " " . $cde->devise, 1, 1, 'R', 0);
         $this->PDF->Cell($this->l_tot, $this->h_tot, $msg['acquisition_tva'], 1, 0, 'L', 0);
         $this->PDF->Cell($this->l_tot, $this->h_tot, number_format($tab_tot['tva'], 2, '.', '') . " " . $cde->devise, 1, 1, 'R', 0);
     }
     $this->PDF->Cell($this->l_tot, $this->h_tot, $msg['acquisition_total_ttc'], 1, 0, 'L', 0);
     $this->PDF->Cell($this->l_tot, $this->h_tot, number_format($tab_tot['ttc'], 2, '.', '') . " " . $cde->devise, 1, 1, 'R', 0);
     $this->PDF->Ln();
     //Affichage conditions de paiement
     $text_paiement = $msg['acquisition_mode_pai'];
     if ($fou->num_paiement) {
         $pai = new paiements($fou->num_paiement);
         $text_paiement .= "{$pai->libelle}";
         $this->PDF->MultiCell($this->w, $this->h_tab, $text_paiement, 0, 'L', 0);
         $this->PDF->Ln();
     }
     //Affichage texte after
     if ($this->text_after != '') {
         $this->PDF->MultiCell($this->w, $this->h_tab, $this->text_after, 0, 'J', 0);
         $this->PDF->Ln();
     }
     //Affichage signature
     $this->PDF->Ln();
     $this->PDF->SetFontSize($this->fs_sign);
     $this->PDF->SetX($this->x_sign);
     $this->PDF->MultiCell($this->l_sign, $this->h_sign, $this->text_sign, 0, 'L', 0);
 }
 function generate_RTF()
 {
     global $base_path, $charset, $msg, $biblio_logo;
     global $biblio_name, $biblio_logo, $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_state, $biblio_country, $biblio_phone, $biblio_email, $biblio_website;
     global $madame_monsieur;
     //Format des fonts
     $fontHead = new Font(12, 'Arial', '#0E298A');
     $fontHead->setBold();
     $fontSmall = new Font(1);
     $fontComment = new Font(10, 'Arial');
     $fontComment->setItalic();
     $fontChapter = new Font(10, 'Arial');
     $fontSubChapter = new Font(10, 'Arial');
     $fontSubChapter->setUnderline();
     //Format des paragraphes
     $parPmb = new ParFormat();
     $parPmb->setIndentRight(12.5);
     $parPmb->setBackColor('#0E298A');
     $parPmb->setSpaceAfter(8);
     $parHead = new ParFormat();
     $parHead->setSpaceBefore(5);
     $parChapter = new ParFormat();
     $parChapter->setSpaceBefore(2);
     $parChapter->setSpaceAfter(1);
     $parComment = new ParFormat();
     $parComment->setIndentLeft(1);
     $parComment->setIndentRight(0.5);
     $parContenu = new ParFormat('justify');
     $parContenu->setIndentLeft(1);
     $parSubChapter = new ParFormat();
     $parSubChapter->setIndentLeft(0.5);
     $parInfo = new ParFormat();
     $parInfo->setIndentLeft(0, 5);
     $parInfo->setSpaceAfter(1.5);
     $parInfoBib = new ParFormat();
     $parInfoBib->setIndentLeft(0);
     $parInfoBib->setSpaceAfter(1.5);
     //Document
     $rtf = new Rtf();
     $rtf->setMargins(1, 1, 1, 1);
     foreach ($this->liste_rel as $id_fournisseur => $info_fournisseur) {
         $rtf->setMargins(1, 1, 1, 1);
         $sect =& $rtf->addSection();
         $table =& $sect->addTable();
         $table->addRows(1, 2);
         $table->addColumnsList(array(15, 4));
         //$table->addImageToCell(1,1,$base_path."/images/".$biblio_logo,new ParFormat('center'),0,0);
         // Info biblio
         $cell =& $table->getCell(1, 1);
         $cell->writeText($this->to_utf8($biblio_name), new Font(14, 'Arial', '#0E298A'), new ParFormat('left'));
         if ($biblio_adr1) {
             $cell->writeText($this->to_utf8($biblio_adr1), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         if ($biblio_adr2) {
             $cell->writeText($this->to_utf8($biblio_adr2), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         if ($biblio_cp || $biblio_town) {
             $cell->writeText($this->to_utf8($biblio_cp . " " . $biblio_town), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         if ($biblio_phone) {
             $cell->writeText($this->to_utf8($biblio_phone), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         if ($biblio_email) {
             $cell->writeText($this->to_utf8($biblio_email), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         // Info date de génération
         $cell =& $table->getCell(1, 2);
         if ($biblio_email) {
             $cell->writeText($this->to_utf8("\n" . $msg['fpdf_edite'] . " " . formatdate(date("Y-m-d", time())), ENT_QUOTES, $charset), new Font(12, 'Arial', '#0E298A'), new ParFormat('right'));
         }
         if ($id_fournisseur) {
             $fou = new entites($id_fournisseur);
             $coord_fou = entites::get_coordonnees($id_fournisseur, 1);
             $coord_fou = pmb_mysql_fetch_object($coord_fou);
             if ($fou->raison_sociale != '') {
                 $libelle = $fou->raison_sociale;
             } else {
                 $libelle = $coord_fou->libelle;
             }
             $table =& $sect->addTable();
             $table->addRows(2, 2);
             $table->addColumnsList(array(9, 10));
             $cell =& $table->getCell(1, 2);
             $cell->writeText($this->to_utf8($libelle), new Font(14, 'Arial', '#0E298A'), new ParFormat('left'));
             if ($coord_fou->adr1) {
                 $cell->writeText($this->to_utf8($coord_fou->adr1), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
             if ($coord_fou->adr2) {
                 $cell->writeText($this->to_utf8($coord_fou->adr2), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
             if ($coord_fou->cp) {
                 $cell->writeText($this->to_utf8($coord_fou->cp), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
             if ($coord_fou->ville) {
                 $cell->writeText($this->to_utf8($coord_fou->ville), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
             if ($coord_fou->contact != '') {
                 $cell =& $table->getCell(2, 2);
                 $cell->writeText($this->to_utf8($msg['acquisition_act_formule'] . " " . $coord_fou->contact), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
         }
         $sect->writeText($this->to_utf8($msg["abts_gestion_retard_lettre_monsieur"] . "<br />"), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         foreach ($info_fournisseur as $num_notice => $info_notice) {
             //print $num_notice; print_r($info_notice) ;exit;
             $perio = new serial_display($num_notice);
             $sect->writeText($this->to_utf8($perio->notice->tit1), $fontHead, $parHead);
             $sect->emptyParagraph($fontSmall, $parPmb);
             foreach ($info_notice as $abt_num => $info_abt) {
                 //$sect->writeText($this->to_utf8($doc), new Font(10,'Arial'), $parInfo);
                 foreach ($info_abt as $rel_id => $rel_info) {
                     $date = "<u>" . $rel_info["rel_libelle_numero"] . "</u> : " . formatdate($rel_info["rel_date_parution"]);
                     $sect->writeText($this->to_utf8($date), new Font(10, 'Arial'), $parInfo);
                     $sect->writeText($this->to_utf8($rel_info["rel_comment_gestion"]), new Font(10, 'Arial'), $parSubChapter);
                 }
             }
         }
         $sect->insertPageBreak();
     }
     $rtf->sendRtf("rapport");
 }
Example #14
0
function verif_exercice($id_bibli)
{
    global $charset;
    global $msg;
    global $dbh;
    $q = entites::getCurrentExercices($id_bibli);
    $r = mysql_query($q, $dbh);
    if (mysql_num_rows($r)) {
        return;
    }
    //Pas d'exercice actif pour la bibliothèque
    $error_msg .= htmlentities($msg["acquisition_err_exer"], ENT_QUOTES, $charset) . "<div class='row'></div>";
    error_message($msg[321], $error_msg . htmlentities($msg["acquisition_err_par"], ENT_QUOTES, $charset), '1', './admin.php?categ=acquisition');
    die;
}
Example #15
0
function show_list_liv($id_bibli)
{
    global $msg, $charset;
    global $search_form_actes, $livlist_form;
    global $nb_per_page_acq;
    global $class_path;
    global $user_input, $statut, $page, $nbr_lignes, $tri_param, $limit_param, $last_param;
    global $tab_bib;
    //Creation selecteur etablissement
    $sel_bibli = "<select class='saisie-50em' id='id_bibli' name='id_bibli' onchange=\"submit();\" >";
    foreach ($tab_bib[0] as $k => $v) {
        $sel_bibli .= "<option value='" . $v . "' ";
        if ($v == $id_bibli) {
            $sel_bibli .= "selected='selected' ";
        }
        $sel_bibli .= ">" . htmlentities($tab_bib[1][$k], ENT_QUOTES, $charset) . "</option>";
    }
    $sel_bibli .= "</select>";
    $search_form_actes = str_replace('<!-- sel_bibli -->', $sel_bibli, $search_form_actes);
    //Creation selecteur statut
    $sel_statut = "<select class='saisie-25em' id='statut' name='statut' onchange=\"submit();\" >";
    $list_statut = actes::getStatelist(TYP_ACT_LIV);
    foreach ($list_statut as $k => $v) {
        $sel_statut .= "<option value='" . $k . "'>" . htmlentities($v, ENT_QUOTES, $charset) . "</option>";
    }
    $sel_statut .= "</select>";
    $search_form_actes = str_replace('<!-- sel_statut -->', $sel_statut, $search_form_actes);
    //Affichage form de recherche
    $titre = htmlentities($msg['recherche'] . ' : ' . $msg['acquisition_ach_liv'], ENT_QUOTES, $charset);
    $action = "./acquisition.php?categ=ach&sub=livr&action=list&user_input=";
    $search_form_actes = str_replace('!!form_title!!', $titre, $search_form_actes);
    $search_form_actes = str_replace('!!action!!', $action, $search_form_actes);
    $search_form_actes = str_replace('!!user_input!!', $user_input, $search_form_actes);
    print $search_form_actes;
    if (!$statut) {
        $statut = getSessionLivState();
        //Recuperation du statut courant
    } else {
        setSessionLivState($statut);
    }
    print "<script type='text/javascript' >document.forms['search'].elements['statut'].value = " . $statut . ";document.forms['search'].elements['user_input'].focus();\n\tdocument.forms['search'].elements['user_input'].select();</script>";
    //Prise en compte du formulaire de recherche
    // nombre de références par pages
    if ($nb_per_page_acq != "") {
        $nb_per_page = $nb_per_page_acq;
    } else {
        $nb_per_page = 10;
    }
    // traitement de la saisie utilisateur
    require_once $class_path . "/analyse_query.class.php";
    // on récupére le nombre de lignes qui vont bien
    if (!$nbr_lignes) {
        if (!$user_input) {
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_LIV, $statut);
        } else {
            $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
            if ($aq->error) {
                error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
                exit;
            }
            $nbr_lignes = entites::getNbActes($id_bibli, TYP_ACT_LIV, $statut, $aq, $user_input);
        }
    } else {
        $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0);
    }
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        $url_base = "{$PHP_SELF}?categ=ach&sub=livr&action=list&id_bibli={$id_bibli}&user_input=" . rawurlencode(stripslashes($user_input)) . "&statut={$statut}";
        // on lance la vraie requête
        if (!$user_input) {
            $res = entites::listActes($id_bibli, TYP_ACT_LIV, $statut, $debut, $nb_per_page);
        } else {
            $res = entites::listActes($id_bibli, TYP_ACT_LIV, $statut, $debut, $nb_per_page, $aq, $user_input);
        }
        //Affichage liste des livraisons
        $liv_list = "";
        $nbr = pmb_mysql_num_rows($res);
        $parity = 1;
        for ($i = 0; $i < $nbr; $i++) {
            $row = pmb_mysql_fetch_object($res);
            $fourn = new entites($row->num_fournisseur);
            $id_cde = liens_actes::getParent($row->id_acte);
            $cde = new actes($id_cde);
            $st = $row->statut & ~STA_ACT_ARC;
            switch ($st) {
                case STA_ACT_REC:
                    $st_liv = htmlentities($msg['acquisition_liv_rec'], ENT_QUOTES, $charset);
                    break;
                default:
                    $st_liv = '';
            }
            if (($row->statut & STA_ACT_ARC) == STA_ACT_ARC) {
                $st_liv = '<s>' . $st_liv . '</s>';
            }
            if ($parity % 2) {
                $pair_impair = "even";
            } else {
                $pair_impair = "odd";
            }
            $parity += 1;
            $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='" . $pair_impair . "'\" ";
            $dn_javascript = "onmousedown=\"document.location='./acquisition.php?categ=ach&sub=livr&action=modif&id_bibli=" . $id_bibli . "&id_liv=" . $row->id_acte . "' \" ";
            $liv_list .= "<tr class='" . $pair_impair . "' " . $tr_javascript . " style='cursor: pointer' >\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $row->numero . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . $cde->numero . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . htmlentities($fourn->raison_sociale, ENT_QUOTES, $charset) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>" . formatdate($row->date_acte) . "</i></td>\n\t\t\t\t\t\t<td " . $dn_javascript . " ><i>{$st_liv}</i></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<a href=# onclick=\"openPopUp('./pdf.php?pdfdoc=livr&id_liv=" . $row->id_acte . "' ,'print_PDF', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\" >\n\t\t\t\t\t\t\t\t<img src='./images/print.gif' border='0' align='center' alt='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg['imprimer'], ENT_QUOTES, $charset) . "' />\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>";
        }
        if (!$last_param) {
            $nav_bar = aff_pagination($url_base, $nbr_lignes, $nb_per_page, $page);
        } else {
            $nav_bar = "";
        }
        $livlist_form = str_replace('<!-- liv_list -->', $liv_list, $livlist_form);
        $livlist_form = str_replace('<!-- nav_bar -->', $nav_bar, $livlist_form);
        print $livlist_form;
    } else {
        // la requête n'a produit aucun résultat
        error_message($msg['acquisition_liv_rech'], str_replace('!!liv_cle!!', stripslashes($user_input), $msg['acquisition_liv_rech_error']), 0, './categ=ach&sub=livr&action=list&id_bibli=' . $id_bibli);
    }
}
Example #16
0
function show_results($dbh, $user_input, $nbr_lignes = 0, $page = 0, $id = 0)
{
    global $nb_per_page;
    global $base_url;
    global $caller;
    global $charset;
    global $msg;
    global $id_bibli;
    //comptage
    if ($user_input == "") {
        $nbr_lignes = entites::getNbFournisseurs($id_bibli);
    } else {
        $aq = new analyse_query(stripslashes($user_input));
        if ($aq->error) {
            error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message));
            exit;
        }
        $nbr_lignes = entites::getNbFournisseurs($id_bibli, $aq);
    }
    if (!$page) {
        $page = 1;
    }
    $debut = ($page - 1) * $nb_per_page;
    if ($nbr_lignes) {
        //liste
        if ($user_input == "") {
            $res = entites::list_fournisseurs($id_bibli, $debut, $nb_per_page);
        } else {
            $res = entites::list_fournisseurs($id_bibli, $debut, $nb_per_page, $aq);
        }
        while ($row = mysql_fetch_object($res)) {
            $entry = $row->raison_sociale;
            $adresse = '';
            if ($caller != 'form_abonnement') {
                $coord = entites::get_coordonnees($row->id_entite, '1');
                if (mysql_num_rows($coord) != 0) {
                    $coord = mysql_fetch_object($coord);
                    if ($coord->libelle != '') {
                        $adresse = htmlentities(addslashes($coord->libelle), ENT_QUOTES, $charset) . "\\n";
                    }
                    if ($coord->contact != '') {
                        $adresse .= htmlentities(addslashes($coord->contact), ENT_QUOTES, $charset) . "\\n";
                    }
                    if ($coord->adr1 != '') {
                        $adresse .= htmlentities(addslashes($coord->adr1), ENT_QUOTES, $charset) . "\\n";
                    }
                    if ($coord->adr2 != '') {
                        $adresse .= htmlentities(addslashes($coord->adr2), ENT_QUOTES, $charset) . "\\n";
                    }
                    if ($coord->cp != '') {
                        $adresse .= htmlentities(addslashes($coord->cp), ENT_QUOTES, $charset) . ' ';
                    }
                    if ($coord->ville != '') {
                        $adresse .= htmlentities(addslashes($coord->ville), ENT_QUOTES, $charset);
                    }
                }
            }
            print pmb_bidi("\n\t\t\t<a href='#' onclick=\"set_parent('{$caller}', '{$row->id_entite}', '" . htmlentities(addslashes($entry), ENT_QUOTES, $charset) . "', '{$adresse}' )\">{$entry}</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}&user_input=" . rawurlencode(stripslashes($user_input)) . "&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}&user_input=" . rawurlencode(stripslashes($user_input)) . "&no_display={$no_display}'><img src='./images/right.gif' border='0' title='{$msg['49']}' alt='[{$msg['49']}]' hspace='3' align='middle' /></a>";
        }
    }
    print '</div>';
}
Example #17
0
function show_coord_form($id = 0)
{
    global $msg;
    global $charset;
    global $coord_form, $coord_form_biblio, $coord_form_suite;
    global $ptab, $script;
    $ptab[1] = $ptab[1] . $ptab[10] . $ptab[11];
    $ptab[1] = str_replace('!!adresse!!', htmlentities($msg[acquisition_adr_fac], ENT_QUOTES, $charset), $ptab[1]);
    $coord_form = str_replace('!!id!!', $id, $coord_form);
    $ptab[3] = str_replace('!!id!!', $id, $ptab[3]);
    if (!$id) {
        $coord_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_ajout_biblio], ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!raison_suppr!!', '', $coord_form);
        $coord_form = str_replace('!!raison!!', '', $coord_form);
        $coord_form = str_replace('!!contact!!', $ptab[1], $coord_form);
        $coord_form = str_replace('!!max_coord!!', '2', $coord_form);
        $coord_form = str_replace('!!id1!!', '0', $coord_form);
        $coord_form = str_replace('!!lib_1!!', '', $coord_form);
        $coord_form = str_replace('!!cta_1!!', '', $coord_form);
        $coord_form = str_replace('!!ad1_1!!', '', $coord_form);
        $coord_form = str_replace('!!ad2_1!!', '', $coord_form);
        $coord_form = str_replace('!!cpo_1!!', '', $coord_form);
        $coord_form = str_replace('!!vil_1!!', '', $coord_form);
        $coord_form = str_replace('!!eta_1!!', '', $coord_form);
        $coord_form = str_replace('!!pay_1!!', '', $coord_form);
        $coord_form = str_replace('!!te1_1!!', '', $coord_form);
        $coord_form = str_replace('!!te2_1!!', '', $coord_form);
        $coord_form = str_replace('!!fax_1!!', '', $coord_form);
        $coord_form = str_replace('!!ema_1!!', '', $coord_form);
        $coord_form = str_replace('!!com_1!!', '', $coord_form);
        $coord_form = str_replace('!!id2!!', '0', $coord_form);
        $coord_form = str_replace('!!lib_2!!', '', $coord_form);
        $coord_form = str_replace('!!cta_2!!', '', $coord_form);
        $coord_form = str_replace('!!ad1_2!!', '', $coord_form);
        $coord_form = str_replace('!!ad2_2!!', '', $coord_form);
        $coord_form = str_replace('!!cpo_2!!', '', $coord_form);
        $coord_form = str_replace('!!vil_2!!', '', $coord_form);
        $coord_form = str_replace('!!eta_2!!', '', $coord_form);
        $coord_form = str_replace('!!pay_2!!', '', $coord_form);
        $coord_form = str_replace('!!te1_2!!', '', $coord_form);
        $coord_form = str_replace('!!te2_2!!', '', $coord_form);
        $coord_form = str_replace('!!fax_2!!', '', $coord_form);
        $coord_form = str_replace('!!ema_2!!', '', $coord_form);
        $coord_form = str_replace('!!com_2!!', '', $coord_form);
        $coord_form = str_replace('!!commentaires!!', '', $coord_form);
        $coord_form = str_replace('!!siret!!', '', $coord_form);
        $coord_form = str_replace('!!rcs!!', '', $coord_form);
        $coord_form = str_replace('!!naf!!', '', $coord_form);
        $coord_form = str_replace('!!tva!!', '', $coord_form);
        $coord_form = str_replace('!!site_web!!', '', $coord_form);
        $coord_form = str_replace('!!logo!!', '', $coord_form);
        autorisations();
    } else {
        $biblio = new entites($id);
        $coord_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_modif_biblio], ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!raison!!', htmlentities($biblio->raison_sociale, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!contact!!', $ptab[1], $coord_form);
        $row = mysql_fetch_object(entites::get_coordonnees($biblio->id_entite, '1'));
        $coord_form = str_replace('!!id1!!', $row->id_contact, $coord_form);
        $coord_form = str_replace('!!lib_1!!', htmlentities($row->libelle, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!cta_1!!', htmlentities($row->contact, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!ad1_1!!', htmlentities($row->adr1, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!ad2_1!!', htmlentities($row->adr2, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!cpo_1!!', htmlentities($row->cp, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!vil_1!!', htmlentities($row->ville, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!eta_1!!', htmlentities($row->etat, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!pay_1!!', htmlentities($row->pays, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!te1_1!!', htmlentities($row->tel1, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!te2_1!!', htmlentities($row->tel2, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!fax_1!!', htmlentities($row->fax, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!ema_1!!', htmlentities($row->email, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!com_1!!', htmlentities($row->commentaires, ENT_QUOTES, $charset), $coord_form);
        $row = mysql_fetch_object(entites::get_coordonnees($biblio->id_entite, '2'));
        $coord_form = str_replace('!!id2!!', $row->id_contact, $coord_form);
        $coord_form = str_replace('!!lib_2!!', htmlentities($row->libelle, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!cta_2!!', htmlentities($row->contact, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!ad1_2!!', htmlentities($row->adr1, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!ad2_2!!', htmlentities($row->adr2, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!cpo_2!!', htmlentities($row->cp, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!vil_2!!', htmlentities($row->ville, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!eta_2!!', htmlentities($row->etat, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!pay_2!!', htmlentities($row->pays, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!te1_2!!', htmlentities($row->tel1, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!te2_2!!', htmlentities($row->tel2, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!fax_2!!', htmlentities($row->fax, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!ema_2!!', htmlentities($row->email, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!com_2!!', htmlentities($row->commentaires, ENT_QUOTES, $charset), $coord_form);
        $liste_coord = entites::get_coordonnees($biblio->id_entite, '0');
        $coord_form = str_replace('!!max_coord!!', mysql_num_rows($liste_coord) + 2, $coord_form);
        $i = 3;
        while ($row = mysql_fetch_object($liste_coord)) {
            $coord_form = str_replace('<!--coord_repetables-->', $ptab[2] . '<!--coord_repetables-->', $coord_form);
            $coord_form = str_replace('!!no_X!!', $i, $coord_form);
            $i++;
            $coord_form = str_replace('!!idX!!', $row->id_contact, $coord_form);
            $coord_form = str_replace('!!lib_X!!', htmlentities($row->libelle, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!cta_X!!', htmlentities($row->contact, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!ad1_X!!', htmlentities($row->adr1, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!ad2_X!!', htmlentities($row->adr2, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!cpo_X!!', htmlentities($row->cp, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!vil_X!!', htmlentities($row->ville, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!eta_X!!', htmlentities($row->etat, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!pay_X!!', htmlentities($row->pays, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!te1_X!!', htmlentities($row->tel1, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!te2_X!!', htmlentities($row->tel2, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!fax_X!!', htmlentities($row->fax, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!ema_X!!', htmlentities($row->email, ENT_QUOTES, $charset), $coord_form);
            $coord_form = str_replace('!!com_X!!', htmlentities($row->commentaires, ENT_QUOTES, $charset), $coord_form);
        }
        $coord_form = str_replace('!!commentaires!!', htmlentities($biblio->commentaires, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!siret!!', htmlentities($biblio->siret, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!rcs!!', htmlentities($biblio->rcs, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!naf!!', htmlentities($biblio->naf, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!tva!!', htmlentities($biblio->tva, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!site_web!!', htmlentities($biblio->site_web, ENT_QUOTES, $charset), $coord_form);
        $coord_form = str_replace('!!logo!!', htmlentities($biblio->logo, ENT_QUOTES, $charset), $coord_form);
        autorisations($biblio->autorisations);
        $coord_form = str_replace('<!-- bouton_sup -->', $ptab[3], $coord_form);
        $coord_form = str_replace('!!raison_suppr!!', addslashes($biblio->raison_sociale), $coord_form);
    }
    print confirmation_delete("./admin.php?categ=acquisition&sub=entite&action=del&id=");
    print $script;
    print $coord_form;
}
Example #18
0
function get_coordonnees_etab($user_id = '0', $field_values, $current_field, $form_name)
{
    global $dbh, $msg, $charset;
    global $acquisition_active;
    global $user_acquisition_adr_form;
    if (!$acquisition_active) {
        return;
    }
    if (!($field_values[7] & ACQUISITION_AUTH)) {
        return;
    }
    if ($user_id == '0') {
        return;
    }
    //Affichage de la liste des bibliothèques auxquelles a accès l'utilisateur
    $q = entites::list_biblio($user_id);
    $res = mysql_query($q, $dbh);
    $nbr = mysql_num_rows($res);
    if ($nbr == '0') {
        return;
    }
    $tab1 = explode('|', $field_values[$current_field]);
    $tab_adr = array();
    foreach ($tab1 as $key => $value) {
        $tab2 = explode(',', $value);
        $tab_adr[$tab2[0]]['id_adr_fac'] = $tab2[1];
        $tab_adr[$tab2[0]]['id_adr_liv'] = $tab2[2];
    }
    while ($row = mysql_fetch_object($res)) {
        $acquisition_user_param .= "<div class='row'>";
        $acquisition_user_param .= "<label class='etiquette'>" . htmlentities($row->raison_sociale, ENT_QUOTES, $charset) . "</label>";
        $temp_adr_form = $user_acquisition_adr_form;
        if ($tab_adr[$row->id_entite]['id_adr_fac']) {
            $coord = new coordonnees($tab_adr[$row->id_entite]['id_adr_fac']);
            $id_adr_fac = $coord->id_contact;
            if ($coord->libelle != '') {
                $adr_fac = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->contact != '') {
                $adr_fac .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr1 != '') {
                $adr_fac .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr2 != '') {
                $adr_fac .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->cp != '') {
                $adr_fac .= htmlentities($coord->cp, ENT_QUOTES, $charset) . ' ';
            }
            if ($coord->ville != '') {
                $adr_fac .= htmlentities($coord->ville, ENT_QUOTES, $charset);
            }
        } else {
            $id_adr_fac = '0';
            $adr_fac = '';
        }
        if ($tab_adr[$row->id_entite]['id_adr_liv']) {
            $coord = new coordonnees($tab_adr[$row->id_entite]['id_adr_liv']);
            $id_adr_liv = $coord->id_contact;
            if ($coord->libelle != '') {
                $adr_liv = htmlentities($coord->libelle, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->contact != '') {
                $adr_liv .= htmlentities($coord->contact, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr1 != '') {
                $adr_liv .= htmlentities($coord->adr1, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->adr2 != '') {
                $adr_liv .= htmlentities($coord->adr2, ENT_QUOTES, $charset) . "\n";
            }
            if ($coord->cp != '') {
                $adr_liv .= htmlentities($coord->cp, ENT_QUOTES, $charset) . ' ';
            }
            if ($coord->ville != '') {
                $adr_liv .= htmlentities($coord->ville, ENT_QUOTES, $charset);
            }
        } else {
            $id_adr_liv = 0;
            $adr_liv = '';
        }
        $temp_adr_form = str_replace('!!id_bibli!!', $row->id_entite, $temp_adr_form);
        $temp_adr_form = str_replace('!!id_adr_liv!!', $id_adr_liv, $temp_adr_form);
        $temp_adr_form = str_replace('!!adr_liv!!', $adr_liv, $temp_adr_form);
        $temp_adr_form = str_replace('!!id_adr_fac!!', $id_adr_fac, $temp_adr_form);
        $temp_adr_form = str_replace('!!adr_fac!!', $adr_fac, $temp_adr_form);
        $acquisition_user_param .= $temp_adr_form;
        $acquisition_user_param .= "</div>";
    }
    $acquisition_user_param = str_replace('!!form_name!!', $form_name, $acquisition_user_param);
    $acquisition_user_param = "<hr /><div class='row'>" . htmlentities($msg['acquisition_user_deflt_adr'], ENT_QUOTES, $charset) . $acquisition_user_param . "</div>";
    return $acquisition_user_param;
}
Example #19
0
 } else {
     $fs_footer = $pos_footer[1];
 }
 //---------------------------------------------------------------------------------------------------------------------
 $taille_doc = array($largeur_page, $hauteur_page);
 $w = $largeur_page - $marge_gauche - $marge_droite;
 $ourPDF = new $fpdf($orient_page, 'mm', $taille_doc);
 $ourPDF->Open();
 $ourPDF->SetMargins($marge_gauche, $marge_haut, $marge_droite);
 //On récupère les infos de la facture
 $fac = new actes($id_fac);
 $lignes = actes::getLignes($id_fac);
 $bibli = new entites($fac->num_entite);
 $coord_fac = new coordonnees($fac->num_contact_fact);
 $fou = new entites($fac->num_fournisseur);
 $coord_fou = entites::get_coordonnees($fac->num_fournisseur, '1');
 $coord_fou = mysql_fetch_object($coord_fou);
 $id_cde = liens_actes::getParent($id_fac);
 $cde = new actes($id_cde);
 $ourPDF->addPage();
 $ourPDF->setFont($pmb_pdf_font);
 //Affichage date
 $date = formatdate(today());
 $ourPDF->setFontSize($fs_date);
 $ourPDF->SetXY($x_date, $y_date);
 $ourPDF->Cell($l_date, $h_date, $date, 0, 0, 'L', 0);
 //Affichage raison sociale
 $raison = $bibli->raison_sociale;
 $ourPDF->setFontSize($fs_raison);
 $ourPDF->SetXY($x_raison, $y_raison);
 $ourPDF->Cell($l_raison, $h_raison, $raison, 0, 0, 'L', 0);
Example #20
0
function do_relances()
{
    global $dbh, $charset;
    global $id_bibli, $chk, $id_lig;
    global $acquisition_pdfrel_obj_mail, $acquisition_pdfrel_text_mail;
    global $acquisition_pdfrel_by_mail, $PMBuseremailbcc;
    //recuperation des lignes a relancer
    $tab_lig = array();
    foreach ($chk as $v) {
        if ($id_lig[$v]) {
            $tab_lig[] = $id_lig[$v];
        }
    }
    $tab_fou = array();
    $q = lignes_actes::getLines($tab_lig, true);
    if ($q) {
        $r = mysql_query($q, $dbh);
        if (mysql_num_rows($r)) {
            while ($row = mysql_fetch_object($r)) {
                if (!array_key_exists($row->num_fournisseur, $tab_fou)) {
                    $tab_fou[$row->num_fournisseur] = array();
                }
                if (!array_key_exists($row->id_acte, $tab_fou[$row->num_fournisseur])) {
                    $tab_fou[$row->num_fournisseur][$row->id_acte] = array();
                }
                $tab_fou[$row->num_fournisseur][$row->id_acte][] = $row->id_ligne;
            }
        }
    }
    $bib = new entites($id_bibli);
    $bib_coord = mysql_fetch_object(entites::get_coordonnees($id_bibli, 1));
    $tab_no_mail = array();
    if (!($acquisition_pdfrel_by_mail && strpos($bib_coord->email, '@'))) {
        $tab_no_mail = $tab_fou;
    } else {
        if (count($tab_fou)) {
            foreach ($tab_fou as $id_fou => $tab_act) {
                $fou = new entites($id_fou);
                $fou_coord = mysql_fetch_object(entites::get_coordonnees($id_fou, 1));
                //Si on peut relancer par mail
                if (strpos($fou_coord->email, '@')) {
                    $dest_name = '';
                    if ($fou_coord->libelle) {
                        $dest_name = $fou_coord->libelle;
                    } else {
                        $dest_name = $fou->raison_sociale;
                    }
                    if ($fou_coord->contact) {
                        $dest_name .= " " . $fou_coord->contact;
                    }
                    $dest_mail = $fou_coord->email;
                    $obj_mail = $acquisition_pdfrel_obj_mail;
                    $text_mail = $acquisition_pdfrel_text_mail;
                    $bib_name = $bib_coord->raison_sociale;
                    $bib_mail = $bib_coord->email;
                    $lettre = new lettreRelance_PDF();
                    $lettre->doLettre($bib, $bib_coord, $fou, $fou_coord, $tab_act);
                    $piece_jointe = array();
                    $piece_jointe[0]['contenu'] = $lettre->getLettre('S');
                    $piece_jointe[0]['nomfichier'] = $lettre->getFileName();
                    //         mailpmb($to_nom="", $to_mail,   $obj="",   $corps="",  $from_name="", $from_mail, $headers, $copie_CC="", $copie_BCC="", $faire_nl2br=0, $pieces_jointes=array())
                    $res_envoi = mailpmb($dest_name, $dest_mail, $obj_mail, $text_mail, $bib_name, $bib_mail, "Content-Type: text/plain; charset=\"{$charset}\"", '', $PMBuseremailbcc, 1, $piece_jointe);
                    if (!$res_envoi) {
                        $tab_no_mail[$id_fou] = $tab_act;
                    }
                } else {
                    $tab_no_mail[$id_fou] = $tab_act;
                }
            }
        }
    }
    if (count($tab_no_mail)) {
        print "\t\n\t\t<form name='print_liste_relances' action='pdf.php?pdfdoc=listrecept' target='lettre' method='post'>\t\t\n\t\t\t<input type='hidden' name='id_bibli' value='" . $id_bibli . "'/>\n\t\t\t<input type='hidden' name='tab_no_mail' value='" . rawurlencode(serialize($tab_no_mail)) . "'/>\n\t\t\t<script type='text/javascript'>\n\t\t\t\topenPopUp('','lettre', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\n\t\t\t\tdocument.print_liste_relances.submit();\n\t\t\t</script>\n\t\t</form>";
    }
    lignes_actes::setRelances($tab_lig);
}