Simplification calcul dispo et config par défaut
This commit is contained in:
parent
d7f7ec9423
commit
af9dbf2b22
14 changed files with 260 additions and 304 deletions
|
|
@ -23,12 +23,11 @@
|
|||
|
||||
{{* déterminer s'il s'agit d'une sortie temporaire *}}
|
||||
{{:assign temporaire=false}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $mvt_suppr.output_nature == $elem.label && $elem.type == 'temporaire'}}
|
||||
{{:assign temporaire=true}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{:assign var="output_nature" from="config.output_nature.%s"|args:$mvt_suppr.output_nature}}
|
||||
|
||||
{{if $output_nature == 'temporaire'}}
|
||||
{{:assign temporaire=true}}
|
||||
{{/if}}
|
||||
|
||||
{{* dans le cas d'une sortie temporaire, vérifier s'il est possible de la supprimer *}}
|
||||
{{if $temporaire}}
|
||||
|
|
@ -36,32 +35,29 @@
|
|||
{{#load
|
||||
type="movement"
|
||||
where="$$.equipment = :key" :key=$key_eqpmt_suppr
|
||||
assign="movement"
|
||||
assign="mvt"
|
||||
order="$$.date"}}
|
||||
|
||||
{{* déterminer le type de mouvement *}}
|
||||
{{:assign var="mvt_nature" from="mvt.%s_nature"|args:$mvt.direction}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$mvt.direction:$mvt_nature}}
|
||||
|
||||
{{if $key != $_GET.key}}
|
||||
{{* ce n'est pas le mouvement à supprimer : cumuler les entrées/sorties *}}
|
||||
{{if $movement.direction == 'input'}}
|
||||
{{* chercher le type d'entrée parmi les types de la config *}}
|
||||
{{#foreach from=$config.input_nature item="elem"}}
|
||||
{{if $movement.input_nature == $elem.label && $elem.type == 'retour'}}
|
||||
{{:assign exterieur="%d-%d"|math:$exterieur:$movement.amount}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{elseif $movement.direction == 'output'}}
|
||||
{{* chercher le type de sortie parmi les types de la config *}}
|
||||
{{#foreach from=$config.output_nature item="elem"}}
|
||||
{{if $movement.output_nature == $elem.label && $elem.type == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$movement.amount}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{if $mvt.direction == 'input'}}
|
||||
{{if $type_mvt == 'retour'}}
|
||||
{{:assign exterieur="%d-%d"|math:$exterieur:$mvt.amount}}
|
||||
{{/if}}
|
||||
{{elseif $mvt.direction == 'output'}}
|
||||
{{if $type_mvt == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$mvt.amount}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* problème ? *}}
|
||||
{{if $exterieur < 0}}
|
||||
{{:redirect force="./index.html?err=1&msg=suppression"}}
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue