Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente | |||
koha:comment_faire:regie [2020/04/17 17:09] llefaucheur [3.5. Le paiement est en lien avec une facture] |
koha:comment_faire:regie [2020/05/11 11:00] (Version actuelle) sdelaye |
||
---|---|---|---|
Ligne 197: | Ligne 197: | ||
====== 5. Rapports de régie ====== | ====== 5. Rapports de régie ====== | ||
- | FIXME à compléter | + | Notes : il faut tenir compte d'une nouvelle table [account_offsets] présente depuis la version 17.11 afin de pouvoir 'lier ' chaque type de facture à chaque encaissement. |
+ | |||
+ | Exemples de rapport : | ||
+ | Encaissement/Type facture/Catégorie Adherents/Dates/Id de connexion au poste | ||
+ | <code> | ||
+ | select date_format(a2.date,'%d/%m/%y') as Date_Paiement, | ||
+ | case | ||
+ | when a.debit_type_code ='LOST' then 'Exemplaire perdu'/*<== NOUVELLE COLONNE ET NOUVEAU CODE*/ | ||
+ | when a.debit_type_code ='NEW_CARD' then 'Nouvelle carte'/*<== NOUVELLE COLONNE ET NOUVEAU CODE*/ | ||
+ | when a.debit_type_code ='MANUAL' then 'Divers'/*<== NOUVELLE COLONNE ET NOUVEAU CODE*/ | ||
+ | when a.debit_type_code ='ACCOUNT' then 'Inscription' /*Nouvelle inscription*/ | ||
+ | when a.debit_type_code ='ACCOUNT_RENEW' then 'Inscription' /*Ré-inscription*/ | ||
+ | when a.debit_type_code ='OVERDUE' then 'Pénalité de retard'/*<== NOUVELLE COLONNE ET NOUVEAU CODE*/ | ||
+ | when a.debit_type_code ='PMELC' then 'Porte monnaie électronique'/*<== NOUVELLE COLONNE ancien CODE maintenu*/ | ||
+ | else 'AUTRE' end as Type_facture, | ||
+ | a2.payment_type as Type_Paiement, | ||
+ | b2.categorycode as Type_abonnement, | ||
+ | concat(b2.surname, ' ',b2.firstname) as Nom_Prénom, | ||
+ | b2.cardnumber as N_Carte, | ||
+ | substring_index(convert(sum(o.amount),DECIMAL(6,2)),'-',-1) as 'Montants encaissés' | ||
+ | from | ||
+ | account_offsets o | ||
+ | LEFT JOIN accountlines a2 ON (o.credit_id=a2.accountlines_id) | ||
+ | LEFT JOIN accountlines a ON (o.debit_id=a.accountlines_id) | ||
+ | LEFT JOIN borrowers b2 ON (b2.borrowernumber=a.borrowernumber) | ||
+ | LEFT JOIN borrowers b3 ON (b3.borrowernumber=a2.borrowernumber) | ||
+ | where o.type='Payment' and o.amount like '-%' | ||
+ | and a2.date >=<<date sup. égale à |date>> and a2.date <=<<date inf. égale à|date>> | ||
+ | and a2.manager_id=<<Id du poste>> | ||
+ | group by Type_facture,Type_Paiement,a2.date,Nom_Prénom,b2.cardnumber | ||
+ | </code> | ||
+ | Encaissement/Type facture/Catégorie Adherents/Dates/Id poste[caisse] | ||
+ | |||
+ | <code> | ||
+ | select date_format(a2.date,'%d/%m/%y') as Date_Paiement, | ||
+ | case | ||
+ | when a.debit_type_code ='LOST' then 'Exemplaire perdu'/*<== NOUVELLE COLONNE ET NOUVEAU CODE*/ | ||
+ | when a.debit_type_code ='NEW_CARD' then 'Nouvelle carte'/*<== NOUVELLE COLONNE ET NOUVEAU CODE*/ | ||
+ | when a.debit_type_code ='MANUAL' then 'Divers'/*<== NOUVELLE COLONNE ET NOUVEAU CODE*/ | ||
+ | when a.debit_type_code ='ACCOUNT' then 'Inscription' /*Nouvelle inscription*/ | ||
+ | when a.debit_type_code ='ACCOUNT_RENEW' then 'Inscription' /*Ré-inscription*/ | ||
+ | when a.debit_type_code ='OVERDUE' then 'Pénalité de retard'/*<== NOUVELLE COLONNE ET NOUVEAU CODE*/ | ||
+ | when a.debit_type_code ='PMELC' then 'Porte monnaie électronique'/*<== NOUVELLE COLONNE ancien CODE maintenu*/ | ||
+ | else 'AUTRE' end as Type_facture, | ||
+ | a2.payment_type as Type_Paiement, | ||
+ | b2.categorycode as Type_abonnement, | ||
+ | concat(b2.surname, ' ',b2.firstname) as Nom_Prénom, | ||
+ | b2.cardnumber as N_Carte, | ||
+ | substring_index(convert(sum(o.amount),DECIMAL(6,2)),'-',-1) as 'Montants encaissés' | ||
+ | from | ||
+ | account_offsets o | ||
+ | LEFT JOIN accountlines a2 ON (o.credit_id=a2.accountlines_id) | ||
+ | LEFT JOIN accountlines a ON (o.debit_id=a.accountlines_id) | ||
+ | LEFT JOIN borrowers b2 ON (b2.borrowernumber=a.borrowernumber) | ||
+ | LEFT JOIN borrowers b3 ON (b3.borrowernumber=a2.borrowernumber) | ||
+ | where o.type='Payment' and o.amount like '-%' | ||
+ | and a2.date >=<<date sup. égale à |date>> and a2.date <=<<date inf. égale à|date>> | ||
+ | and a2.register_id=<<Id de la caisse>> | ||
+ | group by Type_facture,Type_Paiement,a2.date,Nom_Prénom,b2.cardnumber | ||
+ | |||
+ | </code> | ||