diff --git a/inventaire.html b/inventaire.html index 3a02514..b461122 100644 --- a/inventaire.html +++ b/inventaire.html @@ -70,46 +70,85 @@ WHERE cat.key = @TABLE.$$.category) AS 'Catégorie' ; (SELECT SUM($$.amount) - FROM module_data_equipment AS mvt + FROM @TABLE AS mvt WHERE $$.type = 'movement' AND $$.operation IN %s AND - $$.equipment = module_data_equipment.key + $$.equipment = @TABLE.key ) - (SELECT COALESCE(SUM($$.amount), 0) - FROM module_data_equipment AS mvt + FROM @TABLE AS mvt WHERE $$.type = 'movement' AND $$.operation IN %s AND - $$.equipment = module_data_equipment.key + $$.equipment = @TABLE.key ) AS 'Stock' ; (SELECT COALESCE(SUM($$.amount), 0) - FROM module_data_equipment AS mvt + FROM @TABLE AS mvt WHERE $$.type = 'movement' AND $$.operation IN %s AND - $$.equipment = module_data_equipment.key + $$.equipment = @TABLE.key ) - (SELECT COALESCE(SUM($$.amount), 0) - FROM module_data_equipment AS mvt + FROM @TABLE AS mvt WHERE $$.type = 'movement' AND $$.operation IN %s AND - $$.equipment = module_data_equipment.key + $$.equipment = @TABLE.key ) AS 'Sorti' ; - '' AS 'Disponible' - "|args:$input_types.définitif:$output_types.définitif:$output_types.temporaire:$input_types.retour + + (SELECT + SUM($$.amount) + FROM @TABLE AS mvt + WHERE + $$.type = 'movement' + AND + $$.operation IN %s + AND + $$.equipment = @TABLE.key + ) - + (SELECT + COALESCE(SUM($$.amount), 0) + FROM @TABLE AS mvt + WHERE + $$.type = 'movement' + AND + $$.operation IN %s + AND + $$.equipment = @TABLE.key + ) - + (SELECT + COALESCE(SUM($$.amount), 0) + FROM @TABLE AS mvt + WHERE + $$.type = 'movement' + AND + $$.operation IN %s + AND + $$.equipment = @TABLE.key + ) + (SELECT + COALESCE(SUM($$.amount), 0) + FROM @TABLE AS mvt + WHERE + $$.type = 'movement' + AND + $$.operation IN %s + AND + $$.equipment = @TABLE.key + ) AS 'Disponible' + "|args:$input_types.définitif:$output_types.définitif:$output_types.temporaire:$input_types.retour:$input_types.définitif:$output_types.définitif:$output_types.temporaire:$input_types.retour type="equipment" where="$$.status <> 'archived' AND %s"|args:$condition group="col1 HAVING col3 NOT NULL" @@ -117,14 +156,13 @@ }} {{:assign var=cat_name from=categories.%s|args:$category}} - {{:assign dispo="%d-%d"|math:$col3:$col4}}