Overview
Comment:Improve design of list of years, and add number of transactions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 95f0daf9e2db99a9445d4c9821789908355313e6
User & Date: bohwaz on 2020-12-09 18:23:33
Other Links: manifest | tags
Context
2020-12-09
18:23
$target is not used check-in: 79206bfe3d user: bohwaz tags: trunk
18:23
Improve design of list of years, and add number of transactions check-in: 95f0daf9e2 user: bohwaz tags: trunk
18:20
Just in case ther's a mixed position and outside of 6/7 account codes check-in: 04a0506fd2 user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Accounting/Years.php from [f93259774b] to [adce096083].

46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
	{
		return DB::getInstance()->count(Year::TABLE, 'closed = 1');
	}

	static public function list(bool $reverse = false)
	{
		$desc = $reverse ? 'DESC' : '';
		$em = EntityManager::getInstance(Year::class);

		return $em->all(sprintf('SELECT * FROM @TABLE ORDER BY end_date %s;', $desc));
	}

	static public function getNewYearDates(): array
	{
		$last_year = EntityManager::findOne(Year::class, 'SELECT * FROM @TABLE ORDER BY end_date DESC LIMIT 1;');

		if ($last_year) {







|
>
|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
	{
		return DB::getInstance()->count(Year::TABLE, 'closed = 1');
	}

	static public function list(bool $reverse = false)
	{
		$desc = $reverse ? 'DESC' : '';
		return DB::getInstance()->get(sprintf('SELECT *,
			(SELECT COUNT(*) FROM acc_transactions WHERE id_year = acc_years.id) AS nb_transactions
			FROM acc_years ORDER BY end_date %s;', $desc));
	}

	static public function getNewYearDates(): array
	{
		$last_year = EntityManager::findOne(Year::class, 'SELECT * FROM @TABLE ORDER BY end_date DESC LIMIT 1;');

		if ($last_year) {

Modified src/templates/acc/years/index.tpl from [a2bc7c5c37] to [f4fb5ef736].

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



68
69
70
71
72
73
74
75
76
			<figure>
				<img src="{$admin_url}acc/reports/graph_plot_all.php?type=result" alt="" />
			</figure>
		</section>
	</section>
	{/if}

	<dl class="list">
	{foreach from=$list item="year"}


		<dt>{$year.label}</dt>
		<dd class="desc">
			{if $year.closed}Clôturé{else}En cours{/if}
			| Du {$year.start_date|date_short} au {$year.end_date|date_short}
			| <a href="../charts/accounts/?id={$year.id_chart}">Plan comptable</a>
		</dd>
		<dd class="desc">


			<a href="{$admin_url}acc/reports/graphs.php?year={$year.id}">Graphiques</a>
			| <a href="{$admin_url}acc/reports/trial_balance.php?year={$year.id}">Balance générale</a>
			| <a href="{$admin_url}acc/reports/journal.php?year={$year.id}">Journal général</a>
			| <a href="{$admin_url}acc/reports/ledger.php?year={$year.id}">Grand livre</a>
			| <a href="{$admin_url}acc/reports/statement.php?year={$year.id}">Compte de résultat</a>
			| <a href="{$admin_url}acc/reports/balance_sheet.php?year={$year.id}">Bilan</a>
		</dd>




		{if $session->canAccess('compta', Membres::DROIT_ADMIN)}
		<dd class="actions">
			{linkbutton label="Export CSV" shape="export" href="import.php?id=%d&export=csv"|args:$year.id}
			{linkbutton label="Export tableur" shape="export" href="import.php?id=%d&export=ods"|args:$year.id}
			{if !$year.closed}
				{linkbutton label="Import" shape="upload" href="import.php?id=%d"|args:$year.id}
				{linkbutton label="Balance d'ouverture" shape="reset" href="balance.php?id=%d"|args:$year.id}
				{linkbutton label="Modifier" shape="edit" href="edit.php?id=%d"|args:$year.id}
				{linkbutton label="Clôturer" shape="lock" href="close.php?id=%d"|args:$year.id}
				{linkbutton label="Supprimer" shape="delete" href="delete.php?id=%d"|args:$year.id}
			{/if}
		</dd>
		{/if}



	{/foreach}
	</dl>
{else}
	<p class="block alert">
		Il n'y a pas d'exercice en cours.
	</p>
{/if}

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







|

>
>
|
<
<
<
|
|
|
>
>






|
>
>
>
>

<









<

>
>
>

|







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
68
69

70
71
72
73
74
75
76
77
78
79
80
81
82
			<figure>
				<img src="{$admin_url}acc/reports/graph_plot_all.php?type=result" alt="" />
			</figure>
		</section>
	</section>
	{/if}

	<table class="list">
	{foreach from=$list item="year"}
		<tbody>
			<tr>
				<th><h3>{$year.label}</h3></th>



				<td>{$year.nb_transactions} écritures | <a href="../charts/accounts/?id={$year.id_chart}">Plan comptable</a></td>
			</tr>
			<tr>
				<td>{$year.start_date|date_short} au {$year.end_date|date_short}</td>
				<td>
			<a href="{$admin_url}acc/reports/graphs.php?year={$year.id}">Graphiques</a>
			| <a href="{$admin_url}acc/reports/trial_balance.php?year={$year.id}">Balance générale</a>
			| <a href="{$admin_url}acc/reports/journal.php?year={$year.id}">Journal général</a>
			| <a href="{$admin_url}acc/reports/ledger.php?year={$year.id}">Grand livre</a>
			| <a href="{$admin_url}acc/reports/statement.php?year={$year.id}">Compte de résultat</a>
			| <a href="{$admin_url}acc/reports/balance_sheet.php?year={$year.id}">Bilan</a>
				</td>
			</tr>
			<tr>
				<td><em>{if $year.closed}Clôturé{else}En cours{/if}</em></td>
				<td>
		{if $session->canAccess('compta', Membres::DROIT_ADMIN)}

			{linkbutton label="Export CSV" shape="export" href="import.php?id=%d&export=csv"|args:$year.id}
			{linkbutton label="Export tableur" shape="export" href="import.php?id=%d&export=ods"|args:$year.id}
			{if !$year.closed}
				{linkbutton label="Import" shape="upload" href="import.php?id=%d"|args:$year.id}
				{linkbutton label="Balance d'ouverture" shape="reset" href="balance.php?id=%d"|args:$year.id}
				{linkbutton label="Modifier" shape="edit" href="edit.php?id=%d"|args:$year.id}
				{linkbutton label="Clôturer" shape="lock" href="close.php?id=%d"|args:$year.id}
				{linkbutton label="Supprimer" shape="delete" href="delete.php?id=%d"|args:$year.id}
			{/if}

		{/if}
				</td>
			</tr>
		</tbody>
	{/foreach}
	</table>
{else}
	<p class="block alert">
		Il n'y a pas d'exercice en cours.
	</p>
{/if}

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

Modified src/www/admin/acc/years/index.php from [7a17ddf96c] to [9f9b364525].

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

use Garradin\Accounting\Years;

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

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

$years = new Years;

$tpl->assign('list', $years->list(true));

$tpl->display('acc/years/index.tpl');









<
<
|


1
2
3
4
5
6
7
8
9


10
11
12
<?php
namespace Garradin;

use Garradin\Accounting\Years;

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

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



$tpl->assign('list', Years::list(true));

$tpl->display('acc/years/index.tpl');