2022-01-19 16:04:42 +01:00
|
|
|
<?php
|
|
|
|
|
2023-09-28 11:08:46 +02:00
|
|
|
namespace Paheko\Plugin\RecusFiscaux;
|
2022-01-19 16:04:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* rassembler les infos d'une personne
|
|
|
|
*/
|
|
|
|
class Personne
|
|
|
|
{
|
|
|
|
public $id;
|
2023-01-23 18:53:53 +01:00
|
|
|
public $numero;
|
|
|
|
public $courriel;
|
2022-04-24 14:07:36 +02:00
|
|
|
public $rang; // par ordre alpha de nomPrenom ; sert aux tris
|
2022-01-19 16:04:42 +01:00
|
|
|
public $nomPrenom;
|
|
|
|
public $adresse;
|
|
|
|
public $codePostal;
|
2022-02-10 17:05:24 +01:00
|
|
|
public $ville;
|
2022-03-25 16:09:55 +01:00
|
|
|
public $versements; // versements par taux de réduction
|
2022-01-19 16:04:42 +01:00
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
$id,
|
2023-01-23 18:53:53 +01:00
|
|
|
$numero,
|
|
|
|
$courriel,
|
2022-04-24 14:07:36 +02:00
|
|
|
$rang,
|
2022-01-19 16:04:42 +01:00
|
|
|
$nomPrenom,
|
|
|
|
$adresse,
|
|
|
|
$codePostal,
|
2022-04-24 14:07:36 +02:00
|
|
|
$ville
|
2022-02-19 14:31:04 +01:00
|
|
|
)
|
|
|
|
{
|
2022-01-19 16:04:42 +01:00
|
|
|
$this->id = $id;
|
2023-01-23 18:53:53 +01:00
|
|
|
$this->numero = $numero;
|
|
|
|
$this->courriel = $courriel;
|
2022-04-24 14:07:36 +02:00
|
|
|
$this->rang = $rang;
|
2022-01-19 16:04:42 +01:00
|
|
|
$this->nomPrenom = $nomPrenom;
|
|
|
|
$this->adresse = $adresse;
|
|
|
|
$this->codePostal = $codePostal;
|
2022-02-10 17:05:24 +01:00
|
|
|
$this->ville = $ville;
|
2022-05-20 21:43:38 +02:00
|
|
|
$this->versements = array(); // clé = tarif, valeur = Versement
|
2022-01-19 16:04:42 +01:00
|
|
|
}
|
|
|
|
|
2022-02-18 10:37:39 +01:00
|
|
|
/**
|
|
|
|
* return copie d'une personne
|
2022-03-25 11:27:03 +01:00
|
|
|
*/
|
2022-02-19 14:31:04 +01:00
|
|
|
public function clone()
|
2022-02-10 17:05:24 +01:00
|
|
|
{
|
|
|
|
return new Personne(
|
2022-02-19 14:31:04 +01:00
|
|
|
$this->id,
|
2023-01-23 18:53:53 +01:00
|
|
|
$this->numero,
|
|
|
|
$this->courriel,
|
2022-04-24 14:07:36 +02:00
|
|
|
$this->rang,
|
2022-02-19 14:31:04 +01:00
|
|
|
$this->nomPrenom,
|
|
|
|
$this->adresse,
|
|
|
|
$this->codePostal,
|
2022-04-24 14:07:36 +02:00
|
|
|
$this->ville);
|
2022-02-10 17:05:24 +01:00
|
|
|
}
|
|
|
|
|
2022-02-18 10:37:39 +01:00
|
|
|
/**
|
|
|
|
* ajouter un versement
|
|
|
|
* @param $tauxReduction
|
2022-03-25 16:09:55 +01:00
|
|
|
* @param $montant
|
2022-05-20 21:43:38 +02:00
|
|
|
* @param $dateMin
|
|
|
|
* @param $dateMax
|
2022-01-19 16:04:42 +01:00
|
|
|
*/
|
|
|
|
public function ajouterVersement(
|
2022-03-25 16:09:55 +01:00
|
|
|
$tauxReduction,
|
2022-05-20 21:43:38 +02:00
|
|
|
$montant,
|
|
|
|
$dateMin,
|
|
|
|
$dateMax
|
2022-02-19 14:31:04 +01:00
|
|
|
)
|
|
|
|
{
|
2022-03-25 16:09:55 +01:00
|
|
|
if (array_key_exists($tauxReduction, $this->versements))
|
|
|
|
{
|
2022-05-20 21:43:38 +02:00
|
|
|
$this->versements[$tauxReduction]->ajouter($montant, $dateMin, $dateMax);
|
2022-03-25 16:09:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-05-20 21:43:38 +02:00
|
|
|
$this->versements[$tauxReduction] = new Versement($montant, $dateMin, $dateMax);
|
2022-03-25 16:09:55 +01:00
|
|
|
}
|
2022-01-19 16:04:42 +01:00
|
|
|
}
|
2022-05-20 21:43:38 +02:00
|
|
|
|
2022-01-19 16:04:42 +01:00
|
|
|
}
|