Overview
Comment:Display chart name in years list
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: cabdc28bd536b2b4fbb23b98b7f31c5f9ff85c4d
User & Date: bohwaz on 2020-12-12 13:36:47
Other Links: manifest | tags
Context
2020-12-12
23:24
Allow to move transactions past the closing date to another year check-in: addcc82d4a user: bohwaz tags: trunk, stable
13:36
Display chart name in years list check-in: cabdc28bd5 user: bohwaz tags: trunk, stable
13:27
Add transaction reference to service payment form check-in: 9277c7498c user: bohwaz tags: trunk, stable
Changes

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

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) {







|
|
>
>
>
|







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

	static public function list(bool $reverse = false)
	{
		$desc = $reverse ? 'DESC' : '';
		return DB::getInstance()->get(sprintf('SELECT y.*,
			(SELECT COUNT(*) FROM acc_transactions WHERE id_year = y.id) AS nb_transactions,
			c.label AS chart_name
			FROM acc_years y
			INNER JOIN acc_charts c ON c.id = y.id_chart
			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 [f4fb5ef736] to [40b0f49623].

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	{/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>







|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
	{/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}">{$year.chart_name}</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>