diff --git a/snippets/user_details.html b/snippets/user_details.html
index b93a6f3..07cf0ee 100644
--- a/snippets/user_details.html
+++ b/snippets/user_details.html
@@ -20,6 +20,7 @@
{{/foreach}}
{{#select
+ eqpmt.key as eqpmt_key,
json_extract(eqpmt.document, '$.name') as eqpmt_name,
mvt.key AS mvt_key,
json_extract(mvt.document, '$.direction') as direction,
@@ -47,10 +48,11 @@
- Matériel |
Date |
- Quantité |
Opération |
+ Matériel |
+ Quantité |
+ Total |
|
@@ -58,11 +60,22 @@
{{#foreach from=$temp_mat}}
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}}
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
+ {{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
+ {{if $total == null}}
+ {{:assign total=0}}
+ {{/if}}
+ {{if $direction == 'input' && $type_mvt == 'retour'}}
+ {{:assign var="reste.%s"|args:$eqpmt_key value="%d-%d"|math:$total:$amount}}
+ {{elseif $direction == 'output' && $type_mvt == 'temporaire'}}
+ {{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}}
+ {{/if}}
+ {{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
- {{$eqpmt_name}} |
{{$date|date_short}} |
- {{$amount}} |
{{$op_label}} |
+ {{$eqpmt_name}} |
+ {{$amount}} |
+ {{$total}} |
{{if $direction == "output" && $type_mvt == "temporaire"}}
{{:linkbutton
@@ -79,6 +92,7 @@
{{/if}}
{{#select
+ eqpmt.key as eqpmt_key,
json_extract(eqpmt.document, '$.name') as eqpmt_name,
json_extract(mvt.document, '$.direction') as direction,
json_extract(mvt.document, '$.operation') as operation,
@@ -103,20 +117,31 @@
- Matériel |
Date |
- Quantité |
Opération |
+ Matériel |
+ Quantité |
+ Total |
{{#foreach from=$def_mat}}
+ {{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}}
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
+ {{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
+ {{if $total == null}}
+ {{:assign total=0}}
+ {{/if}}
+ {{if $direction == 'output' && $type_mvt == 'définitif'}}
+ {{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}}
+ {{/if}}
+ {{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
- {{$eqpmt_name}} |
{{$date|date_short}} |
- {{$amount}} |
{{$op_label}} |
+ {{$eqpmt_name}} |
+ {{$amount}} |
+ {{$total}} |
{{/foreach}}
|