{{* -*- brindille -*- *}} {{#restrict block=true section="accounting" level="write"}}{{/restrict}} {{* Afficher l'historique de tous les mouvements *}} {{:admin_header title="Historique des mouvements" custom_css="./style.css" current="module_equipment"}} {{:include file="./_nav.html" current="inventaire" 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.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"}} {{:assign var="categories.%s"|args:$key value=$name}} {{:assign var="cat_options." value=$key label=$name href="?cat_key=%s"|args:$key }} {{/load}}
Filtrer par catégorie {{:dropdown title="Filtrer par catégorie" options=$cat_options value="%s"|args:$selected_category }}
{{: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"}}
Filtrer par appartenance {{:dropdown title="Filtrer par appartenance" options=$prop_options value="%s"|args:$selected_prop }}

Historique de tous les mouvements de matériel

{{* 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:$cat_condition:$prop_condition order=1 max=50 desc=true }} {{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}} {{$date|date_short}} {{$col2}} {{$op_label}} {{$col4}} {{$amount}} {{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$col6}} {{$col7}} {{$comment}} {{else}}

Aucun mouvement.

{{/list}} {{:admin_footer}}