Overview
Comment:Simplified view for favorite accounts
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 5d47c23bff489596e5f8981d0da9306887224555
User & Date: bohwaz on 2020-10-08 13:47:16
Other Links: branch diff | manifest | tags
Context
2020-10-09
10:15
General ledger check-in: 65893d90e5 user: bohwaz tags: dev
2020-10-08
13:47
Simplified view for favorite accounts check-in: 5d47c23bff user: bohwaz tags: dev
2020-10-04
01:00
Implement account journals check-in: b0ad011f2b user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Accounting/Years.php from [3aa7cf08fd] to [849724b7dc].

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Years
{
	static public function get(int $year_id)
	{
		return EntityManager::findOneById(Year::class, $year_id);
	}

	static public function getCurrentOpenYearIfSingle()
	{
		return EntityManager::findOne(Year::class, 'SELECT * FROM @TABLE WHERE closed = 0 GROUP BY closed HAVING COUNT(*) = 1;');
	}

	static public function listOpen()
	{
		$em = EntityManager::getInstance(Year::class);
		return $em->all('SELECT * FROM @TABLE WHERE closed = 0 ORDER BY end_date;');
	}







|

|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Years
{
	static public function get(int $year_id)
	{
		return EntityManager::findOneById(Year::class, $year_id);
	}

	static public function getCurrentOpenYear()
	{
		return EntityManager::findOne(Year::class, 'SELECT * FROM @TABLE WHERE closed = 0 ORDER BY start_date LIMIT 1;');
	}

	static public function listOpen()
	{
		$em = EntityManager::getInstance(Year::class);
		return $em->all('SELECT * FROM @TABLE WHERE closed = 0 ORDER BY end_date;');
	}

Modified src/templates/acc/accounts/index.tpl from [65f07d7bc0] to [4ddb4eddb4].

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

	{foreach from=$accounts item="account"}
		<tr>
			<td class="num">{$account.code}</td>
			<th>{$account.label}</th>
			<td class="desc">{$account.description}</td>
			<td class="actions">
				{linkbutton shape="menu" label="Journal" href="acc/accounts/journal.php?id=%d"|args:$account.id}
				{if $session->canAccess('compta', Membres::DROIT_ADMIN)}
					{linkbutton shape="edit" label="Modifier" href="acc/accounts/edit.php?id=%d"|args:$account.id}
					{linkbutton shape="delete" label="Supprimer" href="acc/accounts/delete.php?id=%d"|args:$account.id}
				{/if}
			</td>
		</tr>
	{/foreach}
	</tbody>
{/foreach}
</table>

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







|












21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

	{foreach from=$accounts item="account"}
		<tr>
			<td class="num">{$account.code}</td>
			<th>{$account.label}</th>
			<td class="desc">{$account.description}</td>
			<td class="actions">
				{linkbutton shape="menu" label="Journal" href="acc/accounts/journal.php?id=%d&simple=1"|args:$account.id}
				{if $session->canAccess('compta', Membres::DROIT_ADMIN)}
					{linkbutton shape="edit" label="Modifier" href="acc/accounts/edit.php?id=%d"|args:$account.id}
					{linkbutton shape="delete" label="Supprimer" href="acc/accounts/delete.php?id=%d"|args:$account.id}
				{/if}
			</td>
		</tr>
	{/foreach}
	</tbody>
{/foreach}
</table>

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

Modified src/templates/acc/accounts/journal.tpl from [8544eb6953] to [4795a14551].

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
{include file="admin/_head.tpl" title="Journal : %s - %s"|args:$account.code:$account.label current="acc/accounts" body_id="rapport"}

{include file="acc/_year_select.tpl"}










<table class="list">
    <colgroup>
        <col width="3%" />
        <col width="12%" />
        <col width="10%" />
        <col width="10%" />
        <col width="12%" />
        <col />
        <col width="6%" />
    </colgroup>
    <thead>
        <tr>
            <td>N°</td>
            <td>Date</td>



            <td>Débit</td>
            <td>Crédit</td>

            <td>Solde cumulé</td>
            <th>Libellé</th>
            <td></td>
        </tr>
    </thead>
    <tbody>
    {foreach from=$journal item="line"}
        <tr>
            <td class="num"><a href="{$admin_url}acc/transactions/details.php?id={$line.id}">{$line.id}</a></td>
            <td>{$line.date|date_fr:'d/m/Y'}</td>



            <td class="money">{if $line.debit}{$line.debit|escape|html_money}{/if}</td>
            <td class="money">{if $line.credit}{$line.credit|escape|html_money}{/if}</td>

            <td class="money">{$line.running_sum|escape|html_money}</td>
            <th>{$line.label}</th>
            <td class="actions">
                {linkbutton href="acc/transactions/details.php?id=%d"|args:$line.id label="Détails" shape="search"}
            </td>
        </tr>
    {/foreach}
    </tbody>
    <tfoot>
        <tr>
            <td colspan="4">Solde</td>
            <td class="money">{$sum|escape|html_money}</td>
            <td colspan="2"></td>
        </tr>
    </tfoot>
</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
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
67
{include file="admin/_head.tpl" title="Journal : %s - %s"|args:$account.code:$account.label current="acc/accounts" body_id="rapport"}

{include file="acc/_year_select.tpl"}

{if $account.type}
<nav class="tabs">
    <ul>
        <li{if $simple_view} class="current"{/if}><a href="{$admin_url}acc/accounts/journal.php?id={$account.id}&amp;simple=1">Vue simplifiée</a></li>
        <li{if !$simple_view} class="current"{/if}><a href="{$admin_url}acc/accounts/journal.php?id={$account.id}&amp;simple=0">Vue normale</a></li>
    </ul>
</nav>
{/if}

<table class="list">
    <colgroup>
        <col width="3%" />
        <col width="12%" />
        <col width="10%" />
        {if !$simple_view}<col width="10%" />{/if}
        <col width="12%" />
        <col />
        <col width="6%" />
    </colgroup>
    <thead>
        <tr>
            <td>N°</td>
            <td>Date</td>
            {if $simple_view}
            <td>Mouvement</td>
            {else}
            <td class="money">Débit</td>
            <td class="money">Crédit</td>
            {/if}
            <td>Solde cumulé</td>
            <th>Libellé</th>
            <td></td>
        </tr>
    </thead>
    <tbody>
    {foreach from=$journal item="line"}
        <tr>
            <td class="num"><a href="{$admin_url}acc/transactions/details.php?id={$line.id}">{$line.id}</a></td>
            <td>{$line.date|date_fr:'d/m/Y'}</td>
            {if $simple_view}
            <td class="money">{if $line.debit}-{$line.debit|escape|html_money}{else}+{$line.credit|escape|html_money}{/if}</td>
            {else}
            <td class="money">{if $line.debit}{$line.debit|escape|html_money}{/if}</td>
            <td class="money">{if $line.credit}{$line.credit|escape|html_money}{/if}</td>
            {/if}
            <td class="money">{$line.running_sum|escape|html_money}</td>
            <th>{$line.label}</th>
            <td class="actions">
                {linkbutton href="acc/transactions/details.php?id=%d"|args:$line.id label="Détails" shape="search"}
            </td>
        </tr>
    {/foreach}
    </tbody>
    <tfoot>
        <tr>
            <td colspan="{if $simple_view}3{else}4{/if}">Solde</td>
            <td class="money">{$sum|escape|html_money}</td>
            <td colspan="2"></td>
        </tr>
    </tfoot>
</table>

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

Modified src/templates/acc/transactions/details.tpl from [809eeeb477] to [83448201cc].

68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	<dd>-</dd>
	{/foreach}
</dl>

<table class="list">
	<thead>
		<tr>

			<th colspan="2">Comptes</th>
			<td>Débit</td>
			<td>Crédit</td>
			<td>Libellé</td>
			<td>Référence</td>
		</tr>
	</thead>
	<tbody>
		{foreach from=$transaction->getLinesWithAccounts() item="line"}
		<tr>
			<td class="num"><a href="{$admin_url}acc/accounts/journal.php?id={$line.id_account}">{$line.account_code}</a></td>
			<td>{$line.account_name}</td>
			<td>{$line.debit|escape|html_money}&nbsp;{$config.monnaie}</td>
			<td>{$line.credit|escape|html_money}&nbsp;{$config.monnaie}</td>
			<td>{$line.label}</td>
			<td>{$line.reference}</td>
		</tr>
		{/foreach}
	</tbody>
</table>

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







>
|
|
|









|
|








68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
	<dd>-</dd>
	{/foreach}
</dl>

<table class="list">
	<thead>
		<tr>
			<td>N°</td>
			<th>Comptes</th>
			<td class="money">Débit</td>
			<td class="money">Crédit</td>
			<td>Libellé</td>
			<td>Référence</td>
		</tr>
	</thead>
	<tbody>
		{foreach from=$transaction->getLinesWithAccounts() item="line"}
		<tr>
			<td class="num"><a href="{$admin_url}acc/accounts/journal.php?id={$line.id_account}">{$line.account_code}</a></td>
			<td>{$line.account_name}</td>
            <td class="money">{if $line.debit}{$line.debit|escape|html_money}{/if}</td>
            <td class="money">{if $line.credit}{$line.credit|escape|html_money}{/if}</td>
			<td>{$line.label}</td>
			<td>{$line.reference}</td>
		</tr>
		{/foreach}
	</tbody>
</table>

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

Modified src/www/admin/acc/_inc.php from [f0ce7f3624] to [2c4d0e7b86].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	if ($current_year->closed) {
		$current_year_id = null;
		$session->set('acc_year', null);
	}
}

if (!$current_year_id) {
	$current_year = Years::getCurrentOpenYearIfSingle();

	if (!$current_year) {
		Utils::redirect(ADMIN_URL . '/acc/years/new.php?msg=FIRST');
	}

	$current_year_id = $current_year->id();
}

if ($session->get('acc_year') != $current_year_id) {
	$session->set('acc_year', $current_year_id);
}

define('Garradin\CURRENT_YEAR_ID', $current_year->id());

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







|


|












17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	if ($current_year->closed) {
		$current_year_id = null;
		$session->set('acc_year', null);
	}
}

if (!$current_year_id) {
	$current_year = Years::getCurrentOpenYear();

	if (!$current_year) {
		Utils::redirect(ADMIN_URL . 'acc/years/new.php?msg=FIRST');
	}

	$current_year_id = $current_year->id();
}

if ($session->get('acc_year') != $current_year_id) {
	$session->set('acc_year', $current_year_id);
}

define('Garradin\CURRENT_YEAR_ID', $current_year->id());

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

Modified src/www/admin/acc/accounts/journal.php from [65fdccc77d] to [f736bfd940].

27
28
29
30
31
32
33

34
35
36
37
else
{
    $tpl->assign('credit', '+');
    $tpl->assign('debit', '-');
}
*/


$tpl->assign('account', $account);
$tpl->assign('journal', $journal);
$tpl->assign('sum', $sum);
$tpl->display('acc/accounts/journal.tpl');







>




27
28
29
30
31
32
33
34
35
36
37
38
else
{
    $tpl->assign('credit', '+');
    $tpl->assign('debit', '-');
}
*/

$tpl->assign('simple_view', qg('simple'));
$tpl->assign('account', $account);
$tpl->assign('journal', $journal);
$tpl->assign('sum', $sum);
$tpl->display('acc/accounts/journal.tpl');

Modified src/www/admin/acc/years/new.php from [0d7b0db29f] to [95e9c0d52b].

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

use Garradin\Accounting\Years;
use Garradin\Accounting\Charts;
use Garradin\Entities\Accounting\Year;

require_once __DIR__ . '/../_inc.php';

$session->requireAccess('compta', Membres::DROIT_ADMIN);

if (f('new') && $form->check('acc_years_new')) {
	try {
		$year = new Year;
		$year->importForm();







|







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

use Garradin\Accounting\Years;
use Garradin\Accounting\Charts;
use Garradin\Entities\Accounting\Year;

require_once __DIR__ . '/../../_inc.php';

$session->requireAccess('compta', Membres::DROIT_ADMIN);

if (f('new') && $form->check('acc_years_new')) {
	try {
		$year = new Year;
		$year->importForm();

Modified src/www/admin/static/admin.css from [4a6fc84d32] to [cc93433f65].

874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
}

#rapport td, #rapport th {
    padding: 0.2em 0.5em;
    text-align: left;
}

#rapport td.money, #rapport th.money {
    text-align: right;
}

#rapport .compte th {
    font-weight: normal;
    padding-left: 1em;
}







|







874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
}

#rapport td, #rapport th {
    padding: 0.2em 0.5em;
    text-align: left;
}

td.money, th.money {
    text-align: right;
}

#rapport .compte th {
    font-weight: normal;
    padding-left: 1em;
}