intégration comptes
FossilOrigin-Name: d81e13438cbc9ed585e76b36e2950615b8da359697f2c577673c77460b59064d
This commit is contained in:
parent
4958b88538
commit
68e6afed11
413
lib/Utils.php
413
lib/Utils.php
@ -8,35 +8,139 @@ use KD2\ZipWriter;
|
|||||||
class Utils
|
class Utils
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return tarifs demandés
|
* @return informations sur les tarifs
|
||||||
* @param array $tarifs
|
|
||||||
*/
|
*/
|
||||||
public static function getTarifs($tarifs)
|
public static function getTarifs()
|
||||||
{
|
{
|
||||||
$db = DB::getInstance();
|
$db = DB::getInstance();
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT id, id_service as idActivite, label, description, amount as montant
|
'SELECT
|
||||||
FROM services_fees
|
id,
|
||||||
WHERE services_fees.%s',
|
id_service as idActivite,
|
||||||
$db->where('id', $tarifs));
|
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 $db->get($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return activités correspondant aux tarifs demandés
|
* faire un tableau associatif avec le résultat d'une requête
|
||||||
* @param array $tarifs
|
|
||||||
*/
|
*/
|
||||||
public static function getActivites($tarifs)
|
static function toAssoc($array, $nomCle)
|
||||||
{
|
{
|
||||||
$db = DB::getInstance();
|
$assoc = array();
|
||||||
$sql = sprintf(
|
foreach ($array as $elem)
|
||||||
'SELECT services.id, services.label, services.description
|
{
|
||||||
FROM services
|
$ro = new \ReflectionObject($elem);
|
||||||
LEFT JOIN services_fees ON services_fees.id_service = services.id
|
$proprietes = $ro->getProperties();
|
||||||
WHERE services_fees.%s
|
$obj = new \stdClass();
|
||||||
GROUP BY services.id',
|
foreach ($proprietes as $p)
|
||||||
$db->where('id', $tarifs));
|
{
|
||||||
return $db->get($sql);
|
$pname = $p->getName();
|
||||||
|
if ($pname == $nomCle) {
|
||||||
|
$key = $p->getValue($elem);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$obj->$pname = $p->getValue($elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$assoc[$key] = $obj;
|
||||||
|
}
|
||||||
|
return $assoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,88 +148,60 @@ class Utils
|
|||||||
* @param $annee
|
* @param $annee
|
||||||
* @param array $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, $champsNom)
|
public static function getVersementsPersonnes($annee, $op, $comptes, $champsNom)
|
||||||
{
|
{
|
||||||
$db = DB::getInstance();
|
$db = DB::getInstance();
|
||||||
$tri = Utils::combinerTri($champsNom);
|
$tri = Utils::combinerTri($champsNom);
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT
|
'SELECT
|
||||||
membres.id as idUser,
|
membres.id as idUser,
|
||||||
|
acc_accounts.id as idCompte,
|
||||||
|
acc_accounts.code as codeCompte,
|
||||||
acc_transactions_lines.credit as versement,
|
acc_transactions_lines.credit as versement,
|
||||||
acc_transactions.date
|
acc_transactions.date
|
||||||
FROM acc_transactions_users
|
FROM acc_transactions_users
|
||||||
INNER JOIN membres on acc_transactions_users.id_user = membres.id
|
INNER JOIN membres
|
||||||
INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id
|
ON acc_transactions_users.id_user = membres.id
|
||||||
INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id
|
INNER JOIN acc_transactions
|
||||||
INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id
|
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
|
WHERE
|
||||||
(strftime(%s, acc_transactions.date) = "%d"
|
(strftime(%s, acc_transactions.date) = "%d"
|
||||||
AND
|
AND
|
||||||
acc_transactions_lines.credit > 0)
|
acc_accounts.%s
|
||||||
ORDER by %s, acc_transactions.date',
|
)
|
||||||
|
ORDER by %s, acc_accounts.id, acc_transactions.date',
|
||||||
'"%Y"',
|
'"%Y"',
|
||||||
$annee,
|
$annee,
|
||||||
|
$db->where('code', $op, $comptes),
|
||||||
$tri
|
$tri
|
||||||
);
|
);
|
||||||
return $db->get($sql);
|
return $db->get($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return versements correspondants à l'année et aux tarifs donnés
|
* @return versements correspondants à :
|
||||||
* triés par tarif, nom, date
|
* @param $annee : année fiscale
|
||||||
* @param $annee
|
* @param $tarifs : tarifs sélectionnés
|
||||||
* @param array $tarifs
|
* @param array $comptes : comptes associés aux tarifs
|
||||||
* @param array $champsNom : liste non vide des champs de nom/prénom
|
* @param array $champsNom : liste non vide des champs de nom/prénom
|
||||||
|
* @remarks tri par tarif, nom, compte, date
|
||||||
*/
|
*/
|
||||||
public static function getVersementsTarifs($annee, $tarifs, $champsNom)
|
public static function getVersementsTarifsComptes($annee,
|
||||||
{
|
$tarifs,
|
||||||
$db = DB::getInstance();
|
$comptes,
|
||||||
$tri = Utils::combinerTri($champsNom);
|
$champsNom)
|
||||||
$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, %s, acc_transactions.date',
|
|
||||||
'"%Y"',
|
|
||||||
$annee,
|
|
||||||
$db->where('id', $tarifs),
|
|
||||||
$tri
|
|
||||||
);
|
|
||||||
return $db->get($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return versements correspondants à l'année et aux comptes donnés
|
|
||||||
* @param $annee
|
|
||||||
* @param $op : opérateur de combinaison des comptes
|
|
||||||
* @param array $comptes
|
|
||||||
* @param array $champsNom : liste non vide des champs de nom/prénom
|
|
||||||
* exemples :
|
|
||||||
* op = 'in', comptes = ['706', '7780', '756']
|
|
||||||
* op = 'like', comptes = '7%'
|
|
||||||
*/
|
|
||||||
public static function getVersementsComptes($annee, $op, $comptes, $champsNom)
|
|
||||||
{
|
{
|
||||||
$db = DB::getInstance();
|
$db = DB::getInstance();
|
||||||
$tri = Utils::combinerTri($champsNom);
|
$tri = Utils::combinerTri($champsNom);
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT
|
'SELECT
|
||||||
services_fees.id as idTarif,
|
services_fees.id as idTarif,
|
||||||
acc_accounts.code as compte,
|
acc_accounts.id as idCompte,
|
||||||
|
acc_accounts.code as codeCompte,
|
||||||
membres.id as idUser,
|
membres.id as idUser,
|
||||||
acc_transactions_lines.credit as versement,
|
acc_transactions_lines.credit as versement,
|
||||||
acc_transactions.date
|
acc_transactions.date
|
||||||
@ -145,13 +221,62 @@ class Utils
|
|||||||
WHERE
|
WHERE
|
||||||
(strftime(%s, acc_transactions.date) = "%d"
|
(strftime(%s, acc_transactions.date) = "%d"
|
||||||
AND
|
AND
|
||||||
acc_accounts.%s
|
services_fees.%s
|
||||||
AND
|
AND
|
||||||
acc_transactions_lines.credit > 0)
|
acc_accounts.%s
|
||||||
ORDER by %s, acc_transactions.date',
|
)
|
||||||
|
ORDER by services_fees.id, %s, acc_accounts.id, acc_transactions.date',
|
||||||
'"%Y"',
|
'"%Y"',
|
||||||
$annee,
|
$annee,
|
||||||
$db->where('code', $op, $comptes),
|
$db->where('id', 'in', $tarifs),
|
||||||
|
$db->where('id', 'in', $comptes),
|
||||||
|
$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,
|
||||||
|
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 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
|
||||||
|
)
|
||||||
|
|
||||||
|
ORDER by %s, acc_accounts.id, acc_transactions.date
|
||||||
|
',
|
||||||
|
'"%Y"',
|
||||||
|
$annee,
|
||||||
|
$db->where('id', 'in', $comptesIsoles),
|
||||||
$tri
|
$tri
|
||||||
);
|
);
|
||||||
return $db->get($sql);
|
return $db->get($sql);
|
||||||
@ -184,8 +309,6 @@ class Utils
|
|||||||
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
ON acc_transactions_lines.id_transaction = acc_transactions.id
|
||||||
WHERE (
|
WHERE (
|
||||||
strftime(%s, acc_transactions.date) = "%d"
|
strftime(%s, acc_transactions.date) = "%d"
|
||||||
AND
|
|
||||||
acc_transactions_lines.credit > 0
|
|
||||||
AND
|
AND
|
||||||
acc_transactions_users.id_transaction = acc_transactions.id
|
acc_transactions_users.id_transaction = acc_transactions.id
|
||||||
AND
|
AND
|
||||||
@ -199,7 +322,6 @@ class Utils
|
|||||||
'"%Y"',
|
'"%Y"',
|
||||||
$annee
|
$annee
|
||||||
);
|
);
|
||||||
// error_log("getDonateurs = " . print_r($sql, true));
|
|
||||||
$donateurs = array();
|
$donateurs = array();
|
||||||
foreach (DB::getInstance()->iterate($sql) as $personne)
|
foreach (DB::getInstance()->iterate($sql) as $personne)
|
||||||
{
|
{
|
||||||
@ -239,121 +361,6 @@ class Utils
|
|||||||
return $tri;
|
return $tri;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** OBSOLETE
|
|
||||||
* Versements totaux par personne pour une année donnée
|
|
||||||
* @param année
|
|
||||||
* @param array $champsNom : liste non vide des champs de nom/prénom
|
|
||||||
*/
|
|
||||||
public static function getVersementsTotaux($annee, $champsNom)
|
|
||||||
{
|
|
||||||
$tri = Utils::combinerTri($champsNom);
|
|
||||||
$sql = sprintf(
|
|
||||||
'SELECT
|
|
||||||
membres.id as idUser,
|
|
||||||
sum(acc_transactions_lines.credit) AS versement
|
|
||||||
FROM
|
|
||||||
acc_transactions_users,
|
|
||||||
membres,
|
|
||||||
acc_transactions
|
|
||||||
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
|
|
||||||
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',
|
|
||||||
'"%Y"',
|
|
||||||
$annee,
|
|
||||||
$tri);
|
|
||||||
return DB::getInstance()->get($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getDonateurs_old($annee, $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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getLignesReduction($lesTaux)
|
|
||||||
{
|
|
||||||
foreach ($lesTaux as $elem)
|
|
||||||
{
|
|
||||||
$lignes[$elem->taux] = $elem->remarque;
|
|
||||||
}
|
|
||||||
return $lignes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getLigneReduction($taux)
|
|
||||||
{
|
|
||||||
return $_SESSION['ligneReduction'][$taux];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return 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 liste des années fiscales
|
* @return liste des années fiscales
|
||||||
*/
|
*/
|
||||||
@ -371,11 +378,25 @@ class Utils
|
|||||||
return $anneesFiscales;
|
return $anneesFiscales;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getLignesReduction($lesTaux)
|
||||||
|
{
|
||||||
|
foreach ($lesTaux as $elem)
|
||||||
|
{
|
||||||
|
$lignes[$elem->taux] = $elem->remarque;
|
||||||
|
}
|
||||||
|
return $lignes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLigneReduction($taux)
|
||||||
|
{
|
||||||
|
return $_SESSION['ligneReduction'][$taux];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* récupérer dans la config du plugin les champs des membres
|
* récupérer dans la config du plugin les champs des membres
|
||||||
* utilisés pour le nom et le prénom ; ajouter/supprimer les
|
* utilisés pour le nom et le prénom ; ajouter/supprimer les
|
||||||
* modifications par rapport à la config garradin
|
* modifications par rapport à la config garradin
|
||||||
* @return tableau des champs : clé = nom, valeur = { titre, position }
|
* @return array tableau des champs : clé = nom, valeur = { titre, position }
|
||||||
*/
|
*/
|
||||||
public static function getChampsNom($config, $plugin) : array
|
public static function getChampsNom($config, $plugin) : array
|
||||||
{
|
{
|
||||||
|
@ -1,67 +1,55 @@
|
|||||||
<!-- nav bar -->
|
<!-- nav bar -->
|
||||||
{include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="index"}
|
{include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="index"}
|
||||||
|
|
||||||
<?php $url = PLUGIN_URL ?>
|
|
||||||
<nav class="acc-year">
|
<nav class="acc-year">
|
||||||
<h4>Année fiscale sélectionnée :</h4>
|
<h4>Année fiscale sélectionnée :</h4>
|
||||||
<h3>{$annee_recu}</h3>
|
<h3>{$annee_recu}</h3>
|
||||||
<footer>{linkbutton label="Changer d'année fiscale" href="$url/choix_annee.php?from=%s"|args:rawurlencode($self_url) shape="settings"}</footer>
|
<footer>{linkbutton label="Changer d'année fiscale" href="%s/choix_annee.php?from=%s"|args:PLUGIN_URL,rawurlencode($self_url) shape="settings"}</footer>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<form id="formulaire_saisie" method="post" action="action.php">
|
<form id="formulaire_saisie" method="post" action="action.php">
|
||||||
|
|
||||||
<div id="choix_methode">
|
<div id="choix_methode">
|
||||||
<h2>Choisir une méthode de génération des reçus</h2>
|
<h3>Sélectionner les versements pour les reçus</h3>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
{* <legend>Choisir une des méthodes</legend> *}
|
{* <legend>Choisir une des méthodes</legend> *}
|
||||||
<dl>
|
<dl id="menu">
|
||||||
<dd class="radio-btn">
|
<dd class="radio-btn">
|
||||||
<input type="radio" id="radio_versements_personne" name="choix_versements" value="personne"
|
<input type="radio" id="radio_versements_personne" name="choix_versements" value="personne"
|
||||||
onclick="choixMethodeGeneration(this.form, 'personne', '.tous', '.activites');" />
|
onclick="choixMethodeGeneration(this.form, 'personne', 'menu_versements', '.menu');" />
|
||||||
<label for="radio_versements_personne">
|
<label for="radio_versements_personne">
|
||||||
<div class="explications">
|
<div class="explications">
|
||||||
<h5>
|
<h5>
|
||||||
Tous les versements des membres font l'objet d'un reçu, quels que soient les activités, tarifs et les comptes du plan comptable
|
Seuls les versements des personnes importent.
|
||||||
</h5>
|
</h5>
|
||||||
<p>Choisissez cette option si vous voulez sélectionner les versements d'une, plusieurs
|
<p class="help">Choisissez cette option si vous n'avez pas besoin des activités ni des tarifs</p>
|
||||||
ou toutes les personnes</p>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</dd>
|
</dd>
|
||||||
|
{*
|
||||||
<dd class="radio-btn">
|
<dd class="radio-btn">
|
||||||
<input type="radio" id="radio_versements_personne_compte" name="choix_versements" value="personne_compte"
|
<input type="radio" id="radio_versements_personne_compte" name="choix_versements" value="personne_compte"
|
||||||
onclick="choixMethodeGeneration(this.form, 'personne', '.tous', '.activites');" />
|
onclick="choixMethodeGeneration(this.form, 'compte', 'menu_comptes', '.menu');" />
|
||||||
<label for="radio_versements_personne_compte">
|
<label for="radio_versements_personne_compte">
|
||||||
<div class="explications">
|
<div class="explications">
|
||||||
<h5>
|
<h5>
|
||||||
Seuls les versements sur certains comptes du plan comptable font l'objet d'un reçu
|
Seuls certains comptes du plan comptable importent.
|
||||||
</h5>
|
</h5>
|
||||||
<p>Choisissez cette option si vous voulez sélectionner :</p>
|
<p class="help">Choisissez cette option si les comptes du plan comptable importent, mais pas les activités ni les tarifs</p>
|
||||||
<ul>
|
|
||||||
<li>certains comptes du plan comptable</li>
|
|
||||||
<li>certains versements de certaines personnes</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</dd>
|
</dd>
|
||||||
|
*}
|
||||||
<dd class="radio-btn">
|
<dd class="radio-btn">
|
||||||
<dd class="radio-btn">
|
<input type="radio" id="radio_versements_activites" name="choix_versements" value="activite"
|
||||||
<input type="radio" id="radio_versements_activites" name="choix_versements"
|
onclick="choixMethodeGeneration(this.form, 'activite', 'menu_activites_tarifs', '.menu');" />
|
||||||
value="activite" onclick="choixMethodeGeneration(this.form, 'activite', '.activites', '.tous');" />
|
|
||||||
<label for="radio_versements_activites">
|
<label for="radio_versements_activites">
|
||||||
<div class="explications">
|
<div class="explications">
|
||||||
<h5>
|
<h5>
|
||||||
Seuls les versements de certaines activités et tarifs font
|
Certaines activités ou certains tarifs importent.
|
||||||
l'objet d'un reçu
|
|
||||||
</h5>
|
</h5>
|
||||||
<p>Choisissez cette option si vous voulez sélectionner :</p>
|
<p class="help">Choisissez cette option pour classer les versements par activités et tarifs</p>
|
||||||
<ul>
|
|
||||||
<li>certaines activités ou certains tarifs</li>
|
|
||||||
<li>certains versements de certaines personnes</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</dd>
|
</dd>
|
||||||
@ -69,110 +57,215 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{* Toutes les personnes *}
|
{* Tous les versements *}
|
||||||
<div id="div_taux_reduc" class="tous hidden">
|
<div id="menu_versements" class="menu hidden">
|
||||||
<h2>Choisir le taux de réduction</h2>
|
<h3>Choisir le taux de réduction</h3>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
{if $nbTaux == 0}
|
{if $nbTaux == 0}
|
||||||
<h3 class="warning">Vous devez d'abord sélectionner au moins un taux de réduction dans l'onglet de
|
<h3 class="warning">Vous devez d'abord sélectionner au moins un taux de réduction dans l'onglet de configuration</h3>
|
||||||
configuration</h3>
|
|
||||||
{/if}
|
{/if}
|
||||||
{if $nbChamps == 0}
|
{if $nbChamps == 0}
|
||||||
<h3 class="warning">Vous devez d'abord sélectionner au moins un champ pour le nom et le prénom dans l'onglet
|
<h3 class="warning">Vous devez d'abord sélectionner au moins un champ pour le nom et le prénom dans l'onglet de configuration</h3>
|
||||||
de configuration</h3>
|
|
||||||
{/if}
|
{/if}
|
||||||
{if $nbTaux > 0 && $nbChamps > 0}
|
{if $nbTaux > 0 && $nbChamps > 0}
|
||||||
|
<ul class="reduction">
|
||||||
{foreach from=$plugin_config->reduction item="reduc"}
|
{foreach from=$plugin_config->reduction item="reduc"}
|
||||||
{if $reduc->valeur == 1}
|
{if $reduc->valeur == 1}
|
||||||
|
<li>
|
||||||
<span class="radio-btn">
|
<span class="radio-btn">
|
||||||
<input type="radio" id="{$reduc->taux}" name="taux_reduction" value="{$reduc->taux}"
|
<input
|
||||||
{if $nbTaux == 1}checked{/if} />
|
type="radio"
|
||||||
|
id="{$reduc->taux}"
|
||||||
|
name="taux_reduction"
|
||||||
|
value="{$reduc->taux}"
|
||||||
|
{if $nbTaux == 1}checked{/if}
|
||||||
|
/>
|
||||||
<label for="{$reduc->taux}">{$reduc->taux}{if $reduc->remarque != ""} - {$reduc->remarque}{/if}</label>
|
<label for="{$reduc->taux}">{$reduc->taux}{if $reduc->remarque != ""} - {$reduc->remarque}{/if}</label>
|
||||||
</span>
|
</span>
|
||||||
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
</ul>
|
||||||
{/if}
|
{/if}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="generer_tous" class="tous hidden">
|
<p class="submit">
|
||||||
<p class=" submit">
|
|
||||||
{csrf_field key="generer_tous_recus"}
|
{csrf_field key="generer_tous_recus"}
|
||||||
{button type="submit" name="generer_tous" label="Poursuivre" shape="right" class="main" onclick="return verifierRadio('div_taux_reduc');" }
|
{button type="submit" name="generer_tous" label="Poursuivre" shape="right" class="main" onclick="return verifierRadio('menu_versements');" }
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{* Activités et tarifs *}
|
{* Comptes *}
|
||||||
<div id="liste_activites_tarifs" class="activites hidden">
|
{*
|
||||||
<h2>Choisir les activités et tarifs concernés par les reçus ainsi que le taux de réduction</h2>
|
<div id="menu_comptes" class="menu hidden">
|
||||||
|
<h3>Choisir les comptes concernés ainsi que le taux de réduction</h3>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
{if $nbTaux == 0}
|
{if $nbTaux == 0}
|
||||||
<h3 class="warning">Vous devez d'abord sélectionner au moins un taux de réduction dans l'onglet de
|
<h3 class="warning">Vous devez d'abord sélectionner au moins un taux de réduction dans l'onglet de configuration</h3>
|
||||||
configuration</h3>
|
|
||||||
{/if}
|
{/if}
|
||||||
{if $nbChamps == 0}
|
{if $nbChamps == 0}
|
||||||
<h3 class="warning">Vous devez d'abord sélectionner au moins un champ pour le nom et le prénom dans l'onglet
|
<h3 class="warning">Vous devez d'abord sélectionner au moins un champ pour le nom et le prénom dans l'onglet de configuration</h3>
|
||||||
de configuration</h3 {/if} {if $nbTaux > 0 && $nbChamps > 0} <table class="list">
|
{/if}
|
||||||
|
{if $nbTaux > 0 && $nbChamps > 0}
|
||||||
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Activité et Tarif</th>
|
<th style="width: 35%;">N° et Compte</th>
|
||||||
<th>Cocher</th>
|
|
||||||
<th>Taux de réduction</th>
|
<th>Taux de réduction</th>
|
||||||
<th>Caractéristiques activité</th>
|
|
||||||
<th>N° et Compte</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{foreach from=$activitesTarifsComptes item="activite"}
|
{foreach from=$lesComptes key="idcpt" item="compte"}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span>{$activite.titreActivite} - {$activite.titreTarif}</span>
|
{if $nbTarifs == 1}
|
||||||
</td>
|
{input
|
||||||
|
type="checkbox"
|
||||||
|
name="comptes[]"
|
||||||
|
value=$idcpt
|
||||||
|
label="%s : %s"|args:$compte.codeCompte,$compte.nomCompte
|
||||||
|
checked="checked"
|
||||||
|
}
|
||||||
|
{else}
|
||||||
|
{input
|
||||||
|
type="checkbox"
|
||||||
|
name="comptes[]"
|
||||||
|
value=$idcpt
|
||||||
|
label="%s : %s"|args:$compte.codeCompte,$compte.nomCompte
|
||||||
|
}
|
||||||
|
{/if}
|
||||||
<td>
|
<td>
|
||||||
{if $nbTarifs == 1}
|
{foreach from=$plugin_config->reduction item="reduc"}
|
||||||
{input
|
|
||||||
type="checkbox"
|
|
||||||
name="tarifs[]"
|
|
||||||
value=$activite.idTarif
|
|
||||||
checked="checked"
|
|
||||||
}
|
|
||||||
{else}
|
|
||||||
{input
|
|
||||||
type="checkbox"
|
|
||||||
name="tarifs[]"
|
|
||||||
value=$activite.idTarif
|
|
||||||
}
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{foreach from=$plugin_config->reduction item="reduc"}
|
|
||||||
{if $reduc->valeur == 1}
|
{if $reduc->valeur == 1}
|
||||||
<span class="radio-btn">
|
<span class="radio-btn">
|
||||||
<input type="radio" id="taux_{$reduc->taux}_{$activite.idTarif}"
|
<input type="radio" id="taux_{$reduc->taux}_{$idcpt}"
|
||||||
name="taux_reduction_{$activite.idTarif}" value="{$reduc->taux}"
|
name="taux_reduction_{$idcpt}" value="{$reduc->taux}"
|
||||||
{if $nbTarifs > 1}disabled{/if} {if $nbTaux == 1}checked{/if} />
|
{if $nbTarifs > 1}disabled{/if} {if $nbTaux == 1}checked{/if} />
|
||||||
<label
|
<label for="taux_{$reduc->taux}_{$idcpt}">{$reduc->taux}
|
||||||
for="taux_{$reduc->taux}_{$activite.idTarif}">{$reduc->taux}{if $reduc->remarque != ""}
|
{if $reduc->remarque != ""} - {$reduc->remarque}{/if}
|
||||||
- {$reduc->remarque}{/if}</label>
|
</label>
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</td>
|
</td>
|
||||||
<td>{if $activite.descActivite != ""}{$activite.descActivite} ; {/if}{$activite.descTarif}</td>
|
|
||||||
<td>{$activite.numeroCpt} : {$activite.nomCpt}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="generer_activites" class="activites hidden">
|
<p class="submit">
|
||||||
<p class=" submit">
|
{csrf_field key="generer_recus_comptes"}
|
||||||
|
{button type="submit" name="generer_comptes" label="Poursuivre" shape="right" class="main" onclick="return verifierCases('menu_comptes');" }
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
*}
|
||||||
|
{* Activités et tarifs *}
|
||||||
|
<div id="menu_activites_tarifs" class="menu hidden">
|
||||||
|
<h3>Choisir les activités, tarifs et comptes concernés ainsi que le taux de réduction</h3>
|
||||||
|
<fieldset>
|
||||||
|
{if $nbTaux == 0}
|
||||||
|
<h3 class="warning">Vous devez d'abord sélectionner au moins un taux de réduction dans l'onglet de configuration</h3>
|
||||||
|
{/if}
|
||||||
|
{if $nbChamps == 0}
|
||||||
|
<h3 class="warning">Vous devez d'abord sélectionner au moins un champ pour le nom et le prénom dans l'onglet de configuration</h3>
|
||||||
|
{/if}
|
||||||
|
{if $nbTaux > 0 && $nbChamps > 0}
|
||||||
|
<ul id="liste_activites">
|
||||||
|
{foreach from=$activitesTarifsComptes item="elem"}
|
||||||
|
<li>
|
||||||
|
<?php
|
||||||
|
$tarif = $lesTarifs[$elem->idTarif];
|
||||||
|
$compte = $lesComptes[$elem->idCompte];
|
||||||
|
$activite = $lesActivites[$tarif->idActivite];
|
||||||
|
?>
|
||||||
|
<div class="activite">
|
||||||
|
<?php
|
||||||
|
$libelle = $activite->label . " - tarif " . $tarif->label . " ; ";
|
||||||
|
?>
|
||||||
|
{if $nbTarifs == 1}
|
||||||
|
{input
|
||||||
|
type="checkbox"
|
||||||
|
name="tarifs[]"
|
||||||
|
value="%s_%s"|args:$elem.idTarif,$elem.idCompte
|
||||||
|
label="%s - tarif %s ;"|args:$activite.label,$tarif.label
|
||||||
|
checked="checked"
|
||||||
|
}
|
||||||
|
{else}
|
||||||
|
{input
|
||||||
|
type="checkbox"
|
||||||
|
name="tarifs[]"
|
||||||
|
value="%s_%s"|args:$elem.idTarif,$elem.idCompte
|
||||||
|
label="%s - tarif %s ;"|args:$activite.label,$tarif.label
|
||||||
|
}
|
||||||
|
{/if}
|
||||||
|
<span>compte : {$elem.codeCompte} ({$compte->nomCompte})</span>
|
||||||
|
</div>
|
||||||
|
<ul class="reduction">
|
||||||
|
{foreach from=$plugin_config->reduction item="reduc"}
|
||||||
|
{if $reduc->valeur == 1}
|
||||||
|
<li>
|
||||||
|
<span class="radio-btn">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
id="taux_{$reduc->taux}_{$elem.idTarif}_{$elem.idCompte}"
|
||||||
|
name="taux_reduction_{$elem.idTarif}_{$elem.idCompte}"
|
||||||
|
value="{$reduc->taux}"
|
||||||
|
{if $nbTarifs > 1}disabled{/if}
|
||||||
|
{if $nbTaux == 1}checked{/if}
|
||||||
|
/>
|
||||||
|
<label for="taux_{$reduc->taux}_{$elem.idTarif}_{$elem.idCompte}">
|
||||||
|
{$reduc->taux}{if $reduc->remarque != ""} - {$reduc->remarque}{/if}</label>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
{/foreach}
|
||||||
|
{* comptes non rattachés à une activité *}
|
||||||
|
{foreach from=$comptesSansActivite item="idCompte"}
|
||||||
|
<li>
|
||||||
|
<div class="activite">
|
||||||
|
{input
|
||||||
|
type="checkbox"
|
||||||
|
name="comptes[]"
|
||||||
|
value="%s"|args:$idCompte
|
||||||
|
label="Versements non rattachés à une activité ;"
|
||||||
|
}
|
||||||
|
<?php $compte = $lesComptes[$idCompte]; ?>
|
||||||
|
<span>compte : {$compte.codeCompte} ({$compte.nomCompte})</span>
|
||||||
|
</div>
|
||||||
|
{/foreach}
|
||||||
|
<ul class="reduction">
|
||||||
|
{foreach from=$plugin_config->reduction item="reduc"}
|
||||||
|
{if $reduc->valeur == 1}
|
||||||
|
<li>
|
||||||
|
<span class="radio-btn">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
id="taux_{$reduc->taux}_{$idCompte}"
|
||||||
|
name="taux_reduction_{$idCompte}"
|
||||||
|
value="{$reduc->taux}"
|
||||||
|
disabled
|
||||||
|
{if $nbTaux == 1}checked{/if}
|
||||||
|
/>
|
||||||
|
<label for="taux_{$reduc->taux}_{$idCompte}">
|
||||||
|
{$reduc->taux}{if $reduc->remarque != ""} - {$reduc->remarque}{/if}</label>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{/if}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<p class="submit">
|
||||||
{csrf_field key="generer_recus_activites"}
|
{csrf_field key="generer_recus_activites"}
|
||||||
{button type="submit" name="generer_activites" label="Poursuivre" shape="right" class="main" onclick="return verifierCases('liste_activites_tarifs');" }
|
{button type="submit" name="generer_activites" label="Poursuivre" shape="right" class="main" onclick="return verifierCases('menu_activites_tarifs');" }
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -184,8 +277,8 @@
|
|||||||
for (var laCase of document.querySelectorAll("input[type=checkbox]")) {
|
for (var laCase of document.querySelectorAll("input[type=checkbox]")) {
|
||||||
laCase.addEventListener('change', (evt) => {
|
laCase.addEventListener('change', (evt) => {
|
||||||
var idCase = evt.target;
|
var idCase = evt.target;
|
||||||
// chercher la ligne englobante (<tr>)
|
// chercher la ligne englobante (<li>)
|
||||||
var ligne = idCase.closest("tr");
|
var ligne = idCase.closest("li");
|
||||||
// itérer sur les radio de cette ligne
|
// itérer sur les radio de cette ligne
|
||||||
var lesRadios = ligne.querySelectorAll('input[type=radio]');
|
var lesRadios = ligne.querySelectorAll('input[type=radio]');
|
||||||
for (var idRadio of lesRadios) {
|
for (var idRadio of lesRadios) {
|
||||||
|
@ -26,41 +26,51 @@
|
|||||||
$pair = true;
|
$pair = true;
|
||||||
$tarifCourant = $versement->idTarif;
|
$tarifCourant = $versement->idTarif;
|
||||||
$personneCourante = $versement->idUser;
|
$personneCourante = $versement->idUser;
|
||||||
$compteCourant = $versement->compte;
|
$compteCourant = $versement->idCompte;
|
||||||
?>
|
?>
|
||||||
{afficher_debut_tarif versement=$versement}
|
{afficher_debut_tarif versement=$versement}
|
||||||
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
||||||
|
{afficher_debut_compte idCompte=$compteCourant}
|
||||||
{elseif $versement.idTarif != $tarifCourant}
|
{elseif $versement.idTarif != $tarifCourant}
|
||||||
{* changement de tarif *}
|
{* changement de tarif *}
|
||||||
|
{fin_compte}
|
||||||
{fin_personne}
|
{fin_personne}
|
||||||
{fin_tarif}
|
{fin_tarif}
|
||||||
<?php
|
<?php
|
||||||
$pair = true;
|
$pair = true;
|
||||||
$tarifCourant = $versement->idTarif;
|
$tarifCourant = $versement->idTarif;
|
||||||
$personneCourante = $versement->idUser;
|
$personneCourante = $versement->idUser;
|
||||||
$compteCourant = $versement->compte;
|
$compteCourant = $versement->idCompte;
|
||||||
?>
|
?>
|
||||||
{afficher_debut_tarif versement=$versement}
|
{afficher_debut_tarif versement=$versement}
|
||||||
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
||||||
|
{afficher_debut_compte idCompte=$compteCourant}
|
||||||
{elseif $versement.idUser != $personneCourante}
|
{elseif $versement.idUser != $personneCourante}
|
||||||
{* changement de personne *}
|
{* changement de personne *}
|
||||||
|
{fin_compte}
|
||||||
{fin_personne}
|
{fin_personne}
|
||||||
<?php
|
<?php
|
||||||
$pair = true;
|
$pair = true;
|
||||||
$personneCourante = $versement->idUser;
|
$personneCourante = $versement->idUser;
|
||||||
$compteCourant = $versement->compte;
|
$compteCourant = $versement->idCompte;
|
||||||
?>
|
?>
|
||||||
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
{afficher_debut_personne user=$personneCourante idVersement="%s_%s"|args:$tarifCourant,$personneCourante}
|
||||||
{elseif $versement.compte != $compteCourant}
|
{afficher_debut_compte idCompte=$compteCourant}
|
||||||
{* même personne mais changement de compte *}
|
{elseif $versement.idCompte != $compteCourant}
|
||||||
<?php $compteCourant = $versement->compte; ?>
|
{fin_compte}
|
||||||
<hr />
|
{* changement de compte *}
|
||||||
|
<?php
|
||||||
|
$pair = true;
|
||||||
|
$compteCourant = $versement->idCompte;
|
||||||
|
?>
|
||||||
|
{afficher_debut_compte idCompte=$compteCourant}
|
||||||
{else}
|
{else}
|
||||||
{* même personne, même compte *}
|
{* même personne, même compte *}
|
||||||
{/if}
|
{/if}
|
||||||
{afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang pair=$pair}
|
{afficher_versement versement=$versement idVersement="%s_%s"|args:$tarifCourant,$personneCourante rang=$rang pair=$pair}
|
||||||
<?php $pair = ! $pair; ?>
|
<?php $pair = ! $pair; ?>
|
||||||
{/foreach} {* Itération sur les versements *}
|
{/foreach} {* Itération sur les versements *}
|
||||||
|
{fin_compte}
|
||||||
{fin_personne}
|
{fin_personne}
|
||||||
{fin_tarif}
|
{fin_tarif}
|
||||||
|
|
||||||
|
@ -3,6 +3,42 @@
|
|||||||
|
|
||||||
<h2>Versements par personne</h2>
|
<h2>Versements par personne</h2>
|
||||||
|
|
||||||
|
<form method="post" id="saisie_taux" action="{$self_url}">
|
||||||
|
<div id="menu_versements" class="menu">
|
||||||
|
<h3>Choisir le taux de réduction</h3>
|
||||||
|
<fieldset>
|
||||||
|
{*
|
||||||
|
{if $nbTaux == 0}
|
||||||
|
<h3 class="warning">Vous devez d'abord sélectionner au moins un taux de réduction dans l'onglet de configuration</h3>
|
||||||
|
{/if}
|
||||||
|
{if $nbChamps == 0}
|
||||||
|
<h3 class="warning">Vous devez d'abord sélectionner au moins un champ pour le nom et le prénom dans l'onglet de configuration</h3>
|
||||||
|
{/if}
|
||||||
|
{if $nbTaux > 0 && $nbChamps > 0}
|
||||||
|
*}
|
||||||
|
<ul class="reduction">
|
||||||
|
{foreach from=$plugin_config->reduction item="reduc"}
|
||||||
|
{if $reduc->valeur == 1}
|
||||||
|
<li>
|
||||||
|
<span class="radio-btn">
|
||||||
|
<input type="radio" id="{$reduc->taux}" name="taux_reduction" value="{$reduc->taux}"
|
||||||
|
{*
|
||||||
|
{if $nbTaux == 1}checked{/if}
|
||||||
|
*}
|
||||||
|
/>
|
||||||
|
<label for="{$reduc->taux}">{$reduc->taux}{if $reduc->remarque != ""} - {$reduc->remarque}{/if}</label>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
{*
|
||||||
|
{/if}
|
||||||
|
*}
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<fieldset class="noprint">
|
<fieldset class="noprint">
|
||||||
<input type="checkbox" class="check_global" id="check_global"
|
<input type="checkbox" class="check_global" id="check_global"
|
||||||
onclick="cocherDecocherToutesLesPersonnes(check_global)" />
|
onclick="cocherDecocherToutesLesPersonnes(check_global)" />
|
||||||
@ -14,7 +50,7 @@
|
|||||||
onclick="return verifierChoix(this.form)" />
|
onclick="return verifierChoix(this.form)" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<form method="post" id="versements_personnes" action="generer_recus.php?type=personne">
|
<form method="post" id="versements_personnes" class="" action="generer_recus.php?type=personne">
|
||||||
|
|
||||||
{* Itération sur les personnes *}
|
{* Itération sur les personnes *}
|
||||||
{foreach from=$lesVersements key="rang" item="versement"}
|
{foreach from=$lesVersements key="rang" item="versement"}
|
||||||
@ -23,28 +59,36 @@
|
|||||||
<?php
|
<?php
|
||||||
$pair = true;
|
$pair = true;
|
||||||
$personneCourante = $versement->idUser;
|
$personneCourante = $versement->idUser;
|
||||||
$compteCourant = $versement->compte;
|
$compteCourant = $versement->idCompte;
|
||||||
?>
|
?>
|
||||||
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
|
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
|
||||||
|
{afficher_debut_compte idCompte=$compteCourant}
|
||||||
{elseif $versement.idUser != $personneCourante}
|
{elseif $versement.idUser != $personneCourante}
|
||||||
{* changement de personne *}
|
{* changement de personne *}
|
||||||
|
{fin_compte}
|
||||||
{fin_personne}
|
{fin_personne}
|
||||||
<?php
|
<?php
|
||||||
$pair = true;
|
$pair = true;
|
||||||
$personneCourante = $versement->idUser;
|
$personneCourante = $versement->idUser;
|
||||||
$compteCourant = $versement->compte;
|
$compteCourant = $versement->idCompte;
|
||||||
?>
|
?>
|
||||||
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
|
{afficher_debut_personne user=$personneCourante idVersement=$personneCourante}
|
||||||
{elseif $versement.compte != $compteCourant}
|
{afficher_debut_compte idCompte=$compteCourant}
|
||||||
{* même personne mais changement de compte *}
|
{elseif $versement.idCompte != $compteCourant}
|
||||||
<?php $compteCourant = $versement->compte; ?>
|
{fin_compte}
|
||||||
<hr />
|
{* changement de compte *}
|
||||||
|
<?php
|
||||||
|
$pair = true;
|
||||||
|
$compteCourant = $versement->idCompte;
|
||||||
|
?>
|
||||||
|
{afficher_debut_compte idCompte=$compteCourant}
|
||||||
{else}
|
{else}
|
||||||
{* même personne, même compte *}
|
{* même personne, même compte *}
|
||||||
{/if}
|
{/if}
|
||||||
{afficher_versement versement=$versement idVersement=$personneCourante rang=$rang pair=$pair}
|
{afficher_versement versement=$versement idVersement=$personneCourante rang=$rang pair=$pair}
|
||||||
<?php $pair = ! $pair; ?>
|
<?php $pair = ! $pair; ?>
|
||||||
{/foreach} {* Itération sur les personnes *}
|
{/foreach} {* Itération sur les personnes *}
|
||||||
|
{fin_compte}
|
||||||
{fin_personne}
|
{fin_personne}
|
||||||
|
|
||||||
<input type="submit" value="Générer les reçus" onclick="return verifierChoix(this.form)" />
|
<input type="submit" value="Générer les reçus" onclick="return verifierChoix(this.form)" />
|
||||||
|
@ -64,31 +64,43 @@ $tpl->register_function('afficher_debut_tarif', function ($params)
|
|||||||
{
|
{
|
||||||
$versement = $params['versement'];
|
$versement = $params['versement'];
|
||||||
$idTarif = $versement->idTarif;
|
$idTarif = $versement->idTarif;
|
||||||
$tarif = $_SESSION['lesTarifs'][$idTarif];
|
|
||||||
$idActivite = $tarif->idActivite;
|
|
||||||
$activite = $_SESSION['lesActivites'][$idActivite];
|
|
||||||
|
|
||||||
$out = sprintf('
|
$out = sprintf('
|
||||||
<details class="activite" open="open">
|
<details class="activite" open="open">
|
||||||
<summary class="activite">
|
<summary class="activite">
|
||||||
<div class="activite">
|
<div class="activite">
|
||||||
<input type="checkbox" id="check_%1$s"
|
<input type="checkbox" id="check_%1$s"
|
||||||
onclick="cocherDecocherTarif(check_%1$s)" />
|
onclick="cocherDecocherTarif(check_%1$s)" />',
|
||||||
<label for="check_%1$s">
|
$idTarif);
|
||||||
<h3 class="activite">Activité « %2$s »</h3>',
|
if ($idTarif == 0) {
|
||||||
$idTarif,
|
// versement sur un compte non rattaché à une activité
|
||||||
$activite->label);
|
|
||||||
|
|
||||||
if (!empty($activite->description)) {
|
|
||||||
$out .= sprintf('
|
$out .= sprintf('
|
||||||
<p class="activite">%s</p>', $activite->description);
|
<label for="check_%s">
|
||||||
|
<h3 class="activite">Versements non rattachés à une activité</h3>',
|
||||||
|
$idTarif);
|
||||||
}
|
}
|
||||||
$out .= sprintf('
|
else {
|
||||||
|
$tarif = $_SESSION['lesTarifs'][$idTarif];
|
||||||
|
$idActivite = $tarif->idActivite;
|
||||||
|
$activite = $_SESSION['lesActivites'][$idActivite];
|
||||||
|
|
||||||
|
$out .= sprintf('
|
||||||
|
<label for="check_%s">
|
||||||
|
<h3 class="activite">Activité « %s »</h3>',
|
||||||
|
$idTarif,
|
||||||
|
$activite->label);
|
||||||
|
|
||||||
|
if (!empty($activite->description)) {
|
||||||
|
$out .= sprintf('
|
||||||
|
<p class="activite">%s</p>', $activite->description);
|
||||||
|
}
|
||||||
|
$out .= sprintf('
|
||||||
<p class="activite">tarif « %s »', $tarif->label);
|
<p class="activite">tarif « %s »', $tarif->label);
|
||||||
if ($tarif->montant > 0) {
|
if ($tarif->montant > 0) {
|
||||||
$out .= sprintf(' montant : %.2f €</p>', $tarif->montant/100);
|
$out .= sprintf(' montant : %.2f €</p>', $tarif->montant/100);
|
||||||
} else {
|
} else {
|
||||||
$out .= ' montant : libre</p>';
|
$out .= ' montant : libre</p>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$out .= '
|
$out .= '
|
||||||
</label>
|
</label>
|
||||||
@ -115,14 +127,25 @@ $tpl->register_function('afficher_debut_personne', function ($params)
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</summary>
|
</summary>
|
||||||
|
<div class="versements">',
|
||||||
<fieldset class="versements" id="versements_%1$s">',
|
|
||||||
$idVersement,
|
$idVersement,
|
||||||
$personne->nomPrenom
|
$personne->nomPrenom
|
||||||
);
|
);
|
||||||
return $out;
|
return $out;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// afficher infos compte
|
||||||
|
$tpl->register_function('afficher_debut_compte', function ($params)
|
||||||
|
{
|
||||||
|
$idCompte = $params['idCompte'];
|
||||||
|
$out = sprintf('
|
||||||
|
<fieldset class="versements">
|
||||||
|
<div><p>Compte N° %1$s : %2$s</p></div>',
|
||||||
|
$_SESSION['comptes'][$idCompte]->codeCompte,
|
||||||
|
$_SESSION['comptes'][$idCompte]->nomCompte);
|
||||||
|
return $out;
|
||||||
|
});
|
||||||
|
|
||||||
// afficher un versement
|
// afficher un versement
|
||||||
$tpl->register_function('afficher_versement', function ($params)
|
$tpl->register_function('afficher_versement', function ($params)
|
||||||
{
|
{
|
||||||
@ -140,24 +163,34 @@ $tpl->register_function('afficher_versement', function ($params)
|
|||||||
name="selected[]"
|
name="selected[]"
|
||||||
value="%2$s"
|
value="%2$s"
|
||||||
onclick="cocherDecocherVersement(check_%1$s_%2$s, total_%1$s)" />
|
onclick="cocherDecocherVersement(check_%1$s_%2$s, total_%1$s)" />
|
||||||
<label for="check_%1$s_%2$s"><span class="montant">%3$.2f</span>
|
<label for="check_%1$s_%2$s"><span class="montant">%3$s</span>
|
||||||
<span>%4$s</span>
|
<span>%4$s</span>
|
||||||
<span>%5$s</span>
|
|
||||||
</label>
|
</label>
|
||||||
</div>',
|
</div>',
|
||||||
$idVersement,
|
$idVersement,
|
||||||
$rang,
|
$rang,
|
||||||
$versement->versement/100,
|
number_format(
|
||||||
date_format(date_create($versement->date),"d/m/Y"),
|
$versement->versement/100,
|
||||||
$versement->compte
|
2,
|
||||||
|
",",
|
||||||
|
" "
|
||||||
|
),
|
||||||
|
date_format(date_create($versement->date),"d/m/Y")
|
||||||
);
|
);
|
||||||
return $out;
|
return $out;
|
||||||
});
|
});
|
||||||
|
|
||||||
$tpl->register_function('fin_personne', function ($params)
|
$tpl->register_function('fin_compte', function ()
|
||||||
{
|
{
|
||||||
$out = '
|
$out = '
|
||||||
</fieldset>
|
</fieldset>';
|
||||||
|
return $out;
|
||||||
|
});
|
||||||
|
|
||||||
|
$tpl->register_function('fin_personne', function ()
|
||||||
|
{
|
||||||
|
$out = '
|
||||||
|
</div>
|
||||||
</details>';
|
</details>';
|
||||||
return $out;
|
return $out;
|
||||||
});
|
});
|
||||||
@ -175,6 +208,8 @@ $tpl->register_function('fin_tarif', function ($params)
|
|||||||
|
|
||||||
if ($_GET['action'] == 'personne') {
|
if ($_GET['action'] == 'personne') {
|
||||||
require('versements_personnes.php');
|
require('versements_personnes.php');
|
||||||
} else {
|
} else if ($_GET['action'] == 'compte') {
|
||||||
|
require('versements_personnes.php');
|
||||||
|
} else if ($_GET['action'] == 'activite') {
|
||||||
require('versements_activites.php');
|
require('versements_activites.php');
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,7 @@ if (! isset($_SESSION['annee_recu']) || $_SESSION['annee_recu'] == "")
|
|||||||
$_SESSION['annee_recu'] = date("Y") - 1;
|
$_SESSION['annee_recu'] = date("Y") - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// libellés pour les taux de réduction
|
// nombre de taux de réduction activés
|
||||||
$_SESSION['ligneReduction'] = Utils::getLignesReduction($plugin->getConfig('reduction'));
|
|
||||||
|
|
||||||
// compter le nombre de taux de réduction activés
|
|
||||||
$nbTaux = 0;
|
$nbTaux = 0;
|
||||||
foreach ($plugin->getConfig('reduction') as $taux)
|
foreach ($plugin->getConfig('reduction') as $taux)
|
||||||
{
|
{
|
||||||
@ -23,7 +20,6 @@ foreach ($plugin->getConfig('reduction') as $taux)
|
|||||||
// idem avec les champs nom/prénom
|
// idem avec les champs nom/prénom
|
||||||
$nbChamps = 0;
|
$nbChamps = 0;
|
||||||
$champsNom = Utils::getChampsNom($config, $plugin);
|
$champsNom = Utils::getChampsNom($config, $plugin);
|
||||||
|
|
||||||
if (null !== $champsNom)
|
if (null !== $champsNom)
|
||||||
{
|
{
|
||||||
foreach ($champsNom as $nom => $champ)
|
foreach ($champsNom as $nom => $champ)
|
||||||
@ -32,13 +28,36 @@ if (null !== $champsNom)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// comptes sur lesquels des versements de membres ont été faits
|
||||||
|
// pendant l'année fiscale choisie
|
||||||
|
$_SESSION['comptes'] = Utils::getComptes($_SESSION['annee_recu'], 'like', '7%');
|
||||||
|
|
||||||
// liste des activités, cotisations et comptes associés
|
// liste des activités, cotisations et comptes associés
|
||||||
$activitesTarifsComptes = Utils::getActivitesTarifsEtComptes();
|
$activitesTarifsComptes = Utils::getTarifsComptes($_SESSION['annee_recu'], 'like', '7%');
|
||||||
|
$_SESSION['lesTarifs'] = Utils::getTarifs();
|
||||||
|
$_SESSION['lesActivites'] = Utils::getActivites();
|
||||||
|
|
||||||
|
// liste des comptes associés à aucune activité
|
||||||
|
$comptesSansActivite = array();
|
||||||
|
foreach ($_SESSION['comptes'] as $id => $elem)
|
||||||
|
{
|
||||||
|
$trouve = false;
|
||||||
|
foreach ($activitesTarifsComptes as $elem)
|
||||||
|
{
|
||||||
|
if ($id == $elem->idCompte) { $trouve = true ; break; }
|
||||||
|
}
|
||||||
|
if (! $trouve) { $comptesSansActivite[] = $id; }
|
||||||
|
}
|
||||||
|
|
||||||
// préparation de l'affichage
|
// préparation de l'affichage
|
||||||
$tpl->assign('annee_recu', $_SESSION['annee_recu']);
|
$tpl->assign('annee_recu', $_SESSION['annee_recu']);
|
||||||
|
$tpl->assign('lesComptes', $_SESSION['comptes']);
|
||||||
|
$tpl->assign('lesTarifs', $_SESSION['lesTarifs']);
|
||||||
|
$tpl->assign('lesActivites', $_SESSION['lesActivites']);
|
||||||
$tpl->assign('activitesTarifsComptes', $activitesTarifsComptes);
|
$tpl->assign('activitesTarifsComptes', $activitesTarifsComptes);
|
||||||
|
$tpl->assign('comptesSansActivite', $comptesSansActivite);
|
||||||
$tpl->assign('nbTarifs', count($activitesTarifsComptes));
|
$tpl->assign('nbTarifs', count($activitesTarifsComptes));
|
||||||
|
$tpl->assign('nbComptes', count($_SESSION['comptes']));
|
||||||
$tpl->assign('plugin_config', $plugin->getConfig());
|
$tpl->assign('plugin_config', $plugin->getConfig());
|
||||||
$tpl->assign('nbTaux', $nbTaux);
|
$tpl->assign('nbTaux', $nbTaux);
|
||||||
$tpl->assign('nbChamps', $nbChamps);
|
$tpl->assign('nbChamps', $nbChamps);
|
||||||
|
@ -36,7 +36,6 @@ summary.personne
|
|||||||
}
|
}
|
||||||
div.activite
|
div.activite
|
||||||
{
|
{
|
||||||
font-weight : normal;
|
|
||||||
background-color: rgba(var(--gSecondColor), 0.4);
|
background-color: rgba(var(--gSecondColor), 0.4);
|
||||||
}
|
}
|
||||||
div.personne
|
div.personne
|
||||||
@ -101,3 +100,13 @@ div.infos
|
|||||||
margin-left : 1em;
|
margin-left : 1em;
|
||||||
width : 20em;
|
width : 20em;
|
||||||
}
|
}
|
||||||
|
ul#liste_activites dd
|
||||||
|
{
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.reduction span.radio-btn
|
||||||
|
{
|
||||||
|
margin-left : 2em;
|
||||||
|
border-spacing : 0.1em;
|
||||||
|
}
|
||||||
|
@ -7,42 +7,57 @@ use Garradin\Plugin\RecusFiscaux\Personne;
|
|||||||
use Garradin\Plugin\RecusFiscaux\Tarif;
|
use Garradin\Plugin\RecusFiscaux\Tarif;
|
||||||
use Garradin\Plugin\RecusFiscaux\Utils;
|
use Garradin\Plugin\RecusFiscaux\Utils;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
// récupérer les infos du formulaire
|
// récupérer les infos du formulaire
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
|
||||||
|
// tarifs sélectionnés
|
||||||
$tarifsSelectionnes = f('tarifs') ?: [];
|
$tarifsSelectionnes = f('tarifs') ?: [];
|
||||||
|
|
||||||
|
// comptes sélectionnés
|
||||||
|
$comptesSelectionnes = f('comptes') ?: [];
|
||||||
|
|
||||||
// taux de réduction associés
|
// taux de réduction associés
|
||||||
$tauxSelectionnes = array();
|
$tauxSelectionnes = array();
|
||||||
foreach ($tarifsSelectionnes as $idTarif) {
|
foreach ($tarifsSelectionnes as $idTarif)
|
||||||
|
{
|
||||||
$nomRadio = "taux_reduction_" . $idTarif;
|
$nomRadio = "taux_reduction_" . $idTarif;
|
||||||
$valRadio = f("$nomRadio");
|
$valRadio = f("$nomRadio");
|
||||||
$tauxSelectionnes[$idTarif] = $valRadio;
|
$tauxSelectionnes[$idTarif] = $valRadio;
|
||||||
}
|
}
|
||||||
|
foreach ($comptesSelectionnes as $idCompte)
|
||||||
|
{
|
||||||
|
$nomRadio = "taux_reduction_" . $idCompte;
|
||||||
|
$valRadio = f("$nomRadio");
|
||||||
|
$tauxSelectionnes[$idCompte] = $valRadio;
|
||||||
|
}
|
||||||
$_SESSION['tauxSelectionnes'] = $tauxSelectionnes;
|
$_SESSION['tauxSelectionnes'] = $tauxSelectionnes;
|
||||||
|
|
||||||
// obtenir les instances de tarifs correspondant à la sélection
|
// versements correspondants à la sélection, triés par tarif, nom, compte, date
|
||||||
$lesTarifs = array();
|
$lesTarifs = array_map(fn($elem) : string => substr($elem, 0, strpos($elem, '_')),
|
||||||
foreach (Utils::getTarifs($tarifsSelectionnes) as $ot) {
|
$tarifsSelectionnes);
|
||||||
$lesTarifs[$ot->id] = $ot;
|
$lesComptes = array_map(fn($elem) : string => substr($elem, 1 + strpos($elem, '_')),
|
||||||
}
|
$tarifsSelectionnes);
|
||||||
$_SESSION['lesTarifs'] = $lesTarifs;
|
$_SESSION['lesVersements'] =
|
||||||
|
Utils::getVersementsTarifsComptes(
|
||||||
|
$_SESSION['annee_recu'],
|
||||||
|
$lesTarifs,
|
||||||
|
$lesComptes,
|
||||||
|
$champsNom);
|
||||||
|
|
||||||
// activités correspondants aux tarifs sélectionnés
|
// ajouter les versements sans tarif (tri par nom, compte, date)
|
||||||
$lesActivites = array();
|
$versementsSansTarif = Utils::getVersementsComptes($_SESSION['annee_recu'],
|
||||||
foreach (Utils::getActivites($tarifsSelectionnes) as $activite) {
|
$comptesSelectionnes,
|
||||||
$lesActivites[$activite->id] = $activite;
|
$champsNom);
|
||||||
|
foreach ($versementsSansTarif as $versement)
|
||||||
|
{
|
||||||
|
$_SESSION['lesVersements'][] = $versement;
|
||||||
}
|
}
|
||||||
$_SESSION['lesActivites'] = $lesActivites;
|
|
||||||
|
|
||||||
// versements correspondants aux tarifs sélectionnés
|
|
||||||
$_SESSION['lesVersements'] = Utils::getVersementsTarifs($_SESSION['annee_recu'],
|
|
||||||
$tarifsSelectionnes,
|
|
||||||
$champsNom);
|
|
||||||
|
|
||||||
// préparation de l'affichage
|
// préparation de l'affichage
|
||||||
$tpl->assign('lesActivites', $lesActivites);
|
|
||||||
$tpl->assign('lesTarifs', $lesTarifs);
|
|
||||||
$tpl->assign('lesVersements', $_SESSION['lesVersements']);
|
$tpl->assign('lesVersements', $_SESSION['lesVersements']);
|
||||||
$tpl->assign('plugin_css', ['style.css']);
|
$tpl->assign('plugin_css', ['style.css']);
|
||||||
|
|
||||||
// envoyer au template
|
// envoyer au template
|
||||||
$tpl->display(PLUGIN_ROOT . '/templates/versements_activites.tpl');
|
$tpl->display(PLUGIN_ROOT . '/templates/versements_activites.tpl');
|
||||||
|
|
||||||
|
@ -5,81 +5,23 @@ namespace Garradin;
|
|||||||
use Garradin\Plugin\RecusFiscaux\Personne;
|
use Garradin\Plugin\RecusFiscaux\Personne;
|
||||||
use Garradin\Plugin\RecusFiscaux\Utils;
|
use Garradin\Plugin\RecusFiscaux\Utils;
|
||||||
|
|
||||||
$_SESSION['taux_reduction'] = $_POST['taux_reduction'];
|
// vérifier si le taux de réduction a été sélectionné au préalable
|
||||||
|
$_SESSION['taux_reduction'] = f('taux_reduction');
|
||||||
|
if (! isset($_SESSION['taux_reduction']) || $_SESSION['taux_reduction'] == "") {
|
||||||
|
\Garradin\Utils::redirect(PLUGIN_URL . 'index.php');
|
||||||
|
}
|
||||||
|
|
||||||
// versements par personne
|
// versements par personne
|
||||||
$_SESSION['lesVersements'] = Utils::getVersementsComptes($_SESSION['annee_recu'],
|
$_SESSION['lesVersements'] = Utils::getVersementsPersonnes(
|
||||||
"like",
|
$_SESSION['annee_recu'],
|
||||||
'7%',
|
'like',
|
||||||
$champsNom);
|
'7%',
|
||||||
|
$champsNom);
|
||||||
// Utils::getVersementsPersonnes($_SESSION['annee_recu'],
|
|
||||||
// $champsNom);
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// tests
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
$versementsComptes = Utils::getVersementsComptes("2021",
|
|
||||||
// "in",
|
|
||||||
// ['706', '7780', '756'],
|
|
||||||
"like",
|
|
||||||
'7%',
|
|
||||||
$champsNom);
|
|
||||||
// table triée par nom, date
|
|
||||||
// error_log("versementsComptes triée par nom, date = " . print_r($versementsComptes, true));
|
|
||||||
|
|
||||||
// comparer 2 lignes selon le nom
|
|
||||||
function comparerNoms($ligne1, $ligne2)
|
|
||||||
{
|
|
||||||
return
|
|
||||||
$_SESSION['membresDonateurs'][$ligne1->idUser]->rang
|
|
||||||
-
|
|
||||||
$_SESSION['membresDonateurs'][$ligne2->idUser]->rang;
|
|
||||||
}
|
|
||||||
|
|
||||||
// comparer 2 lignes selon la date
|
|
||||||
function comparerDate($ligne1, $ligne2)
|
|
||||||
{
|
|
||||||
return
|
|
||||||
strtotime($ligne1->date) - strtotime($ligne2->date);
|
|
||||||
}
|
|
||||||
|
|
||||||
// comparer 2 lignes selon un champ
|
|
||||||
function comparerChamp($ligne1, $ligne2, $champ)
|
|
||||||
{
|
|
||||||
return $ligne1->$champ - $ligne2->$champ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// autres tris
|
|
||||||
// par tarif, nom, date
|
|
||||||
usort($versementsComptes, function($ligne1, $ligne2)
|
|
||||||
{
|
|
||||||
$result = comparerChamp($ligne1, $ligne2, 'idTarif'); //$ligne1->idTarif - $ligne2->idTarif;
|
|
||||||
if ($result == 0) { $result = comparerNoms($ligne1, $ligne2); }
|
|
||||||
if ($result == 0) { $result = comparerDate($ligne1, $ligne2); }
|
|
||||||
return $result;
|
|
||||||
});
|
|
||||||
// error_log("versementsComptes triée par tarif, nom, date = " . print_r($versementsComptes, true));
|
|
||||||
|
|
||||||
// par nom, compte, date...
|
|
||||||
usort($versementsComptes, function($ligne1, $ligne2)
|
|
||||||
{
|
|
||||||
$result = comparerNoms($ligne1, $ligne2);
|
|
||||||
if ($result == 0) { $result = comparerChamp($ligne1, $ligne2, 'compte'); }
|
|
||||||
if ($result == 0) { $result = comparerDate($ligne1, $ligne2); }
|
|
||||||
return $result;
|
|
||||||
});
|
|
||||||
|
|
||||||
// error_log("versementsComptes triée par nom, compte, date = " . print_r($versementsComptes, true));
|
|
||||||
*/
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
// fin tests
|
|
||||||
// ------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// préparation de l'affichage
|
// préparation de l'affichage
|
||||||
$tpl->assign('lesVersements', $_SESSION['lesVersements']);
|
$tpl->assign('lesVersements', $_SESSION['lesVersements']);
|
||||||
$tpl->assign('plugin_css', ['style.css']);
|
$tpl->assign('plugin_css', ['style.css']);
|
||||||
|
|
||||||
// envoyer au template
|
// envoyer au template
|
||||||
|
$tpl->assign('plugin_config', $plugin->getConfig());
|
||||||
$tpl->display(PLUGIN_ROOT . '/templates/versements_personnes.tpl');
|
$tpl->display(PLUGIN_ROOT . '/templates/versements_personnes.tpl');
|
||||||
|
Loading…
Reference in New Issue
Block a user