AP44/controleurs/c_actionFiche.php

40 lines
1.0 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':
//FRAIS FORFAITAIRES
foreach ($_REQUEST['fraisF'] as $value) {
$pdoNewFiche->updateFraisF(
$value['quantité'],
intval($value['montant']),
$value['id']
);
}
//FRAIS HORS FORFAIT
foreach ($_REQUEST['fraisHF'] as $value) {
if ($value['id'] == NULL) {
$pdoNewFiche->addFraisHF(
$value['libelle'],
$value['date'],
$value['montant']
);
}
}
break;
case 'suprFraisHF':
$pdoNewFiche->suprLigneHF($_GET['idFrais']);
break;
default:
# code...
break;
}