Compare commits
2 commits
reorganisa
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71646c9dcd | ||
|
|
a2c343956c |
9 changed files with 113 additions and 66 deletions
|
|
@ -4,12 +4,34 @@
|
|||
inventaire des entrées/sorties des matériels permanents
|
||||
*}}
|
||||
|
||||
{{* filtrer selon la catégorie *}}
|
||||
{{if $_GET.cat_key == null}}
|
||||
{{:assign selected_category=$module.config.stock_cat_key}}
|
||||
{{if $module.config.stock_cat_key != null}}
|
||||
{{:assign cat_key=$selected_category|quote_sql}}
|
||||
{{/if}}
|
||||
{{elseif $_GET.cat_key == -1}}
|
||||
{{:assign selected_category=null}}
|
||||
{{:save key="config" stock_cat_key=null}}
|
||||
{{else}}
|
||||
{{:assign selected_category=$_GET.cat_key}}
|
||||
{{:assign cat_key=$selected_category|quote_sql}}
|
||||
{{:save key="config" stock_cat_key=$selected_category}}
|
||||
{{/if}}
|
||||
|
||||
{{* condition de filtrage *}}
|
||||
{{if $selected_category != null}}
|
||||
{{:assign cat_condition="$$.category = %s"|args:$cat_key}}
|
||||
{{else}}
|
||||
{{:assign cat_condition="1"}}
|
||||
{{/if}}
|
||||
|
||||
{{* Sélecteur catégories *}}
|
||||
{{:assign var="options." value="" label="Toutes les catégories" href="?prop=1"}}
|
||||
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1&prop=1"}}
|
||||
{{#load type="category" order="$$.name"}}
|
||||
{{:assign var="categories.%s"|args:$key value=$name}}
|
||||
{{:assign
|
||||
var="options."
|
||||
var="cat_options."
|
||||
value=$key
|
||||
label=$name
|
||||
href="?cat_key=%s&prop=1"|args:$key
|
||||
|
|
@ -20,8 +42,8 @@
|
|||
<legend>Filtrer par catégorie</legend>
|
||||
{{:dropdown
|
||||
title="Filtrer par catégorie"
|
||||
options=$options
|
||||
value="%s"|args:$_GET.cat_key
|
||||
options=$cat_options
|
||||
value="%s"|args:$selected_category
|
||||
}}
|
||||
</fieldset>
|
||||
|
||||
|
|
@ -29,14 +51,6 @@
|
|||
<p class="help">Inventaire des matériels propriété de l'association</p>
|
||||
</div>
|
||||
|
||||
{{* filtrer selon la catégorie *}}
|
||||
{{if $_GET.cat_key == null}}
|
||||
{{:assign condition="1"}}
|
||||
{{else}}
|
||||
{{:assign cat_key=$_GET.cat_key|quote_sql}}
|
||||
{{:assign condition="$$.category = %s"|args:$cat_key}}
|
||||
{{/if}}
|
||||
|
||||
{{#list
|
||||
select="
|
||||
$$.name AS 'Matériel' ;
|
||||
|
|
@ -48,7 +62,7 @@
|
|||
(SELECT $$.stock - $$.out) AS 'Disponible'
|
||||
"
|
||||
type="equipment"
|
||||
where="$$.status <> 'archived' AND $$.stock NOT NULL AND %s"|args:$condition
|
||||
where="$$.status <> 'archived' AND $$.stock NOT NULL AND %s"|args:$cat_condition
|
||||
order=1
|
||||
}}
|
||||
{{:assign var=cat_name from=categories.%s|args:$category}}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,34 @@
|
|||
inventaire des entrées/sorties des matériels temporaires
|
||||
*}}
|
||||
|
||||
{{* filtrer selon la catégorie *}}
|
||||
{{if $_GET.cat_key == null}}
|
||||
{{:assign selected_category=$module.config.temp_cat_key}}
|
||||
{{if $module.config.temp_cat_key != null}}
|
||||
{{:assign cat_key=$selected_category|quote_sql}}
|
||||
{{/if}}
|
||||
{{elseif $_GET.cat_key == -1}}
|
||||
{{:assign selected_category=null}}
|
||||
{{:save key="config" temp_cat_key=null}}
|
||||
{{else}}
|
||||
{{:assign selected_category=$_GET.cat_key}}
|
||||
{{:assign cat_key=$selected_category|quote_sql}}
|
||||
{{:save key="config" temp_cat_key=$selected_category}}
|
||||
{{/if}}
|
||||
|
||||
{{* condition de filtrage *}}
|
||||
{{if $selected_category != null}}
|
||||
{{:assign cat_condition="$$.category = %s"|args:$cat_key}}
|
||||
{{else}}
|
||||
{{:assign cat_condition="1"}}
|
||||
{{/if}}
|
||||
|
||||
{{* Sélecteur catégories *}}
|
||||
{{:assign var="options." value="" label="Toutes les catégories" href="?prop=0"}}
|
||||
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1&prop=0"}}
|
||||
{{#load type="category" order="$$.name"}}
|
||||
{{:assign var="categories.%s"|args:$key value=$name}}
|
||||
{{:assign
|
||||
var="options."
|
||||
var="cat_options."
|
||||
value=$key
|
||||
label=$name
|
||||
href="?cat_key=%s&prop=0"|args:$key
|
||||
|
|
@ -20,8 +42,8 @@
|
|||
<legend>Filtrer par catégorie</legend>
|
||||
{{:dropdown
|
||||
title="Filtrer par catégorie"
|
||||
options=$options
|
||||
value="%s"|args:$_GET.cat_key
|
||||
options=$cat_options
|
||||
value="%s"|args:$selected_category
|
||||
}}
|
||||
</fieldset>
|
||||
|
||||
|
|
@ -29,14 +51,6 @@
|
|||
<p class="help">Inventaire des matériels empruntés ou loués</p>
|
||||
</div>
|
||||
|
||||
{{* filtrer selon la catégorie *}}
|
||||
{{if $_GET.cat_key == null}}
|
||||
{{:assign condition="1"}}
|
||||
{{else}}
|
||||
{{:assign cat_key=$_GET.cat_key|quote_sql}}
|
||||
{{:assign condition="$$.category = %s"|args:$cat_key}}
|
||||
{{/if}}
|
||||
|
||||
{{#list
|
||||
select="
|
||||
$$.name AS 'Matériel' ;
|
||||
|
|
@ -46,7 +60,7 @@
|
|||
$$.notowned AS 'Quantité'
|
||||
"
|
||||
type="equipment"
|
||||
where="$$.status <> 'archived' AND $$.notowned != 0 AND %s"|args:$condition
|
||||
where="$$.status <> 'archived' AND $$.notowned != 0 AND %s"|args:$cat_condition
|
||||
order=1
|
||||
}}
|
||||
{{:assign var=cat_name from=categories.%s|args:$category}}
|
||||
|
|
|
|||
|
|
@ -147,14 +147,15 @@
|
|||
{{#select
|
||||
mvt.key AS mvt_key,
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste
|
||||
FROM {!$module.table} AS mvt
|
||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
FROM !table AS mvt
|
||||
LEFT JOIN !table AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN !table AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
AND json_extract(mvt.document, '$.equipment') = :eqpmt_key
|
||||
GROUP by mvt.key
|
||||
;
|
||||
!table=$module.table
|
||||
!op = $operations
|
||||
:eqpmt_key = $_GET.key
|
||||
}}
|
||||
|
|
@ -250,14 +251,15 @@
|
|||
{{#select
|
||||
mvt.key AS mvt_key,
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
|
||||
FROM {!$module.table} AS mvt
|
||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
FROM !table AS mvt
|
||||
LEFT JOIN !table AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN !table AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
AND json_extract(mvt.document, '$.equipment') = :eqpmt_key
|
||||
GROUP by mvt.key
|
||||
;
|
||||
!table=$module.table
|
||||
!op = $operations
|
||||
:eqpmt_key = $_GET.key
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,34 @@
|
|||
{{* 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}}
|
||||
|
||||
{{* Sélecteur catégories *}}
|
||||
{{:assign var="options." value="" label="Toutes les catégories" href="?"}}
|
||||
{{: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="options."
|
||||
var="cat_options."
|
||||
value=$key
|
||||
label=$name
|
||||
href="?cat_key=%s"|args:$key
|
||||
|
|
@ -29,8 +51,8 @@
|
|||
<legend>Filtrer par catégorie</legend>
|
||||
{{:dropdown
|
||||
title="Filtrer par catégorie"
|
||||
options=$options
|
||||
value="%s"|args:$_GET.cat_key
|
||||
options=$cat_options
|
||||
value="%s"|args:$selected_category
|
||||
}}
|
||||
</fieldset>
|
||||
|
||||
|
|
@ -38,18 +60,7 @@
|
|||
<p class="help">Historique de tous les mouvements de matériel</p>
|
||||
</div>
|
||||
|
||||
{{* condition de filtrage *}}
|
||||
{{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 *}}
|
||||
{{* lister les mouvements *}}
|
||||
{{#list
|
||||
type="movement"
|
||||
select="($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
||||
|
|
@ -69,7 +80,7 @@
|
|||
END as 'Stockage';
|
||||
$$.comment AS 'Commentaire'
|
||||
"|args:$config.user_fields.name_sql
|
||||
where="%s"|args:$condition
|
||||
where="%s"|args:$cat_condition
|
||||
order=1
|
||||
max=50
|
||||
desc=true
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@
|
|||
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')
|
||||
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
|
||||
|
|
@ -69,6 +69,7 @@
|
|||
HAVING remain != 0
|
||||
ORDER BY out_date, nom
|
||||
;
|
||||
!table=$module.table
|
||||
!op = $output_ops
|
||||
}}
|
||||
{{if $premier}}
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@
|
|||
json_extract(mvt.document, '$.amount') as amount,
|
||||
COALESCE((SELECT
|
||||
json_extract(links.document, '$.temp_key')
|
||||
FROM {!$module.table} AS links
|
||||
FROM !table AS links
|
||||
WHERE json_extract(links.document, '$.temp_key') = mvt.key
|
||||
OR json_extract(links.document, '$.return') = mvt.key), mvt.key)
|
||||
AS out_temp_key
|
||||
FROM {!$module.table} AS mvt
|
||||
FROM !table AS mvt
|
||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||
INNER JOIN {!$module.table} AS eqpmt
|
||||
INNER JOIN !table AS eqpmt
|
||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
WHERE users.id = :user
|
||||
AND eqpmt.key = :eqpmt_key
|
||||
|
|
@ -65,6 +65,7 @@
|
|||
OR json_extract(mvt.document, '$.operation') IN !input_types)
|
||||
ORDER BY out_temp_key, date
|
||||
;
|
||||
!table=$module.table
|
||||
:user = $_GET.id
|
||||
:eqpmt_key = $_GET.key|trim
|
||||
!output_types=$output_types.temporaire
|
||||
|
|
|
|||
|
|
@ -34,14 +34,15 @@
|
|||
|
||||
{{#select
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
|
||||
FROM {!$module.table} AS mvt
|
||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
FROM !table AS mvt
|
||||
LEFT JOIN !table AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN !table AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
AND mvt.key = :mvt_key
|
||||
GROUP by mvt.key
|
||||
;
|
||||
!table=$module.table
|
||||
!op = $operations
|
||||
:mvt_key = $_GET.key
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -34,14 +34,15 @@
|
|||
|
||||
{{#select
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur
|
||||
FROM {!$module.table} AS mvt
|
||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
FROM !table AS mvt
|
||||
LEFT JOIN !table AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN !table AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
AND mvt.key = :mvt_key
|
||||
GROUP by mvt.key
|
||||
;
|
||||
!table=$module.table
|
||||
!op = $operations
|
||||
:mvt_key = $_GET.key
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@
|
|||
json_extract(mvt.document, '$.amount') AS qte,
|
||||
json_extract(mvt.document, '$.return_date') AS return_date,
|
||||
json_extract(mvt.document, '$.operation') AS operation
|
||||
FROM {!$module.table} AS mvt
|
||||
FROM !table AS mvt
|
||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||
INNER JOIN {!$module.table} AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
INNER JOIN !table AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
WHERE
|
||||
users.id = :user
|
||||
AND
|
||||
|
|
@ -57,6 +57,7 @@
|
|||
json_extract(mvt.document, '$.operation') IN !input_types)
|
||||
ORDER BY eqpmt_name, date
|
||||
;
|
||||
!table=$module.table
|
||||
:user = $user.id
|
||||
!output_types=$output_types.temporaire
|
||||
!input_types=$input_types.retour
|
||||
|
|
@ -165,15 +166,16 @@
|
|||
json_extract(mvt.document, '$.operation') as operation,
|
||||
MIN(json_extract(mvt.document, '$.date')) as date,
|
||||
SUM(json_extract(mvt.document, '$.amount')) as amount
|
||||
FROM {!$module.table} AS mvt
|
||||
FROM !table AS mvt
|
||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||
INNER JOIN {!$module.table} AS eqpmt
|
||||
INNER JOIN !table AS eqpmt
|
||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
WHERE users.id = :user
|
||||
AND json_extract(mvt.document, '$.operation') IN !output_types
|
||||
GROUP BY eqpmt_key, operation
|
||||
ORDER BY eqpmt_name, date
|
||||
;
|
||||
!table=$module.table
|
||||
:user = $user.id
|
||||
!output_types=$output_types.définitif
|
||||
assign="def_mat."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue