}
}
spl_autoload_register("classLoad");
include '../config.php';
//classes loading end
session_start();
if (isset($_SESSION['userMerlaTrav']) and $_SESSION['userMerlaTrav']->profil() == "admin") {
    //classes managers
    $idProjet = 0;
    $projetManager = new ProjetManager($pdo);
    $clientManager = new ClientManager($pdo);
    $contratManager = new ContratManager($pdo);
    $operationManager = new OperationManager($pdo);
    $contratCasLibreManager = new ContratCasLibreManager($pdo);
    $reglementPrevuManager = new ReglementPrevuManager($pdo);
    if (isset($_GET['codeContrat']) and (bool) $contratManager->getCodeContrat($_GET['codeContrat'])) {
        $codeContrat = $_GET['codeContrat'];
        $contrat = $contratManager->getContratByCode($codeContrat);
        $projet = $projetManager->getProjetById($contrat->idProjet());
        $client = $clientManager->getClientById($contrat->idClient());
        $sommeOperations = $operationManager->sommeOperations($contrat->id());
        $biens = "";
        $typeBien = "";
        $niveau = "";
        if ($contrat->typeBien() == "appartement") {
            $appartementManager = new AppartementManager($pdo);
            $biens = $appartementManager->getAppartementById($contrat->idBien());
            $typeBien = "Appartement";
            $niveau = $biens->niveau();
        } else {
            if ($contrat->typeBien() == "localCommercial") {