<?php

namespace Garradin;

use Garradin\Plugin\RecusFiscaux\Personne;
use Garradin\Plugin\RecusFiscaux\Utils;

// vérifier si le taux de réduction a été sélectionné au préalable
$_SESSION['taux_reduction'] = f('taux_reduction');
if (! isset($_SESSION['taux_reduction']) || $_SESSION['taux_reduction'] == "")
{
    \Garradin\Utils::redirect(PLUGIN_URL . 'index.php');
}

// versements par personne
$_SESSION['lesVersements'] = Utils::getVersementsPersonnes(
    $_SESSION['annee_recu'],
    'like',
    '7%',
    $champsNom);

// préparation de l'affichage
$tpl->assign('lesVersements', $_SESSION['lesVersements']);
$tpl->assign('plugin_css', ['style.css']);

// envoyer au template
$tpl->assign('plugin_config', $plugin->getConfig());
$tpl->display(PLUGIN_ROOT . '/templates/versements_personnes.tpl');