stock_disponible : ajout quantité disponible

This commit is contained in:
Jean-Christophe Engel 2023-10-19 20:30:04 +02:00
parent 5974bb158b
commit 772381be37

View File

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