ajout liaison entre sortie temporaire et retour

This commit is contained in:
Jean-Christophe Engel 2025-03-20 17:15:18 +01:00
parent 95db394d7a
commit 144a909494
4 changed files with 81 additions and 45 deletions

View file

@ -85,6 +85,32 @@
{{/if}}
{{/foreach}}
{{* calculer la quantité restant à l'extérieur de chaque matériel *}}
{{#foreach from=$config.output_nature key=key}}
{{if $type == "temporaire"}}
{{:assign var="temp_outputs." value=$key|quote_sql}}
{{/if}}
{{/foreach}}
{{:assign operations=$temp_outputs|implode:","}}
{{:assign operations="("|cat:$operations|cat:")"}}
{{#select
mvt.key AS mvt_key,
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste
FROM module_data_equipment AS mvt
LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.output')
LEFT JOIN module_data_equipment 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
;
!op = $operations
:eqpmt_key = $_GET.key
}}
{{:assign var="reste.%s"|args:$mvt_key value=$reste}}
{{/select}}
{{* calculer et mémoriser les quantités pour que le tri de la liste affiche les valeurs correctes *}}
{{:assign stock=0}}
{{:assign exterieur=0}}
@ -153,11 +179,14 @@
<td class="actions">
{{if $current != "archives"}}
{{if $direction == "output" && $type_mvt == "temporaire"}}
{{:linkbutton
label="Retour"
href="mouvements/return.html?key=%s&prop=%s"|args:$key:$_GET.prop
shape="history"
target="_dialog"}}
{{:assign var="ext" from="reste.%s"|args:$key}}
{{if $ext != null && $ext > 0}}
{{:linkbutton
label="Retour"
href="mouvements/output_return.html?key=%s&prop=%s"|args:$key:$_GET.prop
shape="history"
target="_dialog"}}
{{/if}}
{{/if}}
{{:linkbutton
label="Dupliquer"