début refonte gestion versements
FossilOrigin-Name: 1be54b8a985d3fb24895bae4cc5481743edf0a68dbb0eb4278580df3ce7f530d
This commit is contained in:
parent
2e8eb26e5a
commit
af7816d97f
11 changed files with 322 additions and 112 deletions
|
|
@ -35,7 +35,6 @@ class Personne
|
|||
|
||||
/**
|
||||
* return copie d'une personne
|
||||
*/
|
||||
public function clone()
|
||||
{
|
||||
return new Personne(
|
||||
|
|
@ -46,6 +45,7 @@ class Personne
|
|||
$this->ville,
|
||||
$this->courriel);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* ajouter un versement
|
||||
|
|
|
|||
|
|
@ -39,6 +39,37 @@ class Utils
|
|||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return versements correspondants à l'année donnée
|
||||
* @param $annee
|
||||
* @param array $champsNom : liste non vide des champs de nom/prénom
|
||||
*/
|
||||
public static function getVersementsPersonnes($annee, $champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
membres.id as idUser,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN membres on acc_transactions_users.id_user = membres.id
|
||||
INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id
|
||||
INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
WHERE
|
||||
(strftime(%s, acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_transactions_lines.credit > 0)
|
||||
ORDER by %s, acc_transactions.date',
|
||||
'"%Y"',
|
||||
$annee,
|
||||
$tri
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return versements correspondants à l'année et aux tarifs donnés
|
||||
* @param $annee
|
||||
|
|
@ -76,6 +107,42 @@ class Utils
|
|||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return versements correspondants à l'année et aux comptes donnés
|
||||
* @param $annee
|
||||
* @param array $comptes
|
||||
* @param array $champsNom : liste non vide des champs de nom/prénom
|
||||
*/
|
||||
public static function getVersementsComptes($annee, $comptes, $champsNom)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
$tri = Utils::combinerTri($champsNom);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
acc_accounts.code as compte,
|
||||
membres.id as idUser,
|
||||
acc_transactions_lines.credit as versement,
|
||||
acc_transactions.date
|
||||
FROM acc_transactions_users
|
||||
INNER JOIN membres on acc_transactions_users.id_user = membres.id
|
||||
INNER JOIN acc_transactions on acc_transactions_users.id_transaction = acc_transactions.id
|
||||
INNER JOIN services_users on acc_transactions_users.id_service_user = services_users.id
|
||||
INNER JOIN acc_transactions_lines on acc_transactions_lines.id_transaction = acc_transactions.id
|
||||
WHERE
|
||||
(strftime(%s, acc_transactions.date) = "%d"
|
||||
AND
|
||||
acc_accounts.%s
|
||||
AND
|
||||
acc_transactions_lines.credit > 0)
|
||||
ORDER by acc_accounts.code, %s, acc_transactions.date',
|
||||
'"%Y"',
|
||||
$annee,
|
||||
$db->where('code', $comptes),
|
||||
$tri
|
||||
);
|
||||
return $db->get($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Versements totaux par personne pour une année donnée
|
||||
* @param année
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue