Overview
Comment:Improve UX for debts/credits quick reimbursement
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev | 1.0.0-alpha4
Files: files | file ages | folders
SHA1: baae8665b49aef8fe35e125291ea6ab2fc066af9
User & Date: bohwaz on 2020-11-06 13:32:18
Other Links: branch diff | manifest | tags
Context
2020-11-06
18:28
Fix issues with reconcile check-in: 42fd4e3e9e user: bohwaz tags: dev
13:32
Improve UX for debts/credits quick reimbursement check-in: baae8665b4 user: bohwaz tags: dev, 1.0.0-alpha4
13:19
Fix: date format handling in reconcile check-in: c6461cbb00 user: bohwaz tags: dev, 1.0.0-alpha4
Changes

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

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

		parent::selfCheck();
	}

	public function getJournal(int $year_id, bool $simple = false)
	{
		$db = DB::getInstance();
		$sql = '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
			FROM acc_transactions_lines l
			INNER JOIN acc_transactions t ON t.id = l.id_transaction
			WHERE l.id_account = ? AND t.id_year = ?
			ORDER BY t.date, t.id;';
		$rows = $db->get($sql, $this->id(), $year_id);

		$sum = 0;







|







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

		parent::selfCheck();
	}

	public function getJournal(int $year_id, bool $simple = false)
	{
		$db = DB::getInstance();
		$sql = 'SELECT l.debit, l.credit, t.id, t.date, t.reference, t.type, l.reference AS line_reference, t.label, l.label AS line_label, l.reconciled
			FROM acc_transactions_lines l
			INNER JOIN acc_transactions t ON t.id = l.id_transaction
			WHERE l.id_account = ? AND t.id_year = ?
			ORDER BY t.date, t.id;';
		$rows = $db->get($sql, $this->id(), $year_id);

		$sum = 0;

Modified src/templates/acc/accounts/journal.tpl from [f7f7c198fc] to [2fc2e56258].

95
96
97
98
99
100
101






102
103
104
105
106
107
108
			<td class="money">{$line.credit|raw|html_money}</td>
			{/if}
			<td class="money">{$line.running_sum|raw|html_money:false}</td>
			<th>{$line.label}</th>
			{if !$simple}<td>{$line.line_label}</td>{/if}
			<td>{$line.line_reference}</td>
			<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>







>
>
>
>
>
>







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
			<td class="money">{$line.credit|raw|html_money}</td>
			{/if}
			<td class="money">{$line.running_sum|raw|html_money:false}</td>
			<th>{$line.label}</th>
			{if !$simple}<td>{$line.line_label}</td>{/if}
			<td>{$line.line_reference}</td>
			<td class="actions">
				{if $line.type == Entities\Accounting\Transaction::TYPE_DEBT}
					{linkbutton shape="check" label="Régler cette dette" href="acc/transactions/new.php?payoff_for=%d"|args:$line.id}
				{elseif $line.type == Entities\Accounting\Transaction::TYPE_CREDIT}
					{linkbutton shape="export" label="Régler cette créance" href="acc/transactions/new.php?payoff_for=%d"|args:$line.id}
				{/if}

				{linkbutton href="acc/transactions/details.php?id=%d"|args:$line.id label="Détails" shape="search"}
			</td>
		</tr>
	{/foreach}
	</tbody>
	<tfoot>
		<tr>

Modified src/templates/acc/transactions/details.tpl from [7988ef9b52] to [cbf588a6d3].

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
{include file="admin/_head.tpl" title="Écriture n°%d"|args:$transaction.id current="acc"}

{if $session->canAccess('compta', Membres::DROIT_ADMIN) && !$transaction->validated && !$tr_year->closed}
<nav class="tabs">
	<ul>
		<li><a href="edit.php?id={$transaction.id}">Modifier cette écriture</a></li>
		<li><a href="delete.php?id={$transaction.id}">Supprimer cette écriture</a></li>
	</ul>
</nav>
{/if}

{if $session->canAccess('compta', Membres::DROIT_ECRITURE) && $transaction.status & $transaction::STATUS_WAITING}
<form method="post" action="{$admin_url}acc/transactions/new.php">
<div class="block alert">
	{if $transaction.type == $transaction::TYPE_DEBT}
		<h3>Dette en attente</h3>
		<input type="hidden" name="payoff_for" value="{$transaction.id}" />
		{button shape="check" label="Enregistrer le règlement de cette dette" type="submit"}
	{else}
		<h3>Créance en attente</h3>
		<input type="hidden" name="payoff_for" value="{$transaction.id}" />
		{button shape="export" label="Enregistrer le règlement de cette créance" type="submit"}
	{/if}
</div>
</form>
{/if}

<dl class="describe">
	{if $transaction.id_related}
	<dt>Écriture liée à</dt>
	<dd><a href="{$admin_url}acc/transactions/details.php?id={$transaction.id_related}">#{$transaction.id_related}</a>
		{if $transaction.type == $transaction::TYPE_PAYOFF}(en règlement de){/if}












<



<
|


<
|


<







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
{include file="admin/_head.tpl" title="Écriture n°%d"|args:$transaction.id current="acc"}

{if $session->canAccess('compta', Membres::DROIT_ADMIN) && !$transaction->validated && !$tr_year->closed}
<nav class="tabs">
	<ul>
		<li><a href="edit.php?id={$transaction.id}">Modifier cette écriture</a></li>
		<li><a href="delete.php?id={$transaction.id}">Supprimer cette écriture</a></li>
	</ul>
</nav>
{/if}

{if $session->canAccess('compta', Membres::DROIT_ECRITURE) && $transaction.status & $transaction::STATUS_WAITING}

<div class="block alert">
	{if $transaction.type == $transaction::TYPE_DEBT}
		<h3>Dette en attente</h3>

		{linkbutton shape="check" label="Enregistrer le règlement de cette dette" href="acc/transactions/new.php?payoff_for=%d"|args:$transaction.id}
	{else}
		<h3>Créance en attente</h3>

		{linkbutton shape="export" label="Enregistrer le règlement de cette créance" href="acc/transactions/new.php?payoff_for=%d"|args:$transaction.id}
	{/if}
</div>

{/if}

<dl class="describe">
	{if $transaction.id_related}
	<dt>Écriture liée à</dt>
	<dd><a href="{$admin_url}acc/transactions/details.php?id={$transaction.id_related}">#{$transaction.id_related}</a>
		{if $transaction.type == $transaction::TYPE_PAYOFF}(en règlement de){/if}

Modified src/www/admin/acc/transactions/new.php from [9812e25b58] to [f020545b0c].

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

$chart = $current_year->chart();
$accounts = $chart->accounts();

$transaction = new Transaction;
$lines = [[], []];
$amount = 0;
$payoff_for = null;

// Quick pay-off for debts and credits, directly from a debt/credit details page
if ($id = f('payoff_for')) {
	$payoff_for = $transaction->payOffFrom($id);
	$amount = $payoff_for->sum();
}

// Quick transaction from an account journal page
if ($id = qg('account')) {
	$account = $accounts::get($id);







|


|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

$chart = $current_year->chart();
$accounts = $chart->accounts();

$transaction = new Transaction;
$lines = [[], []];
$amount = 0;
$payoff_for = qg('payoff_for') ?: f('payoff_for');

// Quick pay-off for debts and credits, directly from a debt/credit details page
if ($id = $payoff_for) {
	$payoff_for = $transaction->payOffFrom($id);
	$amount = $payoff_for->sum();
}

// Quick transaction from an account journal page
if ($id = qg('account')) {
	$account = $accounts::get($id);