intégration comptes

FossilOrigin-Name: d81e13438cbc9ed585e76b36e2950615b8da359697f2c577673c77460b59064d
This commit is contained in:
engel 2022-05-18 10:29:19 +00:00
parent 4958b88538
commit 68e6afed11
9 changed files with 609 additions and 421 deletions

View file

@ -5,81 +5,23 @@ namespace Garradin;
use Garradin\Plugin\RecusFiscaux\Personne;
use Garradin\Plugin\RecusFiscaux\Utils;
$_SESSION['taux_reduction'] = $_POST['taux_reduction'];
// 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::getVersementsComptes($_SESSION['annee_recu'],
"like",
'7%',
$champsNom);
// Utils::getVersementsPersonnes($_SESSION['annee_recu'],
// $champsNom);
// ------------------------------------------------------------------------
// tests
// ------------------------------------------------------------------------
/*
$versementsComptes = Utils::getVersementsComptes("2021",
// "in",
// ['706', '7780', '756'],
"like",
'7%',
$champsNom);
// table triée par nom, date
// error_log("versementsComptes triée par nom, date = " . print_r($versementsComptes, true));
// comparer 2 lignes selon le nom
function comparerNoms($ligne1, $ligne2)
{
return
$_SESSION['membresDonateurs'][$ligne1->idUser]->rang
-
$_SESSION['membresDonateurs'][$ligne2->idUser]->rang;
}
// comparer 2 lignes selon la date
function comparerDate($ligne1, $ligne2)
{
return
strtotime($ligne1->date) - strtotime($ligne2->date);
}
// comparer 2 lignes selon un champ
function comparerChamp($ligne1, $ligne2, $champ)
{
return $ligne1->$champ - $ligne2->$champ;
}
// autres tris
// par tarif, nom, date
usort($versementsComptes, function($ligne1, $ligne2)
{
$result = comparerChamp($ligne1, $ligne2, 'idTarif'); //$ligne1->idTarif - $ligne2->idTarif;
if ($result == 0) { $result = comparerNoms($ligne1, $ligne2); }
if ($result == 0) { $result = comparerDate($ligne1, $ligne2); }
return $result;
});
// error_log("versementsComptes triée par tarif, nom, date = " . print_r($versementsComptes, true));
// par nom, compte, date...
usort($versementsComptes, function($ligne1, $ligne2)
{
$result = comparerNoms($ligne1, $ligne2);
if ($result == 0) { $result = comparerChamp($ligne1, $ligne2, 'compte'); }
if ($result == 0) { $result = comparerDate($ligne1, $ligne2); }
return $result;
});
// error_log("versementsComptes triée par nom, compte, date = " . print_r($versementsComptes, true));
*/
// ------------------------------------------------------------------------
// fin tests
// ------------------------------------------------------------------------
$_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');