{{: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}}
{{: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}}