2022-01-26 12:12:42 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Garradin;
|
|
|
|
|
2022-02-19 11:19:42 +01:00
|
|
|
use Garradin\Plugin\RecusFiscaux\Activite;
|
2022-02-10 17:05:24 +01:00
|
|
|
use Garradin\Plugin\RecusFiscaux\Personne;
|
2022-02-19 11:19:42 +01:00
|
|
|
use Garradin\Plugin\RecusFiscaux\Tarif;
|
2022-01-27 09:10:00 +01:00
|
|
|
use Garradin\Plugin\RecusFiscaux\Utils;
|
2022-01-26 12:12:42 +01:00
|
|
|
|
2022-02-07 15:13:22 +01:00
|
|
|
// récupérer les infos du formulaire
|
2022-02-10 17:05:24 +01:00
|
|
|
$tarifsSelectionnes = f('tarifs') ?: [];
|
2022-02-07 14:32:17 +01:00
|
|
|
|
|
|
|
// taux de réduction associés
|
2022-02-10 17:05:24 +01:00
|
|
|
$tauxSelectionnes = array();
|
|
|
|
foreach ($tarifsSelectionnes as $idTarif) {
|
2022-02-07 14:32:17 +01:00
|
|
|
$nomRadio = "taux_reduction_" . $idTarif;
|
|
|
|
$valRadio = f("$nomRadio");
|
2022-02-18 12:51:13 +01:00
|
|
|
$tauxSelectionnes[$idTarif] = $valRadio;
|
2022-02-07 14:32:17 +01:00
|
|
|
}
|
2022-02-18 12:51:13 +01:00
|
|
|
$_SESSION['tauxSelectionnes'] = $tauxSelectionnes;
|
|
|
|
|
2022-02-10 17:05:24 +01:00
|
|
|
// obtenir les instances de tarifs correspondant à la sélection
|
|
|
|
$lesTarifs = array();
|
|
|
|
foreach (Utils::getTarifs($tarifsSelectionnes) as $ot) {
|
2022-03-25 16:09:55 +01:00
|
|
|
$lesTarifs[$ot->id] = $ot;
|
2022-02-10 17:05:24 +01:00
|
|
|
}
|
|
|
|
$_SESSION['lesTarifs'] = $lesTarifs;
|
2022-02-07 14:32:17 +01:00
|
|
|
|
2022-02-10 17:05:24 +01:00
|
|
|
// activités correspondants aux tarifs sélectionnés
|
|
|
|
$lesActivites = array();
|
|
|
|
foreach (Utils::getActivites($tarifsSelectionnes) as $activite) {
|
2022-03-25 16:09:55 +01:00
|
|
|
$lesActivites[$activite->id] = $activite;
|
2022-02-10 17:05:24 +01:00
|
|
|
}
|
|
|
|
$_SESSION['lesActivites'] = $lesActivites;
|
2022-01-26 12:12:42 +01:00
|
|
|
|
2022-02-10 17:05:24 +01:00
|
|
|
// versements correspondants aux tarifs sélectionnés
|
2022-03-18 20:39:02 +01:00
|
|
|
$_SESSION['lesVersements'] = Utils::getVersementsTarifs($_SESSION['annee_recu'],
|
|
|
|
$tarifsSelectionnes,
|
|
|
|
$champsNom);
|
2022-02-10 17:05:24 +01:00
|
|
|
|
2022-01-26 12:12:42 +01:00
|
|
|
// préparation de l'affichage
|
2022-02-10 17:05:24 +01:00
|
|
|
$tpl->assign('lesActivites', $lesActivites);
|
|
|
|
$tpl->assign('lesTarifs', $lesTarifs);
|
2022-01-26 12:12:42 +01:00
|
|
|
$tpl->assign('lesVersements', $_SESSION['lesVersements']);
|
|
|
|
$tpl->assign('plugin_css', ['style.css']);
|
|
|
|
|
|
|
|
// envoyer au template
|
2022-01-29 15:03:41 +01:00
|
|
|
$tpl->display(PLUGIN_ROOT . '/templates/versements_activites.tpl');
|