nouvelle version des structures de données
FossilOrigin-Name: ff5fc2aff4eab5aa2817d5b6183a5ab842bc701609fb255e97728a2a95e19c14
This commit is contained in:
parent
2a7f5ad834
commit
341afe6a7b
9 changed files with 263 additions and 109 deletions
|
|
@ -14,7 +14,6 @@ $versementsSelectionnes = array();
|
|||
foreach ($lesLignes as $indice => $ligne) {
|
||||
$versementsSelectionnes[] = $_SESSION['lesVersements'][$ligne];
|
||||
}
|
||||
|
||||
// cumuler les versements d'une personne
|
||||
$totalPersonnes = cumulerVersements($versementsSelectionnes);
|
||||
|
||||
|
|
@ -51,8 +50,8 @@ foreach ($totalPersonnes as $idPersonne => $personne) {
|
|||
$personne->nomPrenom,
|
||||
$lesMontants,
|
||||
$personne->adresse,
|
||||
$personne->ville,
|
||||
$personne->codePostal
|
||||
$personne->codePostal,
|
||||
$personne->ville
|
||||
);
|
||||
// fabriquer le nom du fichier PDF
|
||||
$nom = str_replace(' ', '_', $personne->nomPrenom);
|
||||
|
|
@ -73,44 +72,36 @@ $fichierZip = Utils::makeArchive(
|
|||
);
|
||||
|
||||
/**
|
||||
* Cumuler les versements de chaque personne par tarif et activité
|
||||
* Cumuler les versements de chaque personne par tarif
|
||||
* @param tableau des versements
|
||||
* @return tableau des versements cumulés
|
||||
*/
|
||||
function cumulerVersements($versements)
|
||||
{
|
||||
$totalPersonnes = array();
|
||||
$idActivite_courant = -1;
|
||||
$idTarif_courant = -1;
|
||||
$idPersonne_courant = -1;
|
||||
$totalVersements = 0;
|
||||
foreach ($versements as $ligne) {
|
||||
if (
|
||||
$ligne->idActivite != $idActivite_courant ||
|
||||
$ligne->idTarif != $idTarif_courant ||
|
||||
$ligne->idUser != $idPersonne_courant
|
||||
) {
|
||||
if ($idActivite_courant != -1) {
|
||||
if ($idTarif_courant != -1) {
|
||||
$totalPersonnes["$idPersonne_courant"]->ajouterVersement(
|
||||
$idActivite_courant,
|
||||
$_SESSION['lesTarifs'][$idTarif_courant]->idActivite,
|
||||
$idTarif_courant,
|
||||
$totalVersements/100
|
||||
);
|
||||
}
|
||||
$idActivite_courant = $ligne->idActivite;
|
||||
$idTarif_courant = $ligne->idTarif;
|
||||
$idPersonne_courant = $ligne->idUser;
|
||||
$totalVersements = $ligne->versement;
|
||||
// créer les infos de la personne, sauf si elle est déjà présente
|
||||
if (!array_key_exists($idPersonne_courant, $totalPersonnes)) {
|
||||
$totalPersonnes["$idPersonne_courant"] = new Personne(
|
||||
$ligne->idUser,
|
||||
$ligne->nom,
|
||||
$ligne->adresse,
|
||||
$ligne->ville,
|
||||
$ligne->codePostal,
|
||||
$ligne->courriel
|
||||
);
|
||||
if (!array_key_exists($idPersonne_courant, $totalPersonnes))
|
||||
{
|
||||
$totalPersonnes["$idPersonne_courant"] =
|
||||
Personne::copier($_SESSION['membresDonateurs'][$ligne->idUser]);
|
||||
}
|
||||
} else {
|
||||
// cumuler versements
|
||||
|
|
@ -119,7 +110,7 @@ function cumulerVersements($versements)
|
|||
}
|
||||
// et le dernier
|
||||
$totalPersonnes["$idPersonne_courant"]->ajouterVersement(
|
||||
$idActivite_courant,
|
||||
$_SESSION['lesTarifs'][$idTarif_courant]->idActivite,
|
||||
$idTarif_courant,
|
||||
$totalVersements/100
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue