<?php
/****************************************************************************************
 * SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV
 *
 * Version 1.0.2
 *
 * Copyright (C) 2006-2015  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/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("../inc/fic_droits.inc.php");
include_once("../inc/fic_st.inc.php");
include_once("../inc/fic_hum.inc.php");
include_once("../inc/lst.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['cs'];

if (@$_SESSION["niv_log"] == 10)
    $coderech = @$_SESSION["code_log"];

$pbm_st = FALSE;

if (@$_SESSION["niv_log"] <= 4)
    $pbm_st = TRUE;

if ($coderech <> "") {
    // Récupération des informations sous-traitant
    $row = lit_enr_st($coderech);
    if (is_array($row))
        extract($row);
    else
        $pbm_st = TRUE;
} else
    $pbm_st = 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 Sous-traitant"); ?></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_st == FALSE) {
    entimpfic("FICHE SOUS-TRAITANT");
    ?>
    <table class="Ftable" width="740" border="0">
    <?PHP
    if ((@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9)) {
        ?>
        <tr>
            <td class="rubNormal" id="f_code" align="right">Actif ?</td>
            <td width="62%">
                <?PHP
                if ($st_ouvert == 1)
                    echo _("Ouvert");
                else
                    echo _("Fermé");
                ?>
            </td>
        </tr>
    <?PHP
    }
    ?>
    <tr>
        <td width="21%" class="rubNormal" id="f_code" align="right"><?PHP echo _("Code"); ?></td>
        <td>
            <?PHP
            echo $st_code;
            ?>
        </td>
    </tr>
    <tr>
        <td height="21" class="rubNormal" id="f_logo" align="right"><?PHP echo _("Logo"); ?></td>
        <td>
            <?PHP
            echo "<div align=\"left\">";
            echo "<img src=\"" . $chemin_logos . "/log" . strtolower($st_code) . ".png" . "\"><br />";
            echo "</div>";
            ?>
        </td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_nom" align="right"><?PHP echo _("Nom"); ?></td>
        <td><?PHP echo $st_nom; ?></td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_rcs" align="right"><?PHP echo _("Siret"); ?></td>
        <td><?PHP echo $st_rcs ?></td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_rcs" align="right"><?PHP echo _("APE"); ?></td>
        <td><?PHP echo $st_rcs ?></td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_rcs" align="right"><?PHP echo _("TVA intra."); ?></td>
        <td><?PHP echo $st_rcs ?></td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_tcom" align="right"><?PHP echo _("Tribunal com."); ?></td>
        <td><?PHP echo $st_tcom ?></td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_adr1" align="right"><?PHP echo _("Adresse"); ?></td>
        <td><?PHP echo $st_adr1 ?></td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_adr2" align="right"><?PHP echo _("Adresse (2)"); ?></td>
        <td><?PHP echo $st_adr2 ?></td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_ville" align="right"><?PHP echo _("Code Postal"); ?></td>
        <td>
            <?PHP
            // Affichage du Code Postal
            echo Retournecp_Id($st_ville, TRUE);
            ?>
        </td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_ville" align="right"><?PHP echo _("Ville"); ?></td>
        <td>
            <?PHP
            // Affichage de la ville
            echo Retourneville_Id($st_ville, TRUE);
            ?>
        </td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_pays" align="right"><?PHP echo _("Pays"); ?></td>
        <td>
            <?PHP
            // Affichage du pays
            echo Retournepays($st_codepays, TRUE);
            ?>
        </td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_telf" align="right"><?PHP echo _("Téléphone Fixe"); ?> </td>
        <td>
            <?PHP
            echo $st_telf . "<br />";
            echo $st_txttelf;
            ?>
        </td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_fax" align="right"><?PHP echo _("Télécopieur"); ?></td>
        <td>
            <?PHP
            echo $st_fax . "<br />";
            echo $st_txtfax;
            ?>
        </td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_web" align="right"><?PHP echo _("Site Web"); ?></td>
        <td><?PHP echo $st_web ?></td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_heures" align="right"><?PHP echo _("Horaires"); ?></td>
        <td><?PHP echo $st_heures ?></td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_heures" align="right"><?PHP echo _("Entête"); ?></td>
        <td>
            <?PHP
            echo formatetxt($st_txtent);
            ?>
        </td>
    </tr>
    <tr>
    <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td colspan="2" class="rubNormal" id="f_web" align="center"><?PHP echo _("Contact principal"); ?></td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_rcivil" align="right"><?PHP echo _("Civilité"); ?></td>
        <td>
            <?PHP
            // Affichage de la civilité
            $db = open_database(DBUSER, DBPASS, DBNAME, DBHOST);

            $rech = "SELECT civ_desc FROM `" . TBCIV . "` WHERE civ_code = '" . $st_resp_civilite . "'";
            $row = $db->get_row($rech, ARRAY_A);
            if ($row) {
                extract($row);
                echo $civ_desc;
            }
            $db->disconnect();
            ?>
        </td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_rprenom" align="right"><?PHP echo _("Prénom"); ?></td>
        <td><?PHP echo $st_resp_prenom ?></td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_rnom" align="right"><?PHP echo _("Nom"); ?></td>
        <td><?PHP echo $st_resp_nom ?></td>
    </tr>
    <tr>
        <td class="rubNormal" id="f_rtelf" align="right"><?PHP echo _("Tel. Fixe"); ?></td>
        <td><?PHP echo $st_resp_telf ?></td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td colspan="2" class="rubNormal" align="center"><span class="annot_gras_it"><?PHP echo _("Emails"); ?></span></td>
        <td width="17%">
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_email" align="right"><?PHP echo _("Général"); ?></td>
        <td><?PHP echo $st_email ?>
            <span class="annot_std_it">(<?PHP echo _("Pour contacts clients"); ?>)</span>
        </td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_emaild" align="right"><?PHP echo _("Direction"); ?></td>
        <td><?PHP echo $st_emaild ?></td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_emailc" align="right"><?PHP echo _("Comptabilité"); ?></td>
        <td><?PHP echo $st_emailc ?></td>
    </tr>
    <tr>
        <td width="21%" class="rubNormal" id="f_emailt" align="right"><?PHP echo _("Technique"); ?></td>
        <td><?PHP echo $st_emailt ?></td>
    </tr>
    <tr>
        <td width="21%">&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
    <?PHP
    if ((@$_SESSION["niv_log"] == 5) OR (@$_SESSION["niv_log"] == 9)) {
        ?>
        <tr>
            <td width="21%" class="rubNormal" id="f_nota" align="right"><?PHP echo _("Notes"); ?></td>
            <td><?PHP
                echo "<span class=\"txtnotes\">";
                echo formatetxt($st_nota);
                echo "</span>";
                ?>
            </td>
        </tr>
        <tr>
            <td width="21%">&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td width="21%" class="rubNormal" id="f_factures" align="right"><?PHP echo _("Emet ses factures"); ?></td>
            <td><?PHP echo $non_oui[$st_fact]; ?></td>
        </tr>
    <?PHP
    }
    ?>
    </table>

<?PHP
}
else
{
?>
    <script type="text/javascript">
        <!--
        window.close();
        //-->
    </script>
<?PHP
}
?>
</body>
</html>