Paramétrisation nom table dans les requêtes

This commit is contained in:
Jean-Christophe Engel 2026-01-27 17:00:24 +01:00
parent a2c343956c
commit 71646c9dcd
6 changed files with 31 additions and 23 deletions

View file

@ -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}}