2022-01-19 16:04:42 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Garradin\Plugin\RecusFiscaux;
|
|
|
|
|
|
|
|
class Versement
|
|
|
|
{
|
2022-05-20 21:43:38 +02:00
|
|
|
public $montant;
|
|
|
|
public $dateMin; // estampille
|
|
|
|
public $dateMax; // estampille
|
2022-01-19 16:04:42 +01:00
|
|
|
|
|
|
|
public function __construct(
|
2022-02-18 12:51:13 +01:00
|
|
|
$montant,
|
2022-05-20 21:43:38 +02:00
|
|
|
$dateMin,
|
|
|
|
$dateMax
|
2022-02-18 12:51:13 +01:00
|
|
|
)
|
|
|
|
{
|
2022-01-19 16:04:42 +01:00
|
|
|
$this->montant = $montant;
|
2022-05-20 21:43:38 +02:00
|
|
|
$this->dateMin = $dateMin;
|
|
|
|
$this->dateMax = $dateMax;
|
2022-01-19 16:04:42 +01:00
|
|
|
}
|
2022-05-20 21:43:38 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
}
|
2022-01-19 16:04:42 +01:00
|
|
|
}
|