modification pdo

This commit is contained in:
pierre renaudot 2023-12-21 10:43:53 +01:00
parent ce94d71198
commit 7fcee1a7bf
9 changed files with 152 additions and 61 deletions

37
Class/class.newFiche.php Normal file
View File

@ -0,0 +1,37 @@
<?php
class Class_newFiche
{
private $pdo = null;
public function __construct(PdoGsb $pDO)
{
$this->pdo = $pDO->getPdoGsb();
}
public function listFraisForfaitaires(): array
{
$req = 'SELECT "fLibelle", "fMontant" FROM forfait';
$result = $this->pdo->prepare($req);
$result->execute();
return $result->fetchAll();
}
public function endInter(string $id)
{
$req = "UPDATE intervention
SET iHeureFin = NOW()
WHERE iCis = :cis AND iId = :idInter AND iHeureFin IS NULL";
$cis = explode('-', $id)[0];
$idInter = explode('-', $id)[1];
$result = PdoBD::$monPdo->prepare($req);
$result->bindParam(':cis', $cis);
$result->bindParam(':idInter', $idInter);
$result->execute();
}
}

34
Class/class.pdo.php Normal file
View File

@ -0,0 +1,34 @@
<?php
class PdoGsb
{
private static $serveur = 'pgsql:host=localhost';
private static $bdd = 'dbname=gsb2024';
private static $user = 'postgres';
private static $mdp = 'postgres';
private static $pdo;
private static $monPdoGsb = null;
/**
* Constructeur prive, cree l'instance de PDO qui sera sollicitee
* pour toutes les methodes de la classe
*/
public function __construct()
{
PdoGsb::$pdo = new PDO(PdoGsb::$serveur . ';' . PdoGsb::$bdd, PdoGsb::$user, PdoGsb::$mdp);
//PdoGsb::$monPdo->query("SET CHARACTER SET utf8");SET client_encoding = 'UTF8';
}
public function _destruct()
{
PdoGsb::$monPdo = null;
}
/**
* Fonction statique qui cree l'unique instance de la classe
* Appel : $instancePdoGsb = PdoGsb::getPdoGsb();
* @return pdo
*/
public function getPdoGsb()
{
return PdoGsb::$pdo;
}
}

View File

@ -7,6 +7,8 @@
// Date : 03/05/2023 à 11H01 ' // Date : 03/05/2023 à 11H01 '
// Auteur : pascal-blain@wanadoo.fr ' // Auteur : pascal-blain@wanadoo.fr '
//****************************************' //****************************************'
header('location: index.php?direction=home');
if (!isset($_REQUEST['action'])) { if (!isset($_REQUEST['action'])) {
$_REQUEST['action'] = 'demandeConnexion'; $_REQUEST['action'] = 'demandeConnexion';
} }

View File

@ -0,0 +1,3 @@
<?php
include(__DIR__ . '/../vues/v_homePage.php');

View File

@ -1,4 +1,9 @@
<?php <?php
require_once(__DIR__ . '/../Class/class.newFiche.php');
$newFiche = new Class_newFiche($pdo);
$liste = $newFiche->listFraisForfaitaires();
var_dump($liste);
include(__DIR__ . '/../vues/v_newFiche.php'); include(__DIR__ . '/../vues/v_newFiche.php');

View File

@ -7,7 +7,7 @@ create table "affectation"("uId" VARCHAR(4) not null,"aDate" TIMESTAMP not null,
-- --
create table "automobile"("aId" SMALLINT not null,"aPuissance" VARCHAR(15),"aMotorisation" VARCHAR(7),"aMontant" NUMERIC(19,4),"aDate" TIMESTAMP,primary key("aId")); create table "automobile"("aId" SMALLINT not null,"aPuissance" VARCHAR(15),"aMotorisation" VARCHAR(7),"aMontant" NUMERIC(19,4),"aDate" TIMESTAMP,primary key("aId"));
-- --
create table "echantillonOffert"("uId" VARCHAR(4) not null,"vNum" SMALLINT not null,"mDepotLegal" VARCHAR(10) not null,"OFF_QTE" SMALLINT,primary key("uId","vNum","mDepotLegal")); create table "echantillon_offert"("uId" VARCHAR(4) not null,"vNum" SMALLINT not null,"mDepotLegal" VARCHAR(10) not null,"OFF_QTE" SMALLINT,primary key("uId","vNum","mDepotLegal"));
-- --
create table "etat"("eId" VARCHAR(2) not null,"eLibelle" VARCHAR(30),"eOrdre" SMALLINT,primary key("eId")); create table "etat"("eId" VARCHAR(2) not null,"eLibelle" VARCHAR(30),"eOrdre" SMALLINT,primary key("eId"));
-- --
@ -15,9 +15,9 @@ create table "famille"("fCode" VARCHAR(3) not null,"fLibelle" VARCHAR(83),primar
-- --
create table "forfait"("fId" VARCHAR(3) not null,"fLibelle" VARCHAR(20),"fMontant" NUMERIC(19,4),primary key("fId")); create table "forfait"("fId" VARCHAR(3) not null,"fLibelle" VARCHAR(20),"fMontant" NUMERIC(19,4),primary key("fId"));
-- --
create table "ligneForfait"("lfVisiteur" VARCHAR(4) not null,"lfMois" VARCHAR(6) not null,"lfForfait" VARCHAR(3) not null,"lfQuantite" SMALLINT,"lfMontant" NUMERIC(19,4),primary key("lfVisiteur","lfMois","lfForfait")); create table "ligne_forfait"("lfVisiteur" VARCHAR(4) not null,"lfMois" VARCHAR(6) not null,"lfForfait" VARCHAR(3) not null,"lfQuantite" SMALLINT,"lfMontant" NUMERIC(19,4),primary key("lfVisiteur","lfMois","lfForfait"));
-- --
create table "ligneHorsForfait"("lhId" INTEGER not null,"lhVisiteur" VARCHAR(4) not null,"lhMois" VARCHAR(6) not null,"lhLibelle" VARCHAR(80),"lhDate" TIMESTAMP,"lhMontant" NUMERIC(19,4),"lhJustificatif" BOOLEAN,"lhRefus" BOOLEAN,primary key("lhId")); create table "ligne_hors_forfait"("lhId" INTEGER not null,"lhVisiteur" VARCHAR(4) not null,"lhMois" VARCHAR(6) not null,"lhLibelle" VARCHAR(80),"lhDate" TIMESTAMP,"lhMontant" NUMERIC(19,4),"lhJustificatif" BOOLEAN,"lhRefus" BOOLEAN,primary key("lhId"));
-- --
create table "medicament"("mDepotLegal" VARCHAR(10) not null,"mNomCommercial" VARCHAR(25),"mComposition" VARCHAR(255),"mEffets" VARCHAR(255),"mContreIndications" VARCHAR(255),"mPrix" REAL,"mFamille" VARCHAR(3) not null,primary key("mDepotLegal")); create table "medicament"("mDepotLegal" VARCHAR(10) not null,"mNomCommercial" VARCHAR(25),"mComposition" VARCHAR(255),"mEffets" VARCHAR(255),"mContreIndications" VARCHAR(255),"mPrix" REAL,"mFamille" VARCHAR(3) not null,primary key("mDepotLegal"));
-- --
@ -29,9 +29,9 @@ create table "praticien"("pNum" INTEGER not null,"pNom" VARCHAR(25),"pPrenom" VA
-- --
create table "remboursement"("rVisiteur" VARCHAR(4) not null,"rMois" VARCHAR(6) not null,"rNbJustificatifs" SMALLINT,"rMontantValide" NUMERIC(19,4),"rDateModif" TIMESTAMP,"rEtat" VARCHAR(2),primary key("rVisiteur","rMois")); create table "remboursement"("rVisiteur" VARCHAR(4) not null,"rMois" VARCHAR(6) not null,"rNbJustificatifs" SMALLINT,"rMontantValide" NUMERIC(19,4),"rDateModif" TIMESTAMP,"rEtat" VARCHAR(2),primary key("rVisiteur","rMois"));
-- --
create table "typeParametre"("tpId" VARCHAR(7) not null,"tpLibelle" VARCHAR(70),"tpBooleen" BOOLEAN,"tpChoixMultiple" BOOLEAN,"tpCumul" BOOLEAN,primary key("tpId")); create table "type_parametre"("tpId" VARCHAR(7) not null,"tpLibelle" VARCHAR(70),"tpBooleen" BOOLEAN,"tpChoixMultiple" BOOLEAN,"tpCumul" BOOLEAN,primary key("tpId"));
-- --
create table "typePraticien"("tCode" VARCHAR(2) not null,"tLibelle" VARCHAR(31),"tLieu" VARCHAR(31),primary key("tCode")); create table "type_praticien"("tCode" VARCHAR(2) not null,"tLibelle" VARCHAR(31),"tLieu" VARCHAR(31),primary key("tCode"));
-- --
create table "utilisateur"("uId" VARCHAR(4) not null,"uNom" VARCHAR(30),"uPrenom" VARCHAR(30),"uLogin" VARCHAR(20) not null,"uMdp" VARCHAR(20),"uAdresse" VARCHAR(32),"uCp" VARCHAR(5),"uVille" VARCHAR(30),"uDateEmbauche" TIMESTAMP,"uSecteur" SMALLINT,"uLabo" VARCHAR(2),"uStatut" SMALLINT,"uRegion" SMALLINT,"uDateEnreg" TIMESTAMP,"uDateModif" TIMESTAMP,"uPuissance" VARCHAR(20),"uMotorisation" VARCHAR(20),primary key("uId")); create table "utilisateur"("uId" VARCHAR(4) not null,"uNom" VARCHAR(30),"uPrenom" VARCHAR(30),"uLogin" VARCHAR(20) not null,"uMdp" VARCHAR(20),"uAdresse" VARCHAR(32),"uCp" VARCHAR(5),"uVille" VARCHAR(30),"uDateEmbauche" TIMESTAMP,"uSecteur" SMALLINT,"uLabo" VARCHAR(2),"uStatut" SMALLINT,"uRegion" SMALLINT,"uDateEnreg" TIMESTAMP,"uDateModif" TIMESTAMP,"uPuissance" VARCHAR(20),"uMotorisation" VARCHAR(20),primary key("uId"));
-- --
@ -140,7 +140,7 @@ insert into "automobile"("aId","aPuissance","aMotorisation","aMontant","aDate")
(20233,'jusqu''à 4CV','essence',0.68,'2023-9-1'), (20233,'jusqu''à 4CV','essence',0.68,'2023-9-1'),
(20234,'5 CV et au-delà','essence',0.71,'2023-9-1'); (20234,'5 CV et au-delà','essence',0.71,'2023-9-1');
-- ---------------------------------------------------------------------------------------------- -- ----------------------------------------------------------------------------------------------
insert into "echantillonOffert"("uId","vNum","mDepotLegal","OFF_QTE") values insert into "echantillon_offert"("uId","vNum","mDepotLegal","OFF_QTE") values
('a131',1,'PHYSOI8',3), ('a131',1,'PHYSOI8',3),
('a131',2,'LIDOXY23',1), ('a131',2,'LIDOXY23',1),
('a131',3,'JOVAI8',1), ('a131',3,'JOVAI8',1),
@ -340,7 +340,7 @@ insert into "forfait"("fId","fLibelle","fMontant") values
('NUI','Nuitée Hôtel',80), ('NUI','Nuitée Hôtel',80),
('REP','Repas Restaurant',25); ('REP','Repas Restaurant',25);
-- ---------------------------------------------------------------------------------------------- -- ----------------------------------------------------------------------------------------------
insert into "ligneForfait"("lfVisiteur","lfMois","lfForfait","lfQuantite","lfMontant") values insert into "ligne_forfait"("lfVisiteur","lfMois","lfForfait","lfQuantite","lfMontant") values
('a131','202011','ETP',11,110), ('a131','202011','ETP',11,110),
('a131','202011','KM',777,0.62), ('a131','202011','KM',777,0.62),
('a131','202011','NUI',16,80), ('a131','202011','NUI',16,80),
@ -4374,7 +4374,7 @@ insert into "ligneForfait"("lfVisiteur","lfMois","lfForfait","lfQuantite","lfMon
('f4','202312','NUI',4,80), ('f4','202312','NUI',4,80),
('f4','202312','REP',18,25); ('f4','202312','REP',18,25);
-- ---------------------------------------------------------------------------------------------- -- ----------------------------------------------------------------------------------------------
insert into "ligneHorsForfait"("lhId","lhVisiteur","lhMois","lhLibelle","lhDate","lhMontant","lhJustificatif","lhRefus") values insert into "ligne_hors_forfait"("lhId","lhVisiteur","lhMois","lhLibelle","lhDate","lhMontant","lhJustificatif","lhRefus") values
(16166,'b34','202011','repas avec praticien','2020-11-15',50,true,false), (16166,'b34','202011','repas avec praticien','2020-11-15',50,true,false),
(16167,'bp','202011','repas avec praticien','2020-11-25',44,true,false), (16167,'bp','202011','repas avec praticien','2020-11-25',44,true,false),
(16168,'e24','202011','Voyage SNCF','2020-11-3',36,true,false), (16168,'e24','202011','Voyage SNCF','2020-11-3',36,true,false),
@ -9290,7 +9290,7 @@ insert into "remboursement"("rVisiteur","rMois","rNbJustificatifs","rMontantVali
('f4','202310',2,3536.64,'2023-11-19','CL'), ('f4','202310',2,3536.64,'2023-11-19','CL'),
('f4','202312',2,1681.7,'2024-1-28','RB'); ('f4','202312',2,1681.7,'2024-1-28','RB');
-- ---------------------------------------------------------------------------------------------- -- ----------------------------------------------------------------------------------------------
insert into "typeParametre"("tpId","tpLibelle","tpBooleen","tpChoixMultiple","tpCumul") values insert into "type_parametre"("tpId","tpLibelle","tpBooleen","tpChoixMultiple","tpCumul") values
('adresse','Coordonnées de l''entreprise',true,true,true), ('adresse','Coordonnées de l''entreprise',true,true,true),
('catProf','Catégorie Socioprofessionnelle',true,true,true), ('catProf','Catégorie Socioprofessionnelle',true,true,true),
('emploi','emploi',false,true,true), ('emploi','emploi',false,true,true),
@ -9305,7 +9305,7 @@ insert into "typeParametre"("tpId","tpLibelle","tpBooleen","tpChoixMultiple","tp
('statJur','statut juridique',false,true,true), ('statJur','statut juridique',false,true,true),
('statUti','Statut de l''utilisateur',true,true,true); ('statUti','Statut de l''utilisateur',true,true,true);
-- ---------------------------------------------------------------------------------------------- -- ----------------------------------------------------------------------------------------------
insert into "typePraticien"("tCode","tLibelle","tLieu") values insert into "type_praticien"("tCode","tLibelle","tLieu") values
('MH','Médecin Hospitalier','Hopital ou clinique'), ('MH','Médecin Hospitalier','Hopital ou clinique'),
('MV','Médecine de Ville','Cabinet'), ('MV','Médecine de Ville','Cabinet'),
('PH','Pharmacien Hospitalier','Hopital ou clinique'), ('PH','Pharmacien Hospitalier','Hopital ou clinique'),
@ -9596,16 +9596,16 @@ insert into "visite"("uId","vNum","pNum","vDate","vRapport","vMotif") values
-- contraintes d'intégrité référentielles -- contraintes d'intégrité référentielles
alter table "remboursement" add foreign key ("rEtat") references "etat"("eId"); alter table "remboursement" add foreign key ("rEtat") references "etat"("eId");
alter table "medicament" add foreign key ("mFamille") references "famille"("fCode"); alter table "medicament" add foreign key ("mFamille") references "famille"("fCode");
alter table "ligneForfait" add foreign key ("lfForfait") references "forfait"("fId"); alter table "ligne_forfait" add foreign key ("lfForfait") references "forfait"("fId");
alter table "echantillonOffert" add foreign key ("mDepotLegal") references "medicament"("mDepotLegal"); alter table "echantillon_offert" add foreign key ("mDepotLegal") references "medicament"("mDepotLegal");
alter table "observation" add foreign key ("mDepotLegal") references "medicament"("mDepotLegal"); alter table "observation" add foreign key ("mDepotLegal") references "medicament"("mDepotLegal");
alter table "observation" add foreign key ("pNum") references "praticien"("pNum"); alter table "observation" add foreign key ("pNum") references "praticien"("pNum");
alter table "visite" add foreign key ("pNum") references "praticien"("pNum"); alter table "visite" add foreign key ("pNum") references "praticien"("pNum");
alter table "ligneForfait" add foreign key ("lfVisiteur","lfMois") references "remboursement"("rVisiteur","rMois") on delete cascade on update cascade; alter table "ligne_forfait" add foreign key ("lfVisiteur","lfMois") references "remboursement"("rVisiteur","rMois") on delete cascade on update cascade;
alter table "ligneHorsForfait" add foreign key ("lhVisiteur","lhMois") references "remboursement"("rVisiteur","rMois") on delete cascade on update cascade; alter table "ligne_hors_forfait" add foreign key ("lhVisiteur","lhMois") references "remboursement"("rVisiteur","rMois") on delete cascade on update cascade;
alter table "parametre" add foreign key ("pType") references "typeParametre"("tpId"); alter table "parametre" add foreign key ("pType") references "type_parametre"("tpId");
alter table "praticien" add foreign key ("pType") references "typePraticien"("tCode"); alter table "praticien" add foreign key ("pType") references "type_praticien"("tCode");
alter table "affectation" add foreign key ("uId") references "utilisateur"("uId"); alter table "affectation" add foreign key ("uId") references "utilisateur"("uId");
alter table "remboursement" add foreign key ("rVisiteur") references "utilisateur"("uId"); alter table "remboursement" add foreign key ("rVisiteur") references "utilisateur"("uId");
alter table "visite" add foreign key ("uId") references "utilisateur"("uId"); alter table "visite" add foreign key ("uId") references "utilisateur"("uId");
alter table "echantillonOffert" add foreign key ("uId","vNum") references "visite"("uId","vNum"); alter table "echantillon_offert" add foreign key ("uId","vNum") references "visite"("uId","vNum");

View File

@ -5,7 +5,7 @@
</a> </a>
<ul class="nav nav-pills flex-column mb-sm-auto mb-0 align-items-center align-items-sm-start" id="menu"> <ul class="nav nav-pills flex-column mb-sm-auto mb-0 align-items-center align-items-sm-start" id="menu">
<li class="nav-item"> <li class="nav-item">
<a href="../index.php" class="nav-link align-middle px-0"> <a href="index.php" class="nav-link align-middle px-0">
<i class="fs-4 bi-house"></i> <span class="ms-1 d-none d-sm-inline">Home</span> <i class="fs-4 bi-house"></i> <span class="ms-1 d-none d-sm-inline">Home</span>
</a> </a>
</li> </li>
@ -13,7 +13,7 @@
Partie visiteur Partie visiteur
--> -->
<?php <?php
if($_SESSION['typeU'] == 'visiteur'): if ($_SESSION['typeU'] == 'visiteur'):
?> ?>
<li> <li>
<a href="#submenu1" data-bs-toggle="collapse" class="nav-link px-0 align-middle"> <a href="#submenu1" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
@ -21,11 +21,13 @@
</a> </a>
<ul class="collapse show nav flex-column ms-1" id="submenu1" data-bs-parent="#menu"> <ul class="collapse show nav flex-column ms-1" id="submenu1" data-bs-parent="#menu">
<li class="w-100"> <li class="w-100">
<a href="../controleurs/c_gestionFiche.php" class="nav-link px-0"> <span class="d-none d-sm-inline">Gérer ses fiches</span> <a href="controleurs/c_gestionFiche.php" class="nav-link px-0"> <span
class="d-none d-sm-inline">Gérer ses fiches</span>
</a> </a>
</li> </li>
<li> <li>
<a href="../index.php?direction=nouvelleFiche" class="nav-link px-0"> <span class="d-none d-sm-inline">Nouvelle Fiche</span> <a href="index.php?direction=nouvelleFiche" class="nav-link px-0"> <span
class="d-none d-sm-inline">Nouvelle Fiche</span>
</a> </a>
</li> </li>
</ul> </ul>
@ -34,17 +36,19 @@
<a href="#" class="nav-link px-0 align-middle"> <a href="#" class="nav-link px-0 align-middle">
<i class="fs-4 bi-table"></i> <span class="ms-1 d-none d-sm-inline">Visites</span></a> <i class="fs-4 bi-table"></i> <span class="ms-1 d-none d-sm-inline">Visites</span></a>
</li> </li>
<?php endif; if ($_SESSION['typeU'] == 'comptable'): ?>
<!-- <!--
Partie comptable Partie comptable
--> -->
<?php endif;
if ($_SESSION['typeU'] == 'comptable'): ?>
<li> <li>
<a href="#submenu2" data-bs-toggle="collapse" class="nav-link px-0 align-middle"> <a href="#submenu2" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-4 bi-speedometer2"></i> <span class="ms-1 d-none d-sm-inline">Fiche de frais</span> <i class="fs-4 bi-speedometer2"></i> <span class="ms-1 d-none d-sm-inline">Fiche de frais</span>
</a> </a>
<ul class="collapse show nav flex-column ms-1" id="submenu2" data-bs-parent="#menu"> <ul class="collapse show nav flex-column ms-1" id="submenu2" data-bs-parent="#menu">
<li class="w-100"> <li class="w-100">
<a href="../controleurs/c_gestionFiche.php" class="nav-link px-0"> <span class="d-none d-sm-inline">A valider</span> <a href="../controleurs/c_gestionFiche.php" class="nav-link px-0"> <span
class="d-none d-sm-inline">A valider</span>
</a> </a>
</li> </li>
<li> <li>

View File

@ -11,9 +11,9 @@ session_start();
//****************************************' //****************************************'
//require_once("include/fct.inc.php"); //require_once("include/fct.inc.php");
//require_once("include/class.pdogsb.php"); require_once("Class/class.pdo.php");
//$pdo = PdoGsb::getPdoGsb(); $pdo = new PdoGsb();
//$estConnecte = estConnecte(); //$estConnecte = estConnecte();
$_SESSION['typeU'] = 'visiteur'; $_SESSION['typeU'] = 'visiteur';
/* /*
@ -21,6 +21,9 @@ if (!isset($_SESSION['userId'])) {
$_REQUEST['direction'] = 'connexion'; $_REQUEST['direction'] = 'connexion';
} }
*/ */
if (!isset($_REQUEST['direction'])) {
$_REQUEST['direction'] = 'connexion';
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -42,8 +45,7 @@ if (!isset($_SESSION['userId'])) {
<?php include('include/menu.php'); ?> <?php include('include/menu.php'); ?>
<div class="col py-3"> <div class="col py-3">
<?php <?php
$action = $_REQUEST['direction']; switch ($_REQUEST['direction']) {
switch ($action) {
case 'connexion': case 'connexion':
include("controleurs/c_connexion.php"); include("controleurs/c_connexion.php");
break; break;
@ -51,6 +53,9 @@ if (!isset($_SESSION['userId'])) {
case 'gestionFiche': case 'gestionFiche':
include("controleurs/c_gestionFiche.php"); include("controleurs/c_gestionFiche.php");
break; break;
case 'home':
include("controleurs/c_homePage.php");
break;
case 'nouvelleFiche': case 'nouvelleFiche':
include(__DIR__ . "/controleurs/c_nouvelleFiche.php"); include(__DIR__ . "/controleurs/c_nouvelleFiche.php");

1
vues/v_homePage.php Normal file
View File

@ -0,0 +1 @@
<h4>BONJOUR VOUS ETES COMPTABLE</h4>