Overview
Comment:
  • Affichage de la catégorie dans les détails de l'opération
  • Suivi des dépenses / recettes par catégorie
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fee53a0296fe9d4f296411ba45dc11a6e3f12ced
User & Date: bohwaz on 2012-09-19 01:12:56
Other Links: manifest | tags
Context
2012-09-19
01:43
Modification d'opération check-in: 1c15ace26c user: bohwaz tags: trunk
01:12
  • Affichage de la catégorie dans les détails de l'opération
  • Suivi des dépenses / recettes par catégorie
check-in: fee53a0296 user: bohwaz tags: trunk
2012-09-15
03:10
Un petit readme qui comprends surtout les références vers les libs incluses check-in: f8ea8442ba user: bohwaz tags: trunk
Changes

Modified include/class.compta_categories.php from [197bb1a68c] to [87a258de1b].

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
    {
        $db = Garradin_DB::getInstance();
        $type = is_null($type) ? '' : 'cat.type = '.(int)$type;
        return $db->simpleStatementFetch('
            SELECT cat.*, cc.libelle AS compte_libelle
            FROM compta_categories AS cat INNER JOIN compta_comptes AS cc
                ON cc.id = cat.compte
            WHERE '.$type.' ORDER BY cat.compte;', SQLITE3_ASSOC);
    }

    public function listMoyensPaiement()
    {
        $db = Garradin_DB::getInstance();
        return $db->simpleStatementFetchAssocKey('SELECT code, nom FROM compta_moyens_paiement ORDER BY nom COLLATE NOCASE;');
    }







|







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
    {
        $db = Garradin_DB::getInstance();
        $type = is_null($type) ? '' : 'cat.type = '.(int)$type;
        return $db->simpleStatementFetch('
            SELECT cat.*, cc.libelle AS compte_libelle
            FROM compta_categories AS cat INNER JOIN compta_comptes AS cc
                ON cc.id = cat.compte
            WHERE '.$type.' ORDER BY cat.intitule;', SQLITE3_ASSOC);
    }

    public function listMoyensPaiement()
    {
        $db = Garradin_DB::getInstance();
        return $db->simpleStatementFetchAssocKey('SELECT code, nom FROM compta_moyens_paiement ORDER BY nom COLLATE NOCASE;');
    }

Modified include/class.compta_journal.php from [50d14d4084] to [0b6fe51fd0].

202
203
204
205
206
207
208




































209
210
211
212
213

    public function getJournal()
    {
        $db = Garradin_DB::getInstance();
        $exercice = $this->_getCurrentExercice();
        $exercice = is_null($exercice) ? 'IS NULL' : '= ' . (int)$exercice;
        $query = 'SELECT *, strftime(\'%s\', date) AS date FROM compta_journal WHERE id_exercice '.$exercice.' ORDER BY date, id;';




































        return $db->simpleStatementFetch($query);
    }
}

?>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249

    public function getJournal()
    {
        $db = Garradin_DB::getInstance();
        $exercice = $this->_getCurrentExercice();
        $exercice = is_null($exercice) ? 'IS NULL' : '= ' . (int)$exercice;
        $query = 'SELECT *, strftime(\'%s\', date) AS date FROM compta_journal WHERE id_exercice '.$exercice.' ORDER BY date, id;';
        return $db->simpleStatementFetch($query);
    }

    public function getListForCategory($type = null, $cat = null)
    {
        $db = Garradin_DB::getInstance();
        $exercice = $this->_getCurrentExercice();

        $query = 'SELECT compta_journal.*, strftime(\'%s\', compta_journal.date) AS date ';

        if (is_null($cat))
        {
            $query.= ', compta_categories.intitule AS categorie
                FROM compta_journal LEFT JOIN compta_categories
                ON compta_journal.id_categorie = compta_categories.id ';
        }
        else
        {
            $query.= ' FROM compta_journal ';
        }

        $query .= ' WHERE ';

        if (!is_null($cat))
        {
            $query .= 'id_categorie = ' . (int)$cat;
        }
        else
        {
            $query.= 'id_categorie IN (SELECT id FROM compta_categories WHERE type = '.(int)$type.')';
        }

        $query .= ' AND id_exercice ';
        $query .= is_null($exercice) ? 'IS NULL' : '= ' . (int)$exercice;
        $query .= ' ORDER BY date;';

        return $db->simpleStatementFetch($query);
    }
}

?>

Modified templates/admin/_head.tpl from [bf53b213ca] to [16bd4865ec].

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
                <li class="members_mail{if $current == 'membres/message_collectif'} current{/if}"><a href="{$www_url}admin/membres/message_collectif.php">Message collectif</a></li>
                {/if}
            </ul>
            {/if}
            </li>
        {/if}
        {if $user.droits.compta >= Garradin_Membres::DROIT_ACCES}
            <li class="compta{if $current == 'compta'} current{/if}"><a href="{$www_url}admin/compta/">Comptabilité</a>
            {if $user.droits.compta >= Garradin_Membres::DROIT_ECRITURE}
            <ul>
                <li class="compta_saisie{if $current == 'compta/saisie'} current{/if}"><a href="{$www_url}admin/compta/saisie.php">Saisie</a></li>
                {if $user.droits.compta >= Garradin_Membres::DROIT_ADMIN}
                <li class="compta_gestion{if $current == 'compta/gestion'} current{/if}"><a href="{$www_url}admin/compta/gestion.php">Suivi des opérations</a></li>
                <li class="compta_banques{if $current == 'compta/banques'} current{/if}"><a href="{$www_url}admin/compta/banques.php">Banques &amp; caisse</a></li>
                <li class="compta_cats{if $current == 'compta/categories'} current{/if}"><a href="{$www_url}admin/compta/categories.php">Catégories &amp; comptes</a></li>







|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
                <li class="members_mail{if $current == 'membres/message_collectif'} current{/if}"><a href="{$www_url}admin/membres/message_collectif.php">Message collectif</a></li>
                {/if}
            </ul>
            {/if}
            </li>
        {/if}
        {if $user.droits.compta >= Garradin_Membres::DROIT_ACCES}
            <li class="compta{if $current == 'compta'} current{/if}"><a href="{$www_url}admin/compta/">Comptabilité <small>[beta]</small></a>
            {if $user.droits.compta >= Garradin_Membres::DROIT_ECRITURE}
            <ul>
                <li class="compta_saisie{if $current == 'compta/saisie'} current{/if}"><a href="{$www_url}admin/compta/saisie.php">Saisie</a></li>
                {if $user.droits.compta >= Garradin_Membres::DROIT_ADMIN}
                <li class="compta_gestion{if $current == 'compta/gestion'} current{/if}"><a href="{$www_url}admin/compta/gestion.php">Suivi des opérations</a></li>
                <li class="compta_banques{if $current == 'compta/banques'} current{/if}"><a href="{$www_url}admin/compta/banques.php">Banques &amp; caisse</a></li>
                <li class="compta_cats{if $current == 'compta/categories'} current{/if}"><a href="{$www_url}admin/compta/categories.php">Catégories &amp; comptes</a></li>

Modified templates/admin/compta/compte_journal.tpl from [d8dff54350] to [ebeaf4175b].

1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{include file="admin/_head.tpl" title="Journal : `$compte.id` - `$compte.libelle`" current="compta/gestion"}

<table class="list">
    <colgroup>
        <col width="3%" />
        <col width="3%" />
        <col width="12%" />
        <col width="10%" />
        <col />
    </colgroup>

{foreach from=$journal item="ligne"}
    <tr>
        <td><a href="{$admin_url}compta/operation.php?id={$ligne.id|escape}">{$ligne.id|escape}</a></td>
        <td class="actions">
            <a class="icn" href="{$admin_url}compta/operation_modifier.php?id={$ligne.id|escape}">✎</a>
        </td>
        <td>{$ligne.date|date_fr:'d/m/Y'|escape}</td>
        <td>{if $ligne.compte_credit == $compte.id}-{$ligne.montant|escape}{else}+{$ligne.montant|escape}{/if}</td>
        <th>{$ligne.libelle|escape}</th>
    </tr>
{/foreach}
    <tbody>
        <tr>
            <td></td>
            <td></td>
            <th>Solde</th>
            <td>{$solde|escape} {$config.monnaie|escape}</td>
            <td></td>
        </tr>
    </tbody>
</table>


{include file="admin/_foot.tpl"}










>
|
|
|
|
|
|
|
|
|
|
|
<












1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
34
{include file="admin/_head.tpl" title="Journal : `$compte.id` - `$compte.libelle`" current="compta/gestion"}

<table class="list">
    <colgroup>
        <col width="3%" />
        <col width="3%" />
        <col width="12%" />
        <col width="10%" />
        <col />
    </colgroup>
    <tbody>
    {foreach from=$journal item="ligne"}
        <tr>
            <td><a href="{$admin_url}compta/operation.php?id={$ligne.id|escape}">{$ligne.id|escape}</a></td>
            <td class="actions">
                <a class="icn" href="{$admin_url}compta/operation_modifier.php?id={$ligne.id|escape}">✎</a>
            </td>
            <td>{$ligne.date|date_fr:'d/m/Y'|escape}</td>
            <td>{if $ligne.compte_credit == $compte.id}-{$ligne.montant|escape}{else}+{$ligne.montant|escape}{/if}</td>
            <th>{$ligne.libelle|escape}</th>
        </tr>
    {/foreach}

        <tr>
            <td></td>
            <td></td>
            <th>Solde</th>
            <td>{$solde|escape} {$config.monnaie|escape}</td>
            <td></td>
        </tr>
    </tbody>
</table>


{include file="admin/_foot.tpl"}

Modified templates/admin/compta/gestion.tpl from [78a832f7b6] to [95abaf6544].

1
2
3
4
5
6
7
8











9












































10
11
{include file="admin/_head.tpl" title="Suivi des opérations" current="compta/gestion"}

<ul class="actions">
    <li class="recettes"><a href="{$www_url}admin/compta/gestion.php?recettes">Recettes</a></li>
    <li class="depenses"><a href="{$www_url}admin/compta/gestion.php?depenses">Dépenses</a></li>
    <li class="journal"><a href="{$www_url}admin/compta/journal.php">Journal général</a></li>
</ul>












<p class="warning">À venir...</p>













































{include file="admin/_foot.tpl"}



|
|



>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{include file="admin/_head.tpl" title="Suivi des opérations" current="compta/gestion"}

<ul class="actions">
    <li class="recettes{if $type == Garradin_Compta_Categories::RECETTES} current{/if}"><a href="{$www_url}admin/compta/gestion.php?recettes">Recettes</a></li>
    <li class="depenses{if $type == Garradin_Compta_Categories::DEPENSES} current{/if}"><a href="{$www_url}admin/compta/gestion.php?depenses">Dépenses</a></li>
    <li class="journal"><a href="{$www_url}admin/compta/journal.php">Journal général</a></li>
</ul>

<form method="get" action="{$self_url}">
    <fieldset>
        <legend>Catégorie</legend>
        <select name="cat" onchange="if (!this.value) location.href = '?{if $type == Garradin_Compta_Categories::RECETTES}recettes{else}depenses{/if}'; else this.form.submit();">
            <option value="">-- Toutes</option>
        {foreach from=$liste_cats item="cat"}
            <option value="{$cat.id|escape}"{if $cat.id == $categorie.id} selected="selected"{/if}>{$cat.intitule|escape}</option>
        {/foreach}
        </select>
    </fieldset>
</form>

<table class="list">
    <colgroup>
        <col width="3%" />
        <col width="3%" />
        <col width="12%" />
        <col width="10%" />
        <col />
        {if !$categorie}
        <col width="20%" />
        {/if}
    </colgroup>
    <tbody>
    {foreach from=$journal item="ligne"}
        <tr>
            <td><a href="{$admin_url}compta/operation.php?id={$ligne.id|escape}">{$ligne.id|escape}</a></td>
            <td class="actions">
                <a class="icn" href="{$admin_url}compta/operation_modifier.php?id={$ligne.id|escape}">✎</a>
            </td>
            <td>{$ligne.date|date_fr:'d/m/Y'|escape}</td>
            <td>{$ligne.montant|escape} {$config.monnaie|escape}</td>
            <th>{$ligne.libelle|escape}</th>
            {if !$categorie}
            <td>{$ligne.categorie|escape}</td>
            {/if}
        </tr>
    {foreachelse}
        <tr>
            <td colspan="3"></td>
            <td colspan="2">
                Aucune opération.
            </td>
            {if !$categorie}<td></td>{/if}
        </tr>
    {/foreach}
        <tr>
            <td></td>
            <td></td>
            <th>Total</th>
            <td>{$total|escape} {$config.monnaie|escape}</td>
            <td></td>
            {if !$categorie}<td></td>{/if}
        </tr>
    </tbody>
</table>

{include file="admin/_foot.tpl"}

Modified templates/admin/compta/index.tpl from [d64968d398] to [f8c04a81be].

1






2
3
4
5
6
7
8
9
10
11
12
13
{include file="admin/_head.tpl" title="Comptabilité" current="compta"}







<h3>Évolution des recettes et dépenses sur les 30 derniers jours</h3>
<p>
    <img src="{$www_url}admin/compta/graph.php?g=recettes_depenses" />
</p>

<h3>Évolution actif/passif sur les 30 derniers jours</h3>
<p>
    <img src="{$www_url}admin/compta/graph.php?g=actif_passif" />
</p>

{include file="admin/_foot.tpl"}

>
>
>
>
>
>












1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{include file="admin/_head.tpl" title="Comptabilité" current="compta"}

<p class="alert">
    Attention la comptabilité est une fonctionnalité en beta,
    il est déconseillé pour le moment de l'utiliser pour la
    comptabilité réelle de votre association.
</p>

<h3>Évolution des recettes et dépenses sur les 30 derniers jours</h3>
<p>
    <img src="{$www_url}admin/compta/graph.php?g=recettes_depenses" />
</p>

<h3>Évolution actif/passif sur les 30 derniers jours</h3>
<p>
    <img src="{$www_url}admin/compta/graph.php?g=actif_passif" />
</p>

{include file="admin/_foot.tpl"}

Modified templates/admin/compta/journal.tpl from [eedaafc38f] to [d1516099fc].

1
2
3
4
5
6
7
8
9
10
11
12
13
{include file="admin/_head.tpl" title="Journal général" current="compta/gestion"}

<ul class="actions">
    <li class="journal current"><a href="{$www_url}admin/compta/journal.php">Journal général</a></li>
</ul>

<table class="list multi">
    <thead>
        <tr>
            <td>Date</td>
            <th>Intitulé</th>
            <td>Comptes</td>
            <td>Débit</td>


<
<
<
<







1
2




3
4
5
6
7
8
9
{include file="admin/_head.tpl" title="Journal général" current="compta/gestion"}





<table class="list multi">
    <thead>
        <tr>
            <td>Date</td>
            <th>Intitulé</th>
            <td>Comptes</td>
            <td>Débit</td>

Modified templates/admin/compta/operation.tpl from [db1640f5f6] to [a9437519ae].

26
27
28
29
30
31
32





33
34
35
36
37
38
39
        {/if}

        {if $operation.moyen_paiement && $operation.moyen_paiement != 'ES'}
            <dt>Compte bancaire</dt>
            <dd>{$compte|escape}</dd>
        {/if}






    {/if}

    <dt>Opération créée par</dt>
    <dd>
        {if $user.droits.membres >= Garradin_Membres::DROIT_ACCES}
            <a href="{$www_url}admin/membres/fiche.php?id={$operation.id_auteur|escape}">{$nom_auteur|escape}</a>
        {else}







>
>
>
>
>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
        {/if}

        {if $operation.moyen_paiement && $operation.moyen_paiement != 'ES'}
            <dt>Compte bancaire</dt>
            <dd>{$compte|escape}</dd>
        {/if}

        <dt>Catégorie</dt>
        <dd>
            <a href="{$www_url}admin/compta/gestion.php?{if $categorie.type == Garradin_Compta_Categories::DEPENSES}depenses{else}recettes{/if}">{if $categorie.type == Garradin_Compta_Categories::DEPENSES}Dépense{else}Recette{/if}</a>&nbsp;:
            <a href="{$www_url}admin/compta/gestion.php?cat={$operation.id_categorie|escape}">{$categorie.intitule|escape}</a>
        </dd>
    {/if}

    <dt>Opération créée par</dt>
    <dd>
        {if $user.droits.membres >= Garradin_Membres::DROIT_ACCES}
            <a href="{$www_url}admin/membres/fiche.php?id={$operation.id_auteur|escape}">{$nom_auteur|escape}</a>
        {else}

Modified www/admin/compta/compte_journal.php from [ed91f76331] to [adbedd9087].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

require_once __DIR__ . '/_inc.php';

if ($user['droits']['compta'] < Garradin_Membres::DROIT_ACCES)
{
    throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
}

$compte = $comptes->get(utils::get('id'));

if (!$compte)
{
    throw new UserException("Le compte demandé n'existe pas.");
}





<
<
<
<
<







1
2
3
4





5
6
7
8
9
10
11
<?php

require_once __DIR__ . '/_inc.php';






$compte = $comptes->get(utils::get('id'));

if (!$compte)
{
    throw new UserException("Le compte demandé n'existe pas.");
}

Modified www/admin/compta/gestion.php from [70f4d2c4f4] to [403d3ed675].

1
2
3
4










































5
6
7
<?php

require_once __DIR__ . '/_inc.php';











































$tpl->display('admin/compta/gestion.tpl');

?>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php

require_once __DIR__ . '/_inc.php';

require_once GARRADIN_ROOT . '/include/class.compta_categories.php';

$cats = new Garradin_Compta_Categories;
$cat = $type = false;

if (utils::get('cat'))
{
	$cat = $cats->get(utils::get('cat'));

	if (!$cat)
	{
		throw new UserException("La catégorie demandée n'existe pas.");
	}

	$type = $cat['type'];
}
else
{
	$type = isset($_GET['depenses'])
		? Garradin_Compta_Categories::DEPENSES
		: Garradin_Compta_Categories::RECETTES;
}

require_once GARRADIN_ROOT . '/include/class.compta_journal.php';
$journal = new Garradin_Compta_Journal;

$list = $journal->getListForCategory($type, $cat ? $cat['id'] : null);

$tpl->assign('categorie', $cat);
$tpl->assign('journal', $list);
$tpl->assign('type', $type);
$tpl->assign('liste_cats', $cats->getList($type));

$total = 0.0;

foreach ($list as $row)
{
	$total += (float) $row['montant'];
}

$tpl->assign('total', $total);

$tpl->display('admin/compta/gestion.tpl');

?>

Modified www/admin/static/admin.css from [0645dcac79] to [ec29f7f903].

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
}

.header .menu li.current > a {
    background: #fff;
    color: rgb(156, 79, 21);
}

.header .menu .list_members small {
    font-weight: normal;
    opacity: 0.5;
    float: right;
    font-size: .7em;
    padding-top: .3em;
}








|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
}

.header .menu li.current > a {
    background: #fff;
    color: rgb(156, 79, 21);
}

.header .menu a small {
    font-weight: normal;
    opacity: 0.5;
    float: right;
    font-size: .7em;
    padding-top: .3em;
}