74 lines
2.2 KiB
PHP
74 lines
2.2 KiB
PHP
<?php
|
|
|
|
//var_dump($_REQUEST['fraisHF']);
|
|
require_once(__DIR__ . '/../Class/class.pdo.php');
|
|
require_once(__DIR__ . '/../Class/class.newFiche.php');
|
|
|
|
|
|
$id = explode('-', $_GET['fiche']); //id de la fiche "userID-date"
|
|
$pdo = new PdoGsb;
|
|
$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']),
|
|
$value['id']
|
|
);
|
|
}
|
|
//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'],
|
|
$value['montant']
|
|
);
|
|
}
|
|
}
|
|
//mise a jour de la fiche remboursement
|
|
$pdoNewFiche->updateRemboursement($nbJustif, $mttValid);
|
|
|
|
break;
|
|
case 'valid':
|
|
$mttValid = 0;
|
|
//FRAIS FORFAITAIRES
|
|
foreach ($_REQUEST['fraisF'] as $value) {
|
|
$mttValid = $mttValid + $value['montant'];
|
|
$pdoNewFiche->updateFraisF(
|
|
$value['quantité'],
|
|
intval($value['montant']),
|
|
$value['id']
|
|
);
|
|
}
|
|
$nbJustif = $_REQUEST['nbJustif'];
|
|
|
|
//mise a jour de la fiche remboursement
|
|
$pdoNewFiche->updateRemboursement($nbJustif, $mttValid);
|
|
$pdoNewFiche->validSheet();
|
|
|
|
break;
|
|
case 'suprFraisHF':
|
|
$pdoNewFiche->suprLigneHF($_GET['idFrais']);
|
|
$pdoNewFiche->updateRemboursement($_GET['$nbJustif'], $_GET['mttValid']);
|
|
break;
|
|
case 'refusFraisHF':
|
|
$pdoNewFiche->accceptFrais(
|
|
$_GET['idFrais'],
|
|
boolval($_GET['state'])
|
|
);
|
|
break;
|
|
|
|
default:
|
|
# code...
|
|
break;
|
|
} |