<tr> <th style="width:20%">Actions</th> <th style="width:15%">Client</th> <th style="width:10%">Projet</th> <th style="width:20%" class="hidden-phone">Bien</th> <th style="width:10%">Date Contrat</th> <th style="width:25%" class="hidden-phone">Note</th> </tr> </thead> <tbody> <?php foreach ($contrats as $contrat) { $revendreTitle = ""; $montantRevente = 0; $operationsNumber = $operationManager->getOpertaionsNumberByIdContrat($contrat->id()); $sommeOperations = $operationManager->sommeOperations($contrat->id()); $bien = ""; $typeBien = ""; $etage = ""; $projet = $projetManager->getProjetById($contrat->idProjet()); if ($contrat->typeBien() == "appartement") { $bien = $appartementManager->getAppartementById($contrat->idBien()); $typeBien = "Appartement"; $etage = "Etage " . $bien->niveau(); } else { $bien = $locauxManager->getLocauxById($contrat->idBien()); $typeBien = "Local commercial"; $etage = ""; } ?>
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") { $locauxManager = new LocauxManager($pdo); $biens = $locauxManager->getLocauxById($contrat->idBien()); $typeBien = "Local Commercial"; } }
$contratCasLibreTitle = ""; if ($contratCasLibreNumber > 0) { $contratCasLibreTitle = "<h4>Informations Supplémentaires</h4>"; $contratCasLibreElements = $contratCasLibreManager->getContratCasLibresByCodeContrat($codeContrat); } //ReglementPrevu Elements $reglementPrevuNumber = $reglementPrevuManager->getReglementNumberByCodeContrat($codeContrat); $reglementPrevuElements = ""; $reglementPrevuTitle = ""; if ($reglementPrevuNumber > 0) { $reglementPrevuTitle = "<h4>Dates des réglements prévus</h4>"; $reglementPrevuElements = $reglementPrevuManager->getReglementPrevuByCodeContrat($codeContrat); } $projet = $projetManager->getProjetById($contrat->idProjet()); $client = $clientManager->getClientById($contrat->idClient()); $sommeOperations = $operationManager->sommeOperations($contrat->id()); $biens = ""; $niveau = ""; if ($contrat->typeBien() == "appartement") { $appartementManager = new AppartementManager($pdo); $biens = $appartementManager->getAppartementById($contrat->idBien()); $niveau = $biens->niveau(); } else { if ($contrat->typeBien() == "localCommercial") { $locauxManager = new LocauxManager($pdo); $biens = $locauxManager->getLocauxById($contrat->idBien()); } } $operations = ""; //test the locaux object number: if exists get operations else do nothing $operationsNumber = $operationManager->getOpertaionsNumberByIdContrat($contrat->id());
$idProjet = $_GET['idProjet']; $projet = $projetManager->getProjetById($idProjet); //Container 1 : Statistiques $chiffreAffaireTheorique = ceil( $appartementManager->getTotalPrixAppartementsByIdProjet($idProjet) + $locauxManager->getTotalPrixLocauxByIdProjet($idProjet) ); //get contacts ids and get sum of client operations $idsContrats = $contratManager->getContratActifIdsByIdProjet($idProjet); $sommeOperationsClients = 0; $sommePrixVente = 0; foreach($idsContrats as $id){ $sommeOperationsClients += $operationsManager->sommeOperations($id); $sommePrixVente += $contratManager->getContratById($id)->prixVente(); } $sommeApportsClients = ($sommeOperationsClients); $reliquat = $sommePrixVente - $sommeOperationsClients; $sommeCharges = $chargeCommunManager->getTotal() + $chargeManager->getTotalByIdProjet($idProjet); $sommeCharges = ceil($sommeCharges); //Container 2 : Statistiques $sommeLivraisons = 0; $idsLivraisons = $livraisonsManager->getLivraisonIdsByIdProjet($idProjet); foreach ( $idsLivraisons as $id ) { $sommeLivraisons += $livraisonDetailManager->getTotalLivraisonByIdLivraison($id); } $sommeReglements = ceil($reglementsFournisseurManager->sommeReglementFournisseurByIdProjet($_GET['idProjet']));
<thead> <tr> <th style="width: 15%">Date</th> <th>Montant</th> <!--th>Reste</th--> <th class="hidden-phone">Quittance</th> <th class="hidden-phone">Mode Paiement</th> <th class="hidden-phone">Modifier</th> <th class="hidden-phone">Supprimer</th> </tr> </thead> <tbody> <?php if ($operationsNumber != 0) { $montant = 0; $reste = $contrat->prixVente() - $operationManager->sommeOperations($contrat->id()) - $contrat->avance(); foreach ($operations as $operation) { //$reste = $reste + $montant; //$montant = $montant + $operation->montant(); ?> <tr> <td><a><?php echo date('d/m/Y', strtotime($operation->date())); ?> </a></td> <td><?php echo number_format($operation->montant(), 2, ',', ' '); ?> DH</td> <td class="hidden-phone">