$createdBy = $_SESSION['userMerlaTrav']->login();
        $numeroCheque = '0';
        if (isset($_POST['numeroCheque'])) {
            $numeroCheque = htmlentities($_POST['numeroCheque']);
        }
        $contratManager = new ContratManager($pdo);
        $contrat = new Contrat(array('numero' => $numero, 'dateCreation' => $dateCreation, 'prixVente' => $prixNegocie, 'avance' => $avance, 'modePaiement' => $modePaiement, 'dureePaiement' => $dureePaiement, 'nombreMois' => $nombreMois, 'echeance' => $echeance, 'note' => $note, 'idClient' => $idClient, 'idProjet' => $idProjet, 'idBien' => $idBien, 'typeBien' => $typeBien, 'code' => $codeContrat, 'numeroCheque' => $numeroCheque, 'created' => $created, 'createdBy' => $createdBy));
        $contratManager->add($contrat);
        if ($typeBien == "appartement") {
            $appartementManager = new AppartementManager($pdo);
            $appartementManager->changeStatus($idBien, "Vendu");
        } else {
            if ($typeBien == "localCommercial") {
                $locauxManager = new LocauxManager($pdo);
                $locauxManager->changeStatus($idBien, "Vendu");
            }
        }
        //add note client into db and show it in the dashboard
        $notesClientManager = new NotesClientManager($pdo);
        $notesClient = new NotesClient(array('note' => $note, 'created' => date('Y-m-d'), 'idProjet' => $idProjet, 'codeContrat' => $codeContrat));
        $notesClientManager->add($notesClient);
        header('Location:../contrat.php?codeContrat=' . $codeContrat);
    } else {
        $_SESSION['contrat-add-error'] = "<strong>Erreur Création Contrat : </strong>Vous devez choisir un 'Type de bien'.";
        header('Location:../contrats-add.php?idProjet=' . $idProjet . '&codeClient=' . $codeClient);
        exit;
    }
} else {
    $_SESSION['contrat-add-error'] = "<strong>Erreur Création Contrat : </strong>Vous devez remplir le champ <strong>Nom</strong>.";
    header('Location:../contrats-add.php?idProjet=' . $idProjet . '&codeClient=' . $codeClient);
}
Esempio n. 2
0
{
    if (file_exists('model/' . $myClass . '.php')) {
        include 'model/' . $myClass . '.php';
    } elseif (file_exists('controller/' . $myClass . '.php')) {
        include 'controller/' . $myClass . '.php';
    }
}
spl_autoload_register("classLoad");
include 'config.php';
//classes loading end
session_start();
if (isset($_SESSION['userMerlaTrav'])) {
    //classes managers
    $usersManager = new UserManager($pdo);
    $mailsManager = new MailManager($pdo);
    $notesClientsManager = new NotesClientManager($pdo);
    $projetManager = new ProjetManager($pdo);
    $contratManager = new ContratManager($pdo);
    $clientManager = new ClientManager($pdo);
    $livraisonsManager = new LivraisonManager($pdo);
    $fournisseursManager = new FournisseurManager($pdo);
    $caisseManager = new CaisseManager($pdo);
    $caisseIaazaManager = new CaisseIaazaManager($pdo);
    $operationsManager = new OperationManager($pdo);
    $compteBancaire = new CompteBancaireManager($pdo);
    //classes and vars
    //users number
    $soldeCaisseAnnahda = $caisseManager->getTotalCaisseByType("Entree") - $caisseManager->getTotalCaisseByType("Sortie");
    $soldeCaisseIaaza = $caisseIaazaManager->getTotalCaisseByType("Entree") - $caisseIaazaManager->getTotalCaisseByType("Sortie");
    $projetNumber = $projetManager->getProjetsNumber();
    $usersNumber = $usersManager->getUsersNumber();