Compare commits
15 Commits
v0.0.1-pr
...
v0.0.1.g-p
Author | SHA1 | Date | |
---|---|---|---|
f08b18fab5 | |||
9f245f6578 | |||
85c00fde0a | |||
d279249503 | |||
1db0ab4873 | |||
53179a0a85 | |||
fa1bacb404 | |||
e55df1b480 | |||
5b5e5cc28e | |||
674514ed06 | |||
7fcee1a7bf | |||
30ccc68f7a | |||
ce94d71198 | |||
280f10fc0b | |||
c226069923 |
26
Class/class.gestionFiche.php
Normal file
26
Class/class.gestionFiche.php
Normal 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 = '';
|
||||
}
|
||||
|
||||
}
|
118
Class/class.newFiche.php
Normal file
118
Class/class.newFiche.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
class Class_newFiche
|
||||
{
|
||||
private $pdo = null;
|
||||
|
||||
private $month;
|
||||
private $userId;
|
||||
|
||||
public function __construct(PdoGsb $pDO, string $userId, string $month)
|
||||
{
|
||||
$this->pdo = $pDO->getPdoGsb();
|
||||
$this->month = $month;
|
||||
$this->userId = $userId;
|
||||
|
||||
$this->existingFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test et ajoute la fiche si elle n'existe pas
|
||||
*/
|
||||
private function existingFile(): void
|
||||
{
|
||||
$req = 'SELECT newremboursement(:idUser, :month); ';
|
||||
|
||||
$result = $this->pdo->prepare($req);
|
||||
$result->bindParam('idUser', $this->userId);
|
||||
$result->bindParam('month', $this->month);
|
||||
$result->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste les frais forfaitaires
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste les frais Forfetaires d'un user pour 1 mois
|
||||
*/
|
||||
public function listFraisForfaitForU(): 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', $this->userId);
|
||||
$result->bindParam('monthF', $this->month);
|
||||
$result->execute();
|
||||
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste les frais hors forfait d'un user pour 1 mois
|
||||
*/
|
||||
public function listFraisHF(): 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', $this->userId);
|
||||
$result->bindParam(':mois', $this->month);
|
||||
$result->execute();
|
||||
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction qui renvoie le prix total validé d'une fiche de frais
|
||||
*
|
||||
* AJOUTER UNE FONCTION QUI CREE LA FICHE DE FRAIS LORS DU SELECT SI CELLE CI N'EXISTE PAS
|
||||
*/
|
||||
public function getMontantValide(): float
|
||||
{
|
||||
$req = 'SELECT "rMontantValide"
|
||||
FROM remboursement
|
||||
WHERE "rVisiteur" = :idVisiteur AND "rMois" = :mois ;';
|
||||
|
||||
$result = $this->pdo->prepare($req);
|
||||
$result->bindParam(':idVisiteur', $this->userId);
|
||||
$result->bindParam(':mois', $this->month);
|
||||
$result->execute();
|
||||
|
||||
return $result->fetch()['rMontantValide'];
|
||||
}
|
||||
|
||||
public function getStatus(): string
|
||||
{
|
||||
$req = 'select etat."eId" from remboursement
|
||||
INNER JOIN etat on etat."eId" = remboursement."rEtat"
|
||||
WHERE "rVisiteur" = :idVisiteur AND "rMois" = :mois ;';
|
||||
|
||||
$result = $this->pdo->prepare($req);
|
||||
$result->bindParam(':idVisiteur', $this->userId);
|
||||
$result->bindParam(':mois', $this->month);
|
||||
$result->execute();
|
||||
|
||||
return $result->fetch()['eId'];
|
||||
}
|
||||
}
|
34
Class/class.pdo.php
Normal file
34
Class/class.pdo.php
Normal 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;
|
||||
}
|
||||
}
|
31
Class/class.user.php
Normal file
31
Class/class.user.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* AJOUT COMPTABLE
|
||||
* INSERT INTO utilisateur
|
||||
* VALUES('cpt1', 'Renaudot', 'Pierre', 'pr07', 'pr', 'rue saint éloi', 21110, 'Marliens', NOW(), 3, 3, 4, 27, NOW(), NOW(), '120cv', 'essence')
|
||||
*/
|
||||
class Class_user
|
||||
{
|
||||
private $pdo = null;
|
||||
|
||||
public function __construct(PdoGsb $pDO)
|
||||
{
|
||||
$this->pdo = $pDO->getPdoGsb();
|
||||
}
|
||||
|
||||
public function connectUser(string $login, string $password): array
|
||||
{
|
||||
$req = 'SELECT "uId", "uNom", "uPrenom", "uAdresse", "uCp", "uVille", "uSecteur", "uLabo", "parametre"."pLibelle"
|
||||
FROM utilisateur
|
||||
INNER JOIN parametre ON "parametre"."pType" = \'statUti\'
|
||||
AND "utilisateur"."uStatut" = "parametre"."pIndice"
|
||||
WHERE "uLogin" = :login AND "uMdp" = :pwd ;';
|
||||
|
||||
$result = $this->pdo->prepare($req);
|
||||
$result->bindParam('login', $login);
|
||||
$result->bindParam('pwd', $password);
|
||||
$result->execute();
|
||||
|
||||
return $result->fetch();
|
||||
}
|
||||
}
|
@ -1,12 +1,37 @@
|
||||
<?php
|
||||
// ***************************************'
|
||||
// Le CASTEL-BTS SIO/ PROJET PPE4 GSB '
|
||||
// Programme: c_connexion.php v2.0 '
|
||||
// Objet : gestion remboursements frais'
|
||||
// Client : laboratoires GSB '
|
||||
// Date : 03/05/2023 à 11H01 '
|
||||
// Auteur : pascal-blain@wanadoo.fr '
|
||||
//****************************************'
|
||||
require_once(__DIR__ . '/../Class/class.user.php');
|
||||
|
||||
$userClass = new Class_user($pdo);
|
||||
if (isset($_POST['login']) && isset($_POST['password'])) {
|
||||
//Récupère les données de l'utilisateur
|
||||
$data = $userClass->connectUser($_POST['login'], $_POST['password']);
|
||||
|
||||
//Si l'utilisateur existe ou pas
|
||||
if (count($data) === 0) {
|
||||
header('location: index.php?direction=connexion&msg=errorco');
|
||||
} else {
|
||||
$_SESSION['uId'] = $data['uId'];
|
||||
$_SESSION['uNom'] = $data['uNom'];
|
||||
$_SESSION['uPrenom'] = $data['uPrenom'];
|
||||
$_SESSION['uAdresse'] = $data['uAdresse'];
|
||||
$_SESSION['uCp'] = $data['uCp'];
|
||||
$_SESSION['uVille'] = $data['uVille'];
|
||||
$_SESSION['uSecteur'] = $data['uSecteur'];
|
||||
$_SESSION['uLabo'] = $data['uLabo'];
|
||||
$_SESSION['uType'] = $data['pLibelle'];
|
||||
|
||||
header('location: index.php?direction=home');
|
||||
}
|
||||
} else {
|
||||
include('vues/v_connexion.php');
|
||||
}
|
||||
die;
|
||||
/*
|
||||
|
||||
|
||||
|
||||
header('location: index.php?direction=home');
|
||||
|
||||
if (!isset($_REQUEST['action'])) {
|
||||
$_REQUEST['action'] = 'demandeConnexion';
|
||||
}
|
||||
@ -42,7 +67,7 @@ switch ($action) {
|
||||
$leMoisPrecedent = (date('Y') - 1) * 100 + 12;
|
||||
}
|
||||
//penser ici à faire la cloture du mois précédent !
|
||||
if ($statut == 'V') /* si le remboursement pour le mois courant n'existe pas (=0) il faut le créer*/{
|
||||
if ($statut == 'V') // si le remboursement pour le mois courant n'existe pas (=0) il faut le créer{
|
||||
$leMois = date('Ym');
|
||||
$leRemboursement = $pdo->existeRemboursement($id, $leMois);
|
||||
if ($leRemboursement == 0) {
|
||||
@ -59,4 +84,5 @@ switch ($action) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
*/
|
||||
|
5
controleurs/c_deconnexion.php
Normal file
5
controleurs/c_deconnexion.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_destroy();
|
||||
|
||||
header('location: ../index.php');
|
@ -1,62 +0,0 @@
|
||||
<?php
|
||||
// ***************************************'
|
||||
// Le CASTEL-BTS SIO/ PROJET PPE4 GSB '
|
||||
// Programme: c_etatFrais.php '
|
||||
// Objet : consultations des frais '
|
||||
// Client : laboratoires GSB '
|
||||
// Version : 3.0 '
|
||||
// Date : 03/05/2023 à 14H09 '
|
||||
// Auteur : pascal-blain@wanadoo.fr '
|
||||
//****************************************'
|
||||
|
||||
$action = $_REQUEST['action'];
|
||||
switch($action) {
|
||||
case 'voir':
|
||||
{
|
||||
$nbRemboursementsAValider=$pdo->getNbRemboursementsAValider();
|
||||
include("vues/v_entete.php");
|
||||
|
||||
if ($_SESSION['statut']!='1')
|
||||
{
|
||||
$lesVisiteurs=$pdo->getLesVisiteurs();
|
||||
include("vues/v_choixVisiteur.php");
|
||||
if ($_SESSION['idVisiteur']!=$visiteurChoisi) {unset($_REQUEST['lstMois']);$_SESSION['idVisiteur']=$visiteurChoisi;}
|
||||
}
|
||||
$idVisiteur = $_SESSION['idVisiteur'];
|
||||
$lesMois=$pdo->getLesMoisDisponibles($idVisiteur);
|
||||
include("vues/v_choixMois.php");
|
||||
$_SESSION['leMois']= $moisChoisi;
|
||||
|
||||
$leMois=$_SESSION['leMois'];
|
||||
$lesInfosRemboursement = $pdo->getInfosRemboursement($idVisiteur,$leMois);
|
||||
$libEtat = $lesInfosRemboursement['libEtat'];
|
||||
$montantValide = $lesInfosRemboursement['montantValide'];
|
||||
$nbJustificatifs = $lesInfosRemboursement['nbJustificatifs'];
|
||||
$dateModif = $lesInfosRemboursement['dateModif'];
|
||||
$etatRemboursement = $lesInfosRemboursement['rEtat'];
|
||||
|
||||
$lesFraisForfait= $pdo->getLesFraisForfait($idVisiteur,$leMois);
|
||||
$lesFraisHorsForfait = $pdo->getLesFraisHorsForfait($idVisiteur,$leMois);
|
||||
|
||||
$ajoutFraisPossible = $pdo->getAjoutFraisPossible($idVisiteur, $leMois, $etatRemboursement);
|
||||
include("vues/v_etatFrais.php");
|
||||
break;
|
||||
}
|
||||
case 'validerEtat':
|
||||
{
|
||||
// code à rédiger ici ...
|
||||
/*
|
||||
// il faut actualiser le code etat, la date, le nombre de justificatifs et le montant valide
|
||||
$pdo->valideRemboursement($idVisiteur,$leMois);
|
||||
$moisASelectionner = $leMois;
|
||||
header ('location: index.php?uc=etatFrais&action=voir&lstMois='.$leMois);
|
||||
break;*/
|
||||
}
|
||||
default :
|
||||
{
|
||||
echo 'erreur d\'aiguillage !'.$action;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,74 +0,0 @@
|
||||
<?php
|
||||
// *****************************************'
|
||||
// Le CASTEL-BTS SIO/ PROJET PPE4 GSB '
|
||||
// Programme: c_gererFraisForfaitaire.php '
|
||||
// Objet : Ajout/modif/suppression frais'
|
||||
// Client : laboratoires GSB '
|
||||
// Version : 3.0 '
|
||||
// Date : 03/05/2023 <20> 11H01 '
|
||||
// Auteur : pascal-blain@wanadoo.fr '
|
||||
//******************************************'
|
||||
$idVisiteur = $_SESSION['idVisiteur'];
|
||||
$leMois = $_SESSION['leMois'];
|
||||
$action = $_REQUEST['action'];
|
||||
//----------------------------------------- AJOUT
|
||||
if ($action=='choix')
|
||||
{
|
||||
include("vues/v_entete.php");
|
||||
$lesForfaitsPossibles= $pdo->getLesForfaitsPossibles();
|
||||
$prixKm=$pdo->getPrixKm($idVisiteur,$leMois);
|
||||
include("vues/v_ajoutFraisForfaitaire.php");
|
||||
}
|
||||
if ($action=='valider')
|
||||
{// enregistrement de la ligne et retour vers l'etat des frais
|
||||
$qte = $_REQUEST['zQte'];
|
||||
if ($qte>0)
|
||||
{ $forfait = $_REQUEST['zForfait'];
|
||||
$montant = str_replace(",",".",$_REQUEST['zPrix']);
|
||||
$montant = str_replace(" ","",$montant);
|
||||
$pdo->ajoutFraisForfait($idVisiteur, $leMois, $forfait, $qte, $montant); //insertion dans la table;
|
||||
}
|
||||
$moisASelectionner = $leMois;
|
||||
header ('location: index.php?uc=etatFrais&action=voir&lstMois='.$leMois);
|
||||
}
|
||||
//----------------------------------------- MODIFICATION
|
||||
if ($action=='editer')
|
||||
{
|
||||
include("vues/v_entete.php");
|
||||
$forfait = $_REQUEST['forfait'];
|
||||
$unForfait = $pdo->getUnFraisForfait($idVisiteur, $leMois, $forfait);
|
||||
include("vues/v_unFraisForfaitaire.php");
|
||||
}
|
||||
if ($action=='validerModifier')
|
||||
{// mise <20> jour de la ligne et retour vers l'etat des frais
|
||||
$qte = $_REQUEST['zQte'];
|
||||
if ($qte>0)
|
||||
{
|
||||
$forfait = $_REQUEST['forfait'];
|
||||
$pdo->majFraisForfait($idVisiteur, $leMois, $forfait, $qte); //mise <20> jour de la table;
|
||||
}
|
||||
$moisASelectionner = $leMois;
|
||||
header ('location: index.php?uc=etatFrais&action=voir&lstMois='.$leMois);
|
||||
}
|
||||
//----------------------------------------- SUPPRESSION
|
||||
if ($action=='supprimer')
|
||||
{
|
||||
include("vues/v_entete.php");
|
||||
$forfait = $_REQUEST['forfait'];
|
||||
|
||||
$unForfait = $pdo->getUnFraisForfait($idVisiteur, $leMois, $forfait);
|
||||
include("vues/v_unFraisForfaitaire.php");
|
||||
}
|
||||
|
||||
if ($action=='validerSupprimer')
|
||||
{// suppression de la ligne et retour vers l'etat des frais
|
||||
$qte = $_REQUEST['zQte'];
|
||||
if ($qte>0)
|
||||
{
|
||||
$forfait = $_REQUEST['forfait'];
|
||||
$pdo->supprimerFraisForfait($idVisiteur, $leMois, $forfait); //suppession de la ligne dans la table;
|
||||
}
|
||||
$moisASelectionner = $leMois;
|
||||
header ('location: index.php?uc=etatFrais&action=voir&lstMois='.$leMois);
|
||||
}
|
||||
?>
|
@ -1,75 +0,0 @@
|
||||
<?php
|
||||
// *****************************************'
|
||||
// Le CASTEL-BTS SIO/ PROJET PPE4 GSB '
|
||||
// Programme: c_gererFraisHorsForfait.php '
|
||||
// Objet : Ajout/modif/suppression frais'
|
||||
// Client : laboratoires GSB '
|
||||
// Version : 3.0 '
|
||||
// Date : 03/05/2023 <20> 11H01 '
|
||||
// Auteur v1: pascal-blain@wanadoo.fr '
|
||||
//******************************************'
|
||||
$idVisiteur = $_SESSION['idVisiteur'];
|
||||
$leMois = $_SESSION['leMois'];
|
||||
$action = $_REQUEST['action'];
|
||||
//----------------------------------------- AJOUT
|
||||
if ($action=='ajouter')
|
||||
{
|
||||
include("vues/v_entete.php");
|
||||
include("vues/v_ajoutFraisHorsForfait.php");
|
||||
}
|
||||
if ($action=='valider')
|
||||
{// enregistrement de la ligne et retour vers l'etat des frais
|
||||
$date = $_REQUEST['zDate'];
|
||||
if ($date>0)
|
||||
{ $libelle=addslashes($_REQUEST['zLibelle']);
|
||||
$montant = str_replace(",",".",$_REQUEST['zMontant']);
|
||||
$montant = str_replace(" ","",$montant);
|
||||
$pdo->ajoutFraisHorsForfait($idVisiteur, $leMois, $date, $libelle, $montant); //insertion dans la table;
|
||||
}
|
||||
$moisASelectionner = $leMois;
|
||||
header ('location: index.php?uc=etatFrais&action=voir&lstMois='.$leMois);
|
||||
}
|
||||
//----------------------------------------- MODIFICATION
|
||||
if ($action=='editer')
|
||||
{
|
||||
include("vues/v_entete.php");
|
||||
$idFrais = $_REQUEST['idFrais'];
|
||||
$unFrais = $pdo->getUnFraisHorsForfait($idFrais);
|
||||
include("vues/v_unFraisHorsForfait.php");
|
||||
}
|
||||
if ($action=='validerModifier')
|
||||
{// mise <20> jour de la ligne et retour vers l'etat des frais
|
||||
$montant = $_REQUEST['zMontant'];
|
||||
if ($montant>0)
|
||||
{
|
||||
$idFrais = $_REQUEST['idFrais'];
|
||||
$date = $_REQUEST['zDate'];
|
||||
$libelle=addslashes($_REQUEST['zLibelle']);
|
||||
$montant = str_replace(",",".",$_REQUEST['zMontant']);
|
||||
$montant = str_replace(" ","",$montant);
|
||||
$pdo->majFraisHorsForfait($idFrais, $date, $libelle, $montant); //mise <20> jour de la table;
|
||||
}
|
||||
$moisASelectionner = $leMois;
|
||||
header ('location: index.php?uc=etatFrais&action=voir&lstMois='.$leMois);
|
||||
}
|
||||
//----------------------------------------- SUPPRESSION
|
||||
if ($action=='supprimer')
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
if ($action=='validerSupprimer')
|
||||
{
|
||||
$montant = $_REQUEST['zMontant'];
|
||||
if ($montant>0)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
9
controleurs/c_gestionFiche.php
Normal file
9
controleurs/c_gestionFiche.php
Normal 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");
|
3
controleurs/c_homePage.php
Normal file
3
controleurs/c_homePage.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
include(__DIR__ . '/../vues/v_homePage.php');
|
69
controleurs/c_nouvelleFiche.php
Normal file
69
controleurs/c_nouvelleFiche.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
require_once(__DIR__ . '/../Class/class.newFiche.php');
|
||||
|
||||
$typeUser = $_SESSION['uType']; //visiteur ou comptable
|
||||
$userId = $_SESSION['uId']; //exemple: 'b34'
|
||||
|
||||
|
||||
/**
|
||||
* Gestion de la date selon la vue à afficher
|
||||
*/
|
||||
if (isset($_GET['currentList'])) {
|
||||
//Date des req SQL et function
|
||||
$date = date('Ym');
|
||||
|
||||
//Date du header
|
||||
try {
|
||||
//sudo timedatectl set-local-rtc 1
|
||||
$format = new IntlDateFormatter(
|
||||
'fr_FR',
|
||||
IntlDateFormatter::FULL,
|
||||
IntlDateFormatter::FULL,
|
||||
'Europe/Paris',
|
||||
IntlDateFormatter::GREGORIAN,
|
||||
'MMMM Y'
|
||||
);
|
||||
$dateHeader = $format->format(time());
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
$dateHeader = date('F Y');
|
||||
}
|
||||
|
||||
//Date du formulaire HF
|
||||
$dateFormHFMin = date('Y-m-\01');
|
||||
$dateFormHFMax = date("Y-m-t", mktime(0, 0, 0, date('m'), 1, date('Y'))); // retourne le dernier jour du mois (30 ou 31)
|
||||
|
||||
} elseif (isset($_GET['dateListing'])) {
|
||||
$date = $_GET['dateListing'];
|
||||
}
|
||||
|
||||
$date = '202404';
|
||||
|
||||
$newFiche = new Class_newFiche($pdo, $userId, $date);
|
||||
|
||||
/**
|
||||
* Liste des frais forfaitaires du mois et de l'user :: sinon afficher les libelle
|
||||
*/
|
||||
$listeFraisForfaitaire = $newFiche->listFraisForfaitForU();
|
||||
if (count($listeFraisForfaitaire) == 0) {
|
||||
$listeFraisForfaitaire = $newFiche->listFraisForfaitaires();
|
||||
}
|
||||
|
||||
/**
|
||||
* Listes des frais HF
|
||||
*/
|
||||
$listeFraisHf = $newFiche->listFraisHF();
|
||||
|
||||
/**
|
||||
* TOTAL DE LA FICHE
|
||||
*/
|
||||
$totalFraisFiche = $newFiche->getMontantValide();
|
||||
|
||||
/**
|
||||
* ETAT DE LA FICHE
|
||||
*/
|
||||
$status = $newFiche->getStatus();
|
||||
//$status = 'CR'; //créé
|
||||
$disabled = ($status !== 'CR') ? 'disabled' : '';
|
||||
|
||||
include(__DIR__ . '/../vues/v_newFiche.php');
|
34
gsb2024.sql
34
gsb2024.sql
@ -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");
|
||||
|
@ -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']);
|
||||
}
|
||||
}
|
||||
|
@ -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¤tList" 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">
|
||||
@ -64,7 +68,7 @@
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li><a class="dropdown-item" href="#">Sign out</a></li>
|
||||
<li><a class="dropdown-item" href="controleurs/c_deconnexion.php">Sign out</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
139
include/newFiche.js
Normal file
139
include/newFiche.js
Normal file
@ -0,0 +1,139 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
calcPrixTotalFrsF();
|
||||
calcPrixTotalFrsHorsF();
|
||||
updatePrixTotal();
|
||||
/**
|
||||
* 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();
|
||||
updatePrixTotal();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* 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('.btn').attr('id', 'frsSup-' + lastId)
|
||||
|
||||
var line = $('<tr id="fraisHf-' + lastId + '" class="fraisHF"></tr>');
|
||||
var tdDate = $('<th scope="row" id="dateFrsHF"></th>');
|
||||
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')
|
||||
|
||||
date.val('')
|
||||
libelle.val('')
|
||||
montant.val('')
|
||||
}
|
||||
|
||||
calcPrixTotalFrsHorsF();
|
||||
updatePrixTotal();
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
/**
|
||||
* Supprimer fraisHf
|
||||
*/
|
||||
$(document).on('click', '.btnSuprFraisHf', function () {
|
||||
id = $(this).attr('id').split('-')[1]
|
||||
console.log(id)
|
||||
|
||||
$('#fraisHf-' + id).remove()
|
||||
calcPrixTotalFrsHorsF();
|
||||
updatePrixTotal();
|
||||
})
|
||||
|
||||
/**
|
||||
* Calcul prix total frais forfaitaires
|
||||
*/
|
||||
function calcPrixTotalFrsF() {
|
||||
|
||||
var prixTotal = 0;
|
||||
$('td[id^="totalFrs-"]').each(function () {
|
||||
prixTotal += parseFloat($(this).html().replace('€', ''))
|
||||
})
|
||||
$('.prixTotalFrsF').html('<strong>TOTAL :</strong> ' + prixTotal.toFixed(2) + ' €')
|
||||
$('.prixTotalFrsF').attr('data-prix', prixTotal.toFixed(2))
|
||||
}
|
||||
/**
|
||||
* Calcul prix total frais hors forfait
|
||||
*/
|
||||
function calcPrixTotalFrsHorsF() {
|
||||
|
||||
var prixTotal = 0;
|
||||
$('td#MttFrsHF').each(function () {
|
||||
prixTotal += parseFloat($(this).html().replace('€', ''))
|
||||
})
|
||||
$('#total-frais-HF').html('<strong>TOTAL :</strong> ' + prixTotal.toFixed(2) + ' €')
|
||||
$('#total-frais-HF').attr('data-prix', prixTotal.toFixed(2))
|
||||
}
|
||||
/**
|
||||
* Calcul prix total de la fiche
|
||||
*/
|
||||
function updatePrixTotal() {
|
||||
var total = parseFloat($('#total-frais-HF').attr('data-prix'))
|
||||
total += parseFloat($('.prixTotalFrsF').attr('data-prix'))
|
||||
|
||||
$('#total-fiche').html('<strong>TOTAL :</strong> ' + total.toFixed(2) + ' €')
|
||||
}
|
44
index(2).php
44
index(2).php
@ -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");
|
||||
?>
|
101
index.php
101
index.php
@ -1,37 +1,84 @@
|
||||
<?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();
|
||||
$_SESSION['typeU'] = 'visiteur';
|
||||
|
||||
/**
|
||||
* Direction si non renseigné et non connecté
|
||||
*/
|
||||
if (!isset($_REQUEST['direction']) && !isset($_SESSION['uId'])) {
|
||||
$_REQUEST['direction'] = 'connexion';
|
||||
} elseif (!isset($_REQUEST['direction']) && isset($_SESSION['uId'])) {
|
||||
$_REQUEST['direction'] = 'home';
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="fr">
|
||||
|
||||
<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
|
||||
if (!isset($_SESSION['uId'])) {
|
||||
$_REQUEST['direction'] = 'connexion';
|
||||
} else {
|
||||
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>
|
24
sqlFunction.txt
Normal file
24
sqlFunction.txt
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
--Fonction pour créer une fiche si celle-ci n'existe pas
|
||||
|
||||
CREATE OR REPLACE FUNCTION newRemboursement(userId CHAR(10), monthFile CHAR(10)) RETURNS int AS $$
|
||||
DECLARE
|
||||
returnValue INT;
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO returnValue
|
||||
FROM remboursement
|
||||
WHERE "rVisiteur" = userId AND "rMois" = monthFile;
|
||||
|
||||
IF returnValue = 0 THEN
|
||||
-- Ajoute une nouvelle ligne à la table remboursement
|
||||
INSERT INTO remboursement
|
||||
VALUES(userId, monthFile, 0, 0, CURRENT_DATE, 'CR');
|
||||
|
||||
-- Mettre à jour la valeur de returnValue après l'insertion
|
||||
returnValue := 1; -- Valeur pour indiquer qu'une ligne a été insérée
|
||||
END IF;
|
||||
|
||||
RETURN returnValue;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
@ -1,75 +0,0 @@
|
||||
<!-- Derniere modification le 03/05/2023 à 11H01 -->
|
||||
<div id="contenu">
|
||||
<h2>AJOUT FRAIS FORFAITAIRE</h2>
|
||||
<form name="nouveauFraisForfaitaire" action="index.php?uc=gererFraisForfaitaire&action=valider" method="POST">
|
||||
<table class="listeLegere">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="date">Quantité</th>
|
||||
<th class="eltForfait">Nature de la dépense</th>
|
||||
<th class="montant">Prix</th>
|
||||
<th class="montant">Montant</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><input type="hidden" name="zMois" value="<?PHP echo $leMois; ?>">
|
||||
<input type="text" name="zQte" onkeyup="calculer()" style="text-align:right;"></td>
|
||||
<td><select name="zForfait" onchange="calculer()">
|
||||
<?PHP
|
||||
foreach ($lesForfaitsPossibles as $unForfait)
|
||||
{echo'<option value="'.$unForfait['fId'].'" size="1">'.$unForfait['fLibelle'].'</option>';}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="text" name="zPrix" style="text-align:right;" disabled></td>
|
||||
<td><input type="text" name="zMontant" style="text-align:right;" disabled></td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php echo 'Puissance du véhicule : '.$prixKm['aPuissance'].' - Carburant : '.$prixKm['aMotorisation'].' (tarif en vigueur depuis le : '.$prixKm['aDate'].')'; ?>
|
||||
<p align="right"><input type="image" name="zValider" alt="Valider" src="images/valider.jpg" onclick="valider()"><input type="image" name="zAnnuler" alt="Annuler" src="images/annuler.jpg" onclick="annuler()"></p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="include/proceduresJava.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
function calculer()
|
||||
{
|
||||
<?php
|
||||
$tarif = 'var tarif = [';
|
||||
foreach ($lesForfaitsPossibles as $unForfait)
|
||||
{
|
||||
|
||||
|
||||
|
||||
$tarif .= $unForfait['fMontant'].',';
|
||||
}
|
||||
$tarif .='];';
|
||||
echo $tarif."\n";
|
||||
?>
|
||||
var iLeChoix = document.nouveauFraisForfaitaire.zForfait.selectedIndex;
|
||||
var quantite = document.nouveauFraisForfaitaire.zQte.value;
|
||||
|
||||
if (!isNaN(quantite))
|
||||
{
|
||||
document.nouveauFraisForfaitaire.zMontant.value = format_euro(quantite * (parseInt(parseFloat(tarif[iLeChoix])*1000))/1000);
|
||||
}
|
||||
document.nouveauFraisForfaitaire.zPrix.value = format_euro((parseInt(parseFloat(tarif[iLeChoix])*1000))/1000);
|
||||
}
|
||||
|
||||
function valider()
|
||||
{
|
||||
document.nouveauFraisForfaitaire.zPrix.disabled=false;
|
||||
document.nouveauFraisForfaitaire.submit();
|
||||
}
|
||||
|
||||
function annuler()
|
||||
{
|
||||
document.nouveauFraisForfaitaire.reset();
|
||||
document.nouveauFraisForfaitaire.submit();
|
||||
}
|
||||
|
||||
window.onload = function() { calculer(); };
|
||||
</script>
|
@ -1,39 +0,0 @@
|
||||
<!-- ajout d'un frais hors forfaits / Derni<6E>re modification le 03/05/2023 <20> 11H01 par P. Blain -->
|
||||
<div id="contenu">
|
||||
<h2>AJOUT D'UN FRAIS HORS FORFAIT</h2>
|
||||
<form name="unFraisHorsForfait" action="index.php?uc=gererFraisHorsForfait&action=valider" method="POST">
|
||||
<table class="listeLegere">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="date">Date</th>
|
||||
<th class="eltForfait">Nature de la dépense</th>
|
||||
<th class="montant">Montant</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><input type="hidden" name="zMois" value="<?PHP echo $leMois; ?>">
|
||||
<input type="text" name="zDate" style="text-align:center;border:0;"></td>
|
||||
<td><input type="text" name="zLibelle" style="text-align:left;border:0;" size='80' maxlength='80' ></td>
|
||||
<td><input type="text" name="zMontant" style="text-align:right;border:0;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p align="right"><input type="image" name="zValider" alt="Valider" src="images/valider.jpg" onclick="valider()"><input type="image" name="zAnnuler" alt="Annuler" src="images/annuler.jpg" onclick="annuler()"></p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function valider()
|
||||
{
|
||||
document.unFraisHorsForfait.submit();
|
||||
}
|
||||
|
||||
function annuler()
|
||||
{
|
||||
document.unFraisHorsForfait.reset();
|
||||
document.unFraisHorsForfait.submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- fin -->
|
@ -1,49 +0,0 @@
|
||||
<!-- choix d'un mois / Derniere modification le 03/05/2023 à 11H01 par Pascal Blain -->
|
||||
<script src="include/proceduresJava.js" type="text/javascript"></script>
|
||||
<?php
|
||||
if ($_SESSION['statut']=="1") {
|
||||
$nbM=count($lesMois);
|
||||
echo '
|
||||
<div id="contenu">
|
||||
<form name="choixM" action="index.php?uc=etatFrais&action=voir" method="post">
|
||||
<h2>Etat de frais de ';} ?>
|
||||
|
||||
<select id="lstMois" name="lstMois" onchange="submit();">
|
||||
<?php
|
||||
if (!isset($_REQUEST['lstMois']))
|
||||
{$moisChoisi = 'premier';}
|
||||
else
|
||||
{$moisChoisi=$_REQUEST['lstMois'];
|
||||
}
|
||||
$i=1;
|
||||
foreach ($lesMois as $unMois)
|
||||
{
|
||||
if($unMois['mois'] == $moisChoisi or $moisChoisi == 'premier')
|
||||
{echo "<option selected value=\"".$unMois['mois']."\">".$unMois['numMois']." ".$unMois['numAnnee']."</option>\n ";
|
||||
$moisChoisi = $unMois['mois'];
|
||||
$noM=$i;}
|
||||
else
|
||||
{echo "<option value=\"".$unMois['mois']."\">".$unMois['numMois']." ".$unMois['numAnnee']."</option>\n ";
|
||||
$i=$i+1;}
|
||||
}
|
||||
echo '
|
||||
</select></h2>';
|
||||
?>
|
||||
<!-- ============================================================== navigation dans les listes visiteurs et mois -->
|
||||
<div id="navigation">
|
||||
<input type="image" id="zPremier" alt="premier" src="images/goPremier.gif" onclick="premier(<?php echo "'".$_SESSION['statut']."'"; ?>)">
|
||||
<input type="image" id="zPrecedent" alt="précédent" src="images/goPrecedent.gif" onclick="precedent(<?php echo "'".$_SESSION['statut']."'"; ?>)">
|
||||
<?php
|
||||
echo '
|
||||
<input type="text" id="zNumero" alt="indice" value="'.$noM.'/'.$nbM.'" disabled="true" size="5" style="text-align:center;vertical-align:top;">';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<input type="image" id="zSuivant" alt="premier" src="images/goSuivant.gif" onclick="suivant(<?php echo "'".$_SESSION['statut']."'"; ?>)">
|
||||
<input type="image" id="zDernier" alt="premier" src="images/goDernier.gif" onclick="dernier(<?php echo "'".$_SESSION['statut']."'"; ?>)">
|
||||
</div>
|
||||
</form>
|
||||
<!-- fin liste de choix -->
|
@ -1,34 +0,0 @@
|
||||
<!-- Choix d'un visiteur / Derniere modification le 03/05/2023 à 11H01 par Pascal Blain -->
|
||||
|
||||
<?php
|
||||
|
||||
if ($_SESSION['statut']!="1")
|
||||
{
|
||||
echo '
|
||||
<div id="contenu">
|
||||
<form name="choixV" action="index.php?uc=etatFrais&action=voir" method="post">
|
||||
<h2>Etat de frais de
|
||||
|
||||
<select id="lstVisiteurs" name="lstVisiteurs" onchange="submit();">';
|
||||
if (!isset($_REQUEST['lstVisiteurs']))
|
||||
{$visiteurChoisi = 'premier';}
|
||||
else
|
||||
{
|
||||
$visiteurChoisi=$_REQUEST['lstVisiteurs'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo '
|
||||
</select>
|
||||
Mois de ';
|
||||
}
|
||||
?>
|
@ -1,4 +1,51 @@
|
||||
<!-- 03/05/2023 à 11H01 -->
|
||||
<section class="vh-100 gradient-custom">
|
||||
<div class="container py-5 h-100">
|
||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
||||
<div class="col-12 col-md-8 col-lg-6 col-xl-5">
|
||||
<div class="card bg-dark text-white" style="border-radius: 1rem;">
|
||||
<div class="card-body p-5 text-center">
|
||||
|
||||
<div class="mb-md-5 mt-md-4 pb-5">
|
||||
|
||||
<h2 class="fw-bold mb-2 text-uppercase">GSB Laboratoire</h2>
|
||||
<p class="text-white-50 mb-5">Entrez votre login et mot-de-passe</p>
|
||||
<form action="index.php" method="POST">
|
||||
<div class="form-outline form-white mb-4">
|
||||
<input type="text" id="typeEmailX"
|
||||
class="form-control form-control-lg" name="login"/>
|
||||
<label class="form-label" for="typeEmailX">Login</label>
|
||||
</div>
|
||||
|
||||
<div class="form-outline form-white mb-4">
|
||||
<input type="password" id="typePasswordX"
|
||||
class="form-control form-control-lg" name="password"/>
|
||||
<label class="form-label" for="typePasswordX">Mot-de-passe</label>
|
||||
</div>
|
||||
|
||||
<!-- <p class="small mb-5 pb-lg-2"><a class="text-white-50" href="#!">Forgot password?</a></p> -->
|
||||
|
||||
<button class="btn btn-outline-light btn-lg px-5"
|
||||
type="submit">Connexion</button>
|
||||
</form>
|
||||
<div class="d-flex justify-content-center text-center mt-4 pt-1">
|
||||
<a href="#!" class="text-white"><i
|
||||
class="fab fa-facebook-f fa-lg"></i></a>
|
||||
<a href="#!" class="text-white"><i
|
||||
class="fab fa-twitter fa-lg mx-4 px-2"></i></a>
|
||||
<a href="#!" class="text-white"><i class="fab fa-google fa-lg"></i></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!--
|
||||
|
||||
<div id="contenu">
|
||||
<h2>Identification utilisateur</h2>
|
||||
|
||||
@ -6,13 +53,13 @@
|
||||
<form method="POST" action="index.php?uc=connexion&action=valideConnexion">
|
||||
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<label for="nom">Login*</label>
|
||||
<input id="login" type="text" name="login" size="30" maxlength="45">
|
||||
</p>
|
||||
<p>
|
||||
<label for="mdp">Mot de passe*</label>
|
||||
<input id="mdp" type="password" name="mdp" size="30" maxlength="45">
|
||||
<p>
|
||||
<label for="mdp">Mot de passe*</label>
|
||||
<input id="mdp" type="password" name="mdp" size="30" maxlength="45">
|
||||
</p>
|
||||
<input type="submit" value="Valider" name="valider">
|
||||
<input type="reset" value="Annuler" name="annuler">
|
||||
|
@ -1,30 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
|
||||
<head>
|
||||
<title>Intranet du Laboratoire Galaxy-Swiss Bourdin</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link href="./styles/stylesGSB.css" rel="stylesheet" type="text/css" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="./images/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
<div id="entete">
|
||||
<img src="./images/logo.jpg" id="logoGSB" alt="Laboratoire Galaxy-Swiss Bourdin" title="Laboratoire Galaxy-Swiss Bourdin" />
|
||||
<?php if (isset($_SESSION['idUtilisateur']))
|
||||
{echo '
|
||||
<!-- affichage du menu / Derniere modification le 03/05/2023 à 11H01 par P. Blain -->
|
||||
<div id="sommaire">
|
||||
<ul>
|
||||
<li><a href="" title=""> </a></li>
|
||||
<li><a href="" title=""> </a>|</li>
|
||||
<li><b>Bienvenue '.$_SESSION['prenom'].' '.strtoupper($_SESSION['nom']).'</b> ('.$_SESSION['typeUtilisateur'].')';
|
||||
if ($_SESSION['statut']<>'1') {echo '<br /><i>Il y a '.$nbRemboursementsAValider.' demandes à valider</i>';}
|
||||
echo ' </li>
|
||||
<li><a href="index.php?uc=connexion&action=demandeConnexion" title="Se déconnecter"><img alt="déconnexion" src="images/deconnexion.png" border="0" height="26px"></a></li>
|
||||
</ul>
|
||||
</div>';} ?>
|
||||
<br /><br /><h1>ÉTAT DES FRAIS ENGAGÉS</h1>
|
||||
<p style="text-align=left;"><?php echo $_SESSION['adr1'].'<br />'.$_SESSION['adr2'].'</p>';?>
|
||||
</div>
|
||||
<!-- fin affichage du menu -->
|
@ -1,140 +0,0 @@
|
||||
|
||||
<!-- affichage du detail de la fiche frais / Derniere modification le 03/05/2023 à 11H01 par Pascal BLAIN -->
|
||||
<div class="encadre">
|
||||
<!-- ============================================================== frais forfaitaires -->
|
||||
<table class="listeLegere">
|
||||
<caption><h3> Éléments forfaitisés
|
||||
<?php
|
||||
if ($ajoutFraisPossible['forfait']=="oui") echo '
|
||||
<a href="index.php?uc=gererFraisForfaitaire&action=choix" title="ajout frais forfaitaire">
|
||||
<img alt="Ajouter un frais forfaitaire" src="images/ajouter.jpg" border="0"> </a>
|
||||
';?></h3>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="date">Quantité</th>
|
||||
<th class="eltForfait">Nature de la dépense</th>
|
||||
<th class="montant">Prix</th>
|
||||
<th class="montant">Montant</th>
|
||||
<?php
|
||||
if ($ajoutFraisPossible['horsForfait']=="oui" or $ajoutFraisPossible['modifComptable']=="oui") {echo '
|
||||
<th> </th>
|
||||
<th> </th>';} ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
$totalFraisForfait=0;
|
||||
foreach ( $lesFraisForfait as $unFraisForfait )
|
||||
{ echo '
|
||||
<tr>
|
||||
<td align="right">'.$unFraisForfait['lfQuantite'].'</td>
|
||||
<td>'.$unFraisForfait['fLibelle'].'</td>
|
||||
<td align="right">'.number_format($unFraisForfait['lfMontant'],2,',','.').'</td>
|
||||
<td align="right">'.number_format($unFraisForfait['totalLigne'],2,',','.').'</td>';
|
||||
|
||||
if ($ajoutFraisPossible['horsForfait']=="oui" or $ajoutFraisPossible['modifComptable']=="oui") echo '
|
||||
<td><a href="index.php?uc=gererFraisForfaitaire&action=editer&forfait='.$unFraisForfait['idfrais'].'"><img alt="modifier" src="images/editer.jpg" border="0"></a></td>
|
||||
<td><a href="index.php?uc=gererFraisForfaitaire&action=supprimer&forfait='.$unFraisForfait['idfrais'].'"><img alt="supprimer" src="images/supprimer.jpg" border="0"></a></td>';
|
||||
|
||||
echo '
|
||||
</tr>';
|
||||
$totalFraisForfait=$totalFraisForfait + $unFraisForfait['totalLigne'];
|
||||
}
|
||||
echo '
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td align="right"><b>Total</b></td>
|
||||
<td align="right"><b>'.number_format($totalFraisForfait,2,',','.').'</b></td>';
|
||||
|
||||
if ($ajoutFraisPossible['horsForfait']=="oui" or $ajoutFraisPossible['modifComptable']=="oui") {echo '
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>';}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- ============================================================== rappel des elements du remboursement -->
|
||||
<form name="autresfrais" action="index.php?uc=etatFrais&action=validerEtat" method="post">
|
||||
<div id="menu">
|
||||
<ul>
|
||||
<li>Etat : <b><?php echo $libEtat;?> </b></li>
|
||||
<li>depuis le :<br /><b><?php echo $dateModif;?></b> </li>
|
||||
<li>Justificatifs : <b><?php echo $nbJustificatifs; ?></b></li>
|
||||
<li>Montant validé : <br /><b><?php echo number_format($montantValide,2,',','.').' €';?></b> </li><br />
|
||||
<?php
|
||||
if ($ajoutFraisPossible['modifComptable']=="oui") { echo '
|
||||
<li style="list-style-type:none;"><img alt="validation de la demande de remboursement" src="images/validation.jpg" onClick="document.autresfrais.submit();"></li>';}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- ============================================================== frais hors forfaits -->
|
||||
<table class="listeLegere">
|
||||
<caption><h3> Autres dépenses (hors forfaits)
|
||||
<?php
|
||||
if ($ajoutFraisPossible['horsForfait']=="oui") echo '
|
||||
<a href="index.php?uc=gererFraisHorsForfait&action=ajouter" title="ajout frais hors forfait">
|
||||
<img alt="Ajouter un frais hors forfait" src="images/ajouter.jpg" border="0"> </a>
|
||||
';?></h3>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="date">Date</th>
|
||||
<th class="libelle">Nature de la dépense</th>
|
||||
<th class="montant">Montant</th>
|
||||
<?php
|
||||
if ($ajoutFraisPossible['horsForfait']=="oui" or $ajoutFraisPossible['modifComptable']=="oui") {echo '
|
||||
<th> </th>
|
||||
<th> </th>';}
|
||||
if ($ajoutFraisPossible['modifComptable']=="oui") {echo '
|
||||
<th><img name="zTous" alt="valider tous les justificatifs" src="images/cocheB.gif" width="20px" onClick="tousLesJustificatifs(document.autresfrais);" onMouseOver="src=\'images/cocheR.gif\'" onMouseOut="src=\'images/cocheB.gif\'">
|
||||
<input type="hidden" name="zSens" value="on"></th>';}
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$totalFraisHorsForfait=0;
|
||||
foreach ( $lesFraisHorsForfait as $unFraisHorsForfait )
|
||||
{if (substr($unFraisHorsForfait['lhLibelle'],0,6)<>'REFUSE') {$td='<td style="text-decoration:none;"';} else {$td='<td style="text-decoration:line-through; color:red;"';}
|
||||
echo '<tr>'.
|
||||
$td.'>'.$unFraisHorsForfait['lhDate'].'</td>'.
|
||||
$td.'>'.$unFraisHorsForfait['lhLibelle'].'</td>'.
|
||||
$td.' align="right">'.number_format($unFraisHorsForfait['lhMontant'],2,',','.').'</td>';
|
||||
|
||||
if ($ajoutFraisPossible['horsForfait']=="oui" or $ajoutFraisPossible['modifComptable']=="oui")
|
||||
{echo '
|
||||
<td><a href="index.php?uc=gererFraisHorsForfait&action=editer&idFrais='.$unFraisHorsForfait['lhId'].'"><img alt="modifier" src="images/editer.jpg" border="0"></a></td>
|
||||
<td><img alt="supprimer" src="images/supprimer.jpg" border="0"></td>';
|
||||
}
|
||||
if ($ajoutFraisPossible['modifComptable']=="oui")
|
||||
{if (substr($unFraisHorsForfait['lhLibelle'],0,6)<>'REFUSE')
|
||||
{echo '<td><input type="checkbox" name="justificatifs[]" value="'.$unFraisHorsForfait['lhId'].'" checked onClick=""></td>';}
|
||||
else
|
||||
{echo '<td> </td>';}
|
||||
}
|
||||
$totalFraisHorsForfait=$totalFraisHorsForfait + $unFraisHorsForfait['lhMontant']; echo '
|
||||
</tr>';
|
||||
}
|
||||
echo '
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td align="right"><b>Total</b></td>
|
||||
<td align="right"><b>'.number_format($totalFraisHorsForfait,2,',','.').'</b></td>';
|
||||
if ($ajoutFraisPossible['horsForfait']=="oui" or $ajoutFraisPossible['modifComptable']=="oui") {echo '
|
||||
<td> </td>
|
||||
<td> </td>';}
|
||||
if ($ajoutFraisPossible['modifComptable']=="oui") {echo '
|
||||
<td> </td>';} echo '
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<h3 align="center"><b>Total de la demande de remboursement de frais : '.number_format($totalFraisForfait + $totalFraisHorsForfait,2,',','.').' €</b></h3>
|
||||
</form>
|
||||
|
||||
</div>'; ?>
|
@ -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>
|
4
vues/v_homePage.php
Normal file
4
vues/v_homePage.php
Normal file
@ -0,0 +1,4 @@
|
||||
<h4>BONJOUR VOUS ETES <?= strtoupper($_SESSION['uType']) ?></h4>
|
||||
<?php
|
||||
|
||||
var_dump($_SESSION);
|
155
vues/v_newFiche.php
Normal file
155
vues/v_newFiche.php
Normal file
@ -0,0 +1,155 @@
|
||||
<center>
|
||||
<h1>Fiche de frais</h1>
|
||||
<br>
|
||||
<p>Mois de
|
||||
<?= $dateHeader ?>
|
||||
</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'] ?>" <?= $disabled ?>>
|
||||
</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 table-primary"></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 <?= $value['lhRefus'] == 1 ? 'table-danger' : '' ?>">
|
||||
<th scope="row" id="dateFrsHF">
|
||||
<?= $value['lhDate'] ?>
|
||||
</th>
|
||||
<td id="LibelleFrsHF">
|
||||
<?= $value['lhLibelle'] ?>
|
||||
</td>
|
||||
<td id="MttFrsHF">
|
||||
<?= $value['lhMontant'] ?> €
|
||||
</td>
|
||||
<td>
|
||||
<?= $value['lhJustificatif'] == 1 ? 'ok' : 'non fournis' ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($typeUser === 'comptable') { ?>
|
||||
<button type="button" class="btn btn-outline-primary btnRefuseFraisHf" id="frsSup-<?= $key ?>" <?= $disabled ?>>
|
||||
Refuser
|
||||
</button>
|
||||
<?php } elseif ($typeUser === 'visiteur') { ?>
|
||||
<button type="button" class="btn btn-outline-primary btnSuprFraisHf" id="frsSup-<?= $key ?>" <?= $disabled ?>>
|
||||
Supprimer
|
||||
</button>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
<!--
|
||||
Formulaire d'ajout de frais HF
|
||||
-->
|
||||
<?php
|
||||
if ($disabled !== 'disabled'):
|
||||
?>
|
||||
<tr class="newFraisForm">
|
||||
<td>
|
||||
<!-- Date form -->
|
||||
<input name="dateHf" class="form-control" id="dateHf" type="date" min="<?= $dateFormHFMin ?>"
|
||||
max="<?= $dateFormHFMax ?>">
|
||||
</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>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<td colspan="2" class="border-0"></td>
|
||||
<td class="table-primary" id="total-frais-HF">TOTAL: 0€</td> <!--COMPLETE HERE -->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- <span class="border-3 border-bottom border-black col-10 mx-auto my-5 d-flex"></span> -->
|
||||
<!-- TOTAL -->
|
||||
<div style="position:fixed; bottom:5px; right:5px; margin:0; padding:5px 3px;">
|
||||
<button type="button" class="btn btn-primary" id="total-fiche">
|
||||
<strong>TOTAL : </strong>
|
||||
<?= $totalFraisFiche ?>
|
||||
</button>
|
||||
</div>
|
||||
<!--
|
||||
<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>
|
||||
-->
|
||||
<?php
|
||||
/**
|
||||
* Affiche le bouton si fiche non cloturé
|
||||
*/
|
||||
if ($status === 'CR'):
|
||||
?>
|
||||
<div class="col-3 d-flex mx-auto my-5 justify-content-center">
|
||||
<button type="button" class="btn btn-outline-primary btn-lg" data-uType="<?= $typeUser ?>">Envoyer la Fiche
|
||||
</button>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<script src="../include/newFiche.js"></script>
|
Reference in New Issue
Block a user