Normalisation attribut (Utils.php) ; ajout onglet Configuration ; préparation choix méthode de génération de reçus
FossilOrigin-Name: 08d84642c176039d5b91135007ba419f5cae36eca6445b55d0ed47b7db362df9
This commit is contained in:
parent
fa590c0d67
commit
a59923348f
@ -1,2 +1,8 @@
|
||||
{
|
||||
"auteur" : "jce",
|
||||
"articlesCGI" : [
|
||||
"Article 200",
|
||||
"Article 228 bis",
|
||||
"Article 978"
|
||||
]
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
nom="Reçus fiscaux"
|
||||
description="Génération de reçus fiscaux pour les dons des membres"
|
||||
auteur="jce"
|
||||
url=""
|
||||
url="https://git.roflcopter.fr/lesanges/recus-fiscaux-garradin"
|
||||
version="0.1"
|
||||
menu=1
|
||||
config=0
|
||||
config=1
|
||||
min_version="1.1"
|
||||
|
@ -14,7 +14,7 @@ class Utils
|
||||
{
|
||||
return DB::getInstance()->get(
|
||||
"SELECT
|
||||
id,
|
||||
id as idActivite,
|
||||
label,
|
||||
description
|
||||
FROM services
|
||||
@ -47,9 +47,9 @@ class Utils
|
||||
{
|
||||
return DB::getInstance()->get(
|
||||
"SELECT
|
||||
services.id as idService,
|
||||
services.label as titreService,
|
||||
services.description as descService,
|
||||
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
|
||||
@ -66,13 +66,14 @@ class Utils
|
||||
{
|
||||
return DB::getInstance()->get(
|
||||
"SELECT
|
||||
services.id as Id,
|
||||
services.label,
|
||||
services.description as descService,
|
||||
services_fees.label as tarif,
|
||||
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 numero_cpt,
|
||||
acc_accounts.label as nom_cpt
|
||||
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
|
||||
@ -164,7 +165,7 @@ class Utils
|
||||
public static function getVersementsTotaux($annee) {
|
||||
$sql =
|
||||
"SELECT
|
||||
acc_transactions_users.id_user as id,
|
||||
acc_transactions_users.id_user as idUser,
|
||||
membres.nom as nom,
|
||||
sum(acc_transactions_lines.credit) AS montant,
|
||||
membres.adresse as adresse,
|
||||
@ -195,43 +196,54 @@ class Utils
|
||||
* @return nom de l'association
|
||||
*/
|
||||
public static function getNomAsso() {
|
||||
return DB::getInstance()->get(
|
||||
return DB::getInstance()->first(
|
||||
"SELECT value
|
||||
FROM config
|
||||
WHERE key = 'nom_asso'"
|
||||
)[0]->value;
|
||||
)->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return adresse de l'association
|
||||
*/
|
||||
public static function getAdresseAsso() {
|
||||
return DB::getInstance()->get(
|
||||
return DB::getInstance()->first(
|
||||
"SELECT value
|
||||
FROM config
|
||||
WHERE key = 'adresse_asso'"
|
||||
)[0]->value;
|
||||
)->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* récupérer l'année du premier exercice
|
||||
* @return liste des années fiscales
|
||||
*/
|
||||
public static function getPremiereAnnee() {
|
||||
return DB::getInstance()->get(
|
||||
public static function getAnneesFiscales() {
|
||||
$rows = DB::getInstance()->get(
|
||||
"SELECT strftime('%Y', start_date) as annee
|
||||
FROM acc_years
|
||||
ORDER by start_date"
|
||||
)[0]->value;
|
||||
ORDER by start_date DESC"
|
||||
);
|
||||
$anneesFiscales = array();
|
||||
foreach ($rows as $row) {
|
||||
$anneesFiscales[] = $row->annee;
|
||||
}
|
||||
return $anneesFiscales;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// zip archive creation
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 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)
|
||||
$archiveDir = null)
|
||||
{
|
||||
$zipFilename = "recus_dons" . $year . ".zip";
|
||||
header('Content-type: application/zip');
|
||||
|
@ -7,5 +7,8 @@
|
||||
<li{if $current_nav == 'index'} class="current"{/if}><a href="{plugin_url}">Activités et tarifs</a></li>
|
||||
<li{if $current_nav == 'personne'} class="current"{/if}><a href="{plugin_url file="personne.php"}">Versements totaux par personne</a></li>
|
||||
<li{if $current_nav == 'versements'} class="current"{/if}><a href="{plugin_url file="versements.php"}">Tous les versements</a></li>
|
||||
{if $session->canAccess($session::SECTION_ACCOUNTING, $session::ACCESS_WRITE)}
|
||||
<li{if $current_nav == 'config'} class="current"{/if}><a href="{plugin_url file="config.php"}">Configuration</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -1,31 +1,117 @@
|
||||
<!-- nav bar -->
|
||||
{include file="%s/templates/_nav.tpl"|args:$plugin_root current_nav="index"}
|
||||
|
||||
<h2>Liste des activités, cotisations et comptes associés</h2>
|
||||
<table class="list">
|
||||
<h2>Choisir l'année fiscale</h2>
|
||||
<form>
|
||||
<fieldset>
|
||||
{* <legend>Choisir l'année fiscale</legend> *}
|
||||
<select id="annee_recu" name="annee_recu">
|
||||
{foreach from=$anneesFiscales item="annee"}
|
||||
<option value="{$annee}" {if $annee == $anneeCourante - 1} selected{/if}>{$annee}
|
||||
</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<div id="choix_methode">
|
||||
<h2>Choisir une méthode de génération des reçus</h2>
|
||||
|
||||
<fieldset>
|
||||
{* <legend>Choisir une des méthodes</legend> *}
|
||||
<dl>
|
||||
<dd class="radio-btn">
|
||||
<input type="radio" id="radio_tous_versements" name="choix_versements" value="tous_versements"
|
||||
onclick="afficherMasquer(this.form, '.tous', '.activites');" />
|
||||
<label for="radio_tous_versements">
|
||||
<div>
|
||||
<h5>
|
||||
Tous les versements des membres font l'objet d'un reçu, sans
|
||||
tenir compte des activités et tarifs
|
||||
</h5>
|
||||
</div>
|
||||
</label>
|
||||
</dd>
|
||||
|
||||
<dd class="radio-btn">
|
||||
<input type="radio" id="radio_versements_activites" name="choix_versements"
|
||||
value="versements_activites"
|
||||
onclick="afficherMasquer(this.form, '.activites', '.tous');" />
|
||||
<label for="radio_versements_activites">
|
||||
<div>
|
||||
<h5>
|
||||
Seuls les versements de certaines activités et tarifs font
|
||||
l'objet d'un reçu
|
||||
</h5>
|
||||
</div>
|
||||
</label>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div id="generer_tous" class="tous hidden">
|
||||
<p class=" submit">
|
||||
{csrf_field key="generer_tous_recus"}
|
||||
{button type="submit" name="generer_tous" label="Générer" shape="right" class="main"}
|
||||
</p>
|
||||
</div>
|
||||
<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>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Description</th>
|
||||
<th>Tarif</th>
|
||||
<th>Description</th>
|
||||
<th>N° Compte</th>
|
||||
<th>Nom Compte</th>
|
||||
<th>Cocher</th>
|
||||
<th>Activité et Tarif</th>
|
||||
<th>Taux de réduction</th>
|
||||
<th>Caractéristiques activité</th>
|
||||
<th>N° et Compte</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$activitesTarifsComptes item="activite"}
|
||||
<tr>
|
||||
<td>{$activite.label}</td>
|
||||
<td>{$activite.descService}</td>
|
||||
<td>{$activite.tarif}</td>
|
||||
<td>{$activite.descTarif}</td>
|
||||
<td>{$activite.numero_cpt}</td>
|
||||
<td>{$activite.nom_cpt}</td>
|
||||
<td>
|
||||
{input type="checkbox" name="tarifs[]" value=$activite.idTarif}
|
||||
</td>
|
||||
<td>
|
||||
<span>{$activite.titreActivite} - {$activite.titreTarif}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="radio-btn">
|
||||
<input type="radio" id="taux_normal_{$activite.idTarif}"
|
||||
name="taux_reduction_{$activite.idTarif}" value="taux_normal" />
|
||||
<label for="taux_normal_{$activite.idTarif}">normal</label>
|
||||
</span>
|
||||
<span class=" radio-btn">
|
||||
<input type="radio" id="taux_majore_{$activite.idTarif}"
|
||||
name="taux_reduction_{$activite.idTarif}" value="taux_majore" />
|
||||
<label for="taux_majore_{$activite.idTarif}">majoré</label>
|
||||
</span>
|
||||
</td>
|
||||
<td>{if $activite.descActivite != ""}{$activite.descActivite} ; {/if}{$activite.descTarif}</td>
|
||||
<td>{$activite.numeroCpt} : {$activite.nomCpt}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<p class="help">Si vous ne savez pas quel taux de réduction utiliser, n'en choisissez aucun</p>
|
||||
</div>
|
||||
|
||||
<div id="generer_activites" class="activites hidden">
|
||||
<p class=" submit">
|
||||
{csrf_field key="generer_recus_activites"}
|
||||
{button type="submit" name="generer_activites" label="Générer" shape="right" class="main"}
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
<script defer type="text/javascript" src="script.js"></script>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
// function afficherMasquer(formulaire, class1, visible1, class2, visible2) {
|
||||
// afficher(formulaire, elem1, visible1);
|
||||
// afficher(formulaire, elem2, visible2);
|
||||
// }
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
<!-- footer -->
|
||||
{include file="admin/_foot.tpl"}
|
@ -10,10 +10,7 @@
|
||||
<thead class="userOrder">
|
||||
<tr>
|
||||
<th class="check">
|
||||
<input
|
||||
type="checkbox"
|
||||
title="Tout cocher / décocher"
|
||||
id="f_all" />
|
||||
<input type="checkbox" title="Tout cocher / décocher" id="f_all" />
|
||||
<label for="f_all"></label>
|
||||
</th>
|
||||
<th>Id</th>
|
||||
@ -31,9 +28,9 @@
|
||||
{input
|
||||
type="checkbox"
|
||||
name="selected[]"
|
||||
value=$versement.id}
|
||||
value=$versement.idUser}
|
||||
</td>
|
||||
<td>{$versement.id}</td>
|
||||
<td>{$versement.idUser}</td>
|
||||
<td>{$versement.nom}</td>
|
||||
<td class="montant">{$versement.montant|raw|money}</td>
|
||||
<td>{$versement.adresse}</td>
|
||||
|
@ -12,11 +12,7 @@
|
||||
<form method="post" action="action.php" class="memberList">
|
||||
|
||||
<fieldset class="versements" id="versements_global">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="check_global"
|
||||
id="check_global"
|
||||
onclick="cocherDecocherTout(check_global)" />
|
||||
<input type="checkbox" class="check_global" id="check_global" onclick="cocherDecocherTout(check_global)" />
|
||||
<label for="check_global">Cliquer pour cocher toutes les lignes</label>
|
||||
</fieldset>
|
||||
|
||||
@ -32,7 +28,8 @@
|
||||
{if !empty($activite->description)}
|
||||
<h4>{$activite->description}</h4>
|
||||
{/if}
|
||||
<h4>tarif « {$tarif->titreTarif} », montant : {if $tarif->montantTarif > 0}{$tarif->montantTarif}
|
||||
<h4>tarif « {$tarif->titreTarif} », montant :
|
||||
{if $tarif->montantTarif > 0}{$tarif->montantTarif|raw|money}
|
||||
€{else}libre
|
||||
{/if}
|
||||
</h4>
|
||||
@ -44,7 +41,7 @@
|
||||
*}
|
||||
<?php $currentUser = -1; $firstUser = true; ?>
|
||||
{foreach from=$lesVersements key="rang" item="versement"}
|
||||
{if $versement.idActivite == $activite->id &&
|
||||
{if $versement.idActivite == $activite->idActivite &&
|
||||
$versement.idTarif == $tarif->idTarif}
|
||||
{if $versement.idUser != $currentUser}
|
||||
{* changement de personne *}
|
||||
@ -58,10 +55,7 @@
|
||||
<?php $idVersements = $versement->idTarif."_".$versement->idUser; ?>
|
||||
<h3 class="personne">Versements de {$versement.nom} : <span id="total_{$idVersements}">0,00 €</span></h3>
|
||||
<fieldset class="versements" id="versements_{$idVersements}">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="check_{$idVersements}"
|
||||
id="check_{$idVersements}"
|
||||
<input type="checkbox" class="check_{$idVersements}" id="check_{$idVersements}"
|
||||
onclick="cocherDecocherPersonne(check_{$idVersements}, total_{$idVersements})" />
|
||||
<label for="check_{$idVersements}">Cliquer pour cocher toutes les lignes</label>
|
||||
<br />
|
||||
@ -69,13 +63,9 @@
|
||||
<?php $currentUser = $versement->idUser; ?>
|
||||
{/if}
|
||||
{* afficher les infos du versement de la personne*}
|
||||
<div {if $rang%2==0}class="pair"{else}class="impair"{/if}>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="check_{$idVersements}"
|
||||
id="check_{$idVersements}_{$rang}"
|
||||
name="selected[]"
|
||||
value={$rang}
|
||||
<div {if $rang%2==0}class="pair" {else}class="impair" {/if}>
|
||||
<input type="checkbox" class="check_{$idVersements}" id="check_{$idVersements}_{$rang}"
|
||||
name="selected[]" value={$rang}
|
||||
onclick="cocherDecocherVersement(check_{$idVersements}_{$rang}, total_{$idVersements})" />
|
||||
<label for=check_{$idVersements}_{$rang}></label>
|
||||
<span class="montant">{$versement.versement|raw|money}</span>
|
||||
@ -95,7 +85,7 @@
|
||||
<script src="script.js"></script>
|
||||
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
<script type="text/javascript">
|
||||
// ouvrir/fermer les détails
|
||||
document.querySelector('#open_details').onclick = () => {
|
||||
document.querySelectorAll('details').forEach((e) => {
|
||||
@ -107,7 +97,7 @@
|
||||
e.removeAttribute('open');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
<!-- footer -->
|
||||
|
@ -4,11 +4,21 @@ namespace Garradin;
|
||||
|
||||
use Garradin\Plugin\RecusFiscaux\Utils;
|
||||
|
||||
// première année d'exercice
|
||||
$anneeCourante = date("Y");
|
||||
$anneesFiscales = Utils::getAnneesFiscales();
|
||||
if ($anneesFiscales[0] < $anneeCourante) {
|
||||
array_unshift($anneesFiscales, $anneeCourante);
|
||||
}
|
||||
|
||||
// liste des activités, cotisations et comptes associés
|
||||
$activitesTarifsComptes = Utils::getActivitesTarifsEtComptes();
|
||||
|
||||
// préparation de l'affichage
|
||||
$tpl->assign('anneesFiscales', $anneesFiscales);
|
||||
$tpl->assign('anneeCourante', $anneeCourante);
|
||||
$tpl->assign('activitesTarifsComptes', $activitesTarifsComptes);
|
||||
$tpl->assign('plugin_css', ['style.css']);
|
||||
|
||||
// envoyer au template
|
||||
$tpl->display(PLUGIN_ROOT . '/templates/index.tpl');
|
||||
|
@ -118,6 +118,15 @@ function verifierChoix(formulaire)
|
||||
return ok;
|
||||
}
|
||||
|
||||
function afficherMasquer(formulaire, nomClasse1, nomClasse2) {
|
||||
for (var elem of formulaire.querySelectorAll(nomClasse1)) {
|
||||
elem.classList.remove('hidden');
|
||||
}
|
||||
for (var elem of formulaire.querySelectorAll(nomClasse2)) {
|
||||
elem.classList.add('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Associer un écouteur à la première case à cocher de chaque table
|
||||
* @remarks : n'est plus utile
|
||||
|
@ -27,3 +27,6 @@ summary.activite {
|
||||
h3.personne {
|
||||
background: rgba(var(--gSecondColor), 0.35);
|
||||
}
|
||||
input[type="text"] {
|
||||
width: 50em;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ $activites = Utils::getActivites();
|
||||
foreach ($activites as $num => $activite)
|
||||
{
|
||||
// ajouter les tarifs de l'activité
|
||||
$activite->{'tarifs'} = Utils::getTarifs($activite->{'id'});
|
||||
$activite->{'tarifs'} = Utils::getTarifs($activite->{'idActivite'});
|
||||
}
|
||||
|
||||
// préparation de l'affichage
|
||||
|
Loading…
Reference in New Issue
Block a user