Ajout filtre par catégorie Location et Prêts en cours
This commit is contained in:
parent
83c2b9af80
commit
974f87e5a4
2 changed files with 116 additions and 37 deletions
|
|
@ -31,20 +31,59 @@
|
|||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<div class="shortFormLeft">
|
||||
<p class="help">Prêts de matériel en cours</p>
|
||||
</div>
|
||||
|
||||
{{* lecture config (défaut ou enregistrée) *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
|
||||
{{* filtrer selon la catégorie *}}
|
||||
{{if $_GET.cat_key == null}}
|
||||
{{:assign selected_category=$module.config.loan_hist_cat_key}}
|
||||
{{elseif $_GET.cat_key == -1}}
|
||||
{{:assign selected_category=null}}
|
||||
{{:save key="config" loan_hist_cat_key=null}}
|
||||
{{else}}
|
||||
{{:assign selected_category=$_GET.cat_key}}
|
||||
{{:save key="config" loan_hist_cat_key=$selected_category}}
|
||||
{{/if}}
|
||||
|
||||
{{* condition de filtrage *}}
|
||||
{{if $selected_category != null}}
|
||||
{{:assign cat_key=$selected_category|quote_sql}}
|
||||
{{:assign cat_condition="json_extract(mat.document, '$.category') = %s"|args:$cat_key}}
|
||||
{{else}}
|
||||
{{:assign cat_condition=1}}
|
||||
{{/if}}
|
||||
|
||||
{{#foreach from=$config.output_nature key="key"}}
|
||||
{{if $type == 'temporaire' && $fee != 'payant'}}
|
||||
{{:assign var="output_types." value=$key|quote_sql}}
|
||||
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{:assign output_ops=$output_types|implode:","}}
|
||||
{{:assign output_ops="("|cat:$output_ops|cat:")"}}
|
||||
{{:assign out_keys=$out_keys|implode:","}}
|
||||
{{:assign out_keys="("|cat:$out_keys|cat:")"}}
|
||||
|
||||
{{* 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="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">Location de matériel en cours</p>
|
||||
</div>
|
||||
|
||||
{{:assign premier=true}}
|
||||
{{#select
|
||||
|
|
@ -61,29 +100,29 @@
|
|||
LEFT JOIN !table AS links ON mvt.key = json_extract(links.document, '$.temp_key')
|
||||
LEFT JOIN !table AS retour ON retour.key = json_extract(links.document, '$.return')
|
||||
INNER JOIN !table AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.type') = 'movement'
|
||||
AND
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
WHERE json_extract(mvt.document, '$.type') = 'movement'
|
||||
AND json_extract(mvt.document, '$.operation') IN !op
|
||||
AND !cat_condition
|
||||
GROUP BY mvt.key
|
||||
HAVING remain != 0
|
||||
ORDER BY out_date, nom
|
||||
;
|
||||
!table=$module.table
|
||||
!op = $output_ops
|
||||
!op = $out_keys
|
||||
!cat_condition=$cat_condition
|
||||
}}
|
||||
{{if $premier}}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Matériel</th>
|
||||
<th>Date prêt</th>
|
||||
<th>Quantité</th>
|
||||
<th>Membre</th>
|
||||
<th>Date retour</th>
|
||||
<th>Reste à rendre</th>
|
||||
<th>Remarque</th>
|
||||
<th class="actions"></th>
|
||||
<td>Matériel</td>
|
||||
<td>Date prêt</td>
|
||||
<td>Quantité</td>
|
||||
<td>Membre</td>
|
||||
<td>Date retour</td>
|
||||
<td>Reste à rendre</td>
|
||||
<td>Remarque</td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
|||
|
|
@ -31,20 +31,59 @@
|
|||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
<div class="shortFormLeft">
|
||||
<p class="help">Location de matériel en cours</p>
|
||||
</div>
|
||||
|
||||
{{* lecture config (défaut ou enregistrée) *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
|
||||
{{#foreach from=$config.output_nature key="key" item="elem"}}
|
||||
{{* filtrer selon la catégorie *}}
|
||||
{{if $_GET.cat_key == null}}
|
||||
{{:assign selected_category=$module.config.rent_hist_cat_key}}
|
||||
{{elseif $_GET.cat_key == -1}}
|
||||
{{:assign selected_category=null}}
|
||||
{{:save key="config" rent_hist_cat_key=null}}
|
||||
{{else}}
|
||||
{{:assign selected_category=$_GET.cat_key}}
|
||||
{{:save key="config" rent_hist_cat_key=$selected_category}}
|
||||
{{/if}}
|
||||
|
||||
{{* condition de filtrage *}}
|
||||
{{if $selected_category != null}}
|
||||
{{:assign cat_key=$selected_category|quote_sql}}
|
||||
{{:assign cat_condition="json_extract(mat.document, '$.category') = %s"|args:$cat_key}}
|
||||
{{else}}
|
||||
{{:assign cat_condition=1}}
|
||||
{{/if}}
|
||||
|
||||
{{#foreach from=$config.output_nature key="key"}}
|
||||
{{if $type == 'temporaire' && $fee == 'payant'}}
|
||||
{{:assign var="output_types." value=$key|quote_sql}}
|
||||
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{:assign output_ops=$output_types|implode:","}}
|
||||
{{:assign output_ops="("|cat:$output_ops|cat:")"}}
|
||||
{{:assign out_keys=$out_keys|implode:","}}
|
||||
{{:assign out_keys="("|cat:$out_keys|cat:")"}}
|
||||
|
||||
{{* 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="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">Location de matériel en cours</p>
|
||||
</div>
|
||||
|
||||
{{:assign premier=true}}
|
||||
{{#select
|
||||
|
|
@ -56,20 +95,21 @@
|
|||
json_extract(mvt.document, '$.amount') AS out_amount,
|
||||
json_extract(mvt.document, '$.return_date') AS return_date,
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain
|
||||
FROM {!$module.table} AS mvt
|
||||
FROM !table AS mvt
|
||||
LEFT JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||
LEFT JOIN {!$module.table} AS links ON mvt.key = json_extract(links.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS retour ON retour.key = json_extract(links.document, '$.return')
|
||||
INNER JOIN {!$module.table} AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.type') = 'movement'
|
||||
AND
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
LEFT JOIN !table AS links ON mvt.key = json_extract(links.document, '$.temp_key')
|
||||
LEFT JOIN !table AS retour ON retour.key = json_extract(links.document, '$.return')
|
||||
INNER JOIN !table AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
|
||||
WHERE json_extract(mvt.document, '$.type') = 'movement'
|
||||
AND json_extract(mvt.document, '$.operation') IN !op
|
||||
AND !cat_condition
|
||||
GROUP BY mvt.key
|
||||
HAVING remain != 0
|
||||
ORDER BY out_date, nom
|
||||
;
|
||||
!op = $output_ops
|
||||
!table=$module.table
|
||||
!op = $out_keys
|
||||
!cat_condition=$cat_condition
|
||||
}}
|
||||
{{if $premier}}
|
||||
<table class="list">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue