Ajout tri inventaire sur quantité disponible

This commit is contained in:
Jean-Christophe Engel 2025-02-24 14:53:26 +01:00
parent 39bd89234a
commit 849dcf00c9

View File

@ -70,46 +70,85 @@
WHERE cat.key = @TABLE.$$.category) AS 'Catégorie' ; WHERE cat.key = @TABLE.$$.category) AS 'Catégorie' ;
(SELECT (SELECT
SUM($$.amount) SUM($$.amount)
FROM module_data_equipment AS mvt FROM @TABLE AS mvt
WHERE WHERE
$$.type = 'movement' $$.type = 'movement'
AND AND
$$.operation IN %s $$.operation IN %s
AND AND
$$.equipment = module_data_equipment.key $$.equipment = @TABLE.key
) - ) -
(SELECT (SELECT
COALESCE(SUM($$.amount), 0) COALESCE(SUM($$.amount), 0)
FROM module_data_equipment AS mvt FROM @TABLE AS mvt
WHERE WHERE
$$.type = 'movement' $$.type = 'movement'
AND AND
$$.operation IN %s $$.operation IN %s
AND AND
$$.equipment = module_data_equipment.key $$.equipment = @TABLE.key
) AS 'Stock' ; ) AS 'Stock' ;
(SELECT (SELECT
COALESCE(SUM($$.amount), 0) COALESCE(SUM($$.amount), 0)
FROM module_data_equipment AS mvt FROM @TABLE AS mvt
WHERE WHERE
$$.type = 'movement' $$.type = 'movement'
AND AND
$$.operation IN %s $$.operation IN %s
AND AND
$$.equipment = module_data_equipment.key $$.equipment = @TABLE.key
) - ) -
(SELECT (SELECT
COALESCE(SUM($$.amount), 0) COALESCE(SUM($$.amount), 0)
FROM module_data_equipment AS mvt FROM @TABLE AS mvt
WHERE WHERE
$$.type = 'movement' $$.type = 'movement'
AND AND
$$.operation IN %s $$.operation IN %s
AND AND
$$.equipment = module_data_equipment.key $$.equipment = @TABLE.key
) AS 'Sorti' ; ) 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" type="equipment"
where="$$.status <> 'archived' AND %s"|args:$condition where="$$.status <> 'archived' AND %s"|args:$condition
group="col1 HAVING col3 NOT NULL" group="col1 HAVING col3 NOT NULL"
@ -117,14 +156,13 @@
}} }}
{{:assign var=cat_name from=categories.%s|args:$category}} {{:assign var=cat_name from=categories.%s|args:$category}}
{{:assign dispo="%d-%d"|math:$col3:$col4}}
<tr> <tr>
<td>{{$name}}</td> <td>{{$name}}</td>
<td>{{$cat_name}}</td> <td>{{$cat_name}}</td>
<td class="num">{{$col3}}</td> <td class="num">{{$col3}}</td>
<td class="num">{{$col4}}</td> <td class="num">{{$col4}}</td>
<td class="num nosort">{{$dispo}}</td> <td class="num">{{$col5}}</td>
<td class="actions"> <td class="actions">
{{if $col4 > 0}} {{if $col4 > 0}}
{{:linkbutton {{:linkbutton
@ -133,7 +171,7 @@
shape="history" shape="history"
target="_dialog"}} target="_dialog"}}
{{/if}} {{/if}}
{{if $dispo > 0}} {{if $col5 > 0}}
{{:linkbutton {{:linkbutton
label="Sortie" label="Sortie"
shape="minus" shape="minus"