diff --git a/historique.html b/historique.html index 9c166a5..453c714 100644 --- a/historique.html +++ b/historique.html @@ -10,18 +10,6 @@ - msg : message de retour *}} -{{:assign equipment_key=$_GET.key|trim}} -{{#load key=$_GET.key assign="equipment"}} -{{else}} - {{:error message="Pas de matériel avec la clé %s"|args:$equipment_key}} -{{/load}} - -{{#load type="category" where="key = :cle" :cle=$equipment.category assign="category"}} -{{else}} - {{:error message="Le matériel %s n'appartient à aucune catégorie"|args:$equipment.designation}} -{{/load}} -{{:admin_header title="Gestion des matériels" current="module_equipment"}} - {{if $_GET.ok}} {{if $_GET.msg == "modification"}}

Modification enregistrée

@@ -46,12 +34,25 @@ {{else}} {{:assign proprio="nonproprio"}} {{/if}} + +{{:assign equipment_key=$_GET.key|trim}} +{{#load key=$equipment_key assign="equipment"}} +{{else}} + {{:error message="Pas de matériel avec la clé %s"|args:$equipment_key}} +{{/load}} + +{{#load type="category" where="key = :cle" :cle=$equipment.category assign="category"}} +{{else}} + {{:error message="Le matériel %s n'appartient à aucune catégorie"|args:$equipment.designation}} +{{/load}} +{{:admin_header title="Gestion des matériels" current="module_equipment"}} + {{:include file="./_nav.html" current="inventaire" subcurrent=$proprio subsubcurrent="mouvements" eqpmt=$equipment.designation category=$category.name}} {{* récupérer la config des entrées/sorties *}} {{:include file="./_get_config.html" keep="config"}} -{{* déterminer les type de mouvements selon l'affection du matériel *}} +{{* déterminer les types de mouvements selon l'affection du matériel *}} {{#foreach from=$config.input_nature key=mvt item=type_mvt}} {{if $_GET.prop}} {{* matériel propriété de l'asso *}} @@ -80,58 +81,140 @@ {{/if}} {{/foreach}} +{{* calculer et mémoriser les quantités pour que le tri de la liste affiche les valeurs correctes *}} +{{:assign stock=0}} +{{:assign exterieur=0}} +{{:assign nonproprio=0}} + +{{#load type="movement" where="$$.equipment = :key" :key=$equipment_key order="$$.date"}} + {{if $direction == 'input'}} + {{:assign var="type_mvt" from="config.input_nature.%s"|args:$input_nature}} + {{if $type_mvt == 'définitif'}} + {{:assign stock="%d+%d"|math:$stock:$amount}} + {{elseif $type_mvt == 'retour'}} + {{:assign exterieur="%d-%d"|math:$exterieur:$amount}} + {{elseif $type_mvt == 'temporaire'}} + {{:assign nonproprio="%d+%d"|math:$nonproprio:$amount}} + {{/if}} + {{else}} + {{:assign var="type_mvt" from="config.output_nature.%s"|args:$output_nature}} + {{if $type_mvt == 'définitif'}} + {{:assign stock="%d-%d"|math:$stock:$amount}} + {{elseif $type_mvt == 'temporaire'}} + {{:assign exterieur="%d+%d"|math:$exterieur:$amount}} + {{elseif $type_mvt == 'retour'}} + {{:assign nonproprio="%d-%d"|math:$nonproprio:$amount}} + {{/if}} + {{/if}} + {{:assign dispo="%d-%d"|math:$stock:$exterieur}} + {{:assign var="quantites.%s.stock"|args:$id value=$stock}} + {{:assign var="quantites.%s.exterieur"|args:$id value=$exterieur}} + {{:assign var="quantites.%s.dispo"|args:$id value=$dispo}} + {{:assign var="quantites.%s.nonproprio"|args:$id value=$nonproprio}} +{{/load}} + {{* lister tous les mouvements du matériel passé en paramètre *}} {{if $_GET.prop}}

Matériel propriété de l'association

+ + {{#list + type="movement" + select="$$.date AS 'Date'; + CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mvt'; + CASE $$.direction WHEN 'input' THEN $$.input_nature WHEN 'output' THEN $$.output_nature END AS 'Opération'; + $$.amount AS 'Quantité'; + "" as 'Stock'; + "" as 'Sorti'; + "" as 'Dispo'; + $$.comment AS 'Commentaire'" + equipment=$equipment_key + order=1 + }} + {{:assign var="type_mvt" from="config.%s_nature.%s"|args:$direction:$col3}} + + {{if $direction === "input" && $input_nature|in:$input_types || + $direction === "output"&& $output_nature|in:$output_types + }} + {{:assign var="stock" from="quantites.%s.stock"|args:$id}} + {{:assign var="exterieur" from="quantites.%s.exterieur"|args:$id}} + {{:assign var="dispo" from="quantites.%s.dispo"|args:$id}} + + {{$date|date_short}} + {{$col2}} + {{$col3}} + {{$amount}} + {{$stock}} + {{$exterieur}} + {{$dispo}} + {{$comment}} + + {{:linkbutton + label="Dupliquer" + href="mouvements/dupliquer_mouvement.html?key=%s&direction=%s&prop=%s"|args:$key:$direction:$_GET.prop + shape="plus" + target="_dialog"}} + {{:linkbutton + label="Modifier" + href="mouvements/modifier_mouvement.html?key=%s&direction=%s"|args:$key:$direction + shape="edit" + target="_dialog"}} + {{:linkbutton + label="Supprimer" + href="mouvements/supprimer_mouvement.html?key=%s&direction=%s&prop=%s"|args:$key:$direction:$_GET.prop + shape="delete" + target="_dialog"}} + + + {{/if}} + {{/list}} + {{else}}

Matériel temporairement dans l'association

+ + {{#list + type="movement" + select="$$.date AS 'Date'; + CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mvt'; + CASE $$.direction WHEN 'input' THEN $$.input_nature WHEN 'output' THEN $$.output_nature END AS 'Opération'; + $$.amount AS 'Quantité'; + "" as 'Présent'; + $$.comment AS 'Commentaire'" + equipment=$equipment_key + order=1 + }} + {{:assign var="type_mvt" from="config.%s_nature.%s"|args:$direction:$col3}} + + {{if $direction === "input" && $input_nature|in:$input_types || + $direction === "output"&& $output_nature|in:$output_types + }} + {{:assign var="stock" from="quantites.%s.nonproprio"|args:$id}} + + {{$date|date_short}} + {{$col2}} + {{$col3}} + {{$amount}} + {{$stock}} + {{$comment}} + + {{:linkbutton + label="Dupliquer" + href="mouvements/dupliquer_mouvement.html?key=%s&direction=%s&prop=%s"|args:$key:$direction:$_GET.prop + shape="plus" + target="_dialog"}} + {{:linkbutton + label="Modifier" + href="mouvements/modifier_mouvement.html?key=%s&direction=%s"|args:$key:$direction + shape="edit" + target="_dialog"}} + {{:linkbutton + label="Supprimer" + href="mouvements/supprimer_mouvement.html?key=%s&direction=%s&prop=%s"|args:$key:$direction:$_GET.prop + shape="delete" + target="_dialog"}} + + + {{/if}} + {{/list}} {{/if}} -{{#list - type="movement" - select="$$.date AS 'Date'; - CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mvt'; - CASE $$.direction WHEN 'input' THEN $$.input_nature WHEN 'output' THEN $$.output_nature END AS 'Opération'; - $$.amount AS 'Quantité'; - $$.comment AS 'Commentaire'" - equipment=$equipment_key - order=1 -}} - {{:assign var="type_mvt" from="config.%s_nature.%s"|args:$direction:$col3}} - {{if $direction == 'input'}} - {{:assign sens="entree"}} - {{else}} - {{:assign sens="sortie"}} - {{/if}} - - {{if $direction === "input" && $input_nature|in:$input_types || - $direction === "output"&& $output_nature|in:$output_types - }} - - {{$date|date_short}} - {{$col2}} - {{$col3}} - {{$amount}} - {{$comment}} - - {{:linkbutton - label="Dupliquer" - href="mouvements/dupliquer_mouvement.html?key=%s&direction=%s&prop=%s"|args:$key:$direction:$_GET.prop - shape="plus" - target="_dialog"}} - {{:linkbutton - label="Modifier" - href="mouvements/modifier_mouvement.html?key=%s&direction=%s"|args:$key:$direction - shape="edit" - target="_dialog"}} - {{:linkbutton - label="Supprimer" - href="mouvements/supprimer_mouvement.html?key=%s&direction=%s&prop=%s"|args:$key:$direction:$_GET.prop - shape="delete" - target="_dialog"}} - - - {{/if}} -{{/list}} - {{:admin_footer}}