Correction pour exercice sur 2 années civiles
FossilOrigin-Name: 24d7a87d9007dfb118ffb7a612b9eae155b1f45cb7f05577dc389240b848014d
This commit is contained in:
parent
457ee5f958
commit
86bc9c8ae1
923
lib/Utils.php
923
lib/Utils.php
@ -8,481 +8,484 @@ use KD2\ZipWriter;
|
||||
|
||||
class Utils
|
||||
{
|
||||
/**
|
||||
* @return informations sur les tarifs
|
||||
*/
|
||||
public static function getTarifs()
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$sql = sprintf(
|
||||
'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 tarifs
|
||||
*/
|
||||
public static function getTarifs()
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$sql = sprintf(
|
||||
'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 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 users
|
||||
ON acc_transactions_users.id_user = users.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("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP by acc_accounts.code
|
||||
ORDER by acc_accounts.code',
|
||||
$annee,
|
||||
$db->where('code', $op, $comptes)
|
||||
);
|
||||
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_years.label,
|
||||
acc_accounts.code as codeCompte,
|
||||
acc_accounts.label as nomCompte
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN users
|
||||
ON acc_transactions_users.id_user = users.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
|
||||
INNER JOIN acc_years
|
||||
ON acc_transactions.id_year = acc_years.id
|
||||
WHERE
|
||||
(strftime("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP by acc_accounts.id
|
||||
ORDER by acc_accounts.code',
|
||||
$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("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP BY services_fees.id, acc_accounts.code
|
||||
ORDER BY acc_accounts.code
|
||||
',
|
||||
$annee,
|
||||
$db->where('code', $op, $comptes)
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
/**
|
||||
* @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("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP BY services_fees.id, acc_accounts.code
|
||||
ORDER BY acc_accounts.code
|
||||
',
|
||||
$annee,
|
||||
$db->where('code', $op, $comptes)
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* faire un tableau associatif avec le résultat d'une requête
|
||||
*/
|
||||
static function toAssoc($array, $nomCle)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
/**
|
||||
* faire un tableau associatif avec le résultat d'une requête
|
||||
*/
|
||||
static function toAssoc($array, $nomCle)
|
||||
{
|
||||
$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 array $champsNom : liste non vide des champs de nom/prénom
|
||||
*/
|
||||
public static function getVersementsPersonnes($annee, $op, $comptes, $champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
users.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 users
|
||||
ON acc_transactions_users.id_user = users.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("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP BY acc_transactions.id, acc_accounts.id
|
||||
ORDER by %s, acc_accounts.code, acc_transactions.date',
|
||||
$annee,
|
||||
$db->where('code', $op, $comptes),
|
||||
$tri
|
||||
);
|
||||
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, $op, $comptes, $champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
users.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 users
|
||||
ON acc_transactions_users.id_user = users.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("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP BY acc_transactions.id, acc_accounts.id
|
||||
ORDER by %s, acc_accounts.code, acc_transactions.date',
|
||||
$annee,
|
||||
$db->where('code', $op, $comptes),
|
||||
$tri
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return versements correspondants à :
|
||||
* @param $annee : année fiscale
|
||||
* @param array $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 getVersementsTarifsComptes($annee,
|
||||
$tarifs,
|
||||
$comptes,
|
||||
$champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$condition = Utils::combinerTarifsComptes($tarifs, $comptes);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
services_fees.id as idTarif,
|
||||
acc_accounts.id as idCompte,
|
||||
acc_accounts.code as codeCompte,
|
||||
users.id as idUser,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN users
|
||||
ON acc_transactions_users.id_user = users.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("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
%s
|
||||
)
|
||||
GROUP BY acc_transactions.id, acc_accounts.id
|
||||
ORDER by %s, acc_accounts.code, acc_transactions.date',
|
||||
$annee,
|
||||
$condition,
|
||||
$tri
|
||||
);
|
||||
// error_log("\ngetVersementsTarifsComptes : sql=" . $sql);
|
||||
return $db->get($sql);
|
||||
}
|
||||
/**
|
||||
* @return versements correspondants à :
|
||||
* @param $annee : année fiscale
|
||||
* @param array $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 getVersementsTarifsComptes($annee,
|
||||
$tarifs,
|
||||
$comptes,
|
||||
$champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$condition = Utils::combinerTarifsComptes($tarifs, $comptes);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
services_fees.id as idTarif,
|
||||
acc_accounts.id as idCompte,
|
||||
acc_accounts.code as codeCompte,
|
||||
users.id as idUser,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN users
|
||||
ON acc_transactions_users.id_user = users.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("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
%s
|
||||
)
|
||||
GROUP BY acc_transactions.id, acc_accounts.id
|
||||
ORDER by %s, acc_accounts.code, acc_transactions.date',
|
||||
$annee,
|
||||
$condition,
|
||||
$tri
|
||||
);
|
||||
// error_log("\ngetVersementsTarifsComptes : sql=" . $sql);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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,
|
||||
$comptesIsoles,
|
||||
$champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'
|
||||
SELECT
|
||||
0 as idTarif,
|
||||
acc_accounts.id as idCompte,
|
||||
acc_accounts.code as codeCompte,
|
||||
users.id as idUser,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN users
|
||||
ON acc_transactions_users.id_user = users.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("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP BY acc_transactions.id, acc_accounts.id
|
||||
ORDER by %s, acc_accounts.code, acc_transactions.date
|
||||
',
|
||||
$annee,
|
||||
$db->where('id', 'in', $comptesIsoles),
|
||||
$tri
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
/**
|
||||
* @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,
|
||||
$comptesIsoles,
|
||||
$champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'
|
||||
SELECT
|
||||
0 as idTarif,
|
||||
acc_accounts.id as idCompte,
|
||||
acc_accounts.code as codeCompte,
|
||||
users.id as idUser,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN users
|
||||
ON acc_transactions_users.id_user = users.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("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
)
|
||||
GROUP BY acc_transactions.id, acc_accounts.id
|
||||
ORDER by %s, acc_accounts.code, acc_transactions.date
|
||||
',
|
||||
$annee,
|
||||
$db->where('id', 'in', $comptesIsoles),
|
||||
$tri
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 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
|
||||
users.id as idUser,
|
||||
users.numero,
|
||||
users.email,
|
||||
row_number() over(order by %s) as rang,
|
||||
%s as nom,
|
||||
users.adresse as adresse,
|
||||
users.code_postal as codePostal,
|
||||
users.ville as ville
|
||||
FROM
|
||||
acc_transactions_users,
|
||||
users,
|
||||
acc_transactions
|
||||
INNER JOIN acc_transactions_lines
|
||||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
WHERE (
|
||||
strftime("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_transactions_users.id_transaction = acc_transactions.id
|
||||
AND
|
||||
acc_transactions_users.id_user = users.id
|
||||
)
|
||||
GROUP by users.id
|
||||
ORDER by %1$s COLLATE U_NOCASE
|
||||
',
|
||||
$tri,
|
||||
$nom,
|
||||
$annee
|
||||
);
|
||||
$donateurs = array();
|
||||
foreach (DB::getInstance()->iterate($sql) as $personne)
|
||||
{
|
||||
$donateurs[$personne->idUser] = new Personne($personne->idUser,
|
||||
$personne->numero,
|
||||
$personne->email,
|
||||
$personne->rang,
|
||||
$personne->nom,
|
||||
$personne->adresse,
|
||||
$personne->codePostal,
|
||||
$personne->ville);
|
||||
}
|
||||
return $donateurs;
|
||||
}
|
||||
/**
|
||||
* @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 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
|
||||
users.id as idUser,
|
||||
users.numero,
|
||||
users.email,
|
||||
row_number() over(order by %s) as rang,
|
||||
%s as nom,
|
||||
users.adresse as adresse,
|
||||
users.code_postal as codePostal,
|
||||
users.ville as ville
|
||||
FROM
|
||||
acc_transactions_users,
|
||||
users,
|
||||
acc_transactions
|
||||
INNER JOIN acc_transactions_lines
|
||||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
WHERE (
|
||||
strftime("%%Y", acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_transactions_users.id_transaction = acc_transactions.id
|
||||
AND
|
||||
acc_transactions_users.id_user = users.id
|
||||
)
|
||||
GROUP by users.id
|
||||
ORDER by %1$s COLLATE U_NOCASE
|
||||
',
|
||||
$tri,
|
||||
$nom,
|
||||
$annee
|
||||
);
|
||||
$donateurs = array();
|
||||
foreach (DB::getInstance()->iterate($sql) as $personne)
|
||||
{
|
||||
$donateurs[$personne->idUser] = new Personne($personne->idUser,
|
||||
$personne->numero,
|
||||
$personne->email,
|
||||
$personne->rang,
|
||||
$personne->nom,
|
||||
$personne->adresse,
|
||||
$personne->codePostal,
|
||||
$personne->ville);
|
||||
}
|
||||
return $donateurs;
|
||||
}
|
||||
|
||||
/**
|
||||
* combiner les champs avec un opérateur
|
||||
* @param array $champs : liste (non vide) de champs
|
||||
* @return chaîne combinée
|
||||
*/
|
||||
private static function combinerChamps($champs)
|
||||
{
|
||||
$op = ' || " " || ';
|
||||
$result = 'ifnull(users.' . $champs[0] . ', "")';
|
||||
for ($i = 1; $i < count($champs); ++$i)
|
||||
{
|
||||
$result .= $op . 'ifnull(users.' . $champs[$i] . ', "")';
|
||||
}
|
||||
return 'trim(' . $result . ')';
|
||||
}
|
||||
/**
|
||||
* combiner les champs avec un opérateur
|
||||
* @param array $champs : liste (non vide) de champs
|
||||
* @return chaîne combinée
|
||||
*/
|
||||
private static function combinerChamps($champs)
|
||||
{
|
||||
$op = ' || " " || ';
|
||||
$result = 'ifnull(users.' . $champs[0] . ', "")';
|
||||
for ($i = 1; $i < count($champs); ++$i)
|
||||
{
|
||||
$result .= $op . 'ifnull(users.' . $champs[$i] . ', "")';
|
||||
}
|
||||
return 'trim(' . $result . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* combiner les clés de tri
|
||||
* @param clés de tri
|
||||
* @return chaîne combinée
|
||||
*/
|
||||
private static function combinerTri(array $champs) : string
|
||||
{
|
||||
$tri = 'users.' . $champs[0];
|
||||
for ($i = 1; $i < count($champs); ++$i)
|
||||
{
|
||||
$tri .= ', users.' . $champs[$i];
|
||||
}
|
||||
return $tri;
|
||||
}
|
||||
/**
|
||||
* combiner les clés de tri
|
||||
* @param clés de tri
|
||||
* @return chaîne combinée
|
||||
*/
|
||||
private static function combinerTri(array $champs) : string
|
||||
{
|
||||
$tri = 'users.' . $champs[0];
|
||||
for ($i = 1; $i < count($champs); ++$i)
|
||||
{
|
||||
$tri .= ', users.' . $champs[$i];
|
||||
}
|
||||
return $tri;
|
||||
}
|
||||
|
||||
/**
|
||||
* combiner chaque tarif avec le numéro de compte associé
|
||||
*/
|
||||
private static function combinerTarifsComptes($tarifs, $comptes)
|
||||
{
|
||||
$condition = '(';
|
||||
$lesCond = array_map(fn($e1, $e2) : string =>
|
||||
"(services_fees.id = '$e1' AND acc_accounts.id = '$e2')",
|
||||
$tarifs, $comptes);
|
||||
$nb = 0;
|
||||
foreach ($lesCond as $cond)
|
||||
{
|
||||
if ($nb > 0) { $condition .= ' OR '; }
|
||||
$condition .= $cond;
|
||||
++$nb;
|
||||
}
|
||||
$condition .= ')';
|
||||
return $condition;
|
||||
}
|
||||
/**
|
||||
* combiner chaque tarif avec le numéro de compte associé
|
||||
*/
|
||||
private static function combinerTarifsComptes($tarifs, $comptes)
|
||||
{
|
||||
$condition = '(';
|
||||
$lesCond = array_map(fn($e1, $e2) : string =>
|
||||
"(services_fees.id = '$e1' AND acc_accounts.id = '$e2')",
|
||||
$tarifs, $comptes);
|
||||
$nb = 0;
|
||||
foreach ($lesCond as $cond)
|
||||
{
|
||||
if ($nb > 0) { $condition .= ' OR '; }
|
||||
$condition .= $cond;
|
||||
++$nb;
|
||||
}
|
||||
$condition .= ')';
|
||||
return $condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return liste des années fiscales
|
||||
*/
|
||||
public static function getAnneesFiscales() : array
|
||||
{
|
||||
$rows = DB::getInstance()->get(
|
||||
"SELECT strftime('%Y', start_date) as annee
|
||||
FROM acc_years
|
||||
UNION
|
||||
SELECT strftime('%Y', end_date) as annee
|
||||
FROM acc_years
|
||||
ORDER by annee DESC"
|
||||
);
|
||||
$anneesFiscales = array();
|
||||
foreach ($rows as $row) {
|
||||
$anneesFiscales[] = $row->annee;
|
||||
}
|
||||
return $anneesFiscales;
|
||||
}
|
||||
/**
|
||||
* @return liste des années fiscales
|
||||
*/
|
||||
public static function getAnneesFiscales() : array
|
||||
{
|
||||
$rows = DB::getInstance()->get(
|
||||
"SELECT strftime('%Y', start_date) as annee
|
||||
FROM acc_years
|
||||
UNION
|
||||
SELECT strftime('%Y', end_date) as annee
|
||||
FROM acc_years
|
||||
ORDER by annee DESC"
|
||||
);
|
||||
$anneesFiscales = array();
|
||||
foreach ($rows as $row) {
|
||||
$anneesFiscales[] = $row->annee;
|
||||
}
|
||||
return $anneesFiscales;
|
||||
}
|
||||
|
||||
public static function getLignesReduction($lesTaux)
|
||||
{
|
||||
foreach ($lesTaux as $elem)
|
||||
{
|
||||
$lignes[$elem->taux] = $elem->remarque;
|
||||
}
|
||||
return $lignes;
|
||||
}
|
||||
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
|
||||
* modifications par rapport à la config paheko
|
||||
* @return array tableau des champs : clé = nom, valeur = { titre, position }
|
||||
*/
|
||||
public static function getChampsNom($config, $plugin) : array
|
||||
{
|
||||
// récupérer dans la config du plugin les champs mémorisés
|
||||
// pour le nom et le prénom (le tableau est vide si pas mémorisé)
|
||||
$champsNom = (array) $plugin->getConfig('champsNom');
|
||||
/**
|
||||
* récupérer dans la config du plugin les champs des membres
|
||||
* utilisés pour le nom et le prénom ; ajouter/supprimer les
|
||||
* modifications par rapport à la config paheko
|
||||
* @return array tableau des champs : clé = nom, valeur = { titre, position }
|
||||
*/
|
||||
public static function getChampsNom($config, $plugin) : array
|
||||
{
|
||||
// récupérer dans la config du plugin les champs mémorisés
|
||||
// pour le nom et le prénom (le tableau est vide si pas mémorisé)
|
||||
$champsNom = (array) $plugin->getConfig('champsNom');
|
||||
|
||||
// récupérer dans la config Paheko les champs des membres
|
||||
// utilisés pour le nom et le prénom
|
||||
$champsPaheko = DynamicFields::getInstance()->listAssocNames();
|
||||
// récupérer dans la config Paheko les champs des membres
|
||||
// utilisés pour le nom et le prénom
|
||||
$champsPaheko = DynamicFields::getInstance()->listAssocNames();
|
||||
|
||||
foreach ($champsPaheko as $name => $title)
|
||||
{
|
||||
if (stristr($title, 'nom'))
|
||||
{
|
||||
// retenir les champs dont le titre contient le terme 'nom'
|
||||
// est-il présent dans la config du plugin ?
|
||||
if (! array_key_exists($name, $champsNom))
|
||||
{
|
||||
// absent => l'ajouter
|
||||
$champ = new \stdClass();
|
||||
$champ->titre = $title;
|
||||
$champ->position = 0;
|
||||
$champsNom[$name] = $champ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// opération symétrique : un champ mémorisé dans la config du
|
||||
// plugin a-t-il disparu de la config paheko ?
|
||||
foreach ($champsNom as $nom => $champ)
|
||||
{
|
||||
if (! array_key_exists($nom, $champsPaheko))
|
||||
{
|
||||
// absent => le supprimer
|
||||
unset($champsNom[$nom]);
|
||||
}
|
||||
}
|
||||
// mettre à jour la config du plugin
|
||||
$plugin->setConfigProperty('champsNom', $champsNom);
|
||||
return $champsNom;
|
||||
}
|
||||
foreach ($champsPaheko as $name => $title)
|
||||
{
|
||||
if (stristr($title, 'nom'))
|
||||
{
|
||||
// retenir les champs dont le titre contient le terme 'nom'
|
||||
// est-il présent dans la config du plugin ?
|
||||
if (! array_key_exists($name, $champsNom))
|
||||
{
|
||||
// absent => l'ajouter
|
||||
$champ = new \stdClass();
|
||||
$champ->titre = $title;
|
||||
$champ->position = 0;
|
||||
$champsNom[$name] = $champ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// opération symétrique : un champ mémorisé dans la config du
|
||||
// plugin a-t-il disparu de la config paheko ?
|
||||
foreach ($champsNom as $nom => $champ)
|
||||
{
|
||||
if (! array_key_exists($nom, $champsPaheko))
|
||||
{
|
||||
// absent => le supprimer
|
||||
unset($champsNom[$nom]);
|
||||
}
|
||||
}
|
||||
// mettre à jour la config du plugin
|
||||
$plugin->setConfigProperty('champsNom', $champsNom);
|
||||
return $champsNom;
|
||||
}
|
||||
|
||||
/**
|
||||
* enregistrer les fichiers dans une archive zip
|
||||
* @param $fileList : liste des fichiers à archiver
|
||||
* @param $year : pour générer le nom de l'archive
|
||||
* @param $archiveDir : ne sert plus
|
||||
*/
|
||||
static function makeArchive(
|
||||
$fileList,
|
||||
$year,
|
||||
$archiveDir = null)
|
||||
{
|
||||
$zipFilename = "recus_dons" . $year . ".zip";
|
||||
header('Content-type: application/zip');
|
||||
header(sprintf('Content-Disposition: attachment; filename="%s"', $zipFilename));
|
||||
$zip = new ZipWriter('php://output');
|
||||
$zip->setCompression(0);
|
||||
foreach ($fileList as $fileName)
|
||||
{
|
||||
$zip->add(basename($fileName), null, $fileName);
|
||||
}
|
||||
$zip->close();
|
||||
} // makeArchive
|
||||
/**
|
||||
* enregistrer les fichiers dans une archive zip
|
||||
* @param $fileList : liste des fichiers à archiver
|
||||
* @param $year : pour générer le nom de l'archive
|
||||
* @param $archiveDir : ne sert plus
|
||||
*/
|
||||
static function makeArchive(
|
||||
$fileList,
|
||||
$year,
|
||||
$archiveDir = null)
|
||||
{
|
||||
$zipFilename = "recus_dons" . $year . ".zip";
|
||||
header('Content-type: application/zip');
|
||||
header(sprintf('Content-Disposition: attachment; filename="%s"', $zipFilename));
|
||||
$zip = new ZipWriter('php://output');
|
||||
$zip->setCompression(0);
|
||||
foreach ($fileList as $fileName)
|
||||
{
|
||||
$zip->add(basename($fileName), null, $fileName);
|
||||
}
|
||||
$zip->close();
|
||||
} // makeArchive
|
||||
}
|
||||
|
@ -4,86 +4,90 @@
|
||||
<h2>Année {$annee_recu} : versements par activité et tarif</h2>
|
||||
|
||||
<fieldset class="noprint">
|
||||
<input type="checkbox" class="check_global" id="check_global" onclick="cocherDecocherTout(check_global)" />
|
||||
<label for="check_global">Cliquer pour cocher toutes les lignes</label>
|
||||
<button type="button" data-icon="↑" class="icn-btn" id="close_details_activite"
|
||||
onclick="montrerMasquerDetails(this.id, 'details.activite', 'toutes les activités')">
|
||||
Replier toutes les activités</button>
|
||||
<button type="button" data-icon="↑" class="icn-btn" id="close_details_personne"
|
||||
onclick="montrerMasquerDetails(this.id, 'details.personne', 'toutes les personnes')">
|
||||
Replier toutes les personnes</button>
|
||||
<br />
|
||||
{button type="submit" label="Télécharger les reçus au format PDF" shape="download"
|
||||
form="versements_activites"
|
||||
formaction="generer_recus.php?type=activite&format=pdf"
|
||||
onclick="return verifierChoix(this.form)"}
|
||||
{button type="submit" target="_dialog" label="Imprimer les reçus" shape="print"
|
||||
form="versements_activites"
|
||||
formaction="generer_recus.php?type=activite&format=print"
|
||||
onclick="return verifierChoix(this.form)"}
|
||||
<input type="checkbox" class="check_global" id="check_global" onclick="cocherDecocherTout(check_global)" />
|
||||
<label for="check_global">Cliquer pour cocher toutes les lignes</label>
|
||||
<button type="button" data-icon="↑" class="icn-btn" id="close_details_activite"
|
||||
onclick="montrerMasquerDetails(this.id, 'details.activite', 'toutes les activités')">
|
||||
Replier toutes les activités</button>
|
||||
<button type="button" data-icon="↑" class="icn-btn" id="close_details_personne"
|
||||
onclick="montrerMasquerDetails(this.id, 'details.personne', 'toutes les personnes')">
|
||||
Replier toutes les personnes</button>
|
||||
<br />
|
||||
{button type="submit" label="Télécharger les reçus au format PDF" shape="download"
|
||||
form="versements_activites"
|
||||
formaction="generer_recus.php?type=activite&format=pdf"
|
||||
onclick="return verifierChoix(this.form)"}
|
||||
{button type="submit" target="_dialog" label="Imprimer les reçus" shape="print"
|
||||
form="versements_activites"
|
||||
formaction="generer_recus.php?type=activite&format=print"
|
||||
onclick="return verifierChoix(this.form)"}
|
||||
</fieldset>
|
||||
|
||||
<form method="post" target="_blank" id="versements_activites">
|
||||
|
||||
{* Itération sur les versements *}
|
||||
{foreach from=$lesVersements key="rang" item="versement"}
|
||||
{if $rang == 0}
|
||||
{* premier versement *}
|
||||
<?php
|
||||
$pair = true;
|
||||
$tarifCourant = $versement->idTarif;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
?>
|
||||
{afficher_debut_tarif versement=$versement}
|
||||
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.idTarif != $tarifCourant}
|
||||
{* changement de tarif *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
{fin_tarif}
|
||||
<?php
|
||||
$pair = true;
|
||||
$tarifCourant = $versement->idTarif;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
?>
|
||||
{afficher_debut_tarif versement=$versement}
|
||||
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.idUser != $personneCourante}
|
||||
{* changement de personne *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
<?php
|
||||
$pair = true;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
?>
|
||||
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.idCompte != $compteCourant}
|
||||
{fin_compte}
|
||||
{* changement de compte *}
|
||||
<?php
|
||||
$pair = true;
|
||||
$compteCourant = $versement->idCompte;
|
||||
?>
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{else}
|
||||
{* même personne, même compte *}
|
||||
{/if}
|
||||
{afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang pair=$pair}
|
||||
<?php $pair = ! $pair; ?>
|
||||
{/foreach} {* Itération sur les versements *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
{fin_tarif}
|
||||
{* Itération sur les versements *}
|
||||
{foreach from=$lesVersements key="rang" item="versement"}
|
||||
{if $rang == 0}
|
||||
{* premier versement *}
|
||||
<?php
|
||||
$pair = true;
|
||||
$tarifCourant = $versement->idTarif;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
$codeCompte = $versement->codeCompte;
|
||||
?>
|
||||
{afficher_debut_tarif versement=$versement}
|
||||
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.idTarif != $tarifCourant}
|
||||
{* changement de tarif *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
{fin_tarif}
|
||||
<?php
|
||||
$pair = true;
|
||||
$tarifCourant = $versement->idTarif;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
$codeCompte = $versement->codeCompte;
|
||||
?>
|
||||
{afficher_debut_tarif versement=$versement}
|
||||
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.idUser != $personneCourante}
|
||||
{* changement de personne *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
<?php
|
||||
$pair = true;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
$codeCompte = $versement->codeCompte;
|
||||
?>
|
||||
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.codeCompte != $codeCompte}
|
||||
{fin_compte}
|
||||
{* changement de compte *}
|
||||
<?php
|
||||
$pair = true;
|
||||
$compteCourant = $versement->idCompte;
|
||||
$codeCompte = $versement->codeCompte;
|
||||
?>
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{else}
|
||||
{* même personne, même compte *}
|
||||
{/if}
|
||||
{afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang pair=$pair}
|
||||
<?php $pair = ! $pair; ?>
|
||||
{/foreach} {* Itération sur les versements *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
{fin_tarif}
|
||||
</form>
|
||||
|
||||
{* scripts divers *}
|
||||
<script src="script.js"></script>
|
||||
|
||||
<!-- footer -->
|
||||
{include file="_foot.tpl"}
|
||||
{include file="_foot.tpl"}
|
||||
|
@ -4,67 +4,71 @@
|
||||
<h2>Année {$annee_recu} : versements par personne</h2>
|
||||
|
||||
<fieldset class="noprint">
|
||||
<input type="checkbox" class="check_global" id="check_global"
|
||||
onclick="cocherDecocherToutesLesPersonnes(check_global)" />
|
||||
<label for="check_global">Cliquer pour cocher toutes les lignes</label>
|
||||
<button type="button" data-icon="↑" class="icn-btn" id="close_details_personne"
|
||||
onclick="montrerMasquerDetails(this.id, 'details.personne', 'toutes les personnes')">
|
||||
Replier toutes les personnes</button>
|
||||
<br />
|
||||
{button type="submit" label="Télécharger les reçus au format PDF" shape="download"
|
||||
form="versements_personnes"
|
||||
formaction="generer_recus.php?type=personne&format=pdf"
|
||||
onclick="return verifierChoix(this.form)"}
|
||||
{button type="submit" target="_dialog" label="Imprimer les reçus" shape="print"
|
||||
form="versements_personnes"
|
||||
formaction="generer_recus.php?type=personne&format=print"
|
||||
onclick="return verifierChoix(this.form)"}
|
||||
<input type="checkbox" class="check_global" id="check_global"
|
||||
onclick="cocherDecocherToutesLesPersonnes(check_global)" />
|
||||
<label for="check_global">Cliquer pour cocher toutes les lignes</label>
|
||||
<button type="button" data-icon="↑" class="icn-btn" id="close_details_personne"
|
||||
onclick="montrerMasquerDetails(this.id, 'details.personne', 'toutes les personnes')">
|
||||
Replier toutes les personnes</button>
|
||||
<br />
|
||||
{button type="submit" label="Télécharger les reçus au format PDF" shape="download"
|
||||
form="versements_personnes"
|
||||
formaction="generer_recus.php?type=personne&format=pdf"
|
||||
onclick="return verifierChoix(this.form)"}
|
||||
{button type="submit" label="Imprimer les reçus" shape="print"
|
||||
form="versements_personnes"
|
||||
formaction="generer_recus.php?type=personne&format=print"
|
||||
onclick="return verifierChoix(this.form)"}
|
||||
</fieldset>
|
||||
|
||||
<form method="post" target="_dialog" id="versements_personnes">
|
||||
|
||||
{* Itération sur les personnes *}
|
||||
{foreach from=$lesVersements key="rang" item="versement"}
|
||||
{if $rang == 0}
|
||||
{* 1ère personne *}
|
||||
<?php
|
||||
$pair = true;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
?>
|
||||
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.idUser != $personneCourante}
|
||||
{* changement de personne *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
<?php
|
||||
$pair = true;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
?>
|
||||
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.idCompte != $compteCourant}
|
||||
{fin_compte}
|
||||
{* changement de compte *}
|
||||
<?php
|
||||
$pair = true;
|
||||
$compteCourant = $versement->idCompte;
|
||||
?>
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{else}
|
||||
{* même personne, même compte *}
|
||||
{/if}
|
||||
{afficher_versement versement=$versement idVersement=$personneCourante rang=$rang pair=$pair}
|
||||
<?php $pair = ! $pair; ?>
|
||||
{/foreach} {* Itération sur les personnes *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
{* Itération sur les personnes *}
|
||||
{foreach from=$lesVersements key="rang" item="versement"}
|
||||
|
||||
{if $rang == 0}
|
||||
{* 1ère personne *}
|
||||
<?php
|
||||
$pair = true;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
$codeCompte = $versement->codeCompte;
|
||||
?>
|
||||
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.idUser != $personneCourante}
|
||||
{* changement de personne *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
<?php
|
||||
$pair = true;
|
||||
$personneCourante = $versement->idUser;
|
||||
$compteCourant = $versement->idCompte;
|
||||
$codeCompte = $versement->codeCompte;
|
||||
?>
|
||||
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{elseif $versement.codeCompte != $codeCompte}
|
||||
{fin_compte}
|
||||
{* changement de compte *}
|
||||
<?php
|
||||
$pair = true;
|
||||
$compteCourant = $versement->idCompte;
|
||||
$codeCompte = $versement->codeCompte;
|
||||
?>
|
||||
{afficher_debut_compte idCompte=$compteCourant}
|
||||
{else}
|
||||
{* même personne, même compte *}
|
||||
{/if}
|
||||
{afficher_versement versement=$versement idVersement=$personneCourante rang=$rang pair=$pair}
|
||||
<?php $pair = ! $pair; ?>
|
||||
{/foreach} {* Itération sur les personnes *}
|
||||
{fin_compte}
|
||||
{fin_personne}
|
||||
</form>
|
||||
|
||||
{* scripts divers *}
|
||||
<script src="script.js"></script>
|
||||
|
||||
<!-- footer -->
|
||||
{include file="_foot.tpl"}
|
||||
{include file="_foot.tpl"}
|
||||
|
Loading…
Reference in New Issue
Block a user