From 341afe6a7b5492664036eb269634a9142d98de46 Mon Sep 17 00:00:00 2001 From: engel <> Date: Thu, 10 Feb 2022 16:05:24 +0000 Subject: [PATCH] =?UTF-8?q?nouvelle=20version=20des=20structures=20de=20do?= =?UTF-8?q?nn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: ff5fc2aff4eab5aa2817d5b6183a5ab842bc701609fb255e97728a2a95e19c14 --- lib/Personne.php | 20 ++++- lib/RecusPDF.php | 4 +- lib/Utils.php | 73 +++++++++++++++- lib/Versement.php | 1 + templates/versements_activites.tpl | 102 +++++++++------------- templates/versements_personnes.tpl | 4 +- www/admin/generer_activites.php | 29 +++---- www/admin/generer_personnes.php | 4 +- www/admin/versements_activites.php | 135 +++++++++++++++++++++++++---- 9 files changed, 263 insertions(+), 109 deletions(-) diff --git a/lib/Personne.php b/lib/Personne.php index 14a40d7..2497586 100644 --- a/lib/Personne.php +++ b/lib/Personne.php @@ -10,8 +10,8 @@ class Personne public $id; public $nomPrenom; public $adresse; - public $ville; public $codePostal; + public $ville; public $courriel; public $versements; // tableau des versements totaux par activité/tarif @@ -19,19 +19,31 @@ class Personne $id, $nomPrenom, $adresse, - $ville, $codePostal, - $courriel + $ville, + $courriel = "" ) { $this->id = $id; $this->nomPrenom = $nomPrenom; $this->adresse = $adresse; - $this->ville = $ville; $this->codePostal = $codePostal; + $this->ville = $ville; $this->courriel = $courriel; $this->versements = array(); } + public static function copier($p) + { + return new Personne( + $p->id, + $p->nomPrenom, + $p->adresse, + $p->codePostal, + $p->ville, + $p->courriel); + } + + /* * ajouter un versement pour une activité et un tarif donnés */ diff --git a/lib/RecusPDF.php b/lib/RecusPDF.php index bc4d70e..87d1f41 100644 --- a/lib/RecusPDF.php +++ b/lib/RecusPDF.php @@ -135,8 +135,8 @@ class RecusPDF extends tFPDF $nom, $lesMontants, $adresse, - $ville, - $code_postal) + $code_postal, + $ville) { $this->AddPage(); diff --git a/lib/Utils.php b/lib/Utils.php index d392ac7..5b2a348 100644 --- a/lib/Utils.php +++ b/lib/Utils.php @@ -7,10 +7,79 @@ use KD2\ZipWriter; class Utils { + // ------------------------------------------------------------ + // test nouvelle organisation + /** + * @return tarifs demandés + * @param array $tarifs + */ + public static function getTarifs($tarifs) + { + $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)); + return $db->get($sql); + } + + /** + * @return activités correspondant aux tarifs demandés + * @param array $tarifs + */ + public static function getActivites($tarifs) + { + $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); + } + + /** + * @return versements correspondants à l'année et aux tarifs donnés + * @param $annee + * @param array $tarifs + */ + public static function getVersementsTarifs($annee, $tarifs) + { + $db = DB::getInstance(); + $sql = sprintf( + 'SELECT + services_fees.id as idTarif, + 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 + WHERE + (strftime(%s, acc_transactions.date) = "%d" + AND + services_fees.%s + AND + acc_transactions_lines.credit > 0) + ORDER by services_fees.id, membres.id, acc_transactions.date', + '"%Y"', + $annee, + $db->where('id', $tarifs)); + return $db->get($sql); + } + + // ------------------------------------------------------------ + /** * @return liste des activités */ - public static function getActivites() + public static function getToutesActivites() { return DB::getInstance()->get( "SELECT @@ -26,7 +95,7 @@ class Utils * @return liste des tarifs d'une activité * @param $activite : identifiant de l'activité */ - public static function getTarifs($activite) + public static function getTarifsActivite($activite) { return DB::getInstance()->get( "SELECT diff --git a/lib/Versement.php b/lib/Versement.php index c5d0145..0a4a5bf 100644 --- a/lib/Versement.php +++ b/lib/Versement.php @@ -7,6 +7,7 @@ class Versement public $idActivite; public $idTarif; public $montant; + public $tauxReduction; public function __construct( $idActivite, diff --git a/templates/versements_activites.tpl b/templates/versements_activites.tpl index 3137e9c..36b8a26 100644 --- a/templates/versements_activites.tpl +++ b/templates/versements_activites.tpl @@ -3,7 +3,6 @@