2022-01-19 16:04:42 +01:00
|
|
|
<?php
|
|
|
|
|
2023-09-28 13:20:36 +02:00
|
|
|
namespace Paheko;
|
2023-11-10 12:31:18 +01:00
|
|
|
session_start();
|
2022-01-19 16:04:42 +01:00
|
|
|
|
2023-09-28 13:20:36 +02:00
|
|
|
use Paheko\Plugin\RecusFiscaux\Utils;
|
2022-03-31 10:27:31 +02:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// opérations communes
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// champs pour le nom et prénom
|
|
|
|
$confNoms = Utils::getChampsNom($config, $plugin);
|
|
|
|
uasort($confNoms, function ($a, $b)
|
|
|
|
{
|
|
|
|
return $a->position - $b->position;
|
|
|
|
});
|
|
|
|
$champsNom = array();
|
|
|
|
foreach ($confNoms as $nom => $champ)
|
|
|
|
{
|
|
|
|
if ($champ->position != 0) { $champsNom[] = $nom; }
|
|
|
|
}
|
|
|
|
|
|
|
|
// membres donateurs
|
|
|
|
$_SESSION['membresDonateurs'] = Utils::getDonateurs($_SESSION['annee_recu'],
|
|
|
|
$champsNom);
|
|
|
|
|
2022-04-29 11:01:15 +02:00
|
|
|
// comparaison de lignes de versements
|
|
|
|
// comparer 2 lignes selon le nom
|
|
|
|
function comparerNoms($ligne1, $ligne2)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
$_SESSION['membresDonateurs'][$ligne1->idUser]->rang
|
|
|
|
-
|
|
|
|
$_SESSION['membresDonateurs'][$ligne2->idUser]->rang;
|
|
|
|
}
|
|
|
|
|
|
|
|
// comparer 2 activités par leur libellé
|
|
|
|
function comparerActivites($ligne1, $ligne2)
|
|
|
|
{
|
|
|
|
return strcoll(
|
|
|
|
$_SESSION['lesActivites'][$_SESSION['lesTarifs'][$ligne1->idTarif]->idActivite]->label,
|
|
|
|
$_SESSION['lesActivites'][$_SESSION['lesTarifs'][$ligne2->idTarif]->idActivite]->label);
|
|
|
|
}
|
|
|
|
|
|
|
|
// comparer 2 lignes selon la date
|
|
|
|
function comparerDate($ligne1, $ligne2)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
strtotime($ligne1->date) - strtotime($ligne2->date);
|
|
|
|
}
|
|
|
|
|
|
|
|
// comparer 2 lignes selon un champ numérique entier
|
|
|
|
function comparerChamp($ligne1, $ligne2, $champ)
|
|
|
|
{
|
|
|
|
return $ligne1->$champ - $ligne2->$champ;
|
|
|
|
}
|
|
|
|
|
2022-03-31 10:27:31 +02:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// fonctions pour l'affichage
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// afficher les informations d'une activité et d'un tarif
|
|
|
|
$tpl->register_function('afficher_debut_tarif', function ($params)
|
|
|
|
{
|
|
|
|
$versement = $params['versement'];
|
|
|
|
$idTarif = $versement->idTarif;
|
2024-04-11 11:51:09 +02:00
|
|
|
|
2022-05-04 13:53:12 +02:00
|
|
|
$out = sprintf('
|
|
|
|
<details class="activite" open="open">
|
|
|
|
<summary class="activite">
|
|
|
|
<div class="activite">
|
|
|
|
<input type="checkbox" id="check_%1$s"
|
2022-05-18 12:29:19 +02:00
|
|
|
onclick="cocherDecocherTarif(check_%1$s)" />',
|
|
|
|
$idTarif);
|
|
|
|
if ($idTarif == 0) {
|
|
|
|
// versement sur un compte non rattaché à une activité
|
|
|
|
$out .= sprintf('
|
|
|
|
<label for="check_%s">
|
|
|
|
<h3 class="activite">Versements non rattachés à une activité</h3>',
|
|
|
|
$idTarif);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$tarif = $_SESSION['lesTarifs'][$idTarif];
|
|
|
|
$idActivite = $tarif->idActivite;
|
|
|
|
$activite = $_SESSION['lesActivites'][$idActivite];
|
2022-05-04 13:53:12 +02:00
|
|
|
|
2022-03-31 10:27:31 +02:00
|
|
|
$out .= sprintf('
|
2022-05-18 12:29:19 +02:00
|
|
|
<label for="check_%s">
|
|
|
|
<h3 class="activite">Activité « %s »</h3>',
|
|
|
|
$idTarif,
|
|
|
|
$activite->label);
|
|
|
|
|
|
|
|
if (!empty($activite->description)) {
|
|
|
|
$out .= sprintf('
|
2022-05-04 13:53:12 +02:00
|
|
|
<p class="activite">%s</p>', $activite->description);
|
2022-05-18 12:29:19 +02:00
|
|
|
}
|
|
|
|
$out .= sprintf('
|
2022-05-04 13:53:12 +02:00
|
|
|
<p class="activite">tarif « %s »', $tarif->label);
|
2022-05-18 12:29:19 +02:00
|
|
|
if ($tarif->montant > 0) {
|
|
|
|
$out .= sprintf(' montant : %.2f €</p>', $tarif->montant/100);
|
|
|
|
} else {
|
|
|
|
$out .= ' montant : libre</p>';
|
|
|
|
}
|
2022-03-31 10:27:31 +02:00
|
|
|
}
|
2022-05-04 13:53:12 +02:00
|
|
|
$out .= '
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</summary>';
|
2022-03-31 10:27:31 +02:00
|
|
|
return $out;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Afficher les informations d'une personne
|
|
|
|
$tpl->register_function('afficher_debut_personne', function ($params)
|
|
|
|
{
|
|
|
|
$idUser = $params['user'];
|
|
|
|
$idVersement = $params['idVersement'];
|
|
|
|
|
|
|
|
$personne = $_SESSION['membresDonateurs'][$idUser];
|
2022-05-04 13:53:12 +02:00
|
|
|
$out = sprintf('
|
|
|
|
<details class="personne" open="open">
|
|
|
|
<summary class="personne">
|
|
|
|
<div class="personne">
|
|
|
|
<input type="checkbox" id="check_%1$s"
|
|
|
|
onclick="cocherDecocherPersonne(check_%1$s, total_%1$s)" />
|
|
|
|
<label for="check_%1$s">
|
|
|
|
%2$s : <span class="total" id="total_%1$s">0,00 €</span>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</summary>
|
2022-05-18 12:29:19 +02:00
|
|
|
<div class="versements">',
|
2022-05-04 13:53:12 +02:00
|
|
|
$idVersement,
|
|
|
|
$personne->nomPrenom
|
|
|
|
);
|
2022-03-31 10:27:31 +02:00
|
|
|
return $out;
|
|
|
|
});
|
|
|
|
|
2022-05-18 12:29:19 +02:00
|
|
|
// afficher infos compte
|
|
|
|
$tpl->register_function('afficher_debut_compte', function ($params)
|
|
|
|
{
|
|
|
|
$idCompte = $params['idCompte'];
|
|
|
|
$out = sprintf('
|
|
|
|
<fieldset class="versements">
|
|
|
|
<div><p>Compte N° %1$s : %2$s</p></div>',
|
|
|
|
$_SESSION['comptes'][$idCompte]->codeCompte,
|
|
|
|
$_SESSION['comptes'][$idCompte]->nomCompte);
|
|
|
|
return $out;
|
|
|
|
});
|
|
|
|
|
2022-03-31 10:27:31 +02:00
|
|
|
// afficher un versement
|
|
|
|
$tpl->register_function('afficher_versement', function ($params)
|
|
|
|
{
|
|
|
|
$versement = $params['versement'];
|
|
|
|
$idVersement = $params['idVersement'];
|
|
|
|
$rang = $params['rang'];
|
2022-05-04 13:53:12 +02:00
|
|
|
$pair = $params['pair'];
|
2022-03-31 10:27:31 +02:00
|
|
|
|
|
|
|
$out = '<div class="';
|
2022-05-04 13:53:12 +02:00
|
|
|
$out .= $pair ? 'pair">' : 'impair">';
|
2022-03-31 10:27:31 +02:00
|
|
|
$out .= sprintf('
|
2022-05-04 13:53:12 +02:00
|
|
|
<input type="checkbox"
|
|
|
|
class="check_%1$s"
|
|
|
|
id="check_%1$s_%2$s"
|
|
|
|
name="selected[]"
|
|
|
|
value="%2$s"
|
|
|
|
onclick="cocherDecocherVersement(check_%1$s_%2$s, total_%1$s)" />
|
2022-05-18 12:29:19 +02:00
|
|
|
<label for="check_%1$s_%2$s"><span class="montant">%3$s</span>
|
2022-05-04 13:53:12 +02:00
|
|
|
<span>%4$s</span>
|
|
|
|
</label>
|
|
|
|
</div>',
|
2022-04-28 13:28:41 +02:00
|
|
|
$idVersement,
|
|
|
|
$rang,
|
2022-05-18 12:29:19 +02:00
|
|
|
number_format(
|
|
|
|
$versement->versement/100,
|
|
|
|
2,
|
|
|
|
",",
|
|
|
|
" "
|
|
|
|
),
|
|
|
|
date_format(date_create($versement->date),"d/m/Y")
|
2022-04-28 13:28:41 +02:00
|
|
|
);
|
2022-03-31 10:27:31 +02:00
|
|
|
return $out;
|
|
|
|
});
|
|
|
|
|
2022-05-18 12:29:19 +02:00
|
|
|
$tpl->register_function('fin_compte', function ()
|
2022-05-04 13:53:12 +02:00
|
|
|
{
|
|
|
|
$out = '
|
2022-05-18 12:29:19 +02:00
|
|
|
</fieldset>';
|
|
|
|
return $out;
|
|
|
|
});
|
|
|
|
|
|
|
|
$tpl->register_function('fin_personne', function ()
|
|
|
|
{
|
|
|
|
$out = '
|
|
|
|
</div>
|
2022-05-04 13:53:12 +02:00
|
|
|
</details>';
|
|
|
|
return $out;
|
|
|
|
});
|
|
|
|
|
|
|
|
$tpl->register_function('fin_tarif', function ($params)
|
|
|
|
{
|
|
|
|
$out = '
|
|
|
|
</details>';
|
|
|
|
return $out;
|
|
|
|
});
|
|
|
|
|
2022-03-31 10:27:31 +02:00
|
|
|
// ------------------------------------------------------------------------
|
2022-03-31 21:55:30 +02:00
|
|
|
// aiguillage
|
2022-03-31 10:27:31 +02:00
|
|
|
// ------------------------------------------------------------------------
|
2023-03-07 10:55:51 +01:00
|
|
|
unset($_SESSION['comptesSelectionnes']);
|
|
|
|
unset($_SESSION['tauxSelectionnes']);
|
|
|
|
unset($_SESSION['lesVersements']);
|
2022-03-31 10:27:31 +02:00
|
|
|
|
2022-03-31 11:43:23 +02:00
|
|
|
if ($_GET['action'] == 'personne') {
|
2022-01-29 15:03:41 +01:00
|
|
|
require('versements_personnes.php');
|
2022-05-18 12:29:19 +02:00
|
|
|
} else if ($_GET['action'] == 'activite') {
|
2022-01-29 15:03:41 +01:00
|
|
|
require('versements_activites.php');
|
2022-01-25 17:19:31 +01:00
|
|
|
}
|