fusion branche dev
FossilOrigin-Name: a6a3f6587f6e2d271f439c11230a84a263b03383d2d9842472102dbd88fb2ac5
This commit is contained in:
commit
3347ca7743
20 changed files with 924 additions and 599 deletions
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Garradin\Plugin\RecusFiscaux;
|
||||
/*
|
||||
* information d'une activité
|
||||
*/
|
||||
class Activite
|
||||
{
|
||||
public $id;
|
||||
public $label;
|
||||
public $description;
|
||||
|
||||
public function __construct(
|
||||
$id,
|
||||
$label,
|
||||
$description)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->label = $label;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/*
|
||||
* @return instance de Activite initialisée avec l'objet o
|
||||
*/
|
||||
public static function copier($o)
|
||||
{
|
||||
return new Activite(
|
||||
$o->id,
|
||||
$o->label,
|
||||
$o->description);
|
||||
}
|
||||
}
|
||||
|
|
@ -8,29 +8,29 @@ namespace Garradin\Plugin\RecusFiscaux;
|
|||
class Personne
|
||||
{
|
||||
public $id;
|
||||
public $rang; // par ordre alpha de nomPrenom ; sert aux tris
|
||||
public $nomPrenom;
|
||||
public $adresse;
|
||||
public $codePostal;
|
||||
public $ville;
|
||||
public $courriel;
|
||||
public $versements; // versements par taux de réduction
|
||||
|
||||
public function __construct(
|
||||
$id,
|
||||
$rang,
|
||||
$nomPrenom,
|
||||
$adresse,
|
||||
$codePostal,
|
||||
$ville,
|
||||
$courriel = ""
|
||||
$ville
|
||||
)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->rang = $rang;
|
||||
$this->nomPrenom = $nomPrenom;
|
||||
$this->adresse = $adresse;
|
||||
$this->codePostal = $codePostal;
|
||||
$this->ville = $ville;
|
||||
$this->courriel = $courriel;
|
||||
$this->versements = array(); // clé = tarif, valeur = montant
|
||||
$this->versements = array(); // clé = tarif, valeur = Versement
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -40,30 +40,35 @@ class Personne
|
|||
{
|
||||
return new Personne(
|
||||
$this->id,
|
||||
$this->rang,
|
||||
$this->nomPrenom,
|
||||
$this->adresse,
|
||||
$this->codePostal,
|
||||
$this->ville,
|
||||
$this->courriel);
|
||||
$this->ville);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Garradin\Plugin\RecusFiscaux;
|
||||
/*
|
||||
* information d'un tarif
|
||||
*/
|
||||
class Tarif
|
||||
{
|
||||
public $id;
|
||||
public $idActivite; // activité associée
|
||||
public $label;
|
||||
public $description;
|
||||
public $montant;
|
||||
|
||||
public function __construct(
|
||||
$id,
|
||||
$idActivite,
|
||||
$label,
|
||||
$description,
|
||||
$montant)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->idActivite = $idActivite;
|
||||
$this->label = $label;
|
||||
$this->description = $description;
|
||||
$this->montant = $montant;
|
||||
}
|
||||
|
||||
/*
|
||||
* @return instance de Tarif initialisée avec l'objet o
|
||||
*/
|
||||
public static function copier($o)
|
||||
{
|
||||
return new Tarif(
|
||||
$o->id,
|
||||
$o->idActivite,
|
||||
$o->label,
|
||||
$o->description,
|
||||
$o->montant);
|
||||
}
|
||||
}
|
||||
420
lib/Utils.php
420
lib/Utils.php
|
|
@ -8,158 +8,299 @@ use KD2\ZipWriter;
|
|||
class Utils
|
||||
{
|
||||
/**
|
||||
* @return tarifs demandés
|
||||
* @param $tarifs
|
||||
* @return informations sur les tarifs
|
||||
*/
|
||||
public static function getTarifs(array $tarifs) : array
|
||||
public static function getTarifs()
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$sql = sprintf(
|
||||
'SELECT id, id_service as idActivite, label, description, amount as montant
|
||||
FROM services_fees
|
||||
WHERE services_fees.%s',
|
||||
$db->where('id', $tarifs));
|
||||
'SELECT
|
||||
id,
|
||||
id_service as idActivite,
|
||||
label,
|
||||
description,
|
||||
amount as montant
|
||||
FROM services_fees');
|
||||
return Utils::toAssoc($db->get($sql), 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return informations sur les activités
|
||||
*/
|
||||
public static function getActivites()
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
services.id,
|
||||
services.label,
|
||||
services.description
|
||||
FROM services');
|
||||
return Utils::toAssoc($db->get($sql), 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return comptes sur lesquels des versements de membres ont été faits
|
||||
* @param string $annee
|
||||
* @param $op : opérateur de combinaison des comptes
|
||||
* @param array $comptes
|
||||
*/
|
||||
public static function getComptes($annee, $op, $comptes)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
acc_accounts.id,
|
||||
acc_accounts.code as codeCompte,
|
||||
acc_accounts.label as nomCompte
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN membres
|
||||
ON acc_transactions_users.id_user = membres.id
|
||||
INNER JOIN acc_transactions
|
||||
ON acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN acc_transactions_lines
|
||||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
INNER JOIN acc_accounts
|
||||
ON acc_transactions_lines.id_account = acc_accounts.id
|
||||
WHERE
|
||||
(strftime(%s, acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP by acc_accounts.id
|
||||
ORDER by acc_accounts.id',
|
||||
'"%Y"',
|
||||
$annee,
|
||||
$db->where('code', $op, $comptes)
|
||||
);
|
||||
return Utils::toAssoc($db->get($sql), 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return tarifs des activités et comptes ayant des versements de
|
||||
* membres dans l'année
|
||||
* @param string $annee
|
||||
* @param $op : opérateur de combinaison des comptes
|
||||
* @param array $comptes
|
||||
*/
|
||||
public static function getTarifsComptes($annee, $op, $comptes)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$sql = sprintf(
|
||||
'
|
||||
SELECT
|
||||
services_users.id_fee as idTarif,
|
||||
acc_accounts.id as idCompte,
|
||||
acc_accounts.code as codeCompte
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN acc_transactions
|
||||
ON acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN services_users
|
||||
ON acc_transactions_users.id_service_user = services_users.id
|
||||
INNER JOIN services_fees
|
||||
ON services_users.id_fee = services_fees.id
|
||||
INNER JOIN acc_transactions_lines
|
||||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
INNER JOIN acc_accounts
|
||||
ON acc_transactions_lines.id_account = acc_accounts.id
|
||||
WHERE
|
||||
(strftime(%s, acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP BY services_fees.id,acc_accounts.id
|
||||
',
|
||||
'"%Y"',
|
||||
$annee,
|
||||
$db->where('code', $op, $comptes)
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return activités correspondant aux tarifs demandés
|
||||
* @param $tarifs
|
||||
* faire un tableau associatif avec le résultat d'une requête
|
||||
*/
|
||||
public static function getActivites(array $tarifs) : array
|
||||
static function toAssoc($array, $nomCle)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$sql = sprintf(
|
||||
'SELECT services.id, services.label, services.description
|
||||
FROM services
|
||||
LEFT JOIN services_fees ON services_fees.id_service = services.id
|
||||
WHERE services_fees.%s
|
||||
GROUP BY services.id',
|
||||
$db->where('id', $tarifs));
|
||||
return $db->get($sql);
|
||||
$assoc = array();
|
||||
foreach ($array as $elem)
|
||||
{
|
||||
$ro = new \ReflectionObject($elem);
|
||||
$proprietes = $ro->getProperties();
|
||||
$obj = new \stdClass();
|
||||
foreach ($proprietes as $p)
|
||||
{
|
||||
$pname = $p->getName();
|
||||
if ($pname == $nomCle) {
|
||||
$key = $p->getValue($elem);
|
||||
}
|
||||
else {
|
||||
$obj->$pname = $p->getValue($elem);
|
||||
}
|
||||
}
|
||||
$assoc[$key] = $obj;
|
||||
}
|
||||
return $assoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return versements correspondants à l'année donnée
|
||||
* @param $annee
|
||||
* @param $champsNom : liste non vide des champs de nom/prénom
|
||||
* @param array $champsNom : liste non vide des champs de nom/prénom
|
||||
*/
|
||||
public static function getVersementsPersonnes($annee, array $champsNom) : array
|
||||
public static function getVersementsPersonnes($annee, $op, $comptes, $champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
membres.id as idUser,
|
||||
acc_accounts.id as idCompte,
|
||||
acc_accounts.code as codeCompte,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN membres on acc_transactions_users.id_user = membres.id
|
||||
INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id
|
||||
INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
INNER JOIN membres
|
||||
ON acc_transactions_users.id_user = membres.id
|
||||
INNER JOIN acc_transactions
|
||||
ON acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN acc_transactions_lines
|
||||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
INNER JOIN acc_accounts
|
||||
ON acc_transactions_lines.id_account = acc_accounts.id
|
||||
WHERE
|
||||
(strftime(%s, acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_transactions_lines.credit > 0)
|
||||
ORDER by %s, acc_transactions.date',
|
||||
acc_accounts.%s
|
||||
)
|
||||
ORDER by %s, acc_accounts.id, acc_transactions.date',
|
||||
'"%Y"',
|
||||
$annee,
|
||||
$db->where('code', $op, $comptes),
|
||||
$tri
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return versements correspondants à l'année et aux tarifs donnés
|
||||
* triés par tarif, nom, date
|
||||
* @param $annee
|
||||
* @param $tarifs
|
||||
* @param $champsNom : liste non vide des champs de nom/prénom
|
||||
* @return versements correspondants à :
|
||||
* @param $annee : année fiscale
|
||||
* @param $tarifs : tarifs sélectionnés
|
||||
* @param array $comptes : comptes associés aux tarifs
|
||||
* @param array $champsNom : liste non vide des champs de nom/prénom
|
||||
* @remarks tri par tarif, nom, compte, date
|
||||
*/
|
||||
public static function getVersementsTarifs($annee,
|
||||
array $tarifs,
|
||||
array $champsNom) : array
|
||||
public static function getVersementsTarifsComptes($annee,
|
||||
$tarifs,
|
||||
$comptes,
|
||||
$champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
services_fees.id as idTarif,
|
||||
membres.id as idUser,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
services_fees.id as idTarif,
|
||||
acc_accounts.id as idCompte,
|
||||
acc_accounts.code as codeCompte,
|
||||
membres.id as idUser,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN membres on acc_transactions_users.id_user = membres.id
|
||||
INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id
|
||||
INNER JOIN services_fees on services_users.id_fee = services_fees.id
|
||||
INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
INNER JOIN membres
|
||||
ON acc_transactions_users.id_user = membres.id
|
||||
INNER JOIN acc_transactions
|
||||
ON acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN services_users
|
||||
ON acc_transactions_users.id_service_user = services_users.id
|
||||
INNER JOIN services_fees
|
||||
ON services_users.id_fee = services_fees.id
|
||||
INNER JOIN acc_transactions_lines
|
||||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
INNER JOIN acc_accounts
|
||||
ON acc_transactions_lines.id_account = acc_accounts.id
|
||||
WHERE
|
||||
(strftime(%s, acc_transactions.date) = "%d"
|
||||
(strftime(%s, acc_transactions.date) = "%d"
|
||||
AND
|
||||
services_fees.%s
|
||||
services_fees.%s
|
||||
AND
|
||||
acc_transactions_lines.credit > 0)
|
||||
ORDER by services_fees.id, %s, acc_transactions.date',
|
||||
acc_accounts.%s
|
||||
)
|
||||
ORDER by services_fees.id, %s, acc_accounts.id, acc_transactions.date',
|
||||
'"%Y"',
|
||||
$annee,
|
||||
$db->where('id', $tarifs),
|
||||
$db->where('id', 'in', $tarifs),
|
||||
$db->where('id', 'in', $comptes),
|
||||
$tri
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return versements correspondants à l'année et aux comptes donnés
|
||||
* @param $annee
|
||||
* @param $comptes
|
||||
* @param $champsNom : liste non vide des champs de nom/prénom
|
||||
* @return versements correspondants à :
|
||||
* @param $annee année fiscale
|
||||
* @param $comptesIsoles comptes NON associés à un tarif
|
||||
* @param array $champsNom : liste non vide des champs de nom/prénom
|
||||
* @remarks tri par nom, compte, date
|
||||
*/
|
||||
public static function getVersementsComptes($annee,
|
||||
array $comptes,
|
||||
array $champsNom) : array
|
||||
$comptesIsoles,
|
||||
$champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
acc_accounts.code as compte,
|
||||
'
|
||||
SELECT
|
||||
0 as idTarif,
|
||||
acc_accounts.id as idCompte,
|
||||
acc_accounts.code as codeCompte,
|
||||
membres.id as idUser,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN membres on acc_transactions_users.id_user = membres.id
|
||||
INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id
|
||||
INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
INNER JOIN membres
|
||||
ON acc_transactions_users.id_user = membres.id
|
||||
INNER JOIN acc_transactions
|
||||
ON acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN acc_transactions_lines
|
||||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
INNER JOIN acc_accounts
|
||||
ON acc_transactions_lines.id_account = acc_accounts.id
|
||||
WHERE
|
||||
(strftime(%s, acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
AND
|
||||
acc_transactions_lines.credit > 0)
|
||||
ORDER by acc_accounts.code, %s, acc_transactions.date',
|
||||
acc_accounts.%s
|
||||
)
|
||||
|
||||
ORDER by %s, acc_accounts.id, acc_transactions.date
|
||||
',
|
||||
'"%Y"',
|
||||
$annee,
|
||||
$db->where('code', $comptes),
|
||||
$db->where('id', 'in', $comptesIsoles),
|
||||
$tri
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Versements totaux par personne pour une année donnée
|
||||
* @param année
|
||||
* @param $champsNom : liste non vide des champs de nom/prénom
|
||||
* @return personnes ayant versé des dons pour une année donnée
|
||||
* @param $annee
|
||||
* @param array $champsNom : champs qui définissent le nom et le prénom d'une personne
|
||||
*/
|
||||
public static function getVersementsTotaux($annee, array $champsNom) : array
|
||||
public static function getDonateurs($annee, $champsNom) : array
|
||||
{
|
||||
// concaténer les champs nom/prénoms pour la sélection
|
||||
$nom = Utils::combinerChamps($champsNom);
|
||||
// et pour le tri
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
membres.id as idUser,
|
||||
sum(acc_transactions_lines.credit) AS versement
|
||||
row_number() over(order by %s) as rang,
|
||||
%s as nom,
|
||||
membres.adresse as adresse,
|
||||
membres.code_postal as codePostal,
|
||||
membres.ville as ville
|
||||
FROM
|
||||
acc_transactions_users,
|
||||
membres,
|
||||
|
|
@ -168,27 +309,38 @@ class Utils
|
|||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
WHERE (
|
||||
strftime(%s, acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_transactions_lines.credit > 0
|
||||
AND
|
||||
acc_transactions_users.id_transaction = acc_transactions.id
|
||||
AND
|
||||
acc_transactions_users.id_user = membres.id
|
||||
)
|
||||
GROUP by acc_transactions_users.id_user
|
||||
ORDER by %s COLLATE U_NOCASE',
|
||||
GROUP by membres.id
|
||||
ORDER by %1$s COLLATE U_NOCASE
|
||||
',
|
||||
$tri,
|
||||
$nom,
|
||||
'"%Y"',
|
||||
$annee,
|
||||
$tri);
|
||||
return DB::getInstance()->get($sql);
|
||||
$annee
|
||||
);
|
||||
$donateurs = array();
|
||||
foreach (DB::getInstance()->iterate($sql) as $personne)
|
||||
{
|
||||
$donateurs[$personne->idUser] = new Personne($personne->idUser,
|
||||
$personne->rang,
|
||||
$personne->nom,
|
||||
$personne->adresse,
|
||||
$personne->codePostal,
|
||||
$personne->ville);
|
||||
}
|
||||
return $donateurs;
|
||||
}
|
||||
|
||||
/**
|
||||
* combiner les champs avec un opérateur
|
||||
* @param $champs : liste (non vide) de champs
|
||||
* @param array $champs : liste (non vide) de champs
|
||||
* @return chaîne combinée
|
||||
*/
|
||||
private static function combinerChamps(array $champs) : string
|
||||
private static function combinerChamps($champs)
|
||||
{
|
||||
$op = ' || " " || ';
|
||||
$result = 'ifnull(membres.' . $champs[0] . ', "")';
|
||||
|
|
@ -196,7 +348,7 @@ class Utils
|
|||
{
|
||||
$result .= $op . 'ifnull(membres.' . $champs[$i] . ', "")';
|
||||
}
|
||||
return $result;
|
||||
return 'trim(' . $result . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -215,102 +367,7 @@ class Utils
|
|||
}
|
||||
|
||||
/**
|
||||
* @return personnes ayant versé des dons pour une année donnée
|
||||
* @param $annee
|
||||
* @param $champsNom : champs qui définissent le nom et le prénom d'une personne
|
||||
*/
|
||||
public static function getDonateurs($annee, array $champsNom) : array
|
||||
{
|
||||
// concaténer les champs nom/prénoms pour la sélection
|
||||
$nom = 'trim(' . Utils::combinerChamps($champsNom) . ') as nom,';
|
||||
// et pour le tri
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql =
|
||||
"SELECT
|
||||
membres.id as idUser,
|
||||
" .
|
||||
$nom . "
|
||||
membres.adresse as adresse,
|
||||
membres.code_postal as codePostal,
|
||||
membres.ville as ville
|
||||
FROM
|
||||
acc_transactions_users,
|
||||
membres,
|
||||
acc_transactions
|
||||
INNER JOIN acc_transactions_lines
|
||||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
WHERE (
|
||||
strftime('%Y', acc_transactions.date) = ?
|
||||
AND
|
||||
acc_transactions_lines.credit > 0
|
||||
AND
|
||||
acc_transactions_users.id_transaction = acc_transactions.id
|
||||
AND
|
||||
acc_transactions_users.id_user = membres.id
|
||||
)
|
||||
GROUP by membres.id
|
||||
ORDER by " . $tri . " COLLATE U_NOCASE
|
||||
";
|
||||
$donateurs = array();
|
||||
foreach (DB::getInstance()->iterate($sql, $annee) as $personne)
|
||||
{
|
||||
$donateurs[$personne->idUser] = new Personne($personne->idUser,
|
||||
$personne->nom,
|
||||
$personne->adresse,
|
||||
$personne->codePostal,
|
||||
$personne->ville);
|
||||
}
|
||||
return $donateurs;
|
||||
}
|
||||
|
||||
/**
|
||||
* renvoie un tableau avec les remarques de chaque taux de réduction
|
||||
*/
|
||||
public static function getLignesReduction(array $lesTaux) : array
|
||||
{
|
||||
foreach ($lesTaux as $elem)
|
||||
{
|
||||
/*
|
||||
$ligne = "taux " . $elem->taux . ", ligne " . $elem->ligne;
|
||||
if ($elem->remarque != "") {
|
||||
$ligne .= ", " . $elem->remarque;
|
||||
}
|
||||
$lignes[$elem->taux] = $ligne;
|
||||
*/
|
||||
$lignes[$elem->taux] = $elem->remarque;
|
||||
}
|
||||
return $lignes;
|
||||
}
|
||||
|
||||
public static function getLigneReduction($taux)
|
||||
{
|
||||
return $_SESSION['ligneReduction'][$taux];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array liste de toutes les activités, tarifs et comptes associés
|
||||
*/
|
||||
public static function getActivitesTarifsEtComptes()
|
||||
{
|
||||
return DB::getInstance()->get(
|
||||
"SELECT
|
||||
services.id as idActivite,
|
||||
services.label as titreActivite,
|
||||
services.description as descActivite,
|
||||
services_fees.id as idTarif,
|
||||
services_fees.label as titreTarif,
|
||||
services_fees.description as descTarif,
|
||||
acc_accounts.code as numeroCpt,
|
||||
acc_accounts.label as nomCpt
|
||||
FROM services
|
||||
LEFT JOIN services_fees ON services_fees.id_service = services.id
|
||||
LEFT JOIN acc_accounts ON services_fees.id_account = acc_accounts.id
|
||||
ORDER BY services.label"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array liste des années fiscales
|
||||
* @return liste des années fiscales
|
||||
*/
|
||||
public static function getAnneesFiscales() : array
|
||||
{
|
||||
|
|
@ -326,6 +383,15 @@ class Utils
|
|||
return $anneesFiscales;
|
||||
}
|
||||
|
||||
public static function getLignesReduction($lesTaux)
|
||||
{
|
||||
foreach ($lesTaux as $elem)
|
||||
{
|
||||
$lignes[$elem->taux] = $elem->remarque;
|
||||
}
|
||||
return $lignes;
|
||||
}
|
||||
|
||||
/**
|
||||
* récupérer dans la config du plugin les champs des membres
|
||||
* utilisés pour le nom et le prénom ; ajouter/supprimer les
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue