<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.0
 *
 * Copyright (C) 2006-2014  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
 ****************************************************************************************/


// vérification des tentatives de hack
$pos = strpos($_SERVER['PHP_SELF'], "inc.php");
if ($pos === FALSE)
    $ok_inc = TRUE;
else
    $ok_inc = FALSE;
if ($ok_inc == FALSE) header("Location: ../index.php");


include_once("../inc/config.inc.php");
include_once("../inc/fic_age.inc.php");
include_once("../inc/fic_do.inc.php");
include_once("../inc/fic_droits.inc.php");
include_once("../inc/fic_st.inc.php");
include_once("../inc/fic_hum.inc.php");
include_once("../inc/fic_tec.inc.php");
include_once("../inc/func.inc.php");
include_once("../inc/func_date.inc.php");
include_once("../inc/func_log.inc.php");
include_once("../inc/func_geo.inc.php");
include_once("../inc/func_txt.inc.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(@$_SESSION["code_log"]);
// Variables Formulaire
fix_magic_quotes();
$_GET = clean_str($_GET);

$coderech = $_GET['code'];

$pbm_tec = FALSE;

if ($coderech <> "") {
    // Récupération des informations techniciens

    $row = lit_enr_tec($coderech, TRUE);
    if (is_array($row)) {
        $row = encode_str($row);
        extract($row);

        if ((@$_SESSION["niv_log"] == 4) OR (@$_SESSION["niv_log"] == 3)) {
            if ($tec_codeage <> $_SESSION["code_age"])
                $pbm_tec = TRUE;
        }

        if ($pbm_tec == FALSE) {
            $tec_datecreaf = datetolocal($tec_datecrea);
            $tec_congdf = datetolocal($tec_congd);
            $tec_congff = datetolocal($tec_congf);
            $tec_dateoutf = datetolocal($tec_dateout);
        }
    } else
        $pbm_tec = TRUE;
} else
    $pbm_tec = TRUE;
?>
<!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 _("Impression Fiche Technicien"); ?></title>

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

    <script type="text/javascript">
        <!--
        function init_all() {
            init_Body();
            warn_print(2);
        }

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

</head>

<body>
<?PHP
if ($pbm_tec == FALSE) {
    entimpfic(_("FICHE TECHNICIEN"));
    ?>
    <table class="Ftable" width="100%" border="0">
        <tr>
            <td width="160" class="rubNormal" id="f_codetec" align="right"><?PHP echo _("Code"); ?></td>
            <td><?PHP echo $tec_code ?></td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_salarie" align="right"><?PHP echo _("Salarié"); ?></td>
            <td>
                <?PHP echo $non_oui[$tec_out]; ?>
                <span class="annot_std_it">
        <?PHP
        if ($tec_out == false)
            echo "  (" . _("Embauche le") . " : " . $tec_datecreaf . ")";
        else
            echo "  (" . _("Embauche le") . " : " . $tec_datecreaf . ", départ le : " . $tec_dateoutf . ")";
        ?>
        </span>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_emploi" align="right"><?PHP echo _("Emploi"); ?>
            </td>
            <td>
                <?PHP echo $tec_emploi; ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_qualif" align="right"><?PHP echo _("Qualification"); ?>
            </td>
            <td>
                <?PHP echo $tec_qualif; ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_niveau" align="right"><?PHP echo _("Niveau / Ech. / Coeff."); ?>
            </td>
            <td>
                <?PHP echo $tec_niveau . " / " . $tec_echelon . " / " . $tec_coeff; ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_dconges" align="right"><?PHP echo _("Congés"); ?></td>
            <td colspan="3">
                <?PHP if ($tec_congdf <> "") { ?>
                    <span class="annot_petit_gras">du</span> <?PHP echo $tec_congdf; ?> <span
                        class="annot_petit_gras"> <?PHP echo _("au"); ?> </span> <?PHP echo $tec_congff; ?> <span
                        class="annot_std_it"> <?PHP echo _("Prochains congés ou congés en cours"); ?></span>
                <?PHP } else { ?>
                    &nbsp;
                <?PHP } ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_agence" align="right"><?PHP echo _("Employeur"); ?></td>
            <td width="83%" colspan="3">
                <?PHP
                // Affichage de l'agence
                if ((@$_SESSION["niv_log"] == 4) OR ($tec_codeage <> "")) {
                    $row = lit_enr_age($tec_codeage, TRUE);
                    if (is_array($row)) {
                        $row = encode_str($row);
                        extract($row);
                    }
                    $empl = $tec_codeage . " (" . _("Agence") . ")";
                }
                if ((@$_SESSION["niv_log"] == 6) OR ($tec_codedo <> "")) {
                    $row = lit_enr_do($tec_codedo);
                    if (is_array($row)) {
                        $row = encode_str($row);
                        extract($row);
                    }
                    $empl = $tec_codedo . " (" . _("Donneur d'ordres") . ")";
                }
                if ((@$_SESSION["niv_log"] == 10) OR ($tec_codest <> "")) {
                    $row = lit_enr_st($tec_codest);
                    if (is_array($row)) {
                        $row = encode_str($row);
                        extract($row);
                    }
                    $empl = $tec_codest . " (" . _("Sous-traitant") . ")";
                }
                echo $empl;
                ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_civil" align="right"><?PHP echo _("Civilité"); ?></td>
            <td width="83%" colspan="3">
                <?PHP
                $row = lit_enr_civ($tec_civilite);
                if (is_array($row)) {
                    $row = encode_str($row);
                    extract($row);
                }
                echo $civ_desc;
                ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_prenom" align="right"><?PHP echo _("Prénom"); ?></td>
            <td colspan="3"><?PHP echo $tec_prenom ?>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_nom" align="right"><?PHP echo _("Nom"); ?></td>
            <td colspan="3"><?PHP echo $tec_nom ?>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_adr1" align="right"><?PHP echo _("Adresse"); ?></td>
            <td colspan="3"><?PHP echo $tec_adr1 ?>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_adr2" align="right"><?PHP echo _("Adresse (2)"); ?></td>
            <td colspan="3"><?PHP echo $tec_adr2 ?>
        </tr>
        <tr>
            <td class="rubNormal" id="f_cp" align="right"><?PHP echo _("Code Postal"); ?></td>
            <td colspan="3">
                <?PHP
                echo Retournecp_Id($tec_ville, TRUE);
                ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_ville" align="right"><?PHP echo _("Ville"); ?></td>
            <td colspan="3">
                <?PHP
                echo Retourneville_Id($tec_ville, TRUE);
                ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_pays" align="right"><?PHP echo _("Département"); ?></td>
            <td colspan="3">
                <?PHP
                // Affichage du Département
                $dep = Retournedep($tec_dep, $tec_codepays, TRUE);
                if ($tec_dep <> $dep)
                    echo $tec_dep . " (" . $dep . ")";
                else
                    echo $dep;
                ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_pays" align="right"><?PHP echo _("Pays"); ?></td>
            <td colspan="3">
                <?PHP
                // Affichage du pays
                echo Retournepays($tec_codepays, TRUE);
                ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_telf" align="right"><?PHP echo _("Téléphone Fixe"); ?></td>
            <td colspan="3"><?PHP echo $tec_telf ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_fax" align="right"><?PHP echo _("Télécopieur"); ?></td>
            <td colspan="3"><?PHP echo $tec_fax ?></td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_telp" align="right"><?PHP echo _("Téléphone portable"); ?></td>
            <td colspan="3"><?PHP echo $tec_telp ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_email" align="right"><?PHP echo _("Email"); ?></td>
            <td colspan="3"><?PHP echo $tec_email ?>
            </td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_mess" align="right"><?PHP echo _("Messagerie"); ?></td>
            <td colspan="3"><?PHP echo $tec_mess ?></td>
        </tr>
        <tr>
            <td width="160" class="rubNormal" id="f_nota" align="right"><?PHP echo _("Notes"); ?></td>
            <td colspan="3">
                <?PHP
                echo "<span class=\"txtnotes\">";
                echo formatetxt($tec_nota);
                echo "</span>";
                ?>
            </td>
        </tr>
    </table>
<?PHP
}
else
{
?>
    <script type="text/javascript">
        <!--
        window.close();
        //-->
    </script>
<?PHP
}
?>
</body>
</html>
