Ajout historique des mouvements de prêts
This commit is contained in:
parent
84b35adcfa
commit
1b1680af5c
1 changed files with 130 additions and 0 deletions
130
loan_movements.html
Normal file
130
loan_movements.html
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Afficher l'historique des prêts
|
||||
*}}
|
||||
|
||||
{{:admin_header title="Historique des prêts" custom_css="./style.css" current="module_equipment"}}
|
||||
|
||||
{{:include file="./_nav.html" current="prêts" subcurrent="historique"}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
|
||||
{{* filtrer selon la catégorie *}}
|
||||
{{if $_GET.cat_key == null}}
|
||||
{{:assign selected_category=$module.config.loan_cat_key}}
|
||||
{{elseif $_GET.cat_key == -1}}
|
||||
{{:assign selected_category=null}}
|
||||
{{:save key="config" loan_cat_key=null}}
|
||||
{{else}}
|
||||
{{:assign selected_category=$_GET.cat_key}}
|
||||
{{:save key="config" loan_cat_key=$selected_category}}
|
||||
{{/if}}
|
||||
|
||||
{{* condition de filtrage *}}
|
||||
{{if $selected_category != null}}
|
||||
{{:assign cat_condition="(SELECT key
|
||||
FROM @TABLE AS cat
|
||||
WHERE cat.key = (SELECT $$.category
|
||||
FROM @TABLE AS mat
|
||||
WHERE mat.key = @TABLE.$$.equipment)) = '%s'"|args:$selected_category}}
|
||||
{{else}}
|
||||
{{:assign cat_condition=1}}
|
||||
{{/if}}
|
||||
|
||||
{{* déterminer les types de mouvements *}}
|
||||
{{#foreach from=$config.input_nature key="key"}}
|
||||
{{if $type == 'retour'}}
|
||||
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{#foreach from=$config.output_nature key="key"}}
|
||||
{{if $type == 'temporaire'}}
|
||||
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{:assign key_cond=$mvt_keys|implode:","}}
|
||||
{{:assign key_cond="("|cat:$key_cond|cat:")"}}
|
||||
{{:assign key_cond="$$.operation IN %s"|args:$key_cond}}
|
||||
|
||||
{{* sélecteur de catégorie *}}
|
||||
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}}
|
||||
{{#load type="category" order="$$.name"}}
|
||||
{{*:assign var="categories.%s"|args:$key value=$name*}}
|
||||
{{:assign
|
||||
var="cat_options."
|
||||
value=$key
|
||||
label=$name
|
||||
href="?cat_key=%s"|args:$key
|
||||
}}
|
||||
{{/load}}
|
||||
|
||||
<fieldset class="shortFormRight">
|
||||
<legend>Filtrer par catégorie</legend>
|
||||
{{:dropdown
|
||||
title="Filtrer par catégorie"
|
||||
options=$cat_options
|
||||
value="%s"|args:$selected_category
|
||||
}}
|
||||
</fieldset>
|
||||
|
||||
<div class="shortFormLeft">
|
||||
<p class="help">Historique des prêts</p>
|
||||
</div>
|
||||
|
||||
{{* lister les mouvements *}}
|
||||
{{#list
|
||||
type="movement"
|
||||
select="($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
||||
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mouvement';
|
||||
$$.operation AS 'Opération';
|
||||
(SELECT $$.name
|
||||
FROM @TABLE AS mat
|
||||
WHERE mat.key = @TABLE.$$.equipment) AS 'Matériel' ;
|
||||
$$.amount AS 'Quantité';
|
||||
CASE WHEN $$.user NOT NULL
|
||||
THEN (SELECT %s AS nom FROM users WHERE id = $$.user)
|
||||
ELSE ''
|
||||
END as 'Dépositaire';
|
||||
CASE WHEN $$.storage NOT NULL
|
||||
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
||||
ELSE ''
|
||||
END as 'Stockage';
|
||||
$$.comment AS 'Commentaire'
|
||||
"|args:$config.user_fields.name_sql
|
||||
where="%s AND %s"|args:$key_cond:$cat_condition
|
||||
order=1
|
||||
max=50
|
||||
desc=true
|
||||
}}
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$col2}}</td>
|
||||
<td class="nosort">{{$op_label}}</td>
|
||||
<td>{{$col4}}</td>
|
||||
<td class="num">{{$amount}}</td>
|
||||
<td>{{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$col6}}</td>
|
||||
<td>{{$col7}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<p class="block alert">Aucun mouvement.</p>
|
||||
{{/list}}
|
||||
{{* *}}
|
||||
{{:admin_footer}}
|
||||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
let table = document.querySelector("table[class=list]");
|
||||
if (table != null) {
|
||||
disableColumSort(table);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue