From af7816d97fff220a66e2082a7f11997ea27bafeb Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 24 Mar 2022 18:00:39 +0000 Subject: [PATCH] =?UTF-8?q?d=C3=A9but=20refonte=20gestion=20versements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: 1be54b8a985d3fb24895bae4cc5481743edf0a68dbb0eb4278580df3ce7f530d --- lib/Personne.php | 2 +- lib/Utils.php | 67 +++++++++++++++++++++++ templates/_nav.tpl | 2 +- templates/versements_personnes.tpl | 67 ++++++++++------------- www/admin/config.php | 5 +- www/admin/generer_activites.php | 62 ++++++++++++--------- www/admin/generer_personnes.php | 88 ++++++++++++++++++++++++++---- www/admin/script.js | 67 +++++++++++++++-------- www/admin/style.css | 4 ++ www/admin/versements_activites.php | 4 +- www/admin/versements_personnes.php | 66 ++++++++++++++++++++-- 11 files changed, 322 insertions(+), 112 deletions(-) diff --git a/lib/Personne.php b/lib/Personne.php index 118aca1..2f695f6 100644 --- a/lib/Personne.php +++ b/lib/Personne.php @@ -35,7 +35,6 @@ class Personne /** * return copie d'une personne - */ public function clone() { return new Personne( @@ -46,6 +45,7 @@ class Personne $this->ville, $this->courriel); } + */ /** * ajouter un versement diff --git a/lib/Utils.php b/lib/Utils.php index f6bed5b..e29e92a 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -39,6 +39,37 @@ class Utils return $db->get($sql); } + /** + * @return versements correspondants à l'année donnée + * @param $annee + * @param array $champsNom : liste non vide des champs de nom/prénom + */ + public static function getVersementsPersonnes($annee, $champsNom) + { + $db = DB::getInstance(); + $tri = Utils::combinerTri($champsNom); + $sql = sprintf( + 'SELECT + 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 + WHERE + (strftime(%s, acc_transactions.date) = "%d" + AND + acc_transactions_lines.credit > 0) + ORDER by %s, acc_transactions.date', + '"%Y"', + $annee, + $tri + ); + return $db->get($sql); + } + /** * @return versements correspondants à l'année et aux tarifs donnés * @param $annee @@ -76,6 +107,42 @@ class Utils return $db->get($sql); } + /** + * @return versements correspondants à l'année et aux comptes donnés + * @param $annee + * @param array $comptes + * @param array $champsNom : liste non vide des champs de nom/prénom + */ + public static function getVersementsComptes($annee, $comptes, $champsNom) + { + $db = DB::getInstance(); + $tri = Utils::combinerTri($champsNom); + $sql = sprintf( + 'SELECT + acc_accounts.code as compte, + 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 + 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', + '"%Y"', + $annee, + $db->where('code', $comptes), + $tri + ); + return $db->get($sql); + } + /** * Versements totaux par personne pour une année donnée * @param année diff --git a/templates/_nav.tpl b/templates/_nav.tpl index 6ab82c4..140e031 100644 --- a/templates/_nav.tpl +++ b/templates/_nav.tpl @@ -5,7 +5,7 @@