Overview
Comment:Fix small issues with reconcile
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 1d53639dcc1fbd86aa81ab5744baaa8d91a10edc
User & Date: bohwaz on 2020-11-09 00:05:03
Other Links: branch diff | manifest | tags
Context
2020-11-09
02:07
Small UX improvements check-in: 613a2978e9 user: bohwaz tags: dev
00:05
Fix small issues with reconcile check-in: 1d53639dcc user: bohwaz tags: dev
2020-11-08
23:26
Fix: issues with decimals, thanks to @jullien check-in: 86e78f9a06 user: bohwaz tags: dev, 1.0.0-alpha5
Changes

Modified src/include/lib/Garradin/Entities/Accounting/Account.php from [7663497003] to [e54c1e46ff].

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

		$sum = $this->getSumAtDate($year_id, $start_date);

		$start_sum = false;

		foreach ($rows as $row) {
			if (!$start_sum) {
				yield ['sum' => $sum, 'date' => $start_date];
				$start_sum = true;
			}

			$row->date = \DateTime::createFromFormat('Y-m-d', $row->date);
			$sum += ($row->credit - $row->debit);
			$row->running_sum = $sum;

			yield $row;
		}

		yield ['sum' => $sum, 'date' => $end_date];
	}

	public function getDepositJournal(int $year_id): \Generator
	{
		$res = DB::getInstance()->iterate('SELECT l.debit, l.credit, t.id, t.date, t.reference, l.reference AS line_reference, t.label, l.label AS line_label, l.reconciled, l.id AS id_line, l.id_account
			FROM acc_transactions_lines l
			INNER JOIN acc_transactions t ON t.id = l.id_transaction







|










|







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

		$sum = $this->getSumAtDate($year_id, $start_date);

		$start_sum = false;

		foreach ($rows as $row) {
			if (!$start_sum) {
				yield (object) ['sum' => $sum, 'date' => $start_date];
				$start_sum = true;
			}

			$row->date = \DateTime::createFromFormat('Y-m-d', $row->date);
			$sum += ($row->credit - $row->debit);
			$row->running_sum = $sum;

			yield $row;
		}

		yield (object) ['sum' => $sum, 'date' => $end_date];
	}

	public function getDepositJournal(int $year_id): \Generator
	{
		$res = DB::getInstance()->iterate('SELECT l.debit, l.credit, t.id, t.date, t.reference, l.reference AS line_reference, t.label, l.label AS line_label, l.reconciled, l.id AS id_line, l.id_account
			FROM acc_transactions_lines l
			INNER JOIN acc_transactions t ON t.id = l.id_transaction

Modified src/templates/acc/accounts/reconcile.tpl from [bc79996f6e] to [6ad5cbdca8].

1
2
3
4
5
6
7
8
9
10

11



12

13
14
15
16
17
18
19
..
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{include file="admin/_head.tpl" title="Rapprochement : %s — %s"|args:$account.code,$account.label current="acc/accounts" js=1}

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

<form method="get" action="{$self_url_no_qs}">
	{if !empty($prev) && !empty($next)}
	<fieldset class="shortFormRight">
		<legend>Rapprochement par mois</legend>
		<dl>
			<dd class="actions">

			<a class="icn" href="{$self_url_no_qs}?id={$account.id}&amp;start={$prev|date_fr:'Y-m-01'}&amp;end={$prev|date_fr:'Y-m-t'}{if qg('sauf')}&amp;sauf=1{/if}">&larr; {$prev|date_fr:'F Y'}</a>



			| <a class="icn" href="{$self_url_no_qs}?id={$account.id}&amp;start={$next|date_fr:'Y-m-01'}&amp;end={$next|date_fr:'Y-m-t'}{if qg('sauf')}&amp;sauf=1{/if}">{$next|date_fr:'F Y'} &rarr;</a>

			</dd>
		</dl>
	</fieldset>
	{/if}
	<fieldset>
		<legend>Période de rapprochement</legend>
		<p>
................................................................................
				<th>Libellé</th>
				<th>Réf. écriture</th>
				<th>Réf. ligne</th>
			</tr>
		</thead>
		<tbody>
			{foreach from=$journal item="line"}
			{if isset($line.sum)}
			<tr>
				<td colspan="5"></td>
				<td class="money">{if $line.sum > 0}-{/if}{$line.sum|abs|raw|html_money:false}</td>
				<th>Solde au {$line.date|date_fr:'d/m/Y'}</th>
				<td colspan="2"></td>
			</tr>
			{else}





|




>
|
>
>
>
|
>







 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{include file="admin/_head.tpl" title="Rapprochement : %s — %s"|args:$account.code,$account.label current="acc/accounts" js=1}

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

<form method="get" action="{$self_url_no_qs}">
	{if $prev || $next}
	<fieldset class="shortFormRight">
		<legend>Rapprochement par mois</legend>
		<dl>
			<dd class="actions">
				{if $prev}
					<a class="icn" href="{$self_url_no_qs}?id={$account.id}&amp;start={$prev|date_fr:'Y-m-01'}&amp;end={$prev|date_fr:'Y-m-t'}{if qg('sauf')}&amp;sauf=1{/if}">&larr; {$prev|date_fr:'F Y'}</a>
				{/if}
				{if $prev && $next} | {/if}
				{if $next}
					<a class="icn" href="{$self_url_no_qs}?id={$account.id}&amp;start={$next|date_fr:'Y-m-01'}&amp;end={$next|date_fr:'Y-m-t'}{if qg('sauf')}&amp;sauf=1{/if}">{$next|date_fr:'F Y'} &rarr;</a>
				{/if}
			</dd>
		</dl>
	</fieldset>
	{/if}
	<fieldset>
		<legend>Période de rapprochement</legend>
		<p>
................................................................................
				<th>Libellé</th>
				<th>Réf. écriture</th>
				<th>Réf. ligne</th>
			</tr>
		</thead>
		<tbody>
			{foreach from=$journal item="line"}
			{if isset($line->sum)}
			<tr>
				<td colspan="5"></td>
				<td class="money">{if $line.sum > 0}-{/if}{$line.sum|abs|raw|html_money:false}</td>
				<th>Solde au {$line.date|date_fr:'d/m/Y'}</th>
				<td colspan="2"></td>
			</tr>
			{else}

Modified src/www/admin/acc/accounts/reconcile.php from [a1c67dc490] to [3ea231a576].

72
73
74
75
76
77
78








79
80
81
82
83
84
85
86
87
88
89
	}
}

$prev = clone $start;
$next = clone $start;
$prev->modify('-1 month');
$next->modify('+1 month');









$tpl->assign(compact(
	'account',
	'start',
	'end',
	'prev',
	'next',
	'journal'
));

$tpl->display('acc/accounts/reconcile.tpl');







>
>
>
>
>
>
>
>











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
	}
}

$prev = clone $start;
$next = clone $start;
$prev->modify('-1 month');
$next->modify('+1 month');

if ($next > $current_year->end_date) {
	$next = null;
}

if ($prev < $current_year->start_date) {
	$prev = null;
}

$tpl->assign(compact(
	'account',
	'start',
	'end',
	'prev',
	'next',
	'journal'
));

$tpl->display('acc/accounts/reconcile.tpl');