Garradin Plugins

Check-in [83819e8692]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 83819e8692618b22d2bafce5668730a8418c8ef0
User & Date: bohwaz 2020-05-22 00:56:45
Context
2020-05-22
01:00
total manquant check-in: 7705097317 user: bohwaz tags: trunk
00:56
Fixes check-in: 83819e8692 user: bohwaz tags: trunk
00:42
Mise à jour check-in: 12f779efb8 user: bohwaz tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to caisse/templates/invoice.tpl.

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
		<h1>La rustine — atelier associatif de réparation de vélos</h1>
		<h2>Association « loi 1901 » à but non lucratif — SIRET 538 625 773 00022</h2>
		<h3>5 rue du Havre, 21000 DIJON — 03 73 27 03 66 — contact@larustine.org — http://larustine.org/</h3>
	</div>
</header>

<section class="details">
	<h1>Facture n°C{$tab.id}</h1>
	<h2>Entretien vélo dans le cadre du "Coup de pouce Vélo - Réparation"</h2>
	<h3>Adhérent : {$tab.name}</h3>
	<h4>Date de la facture : {$tab.opened|date_format:"%d/%m/%Y"} — Date d'échéance : {$tab.opened|date_format:"%d/%m/%Y"}</h4>
</section>

<section class="items">
	<form method="post">
................................................................................
			{foreach from=$existing_payments item="payment"}
			<tr class="foot">
				<th>{$payment.name}</th>
				<td colspan="3"><em>Réf. {$payment.reference}</em></td>
				<td>{$payment.amount|raw|pos_money}</td>
			</tr>
			{/foreach}
			{foreach from=$payment_options item="option"}
			<tr class="foot">
				<th colspan="4">Déduction « Coup de pouce vélo - réparation »</th>
				<td>{$option.amount|raw|pos_money}</td>
			</tr>
			{/foreach}
			{if $remainder_after}
			<tr class="foot">
				<th colspan="4">Reste à payer</th>
				<td>{$remainder_after|raw|pos_money}</td>
			</tr>
			{/if}
		</tbody>
	</table>
</section>

</body>
</html>







|







 







<


|

<












87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
...
135
136
137
138
139
140
141

142
143
144
145

146
147
148
149
150
151
152
153
154
155
156
157
		<h1>La rustine — atelier associatif de réparation de vélos</h1>
		<h2>Association « loi 1901 » à but non lucratif — SIRET 538 625 773 00022</h2>
		<h3>5 rue du Havre, 21000 DIJON — 03 73 27 03 66 — contact@larustine.org — http://larustine.org/</h3>
	</div>
</header>

<section class="details">
	<h1>Facture n°{"CDP-%04d"|args:$tab.id}</h1>
	<h2>Entretien vélo dans le cadre du "Coup de pouce Vélo - Réparation"</h2>
	<h3>Adhérent : {$tab.name}</h3>
	<h4>Date de la facture : {$tab.opened|date_format:"%d/%m/%Y"} — Date d'échéance : {$tab.opened|date_format:"%d/%m/%Y"}</h4>
</section>

<section class="items">
	<form method="post">
................................................................................
			{foreach from=$existing_payments item="payment"}
			<tr class="foot">
				<th>{$payment.name}</th>
				<td colspan="3"><em>Réf. {$payment.reference}</em></td>
				<td>{$payment.amount|raw|pos_money}</td>
			</tr>
			{/foreach}

			<tr class="foot">
				<th colspan="4">Déduction « Coup de pouce vélo - réparation »</th>
				<td>{$eligible|raw|pos_money}</td>
			</tr>

			{if $remainder_after}
			<tr class="foot">
				<th colspan="4">Reste à payer</th>
				<td>{$remainder_after|raw|pos_money}</td>
			</tr>
			{/if}
		</tbody>
	</table>
</section>

</body>
</html>

Changes to caisse/templates/tab.tpl.

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
...
209
210
211
212
213
214
215








216
217
218
219
				{if !$remainder && $items && !$current_tab.closed}
					<input type="submit" name="close" value="Clore la note" />
				{/if}
				{if !count($existing_payments)}
					<input type="submit" name="delete" value="Supprimer la note" />
				{/if}
				</form>
				<form method="post" action="./pdf.php?id={$current_tab.id}">
					<input type="submit" value="Facture PDF" />
				</form>
			</div>
		</header>

		<section class="items">
			<form method="post">
			<table class="list">
................................................................................
				<tbody>
				{foreach from=$items item="item"}
				<tr>
					<th>{$item.name} {$item.methods|raw|show_methods}</th>
					<td>{if !$current_tab.closed}<input type="submit" name="change_qty[{$item.id}]" value="{$item.qty}" />{else}{$item.qty}{/if}</td>
					<td>{if !$current_tab.closed}<input type="submit" name="change_price[{$item.id}]" value="{$item.price|escape|pos_money}" />{else}{$item.price|escape|pos_money}{/if}</td>
					<td>{$item.total|escape|pos_money}</td>
					<td class="actions">{if !$current_tab.closed}<a class="icn" href="?delete_item={$item.id}" title="Supprimer">✘</a>{/if}</td>
				</tr>
				{/foreach}
				</tbody>
				<tfoot>
					<tr>
						<th>Total</th>
						<td></td>
................................................................................
			<table class="list">
				<tbody>
				{foreach from=$existing_payments item="payment"}
				<tr>
					<th>{$payment.name}</th>
					<td>{$payment.amount|escape|pos_money}</td>
					<td><em>{$payment.reference}</em></td>
					<td class="actions">{if !$current_tab.closed}<a class="icn" href="?delete_payment={$payment.id}" title="Supprimer">✘</a>{/if}</td>
				</tr>
				{/foreach}
				</tbody>
			</table>
			{/if}

			{if $remainder}
................................................................................
				elm.parentNode.style.display = 'none';
			}
		})
	};

	q.focus();
}








{/literal}
</script>

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







|
|







 







|







 







|







 







>
>
>
>
>
>
>
>




30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
...
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
				{if !$remainder && $items && !$current_tab.closed}
					<input type="submit" name="close" value="Clore la note" />
				{/if}
				{if !count($existing_payments)}
					<input type="submit" name="delete" value="Supprimer la note" />
				{/if}
				</form>
				<form method="post" action="./pdf.php?id={$current_tab.id}" id="f_pdf">
					<input type="submit" data-name="{if $current_tab.name}1{else}0{/if}" value="Facture PDF" />
				</form>
			</div>
		</header>

		<section class="items">
			<form method="post">
			<table class="list">
................................................................................
				<tbody>
				{foreach from=$items item="item"}
				<tr>
					<th>{$item.name} {$item.methods|raw|show_methods}</th>
					<td>{if !$current_tab.closed}<input type="submit" name="change_qty[{$item.id}]" value="{$item.qty}" />{else}{$item.qty}{/if}</td>
					<td>{if !$current_tab.closed}<input type="submit" name="change_price[{$item.id}]" value="{$item.price|escape|pos_money}" />{else}{$item.price|escape|pos_money}{/if}</td>
					<td>{$item.total|escape|pos_money}</td>
					<td class="actions">{if !$current_tab.closed}<a class="icn" href="?id={$current_tab.id}&amp;delete_item={$item.id}" title="Supprimer">✘</a>{/if}</td>
				</tr>
				{/foreach}
				</tbody>
				<tfoot>
					<tr>
						<th>Total</th>
						<td></td>
................................................................................
			<table class="list">
				<tbody>
				{foreach from=$existing_payments item="payment"}
				<tr>
					<th>{$payment.name}</th>
					<td>{$payment.amount|escape|pos_money}</td>
					<td><em>{$payment.reference}</em></td>
					<td class="actions">{if !$current_tab.closed}<a class="icn" href="?id={$current_tab.id}&amp;delete_payment={$payment.id}" title="Supprimer">✘</a>{/if}</td>
				</tr>
				{/foreach}
				</tbody>
			</table>
			{/if}

			{if $remainder}
................................................................................
				elm.parentNode.style.display = 'none';
			}
		})
	};

	q.focus();
}

var pdf = document.getElementById('f_pdf');
pdf.onsubmit = (e) => {
	if (pdf.querySelector('input').getAttribute('data-name') == 0) {
		alert("Merci de donner un nom à la facture d'abord.");
		return false;
	}
};
{/literal}
</script>

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

Changes to caisse/www/admin/pdf.php.

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
}

$tpl->assign('tab', $tab);
$tpl->assign('items', $tab->listItems());
$tpl->assign('existing_payments', $tab->listPayments());
$remainder = $tab->getRemainder();
$options = $tab->listPaymentOptions();


foreach ($options as $k => &$option) {
	if ($option->id != 3) {
		unset($options[$k]);
		continue;
	}

	$eligible = $option->amount;
}

$remainder_after = $remainder - $eligible;

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

$tpl->assign('remainder_after', $remainder_after);
$tpl->assign('payment_options', $options);

$tpl->register_modifier('show_methods', function ($m) {
	$m = explode(',', $m);
	if (in_array(3, $m)) {
		return '<i>Oui</i>';







>













>







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
}

$tpl->assign('tab', $tab);
$tpl->assign('items', $tab->listItems());
$tpl->assign('existing_payments', $tab->listPayments());
$remainder = $tab->getRemainder();
$options = $tab->listPaymentOptions();
$eligible = 0;

foreach ($options as $k => &$option) {
	if ($option->id != 3) {
		unset($options[$k]);
		continue;
	}

	$eligible = $option->amount;
}

$remainder_after = $remainder - $eligible;

$tpl->assign('remainder', $remainder);
$tpl->assign('eligible', $eligible);
$tpl->assign('remainder_after', $remainder_after);
$tpl->assign('payment_options', $options);

$tpl->register_modifier('show_methods', function ($m) {
	$m = explode(',', $m);
	if (in_array(3, $m)) {
		return '<i>Oui</i>';

Changes to caisse/www/admin/tab.php.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

if (!empty($_POST['add_item'])) {
	$tab->addItem((int)key($_POST['add_item']));
	reload();
}
elseif (qg('delete_item')) {
	$tab->removeItem((int)qg('delete_item'));
	reload();
}
elseif (!empty($_POST['change_qty'])) {
	$tab->updateItemQty((int)key($_POST['change_qty']), (int)current($_POST['change_qty']));
	reload();
}
elseif (!empty($_POST['change_price'])) {
	$tab->updateItemPrice((int)key($_POST['change_price']), (int)get_amount(current($_POST['change_price'])));
................................................................................
}
elseif (!empty($_POST['pay'])) {
	$tab->pay((int)$_POST['method_id'], get_amount(f('amount')), $_POST['reference']);
	reload();
}
elseif (qg('delete_payment')) {
	$tab->removePayment((int) qg('delete_payment'));
	reload();
}
elseif (null !== qg('new')) {
	$id = Tab::open($current_pos_session->id);
	Utils::redirect(Utils::plugin_url(['file' => 'tab.php', 'query' => 'id=' . $id]));
}
elseif (!empty($_POST['rename'])) {
	$tab->rename($_POST['rename']);







|







 







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

if (!empty($_POST['add_item'])) {
	$tab->addItem((int)key($_POST['add_item']));
	reload();
}
elseif (qg('delete_item')) {
	$tab->removeItem((int)qg('delete_item'));
	Utils::redirect(Utils::plugin_url(['file' => 'tab.php', 'query' => 'id=' . $tab_id]));
}
elseif (!empty($_POST['change_qty'])) {
	$tab->updateItemQty((int)key($_POST['change_qty']), (int)current($_POST['change_qty']));
	reload();
}
elseif (!empty($_POST['change_price'])) {
	$tab->updateItemPrice((int)key($_POST['change_price']), (int)get_amount(current($_POST['change_price'])));
................................................................................
}
elseif (!empty($_POST['pay'])) {
	$tab->pay((int)$_POST['method_id'], get_amount(f('amount')), $_POST['reference']);
	reload();
}
elseif (qg('delete_payment')) {
	$tab->removePayment((int) qg('delete_payment'));
	Utils::redirect(Utils::plugin_url(['file' => 'tab.php', 'query' => 'id=' . $tab_id]));
}
elseif (null !== qg('new')) {
	$id = Tab::open($current_pos_session->id);
	Utils::redirect(Utils::plugin_url(['file' => 'tab.php', 'query' => 'id=' . $id]));
}
elseif (!empty($_POST['rename'])) {
	$tab->rename($_POST['rename']);