ajout liaison entre entrée temporaire et retour
This commit is contained in:
parent
144a909494
commit
ce87720d41
6 changed files with 322 additions and 77 deletions
|
|
@ -21,54 +21,63 @@
|
|||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{#form on="delete"}}
|
||||
|
||||
{{#load type="link" where="$$.output = :key OR $$.return = :key" :key=$_GET.key}}
|
||||
{{:assign link_key=$key}}
|
||||
{{/load}}
|
||||
|
||||
{{* vérifier s'il est possible de supprimer le mouvement *}}
|
||||
{{if $mvt_suppr.direction == 'input'}}
|
||||
{{:assign dispo=0}}
|
||||
{{:assign nonprop=0}}
|
||||
|
||||
{{#load
|
||||
type="movement"
|
||||
where="$$.equipment = :key" :key=$mvt_suppr.equipment
|
||||
assign="mvt"
|
||||
order="$$.date"}}
|
||||
|
||||
{{* déterminer le type de mouvement *}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}}
|
||||
|
||||
{{if $key != $_GET.key}}
|
||||
{{* ce n'est pas le mouvement à supprimer : cumuler les entrées/sorties *}}
|
||||
{{if $mvt.direction == 'input'}}
|
||||
{{if $type_mvt == 'temporaire'}}
|
||||
{{:assign nonprop="%d+%d"|math:$nonprop:$mvt.amount}}
|
||||
{{else}}
|
||||
{{:assign dispo="%d+%d"|math:$dispo:$mvt.amount}}
|
||||
{{/if}}
|
||||
{{elseif $mvt.direction == 'output'}}
|
||||
{{if $type_mvt == 'retour'}}
|
||||
{{:assign nonprop="%d-%d"|math:$nonprop:$mvt.amount}}
|
||||
{{else}}
|
||||
{{:assign dispo="%d-%d"|math:$dispo:$mvt.amount}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* problème ? *}}
|
||||
{{if $dispo < 0 || $nonprop < 0}}
|
||||
{{:redirect force="../historique.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{/if}}
|
||||
{{:assign var="type_operation" from="config.input_nature.%s.type"|args:$mvt_suppr.operation}}
|
||||
|
||||
{{if $type_operation == 'temporaire'}}
|
||||
{{#load type="link" where="$$.input = :key OR $$.return = :key" :key=$_GET.key}}
|
||||
{{:assign link_key=$key}}
|
||||
{{/load}}
|
||||
{{if $link_key != null}}
|
||||
{{:redirect force="../historique.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
{{else}}
|
||||
{{:assign dispo=0}}
|
||||
{{:assign nonprop=0}}
|
||||
|
||||
{{#load
|
||||
type="movement"
|
||||
where="$$.equipment = :key" :key=$mvt_suppr.equipment
|
||||
assign="mvt"
|
||||
order="$$.date"}}
|
||||
|
||||
{{* déterminer le type de mouvement *}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}}
|
||||
|
||||
{{if $key != $_GET.key}}
|
||||
{{* ce n'est pas le mouvement à supprimer : cumuler les entrées/sorties *}}
|
||||
{{if $mvt.direction == 'input'}}
|
||||
{{if $type_mvt == 'temporaire'}}
|
||||
{{:assign nonprop="%d+%d"|math:$nonprop:$mvt.amount}}
|
||||
{{else}}
|
||||
{{:assign dispo="%d+%d"|math:$dispo:$mvt.amount}}
|
||||
{{/if}}
|
||||
{{elseif $mvt.direction == 'output'}}
|
||||
{{if $type_mvt == 'retour'}}
|
||||
{{:assign nonprop="%d-%d"|math:$nonprop:$mvt.amount}}
|
||||
{{else}}
|
||||
{{:assign dispo="%d-%d"|math:$dispo:$mvt.amount}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* problème ? *}}
|
||||
{{if $dispo < 0 || $nonprop < 0}}
|
||||
{{:redirect force="../historique.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
||||
{{else}}
|
||||
{{* sortie *}}
|
||||
{{:assign var="type_operation" from="config.output_nature.%s.type"|args:$mvt_suppr.operation}}
|
||||
|
||||
{{if $type_operation == 'temporaire'}}
|
||||
{{#load type="link" where="$$.output = :key OR $$.return = :key" :key=$_GET.key}}
|
||||
{{:assign link_key=$key}}
|
||||
{{/load}}
|
||||
{{if $link_key != null}}
|
||||
{{:redirect force="../historique.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{/if}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue