4 Commits

Author SHA1 Message Date
4eac346ff2 ajout liste selon utilisateur 2024-01-11 09:13:35 +01:00
63eddbbc8b ajout liste gestion fiche 2024-01-09 13:04:51 +01:00
pierre renaudot
aa49401a47 bug correction 2024-01-09 10:52:03 +01:00
Pierr0
fcf292e823 correction bugs page newFiche 2024-01-07 16:26:43 +01:00
8 changed files with 118 additions and 67 deletions

View File

@@ -18,9 +18,20 @@ class Class_gestionFiche
return $result->fetchAll();
}
public function utilisateur(string $idUtilisateur): array
public function get_ListesFiches(string $idUtilisateur): array
{
$req = '';
$req = 'SELECT "rMois", "rEtat","rNbJustificatifs","rMontantValide","eLibelle"
FROM remboursement
INNER JOIN etat ON etat."eId"=remboursement."rEtat"
WHERE "rVisiteur"= :userId
ORDER BY "rMois" DESC';
$result = $this->pdo->prepare($req);
$result ->bindParam("userId", $idUtilisateur);
$result ->execute();
return $result->fetchAll();
}
}

View File

@@ -175,12 +175,11 @@ class Class_newFiche
{
$req = 'UPDATE ligne_hors_forfait
SET "lhRefus" = :stateF
WHERE "rVisiteur" = :userId AND "rMois" = :monthF AND "lhId" = :idFrais;';
WHERE "lhId" = :idFrais;';
$result = $this->pdo->prepare($req);
$state = ($state) ? 'false' : 'true';
$result->bindParam(':stateF', $state);
$result->bindParam(':idFrais', $idFrais);
$result->bindParam(':userId', $this->userId);
$result->bindParam(':monthF', $this->month);
return $result->execute();
}

View File

@@ -33,6 +33,12 @@ switch ($_GET['action']) {
case 'suprFraisHF':
$pdoNewFiche->suprLigneHF($_GET['idFrais']);
break;
case 'refusFraisHF':
$pdoNewFiche->accceptFrais(
$_GET['idFrais'],
boolval($_GET['state'])
);
break;
default:
# code...

View File

@@ -1,9 +1,23 @@
<?php
$_SESSION ["typeU"] = "comptable";
$_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_ListesFiches($userId);
include("vues/v_gestionFiches.php");

View File

@@ -2,7 +2,7 @@
require_once(__DIR__ . '/../Class/class.newFiche.php');
$typeUser = $_SESSION['uType']; //visiteur ou comptable
//$typeUser = 'comptable';//$_SESSION['uType']; //visiteur ou comptable
// $typeUser = 'comptable';//$_SESSION['uType']; //visiteur ou comptable
$userId = $_SESSION['uId']; //exemple: 'b34'
/**
@@ -37,7 +37,7 @@ if (isset($_GET['currentList'])) {
$date = $_GET['dateListing'];
}
$date = '202312'; //TESTVAR
//$date = '202312'; //TESTVAR
//Instance de l'objet newFiche qui gère toute la partie bdd
$newFiche = new Class_newFiche($pdo, $userId, $date);

View File

@@ -88,9 +88,25 @@ $(document).ready(function () {
calcPrixTotalFrsHorsF();
updatePrixTotal();
})
})
/**
* Refus d'un frais HF pour un comptable
*/
$(document).on('click', '.btnRefuseFraisHf', function () {
idFrais = $(this).parent().parent().attr('data-id')
fiche = $('#idFiche').attr('data-id')
etatLigne = $(this).attr('data-status')
console.log(etatLigne)
//set on refus
$.ajax({
// url: "../controleurs/c_actionFiche.php?action=refusFraisHF&fiche=" + fiche + "&idFrais=" + idFrais + "&state=" + etatLigne,
url: "controleurs/c_actionFiche.php?action=refusFraisHF&fiche=" + fiche + "&idFrais=" + idFrais + "&state=" + etatLigne,
method: "POST",
}).done(function () {
location.reload();
})
})
/**
* Supprimer fraisHf
*/
@@ -100,7 +116,8 @@ $(document).on('click', '.btnSuprFraisHf', function () {
idFrais = $(this).parent().parent().attr('data-id')
//SUPPRIME DE LA BD
$.ajax({
url: "../controleurs/c_actionFiche.php?action=suprFraisHF&fiche=" + fiche + "&idFrais=" + idFrais,
url: "controleurs/c_actionFiche.php?action=suprFraisHF&fiche=" + fiche + "&idFrais=" + idFrais,
// url: "../controleurs/c_actionFiche.php?action=suprFraisHF&fiche=" + fiche + "&idFrais=" + idFrais,
method: "POST",
})
@@ -152,7 +169,8 @@ $(document).on('click', '#sendFileBtn', function () {
fiche = $('#idFiche').attr('data-id')
$.ajax({
url: "../controleurs/c_actionFiche.php?action=update&fiche=" + fiche,
url: "controleurs/c_actionFiche.php?action=update&fiche=" + fiche,
// url: "../controleurs/c_actionFiche.php?action=update&fiche=" + fiche,
method: "POST",
data: data,
}).done(function () {
@@ -166,7 +184,7 @@ $(document).on('click', '#sendFileBtn', function () {
function calcPrixTotalFrsF() {
var prixTotal = 0;
$('td[id^="totalFrs-"]').each(function () {
$('td.mttFrsTotal').each(function () {
prixTotal += parseFloat($(this).html().replace('€', ''))
})
$('.prixTotalFrsF').html('<strong>TOTAL :</strong> ' + prixTotal.toFixed(2) + ' €')

View File

@@ -4,7 +4,10 @@
<?php
if ($_SESSION['typeU'] != 'comptable') {
echo '<h3>Gérer mes fiches de frais</h3>';
} else {
} else { ?>
<form action="index.php?direction=gestionFiche" method="POST">
<?php
echo '<h3>Gérer les fiches de frais de :</h3>';
echo '<select class="form-select" name="selVisiteur" id="">';
foreach ($LesUtilisateurs as $key => $value) {
@@ -12,11 +15,18 @@
$prenom = $value['uPrenom'];
$nom = $value['uNom'];
if ($id == $userId) {
echo '<option value="' . $id . '" selected>' . $nom . " " . $prenom . "</option>";
} else {
echo '<option value="' . $id . '">' . $nom . " " . $prenom . "</option>";
}
echo '</select>';
}
echo '</select>'; ?>
<button type="submit" class="btn btn-dark m-2" >Selectionner</button>
<!-- Fin du formulaire -->
<?php }
?>
</div>
</center>
@@ -32,24 +42,22 @@
</tr>
</thead>
<tbody>
<?php foreach ($lesFiches as $uneFiche) { ?>
<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>
<th scope="row">
<?= $uneFiche['rMois'] ?>
</th>
<td>
<?= $uneFiche['rMontantValide'] ?> €
</td>
<td>
<?= $uneFiche['eLibelle'] ?>
</td>
<td><a
href="controleurs\c_nouvelleFiche.php?userId=<?= $userId ?>&dateListing=<?= $uneFiche['rMois'] ?>">voir</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>

View File

@@ -5,7 +5,8 @@
<?= $dateHeader ?>
</p>
<p class="color-grey" id='idFiche' data-id="<?= $userId . '-' . $date ?>">
ID: <?= $userId . '-' . $date ?>
ID:
<?= $userId . '-' . $date ?>
</p>
</center>
<br>
@@ -32,8 +33,8 @@
<?= $value['fLibelle'] ?>
</th>
<td>
<input type="text" name="fraisForfait" class="form-control frsFrt"
id="<?= $key ?>" value="<?= $value['lfQuantite'] ?>" <?= $disabled ?>>
<input type="text" name="fraisForfait" class="form-control frsFrt" id="<?= $key ?>"
value="<?= $value['lfQuantite'] ?>" <?= $disabled ?>>
</td>
<td id="mttFrs-<?= $key ?>" data-price="<?= $value['fMontant'] ?>">
<?= $value['fMontant'] ?> €
@@ -73,8 +74,8 @@
<?php
foreach ($listeFraisHf as $key => $value):
?>
<tr id="fraisHf-<?= $key ?>" data-id="<?= $value['lhId'] ?>" class="fraisHF <?= $value['lhRefus'] == 1 ? 'table-danger' : '' ?>"
data-id="<?= $value['lhId'] ?>">
<tr id="fraisHf-<?= $key ?>" data-id="<?= $value['lhId'] ?>"
class="fraisHF <?= $value['lhRefus'] == 1 ? 'table-danger' : '' ?>" data-id="<?= $value['lhId'] ?>">
<th scope="row" id="dateFrsHF">
<?= $value['lhDate'] ?>
</th>
@@ -90,9 +91,9 @@
<td>
<?php
if ($typeUser === 'comptable') { ?>
<button type="button" class="btn btn-outline-primary btnRefuseFraisHf" id="frsSup-<?= $key ?>"
<?= $disabled ?>>
Refuser
<button type="button" class="btn btn-outline-primary btnRefuseFraisHf"
data-status="<?= $value['lhRefus'] | 0 ?>" id="frsSup-<?= $key ?>" <?= $disabled ?>>
<?= ($value['lhRefus']) ? 'Accepter' : 'Refuser' ?>
</button>
<?php } elseif ($typeUser === 'visiteur') { ?>
<button type="button" class="btn btn-outline-primary btnSuprFraisHf" id="frsSup-<?= $key ?>"
@@ -109,7 +110,7 @@
Formulaire d'ajout de frais HF
-->
<?php
if ($disabled !== 'disabled'):
if ($disabled !== 'disabled' && $typeUser !== 'comptable'):
?>
<tr class="newFraisForm">
<td>
@@ -127,12 +128,11 @@
<?php endif ?>
<tr>
<td colspan="2" class="border-0"></td>
<td class="table-primary" id="total-frais-HF">TOTAL: 0€</td> <!--COMPLETE HERE -->
<td class="table-primary" id="total-frais-HF">TOTAL: 0€</td>
</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">
@@ -140,13 +140,6 @@
<?= $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é
@@ -154,8 +147,10 @@
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" id="sendFileBtn" data-uType="<?= $typeUser ?>">Envoyer la Fiche
<button type="button" class="btn btn-outline-primary btn-lg" id="sendFileBtn" data-uType="<?= $typeUser ?>">Envoyer
la Fiche
</button>
</div>
<?php endif ?>
<script src="../include/newFiche.js"></script>
<script src="include/newFiche.js"></script>
<!-- <script src="../include/newFiche.js"></script> -->