gestion date début et fin versements

FossilOrigin-Name: 323bbe3ae892ca099aac2f897e592b35b7224c22ce25bd813e9a11dca0cf9f19
This commit is contained in:
engel 2022-05-20 19:43:38 +00:00
parent 7b9b0fda13
commit 4eb8b7c61d
4 changed files with 73 additions and 24 deletions

View file

@ -30,7 +30,7 @@ class Personne
$this->adresse = $adresse;
$this->codePostal = $codePostal;
$this->ville = $ville;
$this->versements = array(); // clé = tarif, valeur = montant
$this->versements = array(); // clé = tarif, valeur = Versement
}
/**
@ -51,19 +51,24 @@ class Personne
* ajouter un versement
* @param $tauxReduction
* @param $montant
* @param $dateMin
* @param $dateMax
*/
public function ajouterVersement(
$tauxReduction,
$montant
$montant,
$dateMin,
$dateMax
)
{
if (array_key_exists($tauxReduction, $this->versements))
{
$this->versements[$tauxReduction] += $montant;
$this->versements[$tauxReduction]->ajouter($montant, $dateMin, $dateMax);
}
else
{
$this->versements[$tauxReduction] = $montant;
$this->versements[$tauxReduction] = new Versement($montant, $dateMin, $dateMax);
}
}
}

View file

@ -4,21 +4,37 @@ namespace Garradin\Plugin\RecusFiscaux;
class Versement
{
public $idActivite;
public $idTarif;
public $montant;
public $tauxReduction;
public $montant;
public $dateMin; // estampille
public $dateMax; // estampille
public function __construct(
$idActivite,
$idTarif,
$montant,
$tauxReduction
$dateMin,
$dateMax
)
{
$this->idActivite = $idActivite;
$this->idTarif = $idTarif;
$this->montant = $montant;
$this->tauxReduction = $tauxReduction;
$this->dateMin = $dateMin;
$this->dateMax = $dateMax;
}
/**
* ajouter un versement en fixant les dates min et max
* @param $montant
* @param $dateMin
* @param $dateMax
*/
public function ajouter($montant, $dateMin, $dateMax)
{
$this->montant += $montant;
if ($dateMin < $this->dateMin)
{
$this->dateMin = $dateMin;
}
if ($dateMax > $this->dateMax)
{
$this->dateMax = $dateMax;
}
}
}