correction bug total compte

FossilOrigin-Name: d24bebd61e6729bab7cb2caa65523d20146e187b621935e47be84169db710dc7
This commit is contained in:
engel 2022-05-18 19:38:59 +00:00
parent 92a4b7b8a6
commit 358aad1ec7
1 changed files with 15 additions and 6 deletions

View File

@ -205,24 +205,30 @@ function cumulerVersementsTarif($versements)
$totalPersonnes = array(); $totalPersonnes = array();
$idTarifCourant = -1; $idTarifCourant = -1;
$idPersonneCourant = -1; $idPersonneCourant = -1;
$idCompteCourant = -1;
$totalVersements = 0; $totalVersements = 0;
foreach ($versements as $ligne) foreach ($versements as $ligne)
{ {
if ( if (
$ligne->idTarif != $idTarifCourant || $ligne->idTarif != $idTarifCourant ||
$ligne->idUser != $idPersonneCourant $ligne->idUser != $idPersonneCourant ||
$ligne->idCompte != $idCompteCourant
) )
{ {
if ($idTarifCourant != -1) if ($idTarifCourant != -1)
{ {
// changement de tarif ou de personne // changement de tarif ou de personne
$tarifCompte = ($idTarifCourant == 0) ?
$idCompteCourant :
$idTarifCourant . "_" . $idCompteCourant;
$totalPersonnes[$idPersonneCourant]->ajouterVersement( $totalPersonnes[$idPersonneCourant]->ajouterVersement(
$_SESSION['tauxSelectionnes'][$idTarifCourant], $_SESSION['tauxSelectionnes'][$tarifCompte],
$totalVersements $totalVersements
); );
} }
$idTarifCourant = $ligne->idTarif; $idTarifCourant = $ligne->idTarif;
$idPersonneCourant = $ligne->idUser; $idPersonneCourant = $ligne->idUser;
$idCompteCourant = $ligne->idCompte;
$totalVersements = $ligne->versement; $totalVersements = $ligne->versement;
// créer les infos de la personne, sauf si elle est déjà présente // créer les infos de la personne, sauf si elle est déjà présente
if (!array_key_exists($idPersonneCourant, $totalPersonnes)) if (!array_key_exists($idPersonneCourant, $totalPersonnes))
@ -235,8 +241,11 @@ function cumulerVersementsTarif($versements)
} }
} }
// et le dernier // et le dernier
$tarifCompte = ($idTarifCourant == 0) ?
$idCompteCourant :
$idTarifCourant . "_" . $idCompteCourant;
$totalPersonnes[$idPersonneCourant]->ajouterVersement( $totalPersonnes[$idPersonneCourant]->ajouterVersement(
$_SESSION['tauxSelectionnes'][$idTarifCourant], $_SESSION['tauxSelectionnes'][$tarifCompte],
$totalVersements $totalVersements
); );
return $totalPersonnes; return $totalPersonnes;