From 772381be3721fa91d6f0008bb3f675839b9c509a Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 19 Oct 2023 20:30:04 +0200 Subject: [PATCH] =?UTF-8?q?stock=5Fdisponible=20:=20ajout=20quantit=C3=A9?= =?UTF-8?q?=20disponible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mouvements/sorties/stock_disponible.html | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/mouvements/sorties/stock_disponible.html b/mouvements/sorties/stock_disponible.html index 1b69f77..975dc49 100644 --- a/mouvements/sorties/stock_disponible.html +++ b/mouvements/sorties/stock_disponible.html @@ -2,7 +2,7 @@ {{:admin_header title="Gestion des matériels" current="module_equipment"}} {{* barre de navigation *}} -{{:include file="/%s/_nav.html"|args:$module.name current="entrees"}} +{{:include file="/%s/_nav.html"|args:$module.name current="sorties"}} {{* types de sorties *}} {{* TODO : stocker dans la configuration du module *}} @@ -40,8 +40,21 @@ {{* lister les catégories et matériels associés *}} {{#load type="category" assign="category" order="$$.name"}} {{:assign nom_cat=$category.name}} - {{#load type="equipment" where="$$.category = :key" :key=$category.key assign="equipment"}} - {{:assign var="equipments.%s.%s"|args:$nom_cat:$equipment.key value=$equipment.designation}} + + {{#load type="equipment" where="$$.category = :key" :key=$category.key assign="equipment" order="$$.designation"}} + {{:assign var="dispo" value=0}} + + {{* cumuler les entrées et les sorties de ce matériel *}} + {{#load type="movement" where="$$.equipment = :eqpmt_key" :eqpmt_key=$equipment.key assign="movement"}} + {{if $movement.direction === 'entrée'}} + {{:assign dispo="%d+%d"|math:$dispo:$movement.amount}} + {{else}} + {{:assign dispo="%d-%d"|math:$dispo:$movement.amount}} + {{/if}} + {{else}} + {{:error message="pas de mouvement pour la clé=%s"|args:$equipment.key}} + {{/load}} + {{:assign var="equipments.%s.%s"|args:$nom_cat:$equipment.key value="%s (dispo : %d)"|args:$equipment.designation:$dispo}} {{/load}} {{/load}}