12 Commits

16 changed files with 567 additions and 194 deletions

View File

@ -0,0 +1,26 @@
<?php
class Class_gestionFiche
{
private $pdo = null;
public function __construct(PdoGsb $pDO)
{
$this->pdo = $pDO->getPdoGsb();
}
public function getLesUtilisateurs(): array
{
$req = 'SELECT "uId", "uNom", "uPrenom" FROM utilisateur WHERE "uStatut"!=0 ORDER BY "uNom" ASC;';
$result = $this->pdo->prepare($req);
$result ->execute();
return $result->fetchAll();
}
public function utilisateur(string $idUtilisateur): array
{
$req = '';
}
}

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

@ -0,0 +1,57 @@
<?php
class Class_newFiche
{
private $pdo = null;
public function __construct(PdoGsb $pDO)
{
$this->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();
}
}

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 '
// Auteur : pascal-blain@wanadoo.fr '
//****************************************'
header('location: index.php?direction=home');
if (!isset($_REQUEST['action'])) {
$_REQUEST['action'] = 'demandeConnexion';
}

View File

@ -0,0 +1,9 @@
<?php
$_SESSION ["typeU"] = "comptable";
require_once(__DIR__ . '/../Class/class.gestionFiche.php');
$gestionFiche = new Class_gestionFiche($pdo);
$LesUtilisateurs = $gestionFiche->getLesUtilisateurs(); //RENVOIE LISTE USERS
include("vues/v_gestionFiches.php");

View File

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

View File

@ -0,0 +1,22 @@
<?php
require_once(__DIR__ . '/../Class/class.newFiche.php');
$newFiche = new Class_newFiche($pdo);
$_SESSION['userId'] = 'b34';
/**
* Liste des frais forfaitaires du mois et de l'user :: sinon afficher les libelle
*/
$listeFraisForfaitaire = $newFiche->listFraisForfaitForU($_SESSION['userId'], '202011');
if (count($listeFraisForfaitaire) == 0) {
$listeFraisForfaitaire = $newFiche->listFraisForfaitaires();
}
/**
* Listes des frais HF
*/
$listeFraisHf = $newFiche->listFraisHF($_SESSION['userId'], '202011');
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 "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"));
--
@ -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 "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"));
--
@ -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 "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"));
--
@ -140,7 +140,7 @@ insert into "automobile"("aId","aPuissance","aMotorisation","aMontant","aDate")
(20233,'jusqu''à 4CV','essence',0.68,'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',2,'LIDOXY23',1),
('a131',3,'JOVAI8',1),
@ -340,7 +340,7 @@ insert into "forfait"("fId","fLibelle","fMontant") values
('NUI','Nuitée Hôtel',80),
('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','KM',777,0.62),
('a131','202011','NUI',16,80),
@ -4374,7 +4374,7 @@ insert into "ligneForfait"("lfVisiteur","lfMois","lfForfait","lfQuantite","lfMon
('f4','202312','NUI',4,80),
('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),
(16167,'bp','202011','repas avec praticien','2020-11-25',44,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','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),
('catProf','Catégorie Socioprofessionnelle',true,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),
('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'),
('MV','Médecine de Ville','Cabinet'),
('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
alter table "remboursement" add foreign key ("rEtat") references "etat"("eId");
alter table "medicament" add foreign key ("mFamille") references "famille"("fCode");
alter table "ligneForfait" add foreign key ("lfForfait") references "forfait"("fId");
alter table "echantillonOffert" add foreign key ("mDepotLegal") references "medicament"("mDepotLegal");
alter table "ligne_forfait" add foreign key ("lfForfait") references "forfait"("fId");
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 ("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 "ligneHorsForfait" 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 "praticien" add foreign key ("pType") references "typePraticien"("tCode");
alter table "ligne_forfait" add foreign key ("lfVisiteur","lfMois") 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 "type_parametre"("tpId");
alter table "praticien" add foreign key ("pType") references "type_praticien"("tCode");
alter table "affectation" add foreign key ("uId") 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 "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

@ -1,10 +1,12 @@
stocker le nom d'utilisateur et le mot de passe dans la classe n'est pas une très bonne idée pour le code mis en production ... Une bonne solution consiste a stocker les paramètres de connexion à la base de données dans un fichier .ini et à en restreindre l'accès. Par exemple de cette façon:
stocker le nom d'utilisateur et le mot de passe dans la classe n'est pas une très bonne idée pour le code mis en
production ... Une bonne solution consiste a stocker les paramètres de connexion à la base de données dans un fichier
.ini et à en restreindre l'accès. Par exemple de cette façon:
private static $serveur='mysql:host=localhost';
private static $bdd='dbname=gsb2021';
private static $user='root' ;
private static $mdp='root' ;
private static $bdd='dbname=gsb2021';
private static $user='root' ;
private static $mdp='root' ;
gsb.ini:
[database]
driver = mysql
@ -12,22 +14,23 @@ host = localhost
port = 3306
schema = gsb2021
username = root
password = root
password = root
Database connection:
<?php
class MyPDO extends PDO
{
public function __construct($file = 'gsb.ini')
{
if (!$settings = parse_ini_file($file, TRUE)) throw new exception('acces impossible ' . $file . '.');
if (!$settings = parse_ini_file($file, TRUE))
throw new exception('acces impossible ' . $file . '.');
$dns = $settings['database']['driver'] .
':host=' . $settings['database']['host'] .
((!empty($settings['database']['port'])) ? (';port=' . $settings['database']['port']) : '') .
';dbname=' . $settings['database']['schema'];
':host=' . $settings['database']['host'] .
((!empty($settings['database']['port'])) ? (';port=' . $settings['database']['port']) : '') .
';dbname=' . $settings['database']['schema'];
parent::__construct($dns, $settings['database']['username'], $settings['database']['password']);
}
}

View File

@ -5,24 +5,27 @@
</a>
<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">
<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>
</a>
</li>
<!--
Partie visiteur
-->
Partie visiteur
-->
<?php
if($_SESSION['typeU'] == 'visiteur'):
?>
<li>
<a href="#submenu1" 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>
</a>
<ul class="collapse show nav flex-column ms-1" id="submenu1" data-bs-parent="#menu">
<li class="w-100">
<a href="vues/v_gestionFiches.php" class="nav-link px-0"> <span class="d-none d-sm-inline">Gérer ses fiches</span>
<a href="index.php?direction=gestionFiche" class="nav-link px-0"> <span class="d-none d-sm-inline">Gérer ses fiches</span>
</a>
</li>
<li>
<a href="#" 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">Fiche du mois</span>
</a>
</li>
</ul>
@ -31,7 +34,7 @@
<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>
</li>
<?php endif; if ($_SESSION['typeU'] == 'comptable'): ?>
<!--
Partie comptable
-->
@ -41,7 +44,7 @@
</a>
<ul class="collapse show nav flex-column ms-1" id="submenu2" data-bs-parent="#menu">
<li class="w-100">
<a href="#" class="nav-link px-0"> <span class="d-none d-sm-inline">A valider</span>
<a href="index.php?direction=gestionFiche" class="nav-link px-0"> <span class="d-none d-sm-inline">A valider</span>
</a>
</li>
<li>
@ -50,6 +53,7 @@
</li>
</ul>
</li>
<?php endif; ?>
</ul>
<hr>
<div class="dropdown pb-4">

110
include/newFiche.js Normal file
View File

@ -0,0 +1,110 @@
$(document).ready(function () {
calcPrixTotalFrsF();
/**
* Partie enregistrement frais F
*/
$('.frsFrt').on('change', function (e) {
console.log($(this).val())
val = $(this).val();
val = val.replace(',', '.')
if ($.isNumeric(val)) {
/**
* Calcul le prix de la ligne
*/
id = $(this).attr('id')
formTotal = $('#totalFrs-' + id)
mttFrs = $('#mttFrs-' + id).attr('data-price')
formTotal.html((val * mttFrs).toFixed(2) + ' €');
calcPrixTotalFrsF();
}
})
/**
* Enregistrement frais HF
*/
$('.validFraisHF').on('click', function () {
let date = $('#dateHf')
let libelle = $('#libelleHf')
let montant = $('#mttHf')
let canAdd = true;
if (date.val() == "") {
canAdd = false;
date.css("border-color", "red")
} else {
date.css("border-color", "var(--bs-border-color)")
}
if (libelle.val() == "") {
canAdd = false;
libelle.css("border-color", "red")
} else {
libelle.css("border-color", "var(--bs-border-color)")
}
if (montant.val() == "") {
canAdd = false;
montant.css("border-color", "red")
} else {
montant.css("border-color", "var(--bs-border-color)")
}
if (canAdd == true) {
var line = $('tr.fraisHF:first').clone();
lastId = $('tr.fraisHF').length
/*
line.find("#dateFrsHF").html(date.val());
line.find("#LibelleFrsHF").html(libelle.val());
line.find("#MttFrsHF").html(parseFloat(montant.val()).toFixed(2) + ' €');
*/
line.find('.btn').attr('id', 'frsSup-' + lastId)
var line = $('<tr id="fraisHf-' + lastId + '" class="fraisHF"></tr>');
var tdDate = $('<td scope="row" id="dateFrsHF"></td>');
tdDate.html(date.val());
var tdLibelle = $('<td id="LibelleFrsHF"></td>');
tdLibelle.html(libelle.val());
var tdMtt = $('<td id="MttFrsHF"></td>');
tdMtt.html(parseFloat(montant.val().replace(',', '.')).toFixed(2) + ' €');
var tdJust = $('<td></td>');
var btn = $('<td><button type="button" class="btn btn-outline-primary btnSuprFraisHf" id="frsSup-' + lastId + '">Supprimer</button></td>')
$(line).append(tdDate)
$(line).append(tdLibelle)
$(line).append(tdMtt)
$(line).append(tdJust)
$(line).append(btn)
line.insertBefore('.newFraisForm')
}
})
})
/**
* Supprimer fraisHf
*/
$(document).on('click', '.btnSuprFraisHf', function () {
id = $(this).attr('id').split('-')[1]
console.log(id)
$('#fraisHf-' + id).remove()
})
/**
* Calcul prix total
*/
function calcPrixTotalFrsF() {
var prixTotal = 0;
$('td[id^="totalFrs-"]').each(function () {
prixTotal += parseFloat($(this).html().replace('€', ''))
})
$('.prixTotalFrsF').html('<strong>TOTAL :</strong> ' + prixTotal.toFixed(2) + ' €')
}

View File

@ -1,44 +0,0 @@
<?php
session_start();
// ***************************************'
// Le CASTEL-BTS SIO/ PROJET PPE4 GSB '
// Programme: index.php '
// Objet : Gestion des frais '
// Client : laboratoires GSB '
// Version : 3.0 '
// Date : 03/05/2023 à 11H01 '
// Auteur v1: pascal-blain@wanadoo.fr '
//****************************************'
require_once("include/fct.inc.php");
require_once("include/class.pdogsb.php");
$pdo = PdoGsb::getPdoGsb();
$estConnecte = estConnecte();
// on vrifie que l'utilisateur est authentifi
if (!isset($_REQUEST['uc']) || !$estConnecte) {
$_REQUEST['uc'] = 'connexion';
}
// on analyse le cas d'utilisation en cours ...
$uc = $_REQUEST['uc'];
switch ($uc) {
case 'connexion': {
include("controleurs/c_connexion.php");
break;
}
case 'etatFrais': {
include("controleurs/c_etatFrais.php");
break;
}
case 'gererFraisForfaitaire': {
include("controleurs/c_gererFraisForfaitaire.php");
break;
}
case 'gererFraisHorsForfait': {
include("controleurs/c_gererFraisHorsForfait.php");
break;
}
}
include("vues/v_pied.php");
?>

View File

@ -1,37 +1,79 @@
<?php
session_start();
// ***************************************'
// Le CASTEL-BTS SIO/ PROJET PPE4 GSB '
// Programme: index.php '
// Objet : Gestion des frais '
// Client : laboratoires GSB '
// Version : 3.0 '
// Date : 03/05/2023 à 11H01 '
// Auteur v1: pascal-blain@wanadoo.fr '
//****************************************'
//require_once("include/fct.inc.php");
require_once("Class/class.pdo.php");
$pdo = new PdoGsb();
//$estConnecte = estConnecte();
$_SESSION['typeU'] = 'visiteur';
/*
if (!isset($_SESSION['userId'])) {
$_REQUEST['direction'] = 'connexion';
}
*/
if (!isset($_REQUEST['direction'])) {
$_REQUEST['direction'] = 'connexion';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page accueil</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page accueil</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.7.1.js"
integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid">
<div class="row flex-nowrap">
<?php include('include/menu.php') ?>
<div class="col py-3">
<h3>Left Sidebar with Submenus</h3>
<p class="lead">
An example 2-level sidebar with collasible menu items. The menu functions like an "accordion" where
only a single
menu is be open at a time. While the sidebar itself is not toggle-able, it does responsively shrink
in width on smaller screens.</p>
<ul class="list-unstyled">
<li>
<h5>Responsive</h5> shrinks in width, hides text labels and collapses to icons only on mobile
</li>
</ul>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row flex-nowrap">
<?php
include('include/menu.php');
?>
<div class="col py-3">
<?php
switch ($_REQUEST['direction']) {
case 'connexion':
include("controleurs/c_connexion.php");
break;
case 'gestionFiche':
include(__DIR__ . "/controleurs/c_gestionFiche.php");
break;
case 'home':
include("controleurs/c_homePage.php");
break;
case 'nouvelleFiche':
include(__DIR__ . "/controleurs/c_nouvelleFiche.php");
break;
default:
include("controleurs/c_homePage.php");
break;
}
?>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,92 +1,76 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page accueil</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid">
<div class="row flex-nowrap">
<?php include('../include/menu.php') ?>
<div class="col py-3">
<center>
<div class="col-3 mb-4">
<h3>Gerer mes fiches de frais</h3>
<br>
<select class="form-select" name="selVisiteur" id="">
<option value="visiteur1">Visiteur 1</option>
</select>
</div>
</center>
<div class="col-11 d-flex mx-auto">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Mois</th>
<th scope="col">Total</th>
<th scope="col">Statut</th>
<th scope="col">Détails</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Novembre</th>
<td>351 €</td>
<td>en cours...</td>
<td><a href="#">voir</a></td>
</tr>
<tr>
<th scope="row">Octobre</th>
<td>1458 €</td>
<td>en cours...</td>
<td><a href="#">voir</a></td>
</tr>
<tr>
<th scope="row">Septembre</th>
<td>1112 €</td>
<td>classé</td>
<td><a href="#">voir</a></td>
</tr>
</tbody>
</table>
</div>
<div class="col-4 d-flex mx-auto">
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item active" aria-current="page">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<center>
<div class="col-3 mb-4">
<br>
<?php
if ($_SESSION['typeU'] != 'comptable') {
echo '<h3>Gérer mes fiches de frais</h3>';
} else {
echo '<h3>Gérer les fiches de frais de :</h3>';
echo '<select class="form-select" name="selVisiteur" id="">';
foreach ($LesUtilisateurs as $key => $value) {
$id = $value['uId'];
$prenom = $value['uPrenom'];
$nom = $value['uNom'];
echo '<option value="' . $id . '">' . $nom . " " . $prenom . "</option>";
}
echo '</select>';
}
?>
</div>
</center>
</body>
<div class="col-11 d-flex mx-auto">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Mois</th>
<th scope="col">Total</th>
<th scope="col">Statut</th>
<th scope="col">Détails</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Novembre</th>
<td>351 €</td>
<td>en cours...</td>
<td><a href="#">voir</a></td>
</tr>
<tr>
<th scope="row">Octobre</th>
<td>1458 €</td>
<td>en cours...</td>
<td><a href="#">voir</a></td>
</tr>
<tr>
<th scope="row">Septembre</th>
<td>1112 €</td>
<td>classé</td>
<td><a href="#">voir</a></td>
</tr>
</tbody>
</table>
</div>
</html>
<!--
PAGINATION:// NE PAS TOUCHER
-->
<div class="col-4 d-flex mx-auto">
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item active" aria-current="page">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
</div>

1
vues/v_homePage.php Normal file
View File

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

120
vues/v_newFiche.php Normal file
View File

@ -0,0 +1,120 @@
<center>
<h1>Nouvelle Fiche de frais</h1>
<br>
<p>Mois de Novembre 2023</p>
</center>
<br>
<!--
Liste des frais forfaitaires
-->
<h3 class="fw-bold offset-1">Frais forfaitaires</h3>
<div class="col-11 d-flex mx-auto my-3">
<table class="table table-striped-columns align-middle">
<thead class="table-dark">
<tr>
<th scope="col">Intitulé</th>
<th scope="col">Quantité</th>
<th scope="col">Montant</th>
<th scope="col">Total</th>
</tr>
</thead>
<tbody class="table-group-divider border-secondary-subtle">
<?php
foreach ($listeFraisForfaitaire as $key => $value):
?>
<tr>
<th scope="row">
<?= $value['fLibelle'] ?>
</th>
<td>
<input type="text" name="fraisForfait-<?= $value['fId'] ?>" class="form-control frsFrt"
id="<?= $key ?>" value="<?= $value['lfQuantite'] ?>">
</td>
<td id="mttFrs-<?= $key ?>" data-price="<?= $value['fMontant'] ?>">
<?= $value['fMontant'] ?> €
</td>
<td id="totalFrs-<?= $key ?>">
<?= $value['fTotal'] ?>€
</td>
</tr>
<?php
endforeach;
?>
<tr>
<td colspan="3" class="border-0"></td>
<td class="prixTotalFrsF"></td>
</tr>
</tbody>
</table>
</div>
<span class="border-3 border-bottom border-black col-10 mx-auto my-5 d-flex"></span>
<!--
Listes des frais Hors Forfaits
-->
<h3 class="fw-bold offset-1">Hors forfait</h3>
<div class="col-11 d-flex mx-auto my-3">
<table class="table table-striped-columns align-middle">
<thead class="table-dark">
<tr>
<th>Date</th>
<th>Libelle</th>
<th>Montant</th>
<th>Justificatif</th>
<th>Valider</th>
</tr>
</thead>
<tbody class="table-group-divider border-secondary-subtle fraisHFGroup">
<?php
foreach ($listeFraisHf as $key => $value):
?>
<tr id="fraisHf-<?= $key ?>" class="fraisHF">
<td scope="row" id="dateFrsHF">
<?= $value['lhDate'] ?>
</td>
<td id="LibelleFrsHF">
<?= $value['lhLibelle'] ?>
</td>
<td id="MttFrsHF">
<?= $value['lhMontant'] ?> €
</td>
<td>
<?= $value['lhJustificatif'] == 1 ? 'ok' : 'non fournis' ?>
</td>
<td>
<button type="button" class="btn btn-outline-primary btnSuprFraisHf" id="frsSup-<?= $key ?>">
Supprimer
</button>
</td>
</tr>
<?php
endforeach;
?>
<!--
Formulaire d'ajout de frais HF
-->
<tr class="newFraisForm">
<td scope="row">
<input name="dateHf" class="form-control" id="dateHf" type="date" min="2020-11-01" max="2020-11-30">
</td>
<td><input type="text" name="libelleHf" id="libelleHf" class="form-control"
placeholder="saisir un titre"></td>
<td><input type="text" name="mttHf" id="mttHf" class="form-control" placeholder="Saisir un Montant">
</td>
<td><input type="file" class="form-control"></td>
<td><button type="button" class="btn btn-outline-primary validFraisHF">Valider</button></td>
</tr>
</tbody>
</table>
</div>
<span class="border-3 border-bottom border-black col-10 mx-auto my-5 d-flex"></span>
<h3 class="fw-bold offset-1">Commentaire (facultatif)</h3>
<div class="col-8 d-flex mx-auto">
<textarea name="commentaireFiche" id="commentaireFiche" class="form-control border-black"></textarea>
</div>
<div class="col-3 d-flex mx-auto my-5 justify-content-center">
<button type="button" class="btn btn-outline-primary">Envoyer la Fiche</button>
</div>
<script src="../include/newFiche.js"></script>