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
|
|
@ -12,34 +12,28 @@
|
|||
{{:assign stock=0}}
|
||||
{{:assign exterieur=0}}
|
||||
{{:assign nonprop=0}}
|
||||
{{#foreach from=$movements item="movement"}}
|
||||
{{if $movement.equipment == $eqpmt_key}}
|
||||
{{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}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d+%d"|math:$stock:$movement.amount}}
|
||||
{{elseif $elem.type == 'retour'}}
|
||||
{{:assign exterieur="%d-%d"|math:$exterieur:$movement.amount}}
|
||||
{{elseif $elem.type == 'temporaire'}}
|
||||
{{:assign nonprop="%d+%d"|math:$nonprop:$movement.amount}}
|
||||
{{/if}}
|
||||
{{/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}}
|
||||
{{if $elem.type == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$movement.amount}}
|
||||
{{elseif $elem.type == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$movement.amount}}
|
||||
{{elseif $elem.type == 'retour'}}
|
||||
{{:assign nonprop="%d-%d"|math:$nonprop:$movement.amount}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{#foreach from=$movements item="mvt"}}
|
||||
{{* 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 $mvt.equipment == $eqpmt_key}}
|
||||
{{if $mvt.direction == 'input'}}
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign stock="%d+%d"|math:$stock:$mvt.amount}}
|
||||
{{elseif $type_mvt == 'retour'}}
|
||||
{{:assign exterieur="%d-%d"|math:$exterieur:$mvt.amount}}
|
||||
{{elseif $type_mvt == 'temporaire'}}
|
||||
{{:assign nonprop="%d+%d"|math:$nonprop:$mvt.amount}}
|
||||
{{/if}}
|
||||
{{elseif $mvt.direction == 'output'}}
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$mvt.amount}}
|
||||
{{elseif $type_mvt == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$mvt.amount}}
|
||||
{{elseif $type_mvt == 'retour'}}
|
||||
{{:assign nonprop="%d-%d"|math:$nonprop:$mvt.amount}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonprop < 0}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue