Compare commits
10 Commits
v1.0.0a
...
0970030669
Author | SHA1 | Date | |
---|---|---|---|
0970030669 | |||
1acc68b01b | |||
5fccd17767 | |||
|
2819759da7 | ||
e4574d7ff4 | |||
|
db1c54c442 | ||
|
0859a68948 | ||
77d482c5dc | |||
1a78fb2726 | |||
|
865134080e |
@@ -12,6 +12,10 @@ class Class_gestionFiche
|
||||
$this->pdo = $pDO->getPdoGsb();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Récupère tous les utilisateurs différents de 0
|
||||
*/
|
||||
public function getLesUtilisateurs(): array
|
||||
{
|
||||
$req = 'SELECT "uId", "uNom", "uPrenom" FROM utilisateur WHERE "uStatut"!=0 ORDER BY "uNom" ASC;';
|
||||
@@ -21,11 +25,15 @@ class Class_gestionFiche
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
//Mode d'affichage de la date
|
||||
public function dateComplete(string $date): string
|
||||
{
|
||||
return substr($date, 0, 4) . '-' . substr($date, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les fiches a valider par le comptable et sépare les fiches de 12 en 12
|
||||
*/
|
||||
public function get_ficheAvalider(int $nPage): array
|
||||
{
|
||||
$decalage = ($nPage - 1) * $this::$NB_LIGNES_FICHEAVALIDER;
|
||||
@@ -45,6 +53,9 @@ class Class_gestionFiche
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère toutes les fiches a valider avec comme état "CL"
|
||||
*/
|
||||
public function get_nbFicheAvalider(): int
|
||||
{
|
||||
$req = 'SELECT COUNT(*) as "nbFicheAvalider" from remboursement
|
||||
@@ -56,6 +67,9 @@ class Class_gestionFiche
|
||||
return (int) $result['nbFicheAvalider'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère toutes les fiches remboursées
|
||||
*/
|
||||
public function get_nbRemboursement(string $idUtilisateur): int
|
||||
{
|
||||
$req = 'SELECT COUNT(*) as "nbRemboursement" from remboursement WHERE "rVisiteur"= :userId;';
|
||||
@@ -67,15 +81,19 @@ class Class_gestionFiche
|
||||
return (int) $result['nbRemboursement'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère le nombre de page a afficher en fonction du nombre de remboursement et du décallage de 12 en 12
|
||||
*/
|
||||
public function get_Page(int $nPage, string $idUtilisateur): array
|
||||
{
|
||||
$decalage = ($nPage - 1) * $this::$NB_LIGNES_PAGINATION;
|
||||
|
||||
$req = 'SELECT "rMois", "rVisiteur", "rEtat", ROUND("rMontantValide", 2)
|
||||
as "rMontantValide", "eLibelle"
|
||||
FROM remboursement
|
||||
INNER JOIN etat ON etat."eId"=remboursement."rEtat"
|
||||
WHERE "rVisiteur"= :userId
|
||||
ORDER BY "rDateModif" DESC LIMIT :nbLignes offset :decalage;';
|
||||
ORDER BY "rMois" DESC LIMIT :nbLignes offset :decalage;';
|
||||
$result = $this->pdo->prepare($req);
|
||||
$result->bindParam('nbLignes', $this::$NB_LIGNES_PAGINATION);
|
||||
$result->bindParam('decalage', $decalage);
|
||||
|
@@ -109,9 +109,10 @@ class Class_newFiche
|
||||
/**
|
||||
* RETOURNE LE STATUS DE LA FICHE
|
||||
*/
|
||||
public function getStatus(): string
|
||||
public function getStatus(): array
|
||||
{
|
||||
$req = 'select etat."eId" from remboursement
|
||||
$req = 'SELECT etat."eId" , etat."eLibelle"
|
||||
from remboursement
|
||||
INNER JOIN etat on etat."eId" = remboursement."rEtat"
|
||||
WHERE "rVisiteur" = :idVisiteur AND "rMois" = :mois;';
|
||||
|
||||
@@ -120,13 +121,13 @@ class Class_newFiche
|
||||
$result->bindParam(':mois', $this->month);
|
||||
$result->execute();
|
||||
|
||||
return $result->fetch()['eId'];
|
||||
return $result->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* UPDATE LES INFOS DE LA FICHE
|
||||
*/
|
||||
public function updateFile(int $nbJustif, float $mttValid): bool
|
||||
public function updateRemboursement(int $nbJustif, float $mttValid): bool
|
||||
{
|
||||
$req = 'UPDATE remboursement
|
||||
SET "rNbJustificatifs" = :nbJustif,
|
||||
|
@@ -17,8 +17,6 @@ class PdoGsb
|
||||
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()
|
||||
{
|
||||
|
@@ -26,7 +26,27 @@ class Class_user
|
||||
$result->bindParam('login', $login);
|
||||
$result->bindParam('pwd', $password);
|
||||
$result->execute();
|
||||
$result = $result->fetch();
|
||||
|
||||
return $result->fetch();
|
||||
if ($result['pLibelle'] == 'comptable') {
|
||||
$this->updateBdd();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function updateBdd(): void
|
||||
{
|
||||
$curMonth = date('Ym');
|
||||
$prevMonth = DateTime::createFromFormat('Ym', $curMonth);
|
||||
$prevMonth->modify('first day of last month');
|
||||
|
||||
$prevMonth = $prevMonth->format('Ym');
|
||||
|
||||
$req = 'SELECT updateEtat(:currentMonth, :previousMonth)';
|
||||
$result = $this->pdo->prepare($req);
|
||||
$result->bindParam('currentMonth', $curMonth);
|
||||
$result->bindParam('previousMonth', $prevMonth);
|
||||
$result->execute();
|
||||
}
|
||||
}
|
||||
|
@@ -11,8 +11,10 @@ $pdoNewFiche = new Class_newFiche($pdo, $id[0], $id[1]);
|
||||
|
||||
switch ($_GET['action']) {
|
||||
case 'update':
|
||||
$mttValid = 0;
|
||||
//FRAIS FORFAITAIRES
|
||||
foreach ($_REQUEST['fraisF'] as $value) {
|
||||
$mttValid = $mttValid + $value['montant'];
|
||||
$pdoNewFiche->updateFraisF(
|
||||
$value['quantité'],
|
||||
intval($value['montant']),
|
||||
@@ -20,8 +22,12 @@ switch ($_GET['action']) {
|
||||
);
|
||||
}
|
||||
//FRAIS HORS FORFAIT
|
||||
$nbJustif = 0;
|
||||
foreach ($_REQUEST['fraisHF'] as $value) {
|
||||
//SI le fraisHf ne possède pas d'id de la bdd
|
||||
if ($value['id'] == NULL) {
|
||||
$mttValid = $mttValid + $value['montant'];
|
||||
$nbJustif = $nbJustif + 1;
|
||||
$pdoNewFiche->addFraisHF(
|
||||
$value['libelle'],
|
||||
$value['date'],
|
||||
@@ -29,9 +35,13 @@ switch ($_GET['action']) {
|
||||
);
|
||||
}
|
||||
}
|
||||
//mise a jour de la fiche remboursement
|
||||
$pdoNewFiche->updateRemboursement($nbJustif, $mttValid);
|
||||
|
||||
break;
|
||||
case 'suprFraisHF':
|
||||
$pdoNewFiche->suprLigneHF($_GET['idFrais']);
|
||||
$pdoNewFiche->updateRemboursement($_GET['$nbJustif'], $_GET['mttValid']);
|
||||
break;
|
||||
case 'refusFraisHF':
|
||||
$pdoNewFiche->accceptFrais(
|
||||
|
@@ -10,7 +10,6 @@ if (isset($_POST['login']) && isset($_POST['password'])) {
|
||||
header('location: index.php');
|
||||
}
|
||||
|
||||
|
||||
//Si l'utilisateur existe ou pas
|
||||
if (count($data) === 0) {
|
||||
header('location: index.php?direction=connexion&msg=errorco');
|
||||
|
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
$_SESSION["typeU"] = "comptable";
|
||||
|
||||
require_once(__DIR__ . '/../Class/class.gestionFiche.php');
|
||||
$gestionFiche = new Class_gestionFiche($pdo);
|
||||
|
||||
$LesUtilisateurs = $gestionFiche->getLesUtilisateurs(); //RENVOIE LISTE USERS
|
||||
|
||||
if ($_SESSION["typeU"] == "comptable") {
|
||||
if ($_SESSION["uType"] == "comptable") {
|
||||
if (isset($_REQUEST['selVisiteur'])) {
|
||||
$userId = $_REQUEST['selVisiteur'];
|
||||
} else {
|
||||
|
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* sudo date --set "YYYY-MM-DD HH:MM:SS"
|
||||
* sudo apt install php8.2-intl
|
||||
* sudo service apache2 restart
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . '/../Class/class.newFiche.php');
|
||||
@@ -24,7 +26,7 @@ if (isset($_GET['currentList'])) {
|
||||
$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'])) {
|
||||
//Données pour nourire la vue
|
||||
//Données pour nourir la vue
|
||||
$userId = $_REQUEST['userId'];
|
||||
$date = $_REQUEST['dateListing'];
|
||||
|
||||
@@ -36,11 +38,10 @@ if (isset($_GET['currentList'])) {
|
||||
$dateFormHFMax = date("Y-m-t", mktime(0, 0, 0, date('m', $dateTimeStamp), 1, date('Y', $dateTimeStamp))); // retourne le dernier jour du mois (30 ou 31)
|
||||
|
||||
}
|
||||
|
||||
//Date du header en français
|
||||
try {
|
||||
//sudo timedatectl set-local-rtc 1
|
||||
//sudo apt install php8.2-intl
|
||||
//sudo service apache2 restart
|
||||
|
||||
$format = new IntlDateFormatter(
|
||||
'fr_FR',
|
||||
IntlDateFormatter::FULL,
|
||||
@@ -80,6 +81,14 @@ $totalFraisFiche = $newFiche->getMontantValide();
|
||||
* ETAT DE LA FICHE
|
||||
*/
|
||||
$status = $newFiche->getStatus();
|
||||
$disabled = ($status !== 'CR') ? 'disabled' : '';
|
||||
if (
|
||||
($status['eId'] == 'CL' && $typeUser == 'comptable')
|
||||
|| ($status['eId'] == 'CR' && $typeUser == 'visiteur')
|
||||
){
|
||||
$disabled = '';
|
||||
} else {
|
||||
$disabled = 'disabled';
|
||||
}
|
||||
|
||||
|
||||
include(__DIR__ . '/../vues/v_newFiche.php');
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<div class="col-auto col-md-3 col-xl-2 px-sm-2 px-0 bg-dark">
|
||||
<div class="d-flex flex-column align-items-center align-items-sm-start px-3 pt-2 text-white min-vh-100">
|
||||
<a href="/" class="d-flex align-items-center pb-3 mb-md-0 me-md-auto text-white text-decoration-none">
|
||||
<a href="http://localhost:2080/gsb/AP44/index.php?direction=home" class="d-flex align-items-center pb-3 mb-md-0 me-md-auto text-white text-decoration-none">
|
||||
<strong><span class="fs-5 d-none d-sm-inline">GSB LABORATOIRE</span></strong>
|
||||
</a>
|
||||
<div class="dropdown pb-4">
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-dark text-small shadow" aria-labelledby="dropdownUser1">
|
||||
<li><a class="dropdown-item" href="controleurs/c_deconnexion.php">Sign out</a></li>
|
||||
<li><a class="dropdown-item" href="controleurs/c_deconnexion.php">Déconnexion</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<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">
|
||||
<i class="fs-4 bi-house"></i> <span class="ms-1 d-none d-sm-inline">Home</span>
|
||||
<i class="fs-4 bi-house"></i> <span class="ms-1 d-none d-sm-inline">Accueil</span>
|
||||
</a>
|
||||
</li>
|
||||
<!--
|
||||
@@ -64,12 +64,12 @@
|
||||
<ul class="collapse show nav flex-column ms-1" id="submenu2" data-bs-parent="#menu">
|
||||
<li class="w-100">
|
||||
<a href="index.php?direction=gestionFiche" class="nav-link px-0"> <span
|
||||
class="d-none d-sm-inline">A valider</span>
|
||||
class="d-none d-sm-inline">gestion des fiches</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="index.php?direction=ficheAvalider" class="nav-link px-0"> <span
|
||||
class="d-none d-sm-inline">fiches a vérifier</span>
|
||||
class="d-none d-sm-inline">fiches à valider</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@@ -174,7 +174,7 @@ $(document).on('click', '#sendFileBtn', function () {
|
||||
method: "POST",
|
||||
data: data,
|
||||
}).done(function () {
|
||||
location.reload();
|
||||
//location.reload();
|
||||
})
|
||||
})
|
||||
|
||||
@@ -197,9 +197,9 @@ function calcPrixTotalFrsHorsF() {
|
||||
|
||||
console.log($('td#MttFrsHF').length)
|
||||
|
||||
if ($('td#MttFrsHF').length == 0) {
|
||||
vf
|
||||
}
|
||||
// if ($('td#MttFrsHF').length == 0) {
|
||||
// vf
|
||||
// }
|
||||
|
||||
var prixTotal = 0;
|
||||
$('td#MttFrsHF').each(function () {
|
||||
|
@@ -30,7 +30,59 @@ $$ LANGUAGE 'plpgsql';
|
||||
|
||||
|
||||
|
||||
--Fonction pour passer les fiches de "créé" à "saisi cloturé" ET passe les frais HF sur la fiche suivante
|
||||
--dateN -> '202403'
|
||||
CREATE OR REPLACE FUNCTION updateEtat(curMonth varchar(6), prevMonth varchar(6)) RETURNS bool AS $$
|
||||
DECLARE
|
||||
"listeVisiteur" RECORD;
|
||||
curMontantValid FLOAT;
|
||||
oldMontantValid FLOAT;
|
||||
BEGIN
|
||||
--Update les fiches Créées en cloturé si la date est inf au mois courant
|
||||
UPDATE remboursement
|
||||
SET "rEtat" = 'CL'
|
||||
WHERE "rEtat" = 'CR' AND "rMois" < curMonth;
|
||||
|
||||
--Crée une Fiche pour tous les visiteurs qui n'ont pas de fiches mais dont les frais HF doivent être reportés
|
||||
FOR "listeVisiteur" IN
|
||||
SELECT "rVisiteur", SUM("lhMontant") as "montant" FROM remboursement
|
||||
INNER JOIN ligne_hors_forfait ON "rVisiteur" = "lhVisiteur" AND "rMois" = "lhMois"
|
||||
WHERE "rMois" <= curMonth AND "rEtat" = 'CL' AND "lhJustificatif" = FALSE AND "lhRefus" = FALSE
|
||||
GROUP BY "rVisiteur"
|
||||
LOOP
|
||||
--Crée la demande si elle n'existe pas
|
||||
PERFORM newRemboursement("listeVisiteur"."rVisiteur", curMonth);
|
||||
--RECUP l'ancien montant
|
||||
SELECT "rMontantValide" INTO curMontantValid
|
||||
FROM remboursement
|
||||
WHERE "rVisiteur" = "listeVisiteur"."rVisiteur" AND "rMois" = curMonth;
|
||||
|
||||
SELECT "rMontantValide" INTO oldMontantValid
|
||||
FROM remboursement
|
||||
WHERE "rVisiteur" = "listeVisiteur"."rVisiteur" AND "rMois" = prevMonth;
|
||||
--Actualise les montants totaux de remboursement
|
||||
UPDATE remboursement
|
||||
SET "rMontantValide" = curMontantValid + "listeVisiteur"."montant"
|
||||
WHERE "rVisiteur" = "listeVisiteur"."rVisiteur" AND "rMois" = curMonth;
|
||||
|
||||
UPDATE remboursement
|
||||
SET "rMontantValide" = oldMontantValid - "listeVisiteur"."montant"
|
||||
WHERE "rVisiteur" = "listeVisiteur"."rVisiteur" AND "rMois" = prevMonth;
|
||||
END LOOP;
|
||||
|
||||
--Passe les lignes HF non validé avec justif
|
||||
UPDATE ligne_hors_forfait
|
||||
SET "lhMois" = curMonth
|
||||
WHERE "lhMois" <= prevMonth AND "lhJustificatif" = FALSE AND "lhRefus" = FALSE;
|
||||
|
||||
--Passe le remboursement en validé
|
||||
UPDATE remboursement
|
||||
SET "rEtat" = 'VA'
|
||||
WHERE "rEtat" = 'CL' AND "rMois" < prevMonth;
|
||||
|
||||
RETURN true;
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
|
||||
|
||||
|
||||
|
@@ -1,10 +0,0 @@
|
||||
<div class ="erreur">
|
||||
<ul>
|
||||
<?php
|
||||
foreach($_REQUEST['erreurs'] as $erreur)
|
||||
{
|
||||
echo "<li>$erreur</li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
@@ -66,7 +66,7 @@
|
||||
PAGINATION:
|
||||
-->
|
||||
|
||||
<?php if ($pages > 0) { ?>
|
||||
<?php if ($pages > 1) { ?>
|
||||
<div class="col-4 d-flex mx-auto">
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
|
@@ -8,6 +8,11 @@
|
||||
ID:
|
||||
<?= $userId . '-' . $date ?>
|
||||
</p>
|
||||
<p class="color-grey" id='idFiche'>
|
||||
Status:
|
||||
<?= $status['eLibelle'] ?>
|
||||
</p>
|
||||
|
||||
</center>
|
||||
<br>
|
||||
<!--
|
||||
@@ -147,7 +152,7 @@
|
||||
/**
|
||||
* Affiche le bouton si fiche non cloturé
|
||||
*/
|
||||
if ($status === 'CR'):
|
||||
if ($disabled == ''):
|
||||
?>
|
||||
<div class="col-3 d-flex mx-auto my-5 justify-content-center">
|
||||
<button type="button" class="btn btn-outline-primary btn-lg" id="sendFileBtn" data-uType="<?= $typeUser ?>">Envoyer
|
||||
|
Reference in New Issue
Block a user