<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.4
 *
 * Copyright (C) 2006-2016  Sylvain FATOME
 * This program is free software; you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program
 * (in the directory docs);
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 * Contact : galawa@free.fr
 *
 * Web : http://smi.no-ip.org
 ****************************************************************************************/

session_start();

require_once('../lib/gettext/gettext.inc');
include_once('../inc/config.inc.php');
include_once('../inc/func_log.inc.php');
if ((CheckURLLog(FALSE) == FALSE) OR (CheckNivLog('10-11') == FALSE)) {
    header('Location: ../index.php');
}

include_once('../inc/fic_cli.inc.php');
include_once('../inc/fic_droits.inc.php');
include_once('../inc/fic_fici.inc.php');
include_once('../inc/fic_prm.inc.php');
include_once('../inc/fic_statut.inc.php');
include_once('../inc/func.inc.php');
include_once('../inc/func_date.inc.php');
include_once('../inc/func_time.inc.php');
include_once('../inc/func_txt.inc.php');
include_once('../inc/func_geo.inc.php');
include_once('../inc/lst.inc.php');
include_once('../classes/dirtool/class_dirtool.php');
include_once('../classes/ezSQL/shared/ez_sql_core.php');
include_once('../classes/ezSQL/mysqli/ez_sql_mysqli.php');
include_once('../inc/func_sql.inc.php');
Archivelog(valsession('code_log'));
$pbm_conf = FALSE;
if ((!exist_logo('cge')) OR (!exist_logo(valsession('code_st'))) OR (!existe_cdg())) {
    $pbm_conf = TRUE;
}
$tx = 'm';
?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>

        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <title>SMI - <?php echo _('ESPACE PRIVE'); ?> : <?php echo _('Index Sous-Traitant'); ?></title>

        <?php include_once('../inc/header.inc.php'); ?>

        <script type="text/javascript">
            <!--
            function init_all() {
                init_Body();
                $("#onglets_idx").tabs();
                init_autohref_classe('falselnkimg', '<?php echo str_escape(_('Merci de confirmer').'<br />'._("Sinon, cliquez sur 'Annuler'")); ?>');
                warn_taches("<?php echo $nbtaches; ?>");
                Focus_first();
            }

            $(document).ready(function () {
                init_all();
            });
            //-->
        </script>

    </head>

<body>

<?php
if ($pbm_conf == FALSE) {
    include_once('../inc/entete.inc.php');
    cre_ent_form(_('TABLEAU DE BORD'), '', '', '', FALSE);
    ?>
    <div id="onglets_idx">
        <ul>
            <li><a href="#idx_tac"><?php echo _('Tâches à effectuer'); ?></a></li>
            <li><a href="#idx_btc"><?php echo _('Bons de travail en cours'); ?></a></li>
            <li><a href="#idx_bta"><?php echo _('Bons de travail à affecter'); ?></a></li>
        </ul>
        <div id="idx_tac">
            <?php
            $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST, 'utf8');

            $rech = cree_strrechlsttac();
            switch (valsession('niv_log')) {
                // Filtre pour les techniciens sous-traitants
                case 11 :
                    if (!stristr($rech, 'WHERE ')) {
                        $rech .= ' WHERE ' . TBTAC . ".tac_codedest='" . valsession('code_log') . "'";
                    } else {
                        $rech .= ' AND ' . TBTAC . ".tac_codedest='" . valsession('code_log') . "'";
                    }
                    break;
                // Filtre pour les sous-traitants
                case 10 :
                    // On construit la liste des techniciens actifs du sous-traitant
                    $tab_lst_tec = [];
                    $rech2 = 'SELECT tec_code FROM `' . TBTEC . "` WHERE tec_codest='" . valsession('code_log') . "' AND tec_out=0";
                    /** @noinspection PhpUndefinedMethodInspection */
                    $rows2 = $db->get_results($rech2, ARRAY_A);
                    if ($rows2) {
                        foreach ($rows2 as $row2) {
                            extract($row2);
                            $tab_lst_tec[] = $tec_code;
                        }
                    }

                    if (!stristr($rech, 'WHERE ')) {
                        $rech .= ' WHERE (' . TBTAC . ".tac_codedest='" . valsession('code_log') . "'";
                    } else {
                        $rech .= ' AND (' . TBTAC . ".tac_codedest='" . valsession('code_log') . "'";
                    }
                    if (count($tab_lst_tec) > 0) {
                        foreach ($tab_lst_tec as $key => $value) {
                            $rech .= ' OR ' . TBTAC . ".tac_codedest='" . $value . "'";
                        }
                    }
                    $rech .= ')';
                    break;
            }

            if (!stristr($rech, 'WHERE ')) {
                $rech .= " WHERE tac_datefin='0000-00-00'";
            } else {
                $rech .= " AND tac_datefin='0000-00-00'";
            }
            $rech .= 'ORDER BY ' . TBTAC . '.tac_code DESC';

            /** @noinspection PhpUndefinedMethodInspection */
            $rows = $db->get_results($rech, ARRAY_A);

            if ($rows) {
                $numrows = count($rows);
                $nbtaches = $numrows;
                // *** Affichage de la table
                echo '<table class="Mtable" border="0" width="100%" cellpadding="0" cellspacing="0">';

                // création entête
                titlst($tac_titre_col, FALSE);
                echo '<th>' . _('Cliquer') . '</th>';

                $i = 0;

                // Inclusion module affichage liste tâches
                include_once('../inc/tacr_lst.inc.php');

                echo '</table>';
                // *** Fin affichage de la table
            } else {
                echo '<div class="annot_gras_it">';
                echo '<br />' . _('Pas de tâche en cours');
                echo '</div>';
            }

            /** @noinspection PhpUndefinedMethodInspection */
            close_database();

            $taille_piedla = '';
            include('../inc/piedla.inc.php');
            ?>
        </div>

        <div id="idx_btc">
            <?php
            $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST, 'utf8');

            $rech = cree_strrechlstotst();
            if (!stristr($rech, 'WHERE ')) {
                $rech .= ' WHERE ' . TBOT . ".ot_codest='" . valsession('code_st') . "' AND " . TBOT . ".ot_codetec <> '-1' AND " . TBOT . ".ot_codestatut <> 'CLOT'";
            } else {
                $rech .= ' AND ' . TBOT . ".ot_codest='" . valsession('code_st') . "' AND " . TBOT . ".ot_codetec <> '-1' AND " . TBOT . ".ot_codestatut <> 'CLOT'";
            }

            $rech .= 'ORDER BY ' . TBOT . '.ot_code DESC';
            // *** Fin de chaîne de Recherche

            /** @noinspection PhpUndefinedMethodInspection */
            $rows = $db->get_results($rech, ARRAY_A);

            if ($rows) {
                $numrows = count($rows);
                echo '<span class="annot_std_it">';
                echo '(' . _("Lieu/Statut : laisser la souris sur l'icône pour le détail") . '<br />';
                echo '</span>';

                // *** Affichage de la table
                echo '<table class="Mtable" border="0" width="100%" cellpadding="0" cellspacing="0">';

                // création entête
                titlst($ot2_titre_col);
                echo '<th>' . _('Cliquer') . '</th>';

                $i = 0;

                foreach ($rows as $row) {
                    $row = encode_str($row);
                    // Affichage résumé ordre

                    // création de l'entête de ligne (TR)
                    echo '<tr>';

                    echo '<td>';
                    echo $row['ot_code'];
                    $detfic = '>>' . _('Matériel') . ' :<br />' . $row['ot_mat'] . '<br /><br />>>' . _('Travail à effectuer') . ' :<br />' . $row['ot_pbm'];
                    if ($detfic <> '') {
                        echo ' <a href="#" class="pop"><img src="../img/help.png" alt="' . _('Détail') . '" border="0" align="absmiddle"><span>' . formatetxtbr($detfic) . '</span></a>';
                    }
                    echo '</td>';

                    echo '<td>';
                    echo '<div align="center">';
                    echo datetolocal($row['ot_datedde']);
                    echo '</div>';
                    echo '</td>';
                    echo '<td align="center">';
                    echo datetolocal($row['ot_daterdv']);
                    if (datetolocal($row['ot_daterdv']) <> '') {
                        echo '<div align="center" class="annot_petit_it">';
                        echo substr($row['ot_hrdv'], 0, 5);
                        echo '</div>';
                    }
                    echo '</td>';

                    // Affichage icône Lieu
                    echo '<td>';
                    $lieu = $row['ot_codelieu'];
                    $rech2 = 'SELECT * FROM `' . TBLIEU . "` WHERE lieu_code = '$lieu'";

                    /** @noinspection PhpUndefinedMethodInspection */
                    $row2 = $db->get_row($rech2, ARRAY_A);

                    if ($row2) {
                        $row2 = encode_str($row2);
                        extract($row2);
                        if ($lieu_img <> '') {
                            $lieuint = $lieu_desc . ' (' . $lieu . ')';
                            echo '<div style="float:left;width:40px;">';
                            echo ' <img src="' . $lieu_img . '" title="' . $lieuint . '" border="0" align="absmiddle">';
                            echo '</div>';
                        } else {
                            echo '<span class="annot_std_it" style="float:left;">';
                            echo $lieu;
                            echo '</span>';
                        }
                    }

                    // Affichage site client
                    $sitecli = '';
                    if (trim($row['ot_idsite']) == '0') {
                        $row2 = lit_enr_cli($row['ot_codecli'], FALSE);
                        if (is_array($row2)) {
                            $row2 = encode_str($row2);
                            extract($row2);
                            $sitecli .= '<strong>';
                            if ($cli_ste <> '') {
                                $sitecli .= $cli_ste . '<br />';
                            } else {
                                $sitecli .= $cli_civilite . ' ' . $cli_prenom . ' ' . $cli_nom . '<br />';
                            }
                            $sitecli .= '</strong>';
                            $sitecli .= $cli_adr1 . '<br />';
                            if ($cli_adr2 <> '') {
                                $sitecli .= $cli_adr2 . '<br />';
                            }
                            $sitecli .= Retournecp_Id($cli_ville, FALSE) . ' ' . Retourneville_Id($cli_ville, FALSE) . '<br />';
                        }
                    } else {
                        $rech2 = 'SELECT * FROM `' . TBSCLI . "` WHERE `scli_id` = '" . trim($row['ot_idsite']) . "'";
                        /** @noinspection PhpUndefinedMethodInspection */
                        $row2 = $db->get_row($rech2, ARRAY_A);
                        if ($row2) {
                            extract($row2);
                            $sitecli .= '<strong>';
                            $sitecli .= $scli_ste . '<br />';
                            $sitecli .= '</strong>';
                            $sitecli .= $scli_adr1 . '<br />';
                            if ($scli_adr2 <> '') {
                                $sitecli .= $scli_adr2 . '<br />';
                            }
                            $sitecli .= Retournecp_Id($scli_ville, FALSE) . ' ' . Retourneville_Id($scli_ville, FALSE) . '<br />';
                        }
                    }

                    if ($sitecli <> '') {
                        echo '<div class="annot_petit_it" style="float:left;">';
                        echo $sitecli;
                        echo '</div>';
                    }

                    echo '</td>';

                    // Affichage détail urgence
                    echo '<td ';
                    $couleur = give_coul_urg($row['ot_urg'], FALSE);
                    if ($couleur <> 'XX') {
                        echo ' style="background:' . $couleur . '"';
                    }
                    echo ' align="center">';
                    echo give_nom_urg($row['ot_urg'], FALSE);
                    echo '</td>';
                    // Fin affichage détail urgence

                    // Affichage technicien traitant
                    echo '<td align="center">';
                    if (($row['ot_codetec'] <> '') AND ($row['ot_codetec'] <> '-1')) {
                        echo $row['ot_codetec'];
                    } else {
                        echo '&nbsp;';
                    }
                    echo '</td>';

                    // Affichage icône Statut
                    echo '<td align="center">';
                    $statut = $row['ot_codestatut'];
                    $rech2 = 'SELECT * FROM `' . TBSTA . "` WHERE statut_code = '$statut'";

                    /** @noinspection PhpUndefinedMethodInspection */
                    $row2 = $db->get_row($rech2, ARRAY_A);

                    if ($row2) {
                        $row2 = encode_str($row2);
                        extract($row2);
                        if ($statut_img <> '') {
                            $statint = $statut_desc . ' (' . $statut . ')';
                            echo ' <img src="' . $statut_img . '" title="' . $statint . '" border="0" align="absmiddle">';
                        } else {
                            echo '<span class="annot_std_it">';
                            echo $statut;
                            echo '</span>';
                        }
                    }

                    echo '</td>';

                    // CREATION lien dynamique sur icône (édition, suppression, etc...)
                    echo '<td align="center">';

                    $rech2 = 'SELECT int_idsite, int_codecli FROM `' . TBINT . "` WHERE `int_code` = '" . $row['ot_codeint'] . "'";
                    /** @noinspection PhpUndefinedMethodInspection */
                    $row2 = $db->get_row($rech2, ARRAY_A);
                    if ($row2) {
                        $row2 = encode_str($row2);
                        extract($row2);
                    }

                    if ($row['ot_codestatut'] <> 'CLOT') {
                        $lst_maj = TRUE;
                        cre_falselnk_img('', 'ot_edit_' . $row['ot_id'], 'span', 'center', _('Edition'), 'lnk', 'ot_maj.php?tx=' . $tx . '&td=edit&ca=&cas=&ci=&cc=' . $row['ot_codecli'] . '&co=' . $row['ot_code'] . '&si=' . $row['ot_idsite'] . '&tr=', '../img/edit.png');
                    } else {
                        $lst_voir = TRUE;
                        cre_falselnk_img('', 'ot_view_' . $row['ot_id'], 'span', 'center', _('Visualisation'), 'lnk', 'ot_maj.php?tx=' . $tx . '&td=view&ca=&cas=&ci=&cc=' . $row['ot_codecli'] . '&co=' . $row['ot_code'] . '&si=' . $row['ot_idsite'] . '&tr=', '../img/eye.png');
                    }

                    $lst_imp = TRUE;
                    $urlimp = 'ot_pdf.php?co=' . $row['ot_code'];
                    cre_falselnk_img('', 'ot_prn_' . $row['ot_id'], 'span', 'center', _('Impression'), 'lnkpop', $urlimp, '../img/print.png');

                    if ($row['ot_codestatut'] <> 'CLOT') {
                        $del = TRUE;
                        if (CheckNivLog('10-11')) {
                            $del = FALSE;
                        }

                        if ($del == TRUE) {
                            $lst_del = TRUE;
                            cre_falselnk_img('', 'ot_del_' . $row['ot_id'], 'span', 'center', _('Suppression'), 'lnk', 'ot_maj.php?tx=' . $tx . '&td=del&ca=&cas=&ci=&cc=' . $row['ot_codecli'] . '&co=' . $row['ot_code'] . '&si=' . $row['ot_idsite'] . '&tr=', '../img/del.png');
                        }
                    }
                    echo '</td>';

                    echo '</tr>';
                    // Fin affichage résumé ordre

                    $i++;
                }
                echo '</table>';
                // *** Fin affichage de la table
            } else {
                echo '<span class="annot_gras_it">';
                echo '<br /><br />' . _('Pas de bons de travail en cours');
                echo '</span>';
            }

            /** @noinspection PhpUndefinedMethodInspection */
            close_database();

            $taille_piedla = '';
            include('../inc/piedla.inc.php');
            ?>
        </div>

        <div id="idx_bta">
            <?php
            $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST, 'utf8');

            $rech = cree_strrechlstotst();
            if (!stristr($rech, 'WHERE ')) {
                $rech .= ' WHERE ' . TBOT . ".ot_codest='" . valsession('code_st') . "' AND " . TBOT . ".ot_codetec = '-1'";
            } else {
                $rech .= ' AND ' . TBOT . ".ot_codest='" . valsession('code_st') . "' AND " . TBOT . ".ot_codetec = '-1'";
            }

            $rech .= ' ORDER BY ' . TBOT . '.ot_code DESC';
            // *** Fin de chaîne de Recherche

            /** @noinspection PhpUndefinedMethodInspection */
            $rows = $db->get_results($rech, ARRAY_A);

            if ($rows) {
                $numrows = count($rows);
                echo '<span class="annot_std_it">';
                echo '(' . _("Lieu/Statut : laisser la souris sur l'icône pour le détail") . ')<br />';
                echo '</span>';

                // *** Affichage de la table
                echo '<table class="Mtable" border="0" width="100%" cellpadding="0" cellspacing="0">';

                // création entête
                titlst($ot2_titre_col);
                echo '<th>' . _('Cliquer') . '</th>';

                $i = 0;

                foreach ($rows as $row) {
                    $row = encode_str($row);
                    // Affichage résumé ordre

                    // création de l'entête de ligne (TR)
                    echo '<tr>';

                    echo '<td>';
                    echo $row['ot_code'];
                    $detfic = '>>' . _('Matériel') . ' :<br />' . $row['ot_mat'] . '<br /><br />>>' . _('Travail à effectuer') . ' :<br />' . $row['ot_pbm'];
                    if ($detfic <> '') {
                        echo ' <a href="#" class="pop"><img src="../img/help.png" alt="' . _('Détail') . '" border="0" align="absmiddle"><span>' . formatetxtbr($detfic) . '</span></a>';
                    }

                    echo '</td>';

                    echo '<td align="center">';
                    echo datetolocal($row['ot_datedde']);
                    echo '</td>';
                    echo '<td align="center">';
                    echo datetolocal($row['ot_daterdv']);
                    if (datetolocal($row['ot_daterdv']) <> '') {
                        echo '<div align="center" class="annot_petit_it">';
                        echo substr($row['ot_hrdv'], 0, 5);
                        echo '</div>';
                    }
                    echo '</td>';

                    // Affichage icône Lieu
                    echo '<td>';
                    $lieu = $row['ot_codelieu'];
                    $rech2 = 'SELECT * FROM `' . TBLIEU . "` WHERE lieu_code = '$lieu'";

                    /** @noinspection PhpUndefinedMethodInspection */
                    $row2 = $db->get_row($rech2, ARRAY_A);

                    if ($row2) {
                        $row2 = encode_str($row2);
                        extract($row2);
                        if ($lieu_img <> '') {
                            $lieuint = $lieu_desc . ' (' . $lieu . ')';
                            echo '<div style="float:left;width:40px;">';
                            echo ' <img src="' . $lieu_img . '" title="' . $lieuint . '" border="0" align="absmiddle">';
                            echo '</div>';
                        } else {
                            echo '<span class="annot_std_it" style="float:left;">';
                            echo $lieu;
                            echo '</span>';
                        }
                    }

                    // Affichage site client
                    $sitecli = '';
                    if (trim($row['ot_idsite']) == '0') {
                        $row2 = lit_enr_cli($row['ot_codecli'], FALSE);
                        if (is_array($row2)) {
                            $row2 = encode_str($row2);
                            extract($row2);
                            $sitecli .= '<strong>';
                            if ($cli_ste <> '') {
                                $sitecli .= $cli_ste . '<br />';
                            } else {
                                $sitecli .= $cli_civilite . ' ' . $cli_prenom . ' ' . $cli_nom . '<br />';
                            }
                            $sitecli .= '</strong>';
                            $sitecli .= $cli_adr1 . '<br />';
                            if ($cli_adr2 <> '') {
                                $sitecli .= $cli_adr2 . '<br />';
                            }
                            $sitecli .= Retournecp_Id($cli_ville, FALSE) . ' ' . Retourneville_Id($cli_ville, FALSE) . '<br />';
                        }
                    } else {
                        $rech2 = 'SELECT * FROM `' . TBSCLI . "` WHERE `scli_id` = '" . trim($row['ot_idsite']) . "'";
                        /** @noinspection PhpUndefinedMethodInspection */
                        $row2 = $db->get_row($rech2, ARRAY_A);
                        if ($row2) {
                            extract($row2);
                            $sitecli .= '<strong>';
                            $sitecli .= $scli_ste . '<br />';
                            $sitecli .= '</strong>';
                            $sitecli .= $scli_adr1 . '<br />';
                            if ($scli_adr2 <> '') {
                                $sitecli .= $scli_adr2 . '<br />';
                            }
                            $sitecli .= Retournecp_Id($scli_ville, FALSE) . ' ' . Retourneville_Id($scli_ville, FALSE) . '<br />';
                        }
                    }

                    if ($sitecli <> '') {
                        echo '<div class="annot_petit_it" style="float:left;">';
                        echo $sitecli;
                        echo '</div>';
                    }

                    echo '</td>';

                    // Affichage détail urgence
                    echo '<td ';
                    $couleur = give_coul_urg($row['ot_urg'], FALSE);
                    if ($couleur <> 'XX') {
                        echo ' style="background:' . $couleur . '"';
                    }
                    echo ' align="center">';
                    echo give_nom_urg($row['ot_urg'], FALSE);
                    echo '</td>';
                    // Fin affichage détail urgence

                    // Affichage technicien traitant
                    echo '<td align="center">';
                    if (($row['ot_codetec'] <> '') AND ($row['ot_codetec'] <> '-1')) {
                        echo $row['ot_codetec'];
                    } else {
                        echo '&nbsp;';
                    }
                    echo '</td>';

                    // Affichage icône Statut
                    echo '<td align="center">';

                    echo str_div_ico_statut($row['ot_codestatut'], '', FALSE);

                    echo '</td>';

                    // CREATION lien dynamique sur icône (édition, suppression, etc...)
                    echo '<td align="center">';

                    $rech2 = 'SELECT int_idsite, int_codecli FROM `' . TBINT . "` WHERE `int_code` = '" . $row['ot_codeint'] . "'";
                    /** @noinspection PhpUndefinedMethodInspection */
                    $row2 = $db->get_row($rech2, ARRAY_A);
                    if ($row2) {
                        $row2 = encode_str($row2);
                        extract($row2);
                    }

                    if ($row['ot_codestatut'] <> 'CLOT') {
                        $lst_maj = TRUE;
                        cre_falselnk_img('', 'ot_edit_' . $row['ot_id'], 'span', 'center', _('Edition'), 'lnk', 'ot_maj.php?tx=' . $tx . '&td=edit&ca=&cas=&ci=&cc=' . $row['ot_codecli'] . '&co=' . $row['ot_code'] . '&si=' . $row['ot_idsite'] . '&tr=', '../img/edit.png');
                    } else {
                        $lst_voir = TRUE;
                        cre_falselnk_img('', 'ot_view_' . $row['ot_id'], 'span', 'center', _('Visualisation'), 'lnk', 'ot_maj.php?tx=' . $tx . '&td=view&ca=&cas=&ci=&cc=' . $row['ot_codecli'] . '&co=' . $row['ot_code'] . '&si=' . $row['ot_idsite'] . '&tr=', '../img/eye.png');
                    }

                    $lst_imp = TRUE;
                    $urlimp = 'ot_pdf.php?co=' . $row['ot_code'];
                    cre_falselnk_img('', 'ot_prn_' . $row['ot_id'], 'span', 'center', _('Impression'), 'lnkpop', $urlimp, '../img/print.png');

                    if ($row['ot_codestatut'] <> 'CLOT') {
                        $del = TRUE;
                        if (CheckNivLog('10-11')) {
                            $del = FALSE;
                        }

                        if ($del == TRUE) {
                            $lst_del = TRUE;
                            cre_falselnk_img('', 'ot_del_' . $row['ot_id'], 'span', 'center', _('Suppression'), 'lnk', 'ot_maj.php?tx=' . $tx . '&td=del&ca=&cas=&ci=&cc=' . $row['ot_codecli'] . '&co=' . $row['ot_code'] . '&si=' . $row['ot_idsite'] . '&tr=', '../img/del.png');
                        }
                    }
                    echo '</td>';

                    echo '</tr>';
                    // Fin affichage résumé ordre

                    $i++;
                }
                echo '</table>';
                // *** Fin affichage de la table
            } else {
                echo '<span class="annot_gras_it">';
                echo '<br /><br />' . _('Pas de bons de travail en cours');
                echo '</span>';
            }

            /** @noinspection PhpUndefinedMethodInspection */
            close_database();

            $taille_piedla = '';
            include('../inc/piedla.inc.php');
            ?>
        </div>
    </div>
    <?php
    include_once('pied.php');
} else {
    ?>
    <p align="center"><span class="titrepageerr"><?php echo _('PROBLEME DE CONFIGURATION'); ?></span></p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <?php
    pop_ret_auto(_("SMI n'a pas encore été totalement configuré pour votre compte") . '<br />' . _("Merci de contacter l'administrateur ou le centre de gestion"), 'warn', 'index.php');
}
?>