} } spl_autoload_register("classLoad"); include '../config.php'; //classes loading end session_start(); //post input processing $idProjet = $_POST['idProjet']; $codeClient = ""; //classModel $client = ""; //classManager $clientManager = new ClientManager($pdo); if (!empty($_POST['idClient'])) { $idClient = htmlentities($_POST['idClient']); $client = $clientManager->getClientById($idClient); $codeClient = $client->code(); } else { if (empty($_POST['idClient'])) { if (!empty($_POST['nom'])) { $nom = htmlentities($_POST['nom']); if ($clientManager->exists($nom)) { $_SESSION['client-add-error'] = "<strong>Erreur Création Client : </strong>Un client existe déjà avec ce nom : " . $nom . " ."; header('Location:../clients-add.php?idProjet=' . $idProjet); exit; } else { $cin = htmlentities($_POST['cin']); $adresse = htmlentities($_POST['adresse']); $telephone1 = htmlentities($_POST['telephone1']); $telephone2 = htmlentities($_POST['telephone2']); $email = htmlentities($_POST['email']);
</td> <td style="width: 10%"><?php echo $locau->mezzanine(); ?> </td> <td style="width: 10%"><?php echo $locau->status(); ?> </td> <td style="width: 50%">Pour <?php if ($locau->status() == "Réservé") { echo $locau->par(); } else { if ($locau->status() == "Vendu") { echo $clientManager->getClientById($contratManager->getIdClientByIdProjetByIdBienTypeBien($idProjet, $locau->id(), "localCommercial"))->nom(); } } ?> </td> </tr> <?php } //end of loop ?> </table> <br><br> <br><br> <page_footer> <hr/> <p style="text-align: center;font-size: 9pt;"></p>
?> "> <i class="icon-zoom-in"></i> </a> <a title="Modifier Image Note" class="btn mini black" href="#updateImageNote<?php echo $contrat->id(); ?> " data-toggle="modal" data-id="<?php echo $contrat->id(); ?> "> <i class=" icon-refresh"></i> </a> </td> <td><?php echo $clientManager->getClientById($contrat->idClient())->nom(); ?> </td> <td class="hidden-phone"><?php echo $projet->nom(); ?> </td> <td class="hidden-phone"><?php echo $typeBien; ?> - <?php echo $bien->nom(); ?> - <?php echo $etage; ?>
if (isset($_SESSION['userMerlaTrav']) and $_SESSION['userMerlaTrav']->profil() == "admin") { $clientManager = new ClientManager($pdo); $contratManager = new ContratManager($pdo); $projetManager = new ProjetManager($pdo); $appartementManager = new AppartementManager($pdo); $locauxManager = new LocauxManager($pdo); $biens = ""; $idContrat = 0; if (isset($_GET['idContrat']) and ($_GET['idContrat'] > 0 and $_GET['idContrat'] <= $contratManager->getLastId())) { $idContrat = $_GET['idContrat']; } else { header('Location:../dashboard.php'); exit; } $contrat = $contratManager->getContratById($idContrat); $client = $clientManager->getClientById($contrat->idClient()); $projet = $projetManager->getProjetById($contrat->idProjet()); $typeBien = ""; if ($contrat->typeBien() == "appartement") { $biens = $appartementManager->getAppartementById($contrat->idBien()); $typeBien = "Appartement"; } else { if ($contrat->typeBien() == "localCommercial") { $biens = $locauxManager->getLocauxById($contrat->idBien()); $typeBien = "Local commercial"; } } //property data $programme = $projet->nom(); $superficie = $biens->superficie(); $prixHt = number_format($contrat->prixVente(), 2, ',', ' ');
pièces</td> <td style="width: 5%"><?php echo $appartement->cave(); ?> </td> <td style="width: 10%"><?php echo $appartement->status(); ?> </td> <td style="width: 15%">Pour <?php if ($appartement->status() == "Réservé") { echo $appartement->par(); } else { if ($appartement->status() == "Vendu") { echo $clientManager->getClientById($contratManager->getIdClientByIdProjetByIdBienTypeBien($idProjet, $appartement->id(), "appartement"))->nom(); } } ?> </td> </tr> <?php } //end of loop ?> </table> <br><br> <br><br> <page_footer> <hr/> <p style="text-align: center;font-size: 9pt;"></p>
</tr> <?php }//end of loop ?> <?php foreach($appartementsRevendre as $contrat){ $appartement = $appartementManager->getAppartementById($contrat->idBien()); ?> <tr class="appartements"> <td class="hidden-phone"> <div class="btn-group"> <a class="btn green mini dropdown-toggle" data-toggle="dropdown"><i class="icon-exclamation-sign"></i></a> <ul class="dropdown-menu info-dropdown"> <li> <a> Pour : <strong><?= $clientManager->getClientById($contrat->idClient())->nom() ?></strong> </a> </li> <li> <a> Montant de Revente : <strong><?= $appartement->montantRevente() ?> DH</strong> </a> </li> </ul> </div> </td> <td> <div class="btn-group"> <a style="width: 50px" class="btn mini dropdown-toggle" href="#" title="Prix : <?= number_format($appartement->prix(), 2, ',', ' ') ?> DH" data-toggle="dropdown"> <?= $appartement->nom() ?> <i class="icon-angle-down"></i>
<a class="btn mini" title="<?= $locau->par() ?>" href="#updateClient<?= $locau->id() ?>" data-toggle="modal" data-id="<?= $locau->id() ?>"> Pour </a> <?php } else{ ?> <a class="btn mini" title="<?= $locau->par() ?>"> Pour </a> <?php } } elseif( $locau->status() == "Vendu" ){ ?> <a class="btn mini" title="<?= $clientManager->getClientById($contratManager->getIdClientByIdProjetByIdBienTypeBien($idProjet, $locau->id(), "localCommercial"))->nom() ?>"> Pour </a> <?php } ?> </td> </tr> <!-- updateClient box begin --> <div id="updateClient<?= $locau->id() ?>" class="modal hide fade in" tabindex="-1" role="dialog" aria-labelledby="login" aria-hidden="false" > <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> <h3>Changer le client <strong><?= $locau->par() ?></strong> </h3> </div> <div class="modal-body"> <form class="form-horizontal loginFrm" action="controller/LocauxActionController.php" method="post">
$montant = htmlentities($_POST['montant']); $titre = htmlentities($_POST['titre']); $etat = htmlentities($_POST['etat']); //load class manager $commissionManager = new CommissionManager($pdo); //save the commission $commission = new Commission(array('titre' => $titre, 'commissionnaire' => $commissionnaire, 'montant' => $montant, 'date' => $dateCreation, 'etat' => $etat, 'codeContrat' => $codeContrat, 'created' => $created, 'createdBy' => $createdBy)); $commissionManager->add($commission); } //COMMISSION PROCESSING END //create the contract object $contrat = new Contrat(array('reference' => $reference, 'numero' => $numero, 'dateCreation' => $dateCreation, 'prixVente' => $prixNegocie, 'prixVenteArabe' => $prixNegocieArabe, 'avance' => $avance, 'avanceArabe' => $avanceArabe, 'modePaiement' => $modePaiement, 'dureePaiement' => $dureePaiement, 'nombreMois' => $nombreMois, 'echeance' => $echeance, 'note' => $note, 'imageNote' => $noteImage, 'idClient' => $idClient, 'idProjet' => $idProjet, 'idBien' => $idBien, 'typeBien' => $typeBien, 'code' => $codeContrat, 'numeroCheque' => $numeroCheque, 'societeArabe' => $societeArabe, 'etatBienArabe' => $etatBienArabe, 'facadeArabe' => $facadeArabe, 'articlesArabes' => $articlesArabes, 'created' => $created, 'createdBy' => $createdBy)); //adding the contract object to our database $contratManager->add($contrat); //add history data to db $nomClient = $clientManager->getClientById($idClient)->nom(); $history = new History(array('action' => "Ajout", 'target' => "Table des contrats", 'description' => "Ajout du contrat numéro : " . $numero . ", client : " . $nomClient . ", " . $typeBien . " : " . $idBien . ", prix : " . $prixNegocie . " - Projet : " . $nomProjet, 'created' => $created, 'createdBy' => $createdBy)); //add it to db $historyManager->add($history); //in the next if elseif statement, we test the type of the property to change its status //and its price if ($typeBien == "appartement") { $appartementManager = new AppartementManager($pdo); $appartementManager->changeStatus($idBien, "Vendu"); $appartementManager->updatePrix($prixNegocie, $idBien); } else { if ($typeBien == "localCommercial") { $locauxManager = new LocauxManager($pdo); $locauxManager->changeStatus($idBien, "Vendu"); $locauxManager->updatePrix($prixNegocie, $idBien); }
<?php // Include the main TCPDF library (search for installation path). require_once 'lib/tcpdf/tcpdf.php'; require_once 'model/Client.php'; require_once 'model/ClientManager.php'; require_once 'config.php'; $clientManager = new ClientManager($pdo); $client = $clientManager->getClientById(312); // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 018'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 018', PDF_HEADER_STRING); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks
$projet = $projetManager->getProjetById($idProjet); // connexion à la base de données //try{ //$bdd = new PDO('mysql:host=localhost;dbname=maroccar', 'root', ''); //} //catch(Exception $e){ //exit('Impossible de se connecter à la base de données.'); //} // exécution de la requête $resultat = $pdo->query($requete) or die(print_r($bdd->errorInfo())); // résultats $res = '<option value="">Vous pouvez séléctionnez un contrat</option>'; echo $res; while ( $contrat = $resultat->fetch(PDO::FETCH_ASSOC)) { $client = $clientManager->getClientById($contrat['idClient']); $typeBien = ""; $bien = ""; $etage = ""; if ( $contrat['typeBien'] == "appartement" ) { $typeBien = "Appartement"; $bien = $appartementManager->getAppartementById($contrat['idBien']); $etage = "Etage : ".$bien->niveau(); } else { $typeBien = "Local.Com"; $bien = $locauxManager->getLocauxById($contrat['idBien']); } $res = '<option value="'.$contrat['id'].'">'.$client->nom().' - '.$projet->nom().' - '.$typeBien.' : '.$bien->nom().' - '.$etage.'</option>'; echo $res; }