$idCharge = htmlentities($_POST['idCharge']); $idSociete = htmlentities($_POST['idSociete']); $type = htmlentities($_POST['type']); $charge = ""; $chargeManager = ""; if (htmlentities($_POST['typeCharge']) == "terrain") { $charge = new ChargesTerrain($chargeArray); $chargeManager = new ChargesTerrainManager($pdo); } else { if (htmlentities($_POST['typeCharge']) == "construction") { $charge = new ChargesConstruction($chargeArray); $chargeManager = new ChargesConstructionManager($pdo); } else { if (htmlentities($_POST['typeCharge']) == "finition") { $charge = new ChargesFinition($chargeArray); $chargeManager = new ChargesFinitionManager($pdo); } } } $chargeManager->delete($idCharge); //add history data to db $projetManager = new ProjetManager($pdo); $historyManager = new HistoryManager($pdo); $createdBy = $_SESSION['userMerlaTrav']->login(); $created = date('Y-m-d h:i:s'); $history = new History(array('action' => "Suppression", 'target' => "Table des " . htmlentities($_POST['typeCharge']), 'description' => "Suppression des charges " . htmlentities($_POST['typeCharge']) . " - ID : " . $idCharge . " - Projet : " . $projetManager->getProjetById($idProjet)->nom(), 'created' => $created, 'createdBy' => $createdBy)); //add it to db $historyManager->add($history); $_SESSION['charge-delete-success'] = '<strong>Opération valide</strong> : La charge est supprimée avec succès !'; $redirectLink = 'Location:../projet-charges.php?idProjet=' . $idProjet . '&idSociete=' . $idSociete . '&type=' . $type; header($redirectLink);
$created = date('d/m/Y h:m'); //CREATE NEW Charge object $chargeArray = array('dateOperation' => $dateOperation, 'designation' => $designation, 'beneficiaire' => $beneficiaire, 'numeroCheque' => $numeroCheque, 'montant' => $montant, 'idProjet' => $idProjet, 'created' => $created, 'createdBy' => $createdBy); $charge = ""; $chargeManager = ""; if (htmlentities($_POST['typeCharge']) == "terrain") { $charge = new ChargesTerrain($chargeArray); $chargeManager = new ChargesTerrainManager($pdo); } else { if (htmlentities($_POST['typeCharge']) == "construction") { $charge = new ChargesConstruction($chargeArray); $chargeManager = new ChargesConstructionManager($pdo); } else { if (htmlentities($_POST['typeCharge']) == "finition") { $charge = new ChargesFinition($chargeArray); $chargeManager = new ChargesFinitionManager($pdo); } } } $chargeManager->add($charge); //add history data to db $projetManager = new ProjetManager($pdo); $historyManager = new HistoryManager($pdo); $createdBy = $_SESSION['userMerlaTrav']->login(); $created = date('Y-m-d h:i:s'); $history = new History(array('action' => "Ajout", 'target' => "Table des " . htmlentities($_POST['typeCharge']), 'description' => "Ajout des charges " . htmlentities($_POST['typeCharge']) . " - Montant : " . $montant . " - Designation : " . $designation . " - Projet : " . $projetManager->getProjetById($idProjet)->nom(), 'created' => $created, 'createdBy' => $createdBy)); //add it to db $historyManager->add($history); $_SESSION['charge-add-success'] = '<strong>Opération valide</strong> : La charge est ajoutée avec succès !'; $redirectLink = 'Location:../projet-charges.php?idProjet=' . $idProjet . '&idSociete=' . $idSociete . '&type=' . $type; header($redirectLink);
$montant = htmlentities($_POST['montant']); //CREATE NEW Charge object $chargeArray = array('id' => $idCharge, 'dateOperation' => $dateOperation, 'designation' => $designation, 'beneficiaire' => $beneficiaire, 'numeroCheque' => $numeroCheque, 'montant' => $montant, 'idProjet' => $idProjet); $charge = ""; $chargeManager = ""; if (htmlentities($_POST['typeCharge']) == "terrain") { $charge = new ChargesTerrain($chargeArray); $chargeManager = new ChargesTerrainManager($pdo); } else { if (htmlentities($_POST['typeCharge']) == "construction") { $charge = new ChargesConstruction($chargeArray); $chargeManager = new ChargesConstructionManager($pdo); } else { if (htmlentities($_POST['typeCharge']) == "finition") { $charge = new ChargesFinition($chargeArray); $chargeManager = new ChargesFinitionManager($pdo); } } } $chargeManager->update($charge); //add history data to db $projetManager = new ProjetManager($pdo); $historyManager = new HistoryManager($pdo); $createdBy = $_SESSION['userMerlaTrav']->login(); $created = date('Y-m-d h:i:s'); $history = new History(array('action' => "Modification", 'target' => "Table des " . htmlentities($_POST['typeCharge']), 'description' => "Modification des charges " . htmlentities($_POST['typeCharge']) . " - Montant : " . $montant . " - Designation : " . $designation . " - Projet : " . $projetManager->getProjetById($idProjet)->nom(), 'created' => $created, 'createdBy' => $createdBy)); //add it to db $historyManager->add($history); $_SESSION['charge-update-success'] = '<strong>Opération valide</strong> : La charge est modifiée avec succès !'; $redirectLink = 'Location:../projet-charges.php?idProjet=' . $idProjet . '&idSociete=' . $idSociete . '&type=' . $type; header($redirectLink);
} elseif (file_exists('controller/' . $myClass . '.php')) { include 'controller/' . $myClass . '.php'; } } spl_autoload_register("classLoad"); include 'config.php'; include 'lib/pagination.php'; //classes loading end session_start(); if (isset($_SESSION['userMerlaTrav'])) { //classManagers $projetManager = new ProjetManager($pdo); $societeManager = new SocieteManager($pdo); $chargesTerrainManager = new ChargesTerrainManager($pdo); $chargesConstructionManager = new ChargesConstructionManager($pdo); $chargesFinitionManager = new ChargesFinitionManager($pdo); // if (isset($_GET['idProjet']) and ($_GET['idProjet'] >= 1 and $_GET['idProjet'] <= $projetManager->getLastId())) { $idProjet = $_GET['idProjet']; $idSociete = $_GET['idSociete']; $type = $_GET['type']; $chargesTerrain = $chargesTerrainManager->getChargesTerrainsByIdProjet($idProjet); $chargesConstruction = $chargesConstructionManager->getChargesConstructionsByIdProjet($idProjet); $chargesFinition = $chargesFinitionManager->getChargesFinitionsByIdProjet($idProjet); $societe = $societeManager->getSocieteById($idSociete); } ?> <!DOCTYPE html> <!--[if IE 8]> <html lang="en" class="ie8"> <![endif]--> <!--[if IE 9]> <html lang="en" class="ie9"> <![endif]--> <!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
} spl_autoload_register("classLoad"); include 'config.php'; //classes loading end session_start(); if (isset($_SESSION['userMerlaTrav']) and isset($_GET['idProjet'])) { //classes managers //propeties managers $appartementManager = new AppartementManager($pdo); $locauxManager = new LocauxManager($pdo); $terrainManager = new TerrainManager($pdo); $maisonManager = new MaisonManager($pdo); //charges managers $chargesTerrainManager = new ChargesTerrainManager($pdo); $chargesConstructionManager = new ChargesConstructionManager($pdo); $chargesFinitionManager = new ChargesFinitionManager($pdo); //livraisons & fournisseurs managers $livraisonsManager = new LivraisonManager($pdo); $livraisonDetailManager = new LivraisonDetailManager($pdo); $fournisseursManager = new FournisseurManager($pdo); //other managers $caisseManager = new CaisseManager($pdo); $usersManager = new UserManager($pdo); $projetManager = new ProjetManager($pdo); $societeManager = new SocieteManager($pdo); $contratManager = new ContratManager($pdo); //classes and vars $idProjet = $_GET['idProjet']; $idSociete = $_GET['idSociete']; $societe = $societeManager->getSocieteById($idSociete); $projet = $projetManager->getProjetById($idProjet);
$idSociete = htmlentities($_POST['idSociete']); $type = htmlentities($_POST['type']); $dateFrom = htmlentities($_POST['dateFrom']); $dateTo = htmlentities($_POST['dateTo']); if (isset($_POST['terrain'])) { $chargesTerrainManager = new ChargesTerrainManager($pdo); $totalChargesTerrain = number_format($chargesTerrainManager->getTotalByIdProjet($idProjet), 2, ',', ' '); $chargesTerrainLastWeek = $chargesTerrainManager->getChargesTerrainsByDatesByIdProjet($idProjet, $dateFrom, $dateTo); } if (isset($_POST['construction'])) { $chargesConstructionManager = new ChargesConstructionManager($pdo); $totalChargesConstruction = number_format($chargesConstructionManager->getTotalByIdProjet($idProjet), 2, ',', ' '); $chargesConstructionLastWeek = $chargesConstructionManager->getChargesConstructionsByDatesByIdProjet($idProjet, $dateFrom, $dateTo); } if (isset($_POST['finition'])) { $chargesFinitionManager = new ChargesFinitionManager($pdo); $totalChargesFinition = number_format($chargesFinitionManager->getTotalByIdProjet($idProjet), 2, ',', ' '); $chargesFinitionLastWeek = $chargesFinitionManager->getChargesFinitionsByDatesByIdProjet($idProjet, $dateFrom, $dateTo); } ob_start(); ?> <style type="text/css"> p, h1, h2{ text-align: center; text-decoration: underline; } table { border-collapse: collapse; width:100%; }