Compare commits
4 Commits
4eac346ff2
...
v0.0.1h-tg
Author | SHA1 | Date | |
---|---|---|---|
af3771e786 | |||
8aafdf565b | |||
|
a2201a4eb3 | ||
|
89273aced9 |
@@ -20,7 +20,7 @@ class Class_gestionFiche
|
||||
|
||||
public function get_ListesFiches(string $idUtilisateur): array
|
||||
{
|
||||
$req = 'SELECT "rMois", "rEtat","rNbJustificatifs","rMontantValide","eLibelle"
|
||||
$req = 'SELECT "rMois", "rEtat", "rNbJustificatifs", ROUND("rMontantValide", 2) as "rMontantValide", "eLibelle"
|
||||
FROM remboursement
|
||||
INNER JOIN etat ON etat."eId"=remboursement."rEtat"
|
||||
WHERE "rVisiteur"= :userId
|
||||
@@ -33,5 +33,23 @@ class Class_gestionFiche
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
public function dateComplete(string $date) : string
|
||||
{
|
||||
return substr($date, 0, 4) . '-' . substr($date, 4);
|
||||
}
|
||||
|
||||
public function get_ficheAvalider() : array
|
||||
{
|
||||
$req = 'SELECT "rMois", "rVisiteur", "rEtat", ROUND("rMontantValide", 2) as "rMontantValide", "eLibelle", "uNom", "uPrenom"
|
||||
from remboursement
|
||||
INNER JOIN utilisateur ON utilisateur."uId"=remboursement."rVisiteur"
|
||||
INNER JOIN etat ON etat."eId"=remboursement."rEtat"
|
||||
where "rEtat"=\'CL\'
|
||||
ORDER BY "rMois" ASC';
|
||||
$result = $this->pdo->prepare($req);
|
||||
$result ->execute();
|
||||
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
}
|
@@ -13,7 +13,7 @@ class Class_user
|
||||
$this->pdo = $pDO->getPdoGsb();
|
||||
}
|
||||
|
||||
public function connectUser(string $login, string $password): array
|
||||
public function connectUser(string $login, string $password): array|bool
|
||||
{
|
||||
$req = 'SELECT "uId", "uNom", "uPrenom", "uAdresse", "uCp", "uVille", "uSecteur", "uLabo", "parametre"."pLibelle"
|
||||
FROM utilisateur
|
||||
|
@@ -6,6 +6,11 @@ if (isset($_POST['login']) && isset($_POST['password'])) {
|
||||
//Récupère les données de l'utilisateur
|
||||
$data = $userClass->connectUser($_POST['login'], $_POST['password']);
|
||||
|
||||
if($data == false) {
|
||||
header('location: index.php');
|
||||
}
|
||||
|
||||
|
||||
//Si l'utilisateur existe ou pas
|
||||
if (count($data) === 0) {
|
||||
header('location: index.php?direction=connexion&msg=errorco');
|
||||
|
23
controleurs/c_ficheAvalider.php
Normal file
23
controleurs/c_ficheAvalider.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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 (isset($_REQUEST['selVisiteur'])) {
|
||||
$userId = $_REQUEST['selVisiteur'];
|
||||
} else {
|
||||
$userId = $LesUtilisateurs[0]['uId'];
|
||||
}
|
||||
} else {
|
||||
$userId = $_SESSION['uId'];
|
||||
}
|
||||
|
||||
$lesFiches = $gestionFiche->get_ficheAvalider();
|
||||
|
||||
|
||||
|
||||
include("vues/v_fichesAvalider.php");
|
@@ -1,19 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* sudo date --set "YYYY-MM-DD HH:MM:SS"
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . '/../Class/class.newFiche.php');
|
||||
|
||||
$typeUser = $_SESSION['uType']; //visiteur ou comptable
|
||||
// $typeUser = 'comptable';//$_SESSION['uType']; //visiteur ou comptable
|
||||
$typeUser = 'visiteur';//$_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 en français
|
||||
try {
|
||||
//Timestamp de la date
|
||||
$dateTimeStamp = strtotime(date('Y-m-\01'));
|
||||
|
||||
//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'])) {
|
||||
//Données pour nourire la vue
|
||||
$userId = $_REQUEST['userId'];
|
||||
$date = $_REQUEST['dateListing'];
|
||||
|
||||
//Timestamp de la date
|
||||
$dateTimeStamp = strtotime(substr($date, 0, 4) . '-' . substr($date, 4) . '-01');
|
||||
|
||||
//Date du formulaire HF
|
||||
$dateFormHFMin = substr($date, 0, 4) . '-' . substr($date, 4) . '-01';
|
||||
$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
|
||||
$format = new IntlDateFormatter(
|
||||
'fr_FR',
|
||||
@@ -23,18 +48,10 @@ if (isset($_GET['currentList'])) {
|
||||
IntlDateFormatter::GREGORIAN,
|
||||
'MMMM Y'
|
||||
);
|
||||
$dateHeader = $format->format(time());
|
||||
$dateHeader = $format->format($dateFormat);
|
||||
|
||||
} 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'];
|
||||
} catch (\Throwable $th) {
|
||||
$dateHeader = date('F Y', $dateTimeStamp);
|
||||
}
|
||||
|
||||
//$date = '202312'; //TESTVAR
|
||||
|
@@ -13,7 +13,7 @@
|
||||
Partie visiteur
|
||||
-->
|
||||
<?php
|
||||
if($_SESSION['typeU'] == 'visiteur'):
|
||||
if($_SESSION['uType'] == 'visiteur'):
|
||||
?>
|
||||
<li>
|
||||
<a href="#submenu1" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
|
||||
@@ -34,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'): ?>
|
||||
<?php endif; if ($_SESSION['uType'] == 'comptable'): ?>
|
||||
<!--
|
||||
Partie comptable
|
||||
-->
|
||||
@@ -48,7 +48,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="nav-link px-0"> <span class="d-none d-sm-inline">Historique</span>
|
||||
<a href="index.php?direction=ficheAvalider" class="nav-link px-0"> <span class="d-none d-sm-inline">fiches a vérifier</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@@ -195,6 +195,12 @@ function calcPrixTotalFrsF() {
|
||||
*/
|
||||
function calcPrixTotalFrsHorsF() {
|
||||
|
||||
console.log($('td#MttFrsHF').length)
|
||||
|
||||
if ($('td#MttFrsHF').length == 0) {
|
||||
vf
|
||||
}
|
||||
|
||||
var prixTotal = 0;
|
||||
$('td#MttFrsHF').each(function () {
|
||||
prixTotal += parseFloat($(this).html().replace('€', ''))
|
||||
|
@@ -71,6 +71,10 @@ if (!isset($_REQUEST['direction']) && !isset($_SESSION['uId'])) {
|
||||
include(__DIR__ . "/controleurs/c_nouvelleFiche.php");
|
||||
break;
|
||||
|
||||
case 'ficheAvalider':
|
||||
include(__DIR__ . "/controleurs/c_ficheAvalider.php");
|
||||
break;
|
||||
|
||||
default:
|
||||
include("controleurs/c_homePage.php");
|
||||
break;
|
||||
|
35
vues/v_fichesAvalider.php
Normal file
35
vues/v_fichesAvalider.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class="col-11 d-flex mx-auto">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Mois</th>
|
||||
<th scope="col">Nom Fiche</th>
|
||||
<th scope="col">Total</th>
|
||||
<th scope="col">Statut</th>
|
||||
<th scope="col">Détails</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($lesFiches as $uneFiche) { ?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?= $gestionFiche->dateComplete($uneFiche['rMois']) ?>
|
||||
</th>
|
||||
<td>
|
||||
<?= $uneFiche['uNom'] ?>
|
||||
<?= $uneFiche['uPrenom'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $uneFiche['rMontantValide'] ?> €
|
||||
</td>
|
||||
<td>
|
||||
<?= $uneFiche['eLibelle'] ?>
|
||||
</td>
|
||||
<td><a
|
||||
href="index.php?direction=nouvelleFiche&userId=<?= $userId ?>&dateListing=<?= $uneFiche['rMois'] ?>">voir</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
@@ -45,7 +45,7 @@
|
||||
<?php foreach ($lesFiches as $uneFiche) { ?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?= $uneFiche['rMois'] ?>
|
||||
<?= $gestionFiche->dateComplete($uneFiche['rMois']) ?>
|
||||
</th>
|
||||
<td>
|
||||
<?= $uneFiche['rMontantValide'] ?> €
|
||||
@@ -54,7 +54,7 @@
|
||||
<?= $uneFiche['eLibelle'] ?>
|
||||
</td>
|
||||
<td><a
|
||||
href="controleurs\c_nouvelleFiche.php?userId=<?= $userId ?>&dateListing=<?= $uneFiche['rMois'] ?>">voir</a>
|
||||
href="index.php?direction=nouvelleFiche&userId=<?= $userId ?>&dateListing=<?= $uneFiche['rMois'] ?>">voir</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
Reference in New Issue
Block a user