global_history : amélioration filtre catégorie ; ajout filtre appartenance
This commit is contained in:
parent
e2c8ac2d84
commit
2f3785831e
1 changed files with 97 additions and 19 deletions
|
|
@ -8,17 +8,93 @@
|
||||||
|
|
||||||
{{:admin_header title="Historique des mouvements" custom_css="./style.css" current="module_equipment"}}
|
{{:admin_header title="Historique des mouvements" custom_css="./style.css" current="module_equipment"}}
|
||||||
|
|
||||||
{{:include file="./_nav.html" current="historique" subcurrent="tous"}}
|
{{:include file="./_nav.html" current="inventaire" subcurrent="historique"}}
|
||||||
|
|
||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="./_get_config.html" keep="config"}}
|
{{:include file="./_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{* Sélecteur catégories *}}
|
{{* filtrer selon la catégorie *}}
|
||||||
{{:assign var="options." value="" label="Toutes les catégories" href="?"}}
|
{{if $_GET.cat_key == null}}
|
||||||
|
{{:assign selected_category=$module.config.hist_cat_key}}
|
||||||
|
{{elseif $_GET.cat_key == -1}}
|
||||||
|
{{:assign selected_category=null}}
|
||||||
|
{{:save key="config" hist_cat_key=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_category=$_GET.cat_key}}
|
||||||
|
{{:save key="config" hist_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}}
|
||||||
|
|
||||||
|
{{* filtrer selon appartenance *}}
|
||||||
|
{{if $_GET.prop == null}}
|
||||||
|
{{:assign selected_prop=$module.config.hist_prop}}
|
||||||
|
{{elseif $_GET.prop == -1}}
|
||||||
|
{{:assign selected_prop=null}}
|
||||||
|
{{:save key="config" hist_prop=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_prop=$_GET.prop}}
|
||||||
|
{{:save key="config" hist_prop=$_GET.prop}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* déterminer les types de mouvements selon l'appartenance du matériel *}}
|
||||||
|
{{#foreach from=$config.input_nature key="key"}}
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{* les deux sortes de matériel *}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{elseif $selected_prop == 1}}
|
||||||
|
{{* matériel propriété de l'asso *}}
|
||||||
|
{{if $type != 'temporaire'}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{* matériel non propriété de l'asso *}}
|
||||||
|
{{if $type == 'temporaire'}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
{{#foreach from=$config.output_nature key="key"}}
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{* les deux sortes de matériel *}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{elseif $selected_prop == 1}}
|
||||||
|
{{* matériel propriété de l'asso *}}
|
||||||
|
{{if $type != 'retour'}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{* matériel non propriété de l'asso *}}
|
||||||
|
{{if $type == 'retour'}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign key_cond=$mvt_keys|implode:","}}
|
||||||
|
{{:assign key_cond="("|cat:$key_cond|cat:")"}}
|
||||||
|
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{:assign prop_condition="1"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop_condition="$$.operation in %s"|args:$key_cond}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* sélecteurs de catégorie et d'appartenance *}}
|
||||||
|
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}}
|
||||||
{{#load type="category" order="$$.name"}}
|
{{#load type="category" order="$$.name"}}
|
||||||
{{:assign var="categories.%s"|args:$key value=$name}}
|
{{:assign var="categories.%s"|args:$key value=$name}}
|
||||||
{{:assign
|
{{:assign
|
||||||
var="options."
|
var="cat_options."
|
||||||
value=$key
|
value=$key
|
||||||
label=$name
|
label=$name
|
||||||
href="?cat_key=%s"|args:$key
|
href="?cat_key=%s"|args:$key
|
||||||
|
|
@ -29,8 +105,21 @@
|
||||||
<legend>Filtrer par catégorie</legend>
|
<legend>Filtrer par catégorie</legend>
|
||||||
{{:dropdown
|
{{:dropdown
|
||||||
title="Filtrer par catégorie"
|
title="Filtrer par catégorie"
|
||||||
options=$options
|
options=$cat_options
|
||||||
value="%s"|args:$_GET.cat_key
|
value="%s"|args:$selected_category
|
||||||
|
}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{:assign var="prop_options." value="" label="Tous les matériels" href="?prop=-1"}}
|
||||||
|
{{:assign var="prop_options." value="1" label="Matériels propriété de l'association" href="?prop=1"}}
|
||||||
|
{{:assign var="prop_options." value="0" label="Matériels NON propriété de l'association" href="?prop=0"}}
|
||||||
|
|
||||||
|
<fieldset class="shortFormRight">
|
||||||
|
<legend>Filtrer par appartenance</legend>
|
||||||
|
{{:dropdown
|
||||||
|
title="Filtrer par appartenance"
|
||||||
|
options=$prop_options
|
||||||
|
value="%s"|args:$selected_prop
|
||||||
}}
|
}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
@ -38,18 +127,7 @@
|
||||||
<p class="help">Historique de tous les mouvements de matériel</p>
|
<p class="help">Historique de tous les mouvements de matériel</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{* condition de filtrage *}}
|
{{* lister les mouvements *}}
|
||||||
{{if $_GET.cat_key != null}}
|
|
||||||
{{:assign condition="(SELECT key
|
|
||||||
FROM @TABLE AS cat
|
|
||||||
WHERE cat.key = (SELECT $$.category
|
|
||||||
FROM @TABLE AS mat
|
|
||||||
WHERE mat.key = @TABLE.$$.equipment)) = '%s'"|args:$_GET.cat_key}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign condition=1}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* lister tous les mouvements *}}
|
|
||||||
{{#list
|
{{#list
|
||||||
type="movement"
|
type="movement"
|
||||||
select="($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
select="($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
||||||
|
|
@ -69,7 +147,7 @@
|
||||||
END as 'Stockage';
|
END as 'Stockage';
|
||||||
$$.comment AS 'Commentaire'
|
$$.comment AS 'Commentaire'
|
||||||
"|args:$config.user_fields.name_sql
|
"|args:$config.user_fields.name_sql
|
||||||
where="%s"|args:$condition
|
where="%s AND %s"|args:$cat_condition:$prop_condition
|
||||||
order=1
|
order=1
|
||||||
max=50
|
max=50
|
||||||
desc=true
|
desc=true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue