pdo = $pDO->getPdoGsb(); } public function listFraisForfaitaires(): array { $req = 'SELECT "fLibelle", NULL AS "lfQuantite", round("fMontant", 2) AS "fMontant", 0 AS "fTotal", "fId" FROM forfait'; $result = $this->pdo->prepare($req); $result->execute(); return $result->fetchAll(); } public function listFraisForfaitForU(string $idUser, int $month): array { $req = 'SELECT "fLibelle", "lfQuantite", ROUND("fMontant", 2) AS "fMontant", ROUND("lfQuantite" * "fMontant", 2) AS "fTotal", "fId" FROM remboursement INNER JOIN "ligne_forfait" ON "rVisiteur" = "lfVisiteur" AND "rMois" = "lfMois" INNER JOIN "forfait" ON "fId" = "lfForfait" WHERE "rVisiteur" = :idUser AND "rMois" = :monthF;'; $result = $this->pdo->prepare($req); $result->bindParam('idUser', $idUser); $result->bindParam('monthF', $month); $result->execute(); return $result->fetchAll(); } public function listFraisHF(string $idVisiteur, int $month): array { $req = 'SELECT to_char("lhDate", \'YYYY-mm-dd\') AS "lhDate", "lhLibelle", ROUND("lhMontant",2) as "lhMontant", "lhJustificatif", "lhRefus" FROM remboursement inner join "ligne_hors_forfait" on "rVisiteur" = "lhVisiteur" AND "rMois" = "lhMois" WHERE "rVisiteur" = :idVisiteur AND "rMois" = :mois ORDER BY "lhDate";'; $result = $this->pdo->prepare($req); $result->bindParam(':idVisiteur', $idVisiteur); $result->bindParam(':mois', $month); $result->execute(); return $result->fetchAll(); } public function getMontantValide(string $idVisiteur, int $month): float { $req = 'SELECT "rMontantValide" FROM remboursement WHERE "rVisiteur" = :idVisiteur AND "rMois" = :mois ;'; $result = $this->pdo->prepare($req); $result->bindParam(':idVisiteur', $idVisiteur); $result->bindParam(':mois', $month); $result->execute(); return $result->fetchAll()[0]['rMontantValide']; } }