function doLettre(&$bib, &$bib_coord, &$fou, &$fou_coord, &$tab_act)
 {
     global $msg;
     $this->sect =& $this->RTF->addSection();
     //$this->RTF->footers[] = $this->msg_footer;
     $tab1 = $this->sect->addTable();
     $tab1->addRows(1, 0);
     $tab1->addColumnsList(array($this->x_raison - $this->x_logo, $this->x_date - $this->x_raison, $this->largeur_page - $this->marge_droite - $this->x_date));
     //$this->PDF->npage = 1;
     //Affichage logo
     if ($bib->logo != '') {
         $par_logo = new ParFormat();
         $tab1->addImageToCell(1, 1, $bib->logo, new ParFormat(), $this->l_logo, $this->h_logo);
     }
     //Affichage raison sociale
     $raison = $this->RTF->to_utf8($bib->raison_sociale);
     $par_raison = new ParFormat();
     $tab1->writeToCell(1, 2, $raison, $this->fonts['raison'], $par_raison);
     //Affichage date ville
     $ville_end = stripos($bib_coord->ville, "cedex");
     if ($ville_end !== false) {
         $ville = trim(substr($bib_coord->ville, 0, $ville_end));
     } else {
         $ville = $bib_coord->ville;
     }
     $date = $ville . $this->sep_ville_date . format_date(today());
     $date = $this->RTF->to_utf8($date);
     $par_ville = new ParFormat();
     $tab1->writeToCell(1, 3, $date, $this->fonts['date'], $par_ville);
     $this->sect->writeText('', $this->fonts['standard'], new parFormat());
     $tab2 = $this->sect->addTable();
     $tab2->addRows(1, 0);
     $tab2->addColumnsList(array($this->l_adr_rel - $this->x_adr_rel, $this->x_adr_fou - $this->l_adr_rel - $this->x_adr_rel, $this->largeur_page - $this->x_adr_fou));
     //Affichage adresse bibliotheque
     $adr_rel = '';
     if ($bib_coord->libelle != '') {
         $adr_rel .= $bib_coord->libelle . "\r\n";
     }
     if ($bib_coord->adr1 != '') {
         $adr_rel .= $bib_coord->adr1 . "\r\n";
     }
     if ($bib_coord->adr2 != '') {
         $adr_rel .= $bib_coord->adr2 . "\r\n";
     }
     if ($bib_coord->cp != '') {
         $adr_rel .= $bib_coord->cp . " ";
     }
     if ($bib_coord->ville != '') {
         $adr_rel .= $bib_coord->ville . "\r\n";
     }
     if ($bib_coord->tel1 != '') {
         $adr_rel .= $this->text_adr_tel . " " . $bib_coord->tel1 . "\r\n";
     }
     if ($bib_coord->fax != '') {
         $adr_rel .= $this->text_adr_fax . " " . $bib_coord->fax . "\r\n";
     }
     if ($bib_coord->email != '') {
         $adr_rel .= $this->text_adr_email . " " . $bib_coord->email . "\r\n";
     }
     $adr_rel = $this->RTF->to_utf8($adr_rel);
     $par_adr_rel = new parFormat();
     $tab2->writeToCell(1, 1, $adr_rel, $this->fonts['adr_rel'], $par_adr_rel);
     //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 . "\r\n";
     } else {
         $adr_fou = $coord_fou->libelle . "\r\n";
     }
     if ($fou_coord->adr1 != '') {
         $adr_fou .= $fou_coord->adr1 . "\r\n";
     }
     if ($fou_coord->adr2 != '') {
         $adr_fou .= $fou_coord->adr2 . "\r\n";
     }
     if ($fou_coord->cp != '') {
         $adr_fou .= $fou_coord->cp . " ";
     }
     if ($fou_coord->ville != '') {
         $adr_fou .= $fou_coord->ville . "\r\n\r\n";
     }
     if ($fou_coord->contact != '') {
         $adr_fou .= $fou_coord->contact;
     }
     $adr_fou = $this->RTF->to_utf8($adr_fou);
     $par_adr_fou = new parFormat();
     $tab2->writeToCell(1, 3, $adr_fou, $this->fonts['adr_fou'], $par_adr_fou);
     //Affichage numero client
     $numero_cli = $this->RTF->to_utf8($this->text_num_cli . " " . $fou->num_cp_client);
     $par_numero_cli = new parFormat();
     $par_numero_cli->setSpaceAfter(10);
     $this->sect->writeText($numero_cli, $this->fonts['num_cli'], $par_numero_cli);
     //Affichage titre
     $text_titre = $this->RTF->to_utf8($this->text_titre);
     $par_titre = new parFormat();
     $par_titre->setSpaceAfter(10);
     $par_titre->setIndentLeft($this->x_titre - $this->marge_gauche);
     $this->sect->writeText($text_titre, $this->fonts['titre'], $par_titre);
     //Affichage texte before
     if ($this->text_before != '') {
         $text_before = $this->RTF->to_utf8($this->text_before);
         $par_before = new parFormat();
         $this->sect->writeText($text_before, $this->fonts['standard'], $par_before);
     }
     //Affichage des lignes de relances
     foreach ($tab_act as $id_act => $tab_lig) {
         $this->p_header = false;
         $act = new actes($id_act);
         $this->text_num_ech = $this->text_num . ' ' . $act->numero;
         if ($act->date_ech != '0000-00-00') {
             $this->text_num_ech .= ' ' . sprintf($this->text_ech, format_date($act->date_ech));
         }
         $this->doEntete();
         foreach ($tab_lig as $id_lig) {
             $lig = new lignes_actes($id_lig);
             $typ = new types_produits($lig->num_type);
             $col1 = $typ->libelle;
             if ($lig->code) {
                 $col1 .= "\r\n" . $lig->code;
             }
             $col2 = $lig->libelle;
             $col3 = $lig->nb;
             $col4 = $lig->getNbDelivered();
             $col5 = $col3 - $col4;
             $this->tab->addRows(1, 0);
             $this->tab->addColumnsList(array($this->w_col1, $this->w_col2, $this->w_col3, $this->w_col4, $this->w_col5));
             $border_format = new BorderFormat(0.5, "#000000");
             $txt_col1 = $this->RTF->to_utf8($col1);
             $par_col1 = new parFormat();
             $this->tab->writeToCell($this->row, 1, $txt_col1, $this->fonts['standard'], $par_col1);
             $txt_col2 = $this->RTF->to_utf8($col2);
             $par_col2 = new parFormat();
             $this->tab->writeToCell($this->row, 2, $txt_col2, $this->fonts['standard'], $par_col2);
             $txt_col3 = $this->RTF->to_utf8($col3);
             $par_col3 = new parFormat();
             $this->tab->writeToCell($this->row, 3, $txt_col3, $this->fonts['standard'], $par_col3);
             $txt_col4 = $this->RTF->to_utf8($col4);
             $par_col4 = new parFormat();
             $this->tab->writeToCell($this->row, 4, $txt_col4, $this->fonts['standard'], $par_col4);
             $txt_col5 = $this->RTF->to_utf8($col5);
             $par_col5 = new parFormat();
             $this->tab->writeToCell($this->row, 5, $txt_col5, $this->fonts['standard'], $par_col5);
             $this->tab->setBordersOfCells($border_format, 1, 1, $this->row, 5);
             $this->row++;
         }
     }
     //Affichage texte after
     if ($this->text_after != '') {
         $text_after = $this->RTF->to_utf8($this->text_after);
         $par_after = new parFormat();
         $this->sect->writeText($text_after, $this->fonts['standard'], $par_after);
     }
     //Affichage signature
     $text_sign = $this->RTF->to_utf8($this->text_sign);
     $par_sign = new parFormat();
     $par_sign->setSpaceBefore(10);
     $par_sign->setIndentLeft($this->x_sign - $this->marge_gauche);
     $this->sect->writeText($text_sign, $this->fonts['sign'], $par_sign);
     $this->sect->insertPageBreak();
 }
Exemplo n.º 2
0
function show_delivery_form($msg_client = '')
{
    global $dbh, $msg, $charset;
    global $no, $id_lig, $id_prod, $typ_lig;
    global $recept_deliv_form, $recept_deliv_form_suite;
    global $recept_form_qte_liv, $recept_bt_update, $recept_bt_undo, $previous, $recept_bt_next;
    $form = $recept_deliv_form;
    $lg = new lignes_actes($id_lig);
    $act = new actes($lg->num_acte);
    $fou = new entites($act->num_fournisseur);
    $nb_rec = $lg->getNbDelivered($id_lig);
    $nb_sol = $lg->nb - $nb_rec;
    if ($nb_sol > 0) {
        $form = str_replace('<!-- bt_update -->', $recept_bt_update, $form);
        $form = str_replace('<!-- qte_liv -->', $recept_form_qte_liv, $form);
    } else {
        $form = str_replace('<!-- qte_liv -->', '', $form);
    }
    if ($previous) {
        $tp = unserialize(rawurldecode(stripslashes($previous)));
        if (is_array($tp) && count($tp)) {
            $form = str_replace('<!-- bt_undo -->', $recept_bt_undo, $form);
            $form = str_replace('!!previous!!', stripslashes($previous), $form);
        } else {
            $previous = 0;
        }
    }
    if (!$previous) {
        $form = str_replace('<!-- bt_undo -->', '', $form);
        $form = str_replace('!!previous!!', 0, $form);
    }
    $form = str_replace('<!-- bt_next -->', $recept_bt_next, $form);
    $lgstat_form = lgstat::getHtmlSelect(array(0 => 0), FALSE, array('id' => 'sel_lgstat_!!id_lig!!', 'onchange' => 'recept_upd_lgstat(this.getAttribute("id"));'));
    $form = str_replace('!!lib_acte!!', htmlentities($msg['acquisition_recept_fou'], ENT_QUOTES, $charset) . "&nbsp;" . htmlentities($fou->raison_sociale, ENT_QUOTES, $charset) . '&nbsp;' . htmlentities($act->type_acte ? $msg['acquisition_act_num_dev'] : $msg['acquisition_act_num_cde'], ENT_QUOTES, $charset) . htmlentities($act->numero, ENT_QUOTES, $charset), $form);
    $form = str_replace('!!code!!', htmlentities($lg->code, ENT_QUOTES, $charset), $form);
    $form = str_replace('!!lib!!', nl2br(htmlentities($lg->libelle, ENT_QUOTES, $charset)), $form);
    $form = str_replace('!!qte_cde!!', $lg->nb, $form);
    $form = str_replace('!!qte_rec!!', $nb_rec, $form);
    $form = str_replace('!!qte_sol!!', $nb_sol, $form);
    $lgstat_form = str_replace("value='" . $lg->statut . "'", "value='" . $lg->statut . "' selected='selected' ", $lgstat_form);
    $form = str_replace('!!lgstat!!', $lgstat_form, $form);
    $form = str_replace('!!comment_lg!!', nl2br(htmlentities($lg->commentaires_gestion, ENT_QUOTES, $charset)), $form);
    $form = str_replace('!!comment_lo!!', nl2br(htmlentities($lg->commentaires_opac, ENT_QUOTES, $charset)), $form);
    $form = str_replace('!!id_lig!!', $id_lig, $form);
    $form = str_replace('!!id_prod!!', $id_prod, $form);
    $form = str_replace('!!typ_lig!!', $typ_lig, $form);
    $form = str_replace('!!no!!', $no, $form);
    switch ($typ_lig) {
        case '1':
            //notice
            $form .= do_notice_form($id_prod);
            $form .= do_explnum_form();
            $form .= do_expl_form();
            if ($lg->num_acquisition) {
                $form .= do_sugg_form($lg->num_acquisition);
            }
            break;
        case '2':
            //bulletin
            $form .= do_bull_form($id_prod);
            $form .= do_explnum_form();
            $form .= do_expl_form();
            //if ($lg->num_acquisition) $form.=do_sugg_form($lg->num_acquisition);
            break;
        case '3':
            //frais
            break;
        case '4':
            //abt
            break;
        case '5':
            //article
            $form .= do_art_form($id_prod);
            $form .= do_explnum_form();
            if ($lg->num_acquisition) {
                $form .= do_sugg_form($lg->num_acquisition);
            }
            break;
        default:
            //non catalogué
            if ($lg->num_acquisition) {
                $form .= do_sugg_form($lg->num_acquisition);
            }
            break;
    }
    $form = str_replace('!!msg_client!!', $msg_client, $form);
    print $form . $recept_deliv_form_suite;
}