Compare commits
4 Commits
1c395c48e0
...
e8da809830
Author | SHA1 | Date | |
---|---|---|---|
e8da809830 | |||
e4ad0b6982 | |||
77b8f892cc | |||
d40b17ef2c |
205
historique.html
205
historique.html
@ -10,21 +10,11 @@
|
|||||||
- msg : message de retour
|
- 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.ok}}
|
||||||
{{if $_GET.msg == "modification"}}
|
{{if $_GET.msg == "modification"}}
|
||||||
<p class="block confirm">Modification enregistrée</p>
|
<p class="block confirm">Modification enregistrée</p>
|
||||||
|
{{elseif $_GET.msg == "copie"}}
|
||||||
|
<p class="block confirm">Mouvement copié</p>
|
||||||
{{elseif $_GET.msg == "suppression"}}
|
{{elseif $_GET.msg == "suppression"}}
|
||||||
<p class="block confirm">Mouvement supprimé</p>
|
<p class="block confirm">Mouvement supprimé</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
@ -44,12 +34,25 @@
|
|||||||
{{else}}
|
{{else}}
|
||||||
{{:assign proprio="nonproprio"}}
|
{{:assign proprio="nonproprio"}}
|
||||||
{{/if}}
|
{{/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}}
|
{{: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 *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="./_get_config.html" keep="config"}}
|
{{: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}}
|
{{#foreach from=$config.input_nature key=mvt item=type_mvt}}
|
||||||
{{if $_GET.prop}}
|
{{if $_GET.prop}}
|
||||||
{{* matériel propriété de l'asso *}}
|
{{* matériel propriété de l'asso *}}
|
||||||
@ -78,58 +81,140 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/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 *}}
|
{{* lister tous les mouvements du matériel passé en paramètre *}}
|
||||||
{{if $_GET.prop}}
|
{{if $_GET.prop}}
|
||||||
<h3>Matériel propriété de l'association</h3>
|
<h3>Matériel propriété de l'association</h3>
|
||||||
|
|
||||||
|
{{#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}}
|
||||||
|
<tr>
|
||||||
|
<td>{{$date|date_short}}</td>
|
||||||
|
<td>{{$col2}}</td>
|
||||||
|
<td>{{$col3}}</td>
|
||||||
|
<td>{{$amount}}</td>
|
||||||
|
<td>{{$stock}}</td>
|
||||||
|
<td>{{$exterieur}}</td>
|
||||||
|
<td>{{$dispo}}</td>
|
||||||
|
<td>{{$comment}}</td>
|
||||||
|
<td class="actions">
|
||||||
|
{{: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"}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/if}}
|
||||||
|
{{/list}}
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<h3>Matériel temporairement dans l'association</h3>
|
<h3>Matériel temporairement dans l'association</h3>
|
||||||
|
|
||||||
|
{{#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}}
|
||||||
|
<tr>
|
||||||
|
<td>{{$date|date_short}}</td>
|
||||||
|
<td>{{$col2}}</td>
|
||||||
|
<td>{{$col3}}</td>
|
||||||
|
<td>{{$amount}}</td>
|
||||||
|
<td>{{$stock}}</td>
|
||||||
|
<td>{{$comment}}</td>
|
||||||
|
<td class="actions">
|
||||||
|
{{: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"}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/if}}
|
||||||
|
{{/list}}
|
||||||
{{/if}}
|
{{/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
|
|
||||||
}}
|
|
||||||
<tr>
|
|
||||||
<td>{{$date|date_short}}</td>
|
|
||||||
<td>{{$col2}}</td>
|
|
||||||
<td>{{$col3}}</td>
|
|
||||||
<td>{{$amount}}</td>
|
|
||||||
<td>{{$comment}}</td>
|
|
||||||
<td class="actions">
|
|
||||||
{{:linkbutton
|
|
||||||
label="Dupliquer"
|
|
||||||
href="mouvements/dupliquer_mouvement.html?key=%s&direction=%s"|args:$key:$direction
|
|
||||||
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"}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/if}}
|
|
||||||
{{/list}}
|
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
Dupliquer un mouvement
|
Dupliquer un mouvement
|
||||||
paramètres :
|
paramètres :
|
||||||
- key : clé du mouvement à dupliquer
|
- key : clé du mouvement à dupliquer
|
||||||
- direction du mouvement input/output)
|
- direction du mouvement à dupliquer
|
||||||
|
- prop = 1 si matériel appartient à l'asso
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{if $_GET.direction == "input"}}
|
{{if $_GET.direction == "input"}}
|
||||||
@ -14,55 +15,58 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{:admin_header title="Dupliquer une %s"|args:$msg_direction current="module_equipment"}}
|
{{:admin_header title="Dupliquer une %s"|args:$msg_direction current="module_equipment"}}
|
||||||
|
|
||||||
{{:assign direction=$_GET.direction}}
|
|
||||||
{{:assign mvt_key=$_GET.key}}
|
|
||||||
|
|
||||||
{{* récupérer les infos du mouvement à dupliquer *}}
|
{{* récupérer les infos du mouvement à dupliquer *}}
|
||||||
{{#load key=$mvt_key assign="mvt_copie"}}
|
{{#load key=$_GET.key assign="mvt_new"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:error message="Aucune %s avec la clé %s"|args:$msg_direction:$mvt_key}}
|
{{:error message="Aucune %s avec la clé %s"|args:$msg_direction:$_GET.key}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{if $direction == "input"}}
|
|
||||||
{{:assign input_init=$mvt_copie.input_nature}}
|
{{* infos pour affichage *}}
|
||||||
{{:assign url="entrees/index.html"}}
|
{{if $_GET.direction == "input"}}
|
||||||
|
{{:assign mvt_nature=$mvt_new.input_nature}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign output_init=$mvt_copie.output_nature}}
|
{{:assign mvt_nature=$mvt_new.output_nature}}
|
||||||
{{:assign url="sorties/index.html"}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign amount_init=$mvt_copie.amount}}
|
{{:assign amount_init=$mvt_new.amount}}
|
||||||
{{:assign date_init=$mvt_copie.date|date_short}}
|
{{:assign date_init=$mvt_new.date|date_short}}
|
||||||
{{:assign key_eqpmt_init=$mvt_copie.equipment}}
|
{{:assign eqpmt_key=$mvt_new.equipment}}
|
||||||
|
|
||||||
|
{{* récupérer les infos du matériel associé *}}
|
||||||
|
{{#load key=$eqpmt_key assign="eqpmt"}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Aucun matériel avec la clé « %s »"|args:$eqpmt_key}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="../_get_config.html" keep="config"}}
|
{{:include file="../_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{if $direction == "input"}}
|
{{* limiter les opérations possibles *}}
|
||||||
|
{{if $_GET.direction == "input"}}
|
||||||
{{* types d'entrées *}}
|
{{* types d'entrées *}}
|
||||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
{{#foreach from=$config.input_nature key="label" item="type"}}
|
||||||
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
{{if $_GET.prop && $type != "temporaire" ||
|
||||||
{{if $label == $mvt_copie.input_nature}}
|
! $_GET.prop && $type == "temporaire"
|
||||||
{{:assign type_defaut=$label}}
|
}}
|
||||||
|
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $label == $mvt_new.input_nature}}
|
||||||
|
{{:assign nature_defaut=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* types de sorties *}}
|
{{* types de sorties *}}
|
||||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||||
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
{{if $_GET.prop && $type != "retour" ||
|
||||||
{{if $label == $mvt_copie.output_nature}}
|
! $_GET.prop && $type == "retour"
|
||||||
{{:assign type_defaut=$label}}
|
}}
|
||||||
|
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $label == $mvt_new.output_nature}}
|
||||||
|
{{:assign nature_defaut=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* récupérer les infos du matériel associé *}}
|
|
||||||
{{#load key=$key_eqpmt_init assign="eqpmt_init"}}
|
|
||||||
{{else}}
|
|
||||||
{{:error message="Aucun matériel avec la clé « %s »"|args:$key_eqpmt_init}}
|
|
||||||
{{/load}}
|
|
||||||
|
|
||||||
{{* récupérer les infos de la catégorie *}}
|
|
||||||
{{#load type="category" key=$eqpmt_init.category assign="category"}}
|
|
||||||
{{/load}}
|
|
||||||
{{*
|
{{*
|
||||||
-------------------- Traiter la saisie --------------------
|
-------------------- Traiter la saisie --------------------
|
||||||
*}}
|
*}}
|
||||||
@ -72,64 +76,121 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* préparer le mouvement copié *}}
|
{{* préparer le mouvement copié *}}
|
||||||
{{if $direction == "input"}}
|
{{if $_GET.direction == "input"}}
|
||||||
{{:assign var="mvt_copie.input_nature" from="input_labels.%s"|args:$_POST.type_operation}}
|
{{:assign var="mvt_new.input_nature" value=$_POST.nature_operation}}
|
||||||
{{:assign var="type_mvt" from="config.input_nature.%s"|args:$mvt_copie.input_nature}}
|
{{:assign var="type_mvt" from="config.input_nature.%s"|args:$mvt_new.input_nature}}
|
||||||
{{if $type_mvt == "temporaire"}}
|
{{if $type_mvt == "temporaire"}}
|
||||||
{{:assign prop=0}}
|
{{:assign prop=0}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign prop=1}}
|
{{:assign prop=1}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign var="mvt_copie.output_nature" from="output_labels.%s"|args:$_POST.type_operation}}
|
{{:assign var="mvt_new.output_nature" value=$_POST.nature_operation}}
|
||||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$mvt_copie.output_nature}}
|
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$mvt_new.output_nature}}
|
||||||
{{if $type_mvt == "retour"}}
|
{{if $type_mvt == "retour"}}
|
||||||
{{:assign prop=0}}
|
{{:assign prop=0}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign prop=1}}
|
{{:assign prop=1}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign var="mvt_copie.amount" value=$_POST.amount}}
|
|
||||||
{{:assign var="mvt_copie.date" value=$_POST.date|parse_date}}
|
|
||||||
{{:assign var="mvt_copie.comment" value=$_POST.comment}}
|
|
||||||
|
|
||||||
{{* Enregistrer le mouvement *}}
|
{{:assign var="mvt_new.amount" value=$_POST.amount}}
|
||||||
{{:assign mvt_key=""|uuid}}
|
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
|
||||||
{{:save
|
{{:assign var="mvt_new.comment" value=$_POST.comment}}
|
||||||
key=$mvt_key
|
|
||||||
validate_schema="movement.schema.json"
|
{{*
|
||||||
type="movement"
|
lister les mouvements
|
||||||
direction=$direction
|
- insérer le mvt copié à sa place par date croissante
|
||||||
input_nature=$mvt_copie.input_nature
|
*}}
|
||||||
output_nature=$mvt_copie.output_nature
|
{{:assign insere=false}}
|
||||||
amount=$mvt_copie.amount|intval
|
{{#load
|
||||||
equipment=$key_eqpmt_init
|
where="
|
||||||
date=$mvt_copie.date
|
$$.type = 'movement'
|
||||||
comment=$mvt_copie.comment
|
AND
|
||||||
|
$$.equipment = :eqpmt_key"
|
||||||
|
:eqpmt_key=$eqpmt_key
|
||||||
|
order="$$.date"
|
||||||
|
assign="movement"
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=%s"|args:$key_eqpmt_init:$prop:$msg_direction}}
|
{{if! $insere}}
|
||||||
|
{{if
|
||||||
|
$_GET.direction == "input" && $date >= $mvt_new.date ||
|
||||||
|
$_GET.direction == "output" && $date > $mvt_new.date
|
||||||
|
}}
|
||||||
|
{{:assign var="movements_new." from=mvt_new}}
|
||||||
|
{{:assign insere=true}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign var="movements_new." from=movement}}
|
||||||
|
{{/load}}
|
||||||
|
{{if ! $insere}}
|
||||||
|
{{:assign var="movements_new." from=mvt_new}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* Vérifier la cohérence des mouvements du matériel *}}
|
||||||
|
{{:include
|
||||||
|
file="./valider_modification.html"
|
||||||
|
keep="erreur"
|
||||||
|
movements=$movements_new
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{if $erreur}}
|
||||||
|
<p class="block error">
|
||||||
|
Modification demandée impossible :
|
||||||
|
« {{$mvt_nature}} de {{$eqpmt.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||||
|
{{if $_GET.direction == "input"}}
|
||||||
|
« {{$mvt_new.input_nature}}
|
||||||
|
{{else}}
|
||||||
|
« {{$mvt_new.output_nature}}
|
||||||
|
{{/if}}
|
||||||
|
de {{$eqpmt.designation}} (qté : {{$mvt_new.amount}}) à la date du {{$mvt_new.date|date_short}} »
|
||||||
|
</p>
|
||||||
|
{{else}}
|
||||||
|
{{* vérification réussie : enregistrer le mouvement modifié *}}
|
||||||
|
{{:assign mvt_key=""|uuid}}
|
||||||
|
{{:save
|
||||||
|
key=$mvt_key
|
||||||
|
validate_schema="movement.schema.json"
|
||||||
|
type="movement"
|
||||||
|
direction=$_GET.direction
|
||||||
|
input_nature=$mvt_new.input_nature
|
||||||
|
output_nature=$mvt_new.output_nature
|
||||||
|
amount=$mvt_new.amount|intval
|
||||||
|
equipment=$eqpmt_key
|
||||||
|
date=$mvt_new.date
|
||||||
|
comment=$mvt_new.comment
|
||||||
|
}}
|
||||||
|
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{:form_errors}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{*
|
||||||
|
-------------------- Préparer la saisie --------------------
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{* récupérer les infos de la catégorie *}}
|
||||||
|
{{#load key=$eqpmt.category assign="category"}}{{/load}}
|
||||||
|
|
||||||
{{* formulaire de copie du mouvement *}}
|
{{* formulaire de copie du mouvement *}}
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
|
|
||||||
<fieldset class="%s"|args:direction>
|
<fieldset>
|
||||||
{{if $direction == "input"}}
|
{{if $_GET.direction == "input"}}
|
||||||
<legend>Créer une copie de l'entrée « {{$input_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
<legend>Créer une copie de l'entrée « {{$mvt_nature}} {{$eqpmt.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_labels default=$type_defaut}}
|
{{:input type="select" name="nature_operation" label="Type" required=true options=$input_labels default=$nature_defaut}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<legend>Créer une copie de la sortie « {{$output_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
<legend>Créer une copie de la sortie « {{$mvt_nature}} {{$eqpmt.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="select" name="type_operation" label="Type" required=true options=$output_labels default=$type_defaut}}
|
{{:input type="select" name="nature_operation" label="Type" required=true options=$output_labels default=$nature_defaut}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
{{:input type="date" name="date" label="Date" required=true default=$mvt_new.date}}
|
||||||
{{:input type="text" name="designation" label="Matériel" disabled=true default=$eqpmt_init.designation}}
|
{{:input type="text" name="designation" label="Matériel" disabled=true default=$eqpmt.designation}}
|
||||||
{{:input type="text" name="category" label="Catégorie" disabled=true default=$category.name}}
|
{{:input type="text" name="category" label="Catégorie" disabled=true default=$category.name}}
|
||||||
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_copie.amount}}
|
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}}
|
||||||
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_copie.comment}}
|
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -15,25 +15,25 @@
|
|||||||
{{:admin_header title="Modifier une %s"|args:$msg_direction current="module_equipment"}}
|
{{:admin_header title="Modifier une %s"|args:$msg_direction current="module_equipment"}}
|
||||||
|
|
||||||
{{* récupérer les infos du mouvement à modifier *}}
|
{{* récupérer les infos du mouvement à modifier *}}
|
||||||
{{#load key=$_GET.key assign="mvt_modif"}}
|
{{#load key=$_GET.key assign="mvt_new"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:error message="Aucune %s avec la clé %s"|args:$msg_direction:$_GET.key}}
|
{{:error message="Aucune %s avec la clé %s"|args:$msg_direction:$_GET.key}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
|
{{* infos pour affichage *}}
|
||||||
{{if $_GET.direction == "input"}}
|
{{if $_GET.direction == "input"}}
|
||||||
{{:assign input_init=$mvt_modif.input_nature}}
|
{{:assign mvt_nature=$mvt_new.input_nature}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign output_init=$mvt_modif.output_nature}}
|
{{:assign mvt_nature=$mvt_new.output_nature}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{:assign amount_init=$mvt_new.amount}}
|
||||||
{{:assign amount_init=$mvt_modif.amount}}
|
{{:assign date_init=$mvt_new.date|date_short}}
|
||||||
{{:assign date_init=$mvt_modif.date|date_short}}
|
{{:assign eqpmt_key=$mvt_new.equipment}}
|
||||||
{{:assign key_eqpmt_init=$mvt_modif.equipment}}
|
|
||||||
|
|
||||||
{{* récupérer les infos du matériel associé *}}
|
{{* récupérer les infos du matériel associé *}}
|
||||||
{{#load key=$key_eqpmt_init assign="eqpmt_init"}}
|
{{#load key=$eqpmt_key assign="eqpmt"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:error message="Aucun matériel avec la clé « %s »"|args:$key_eqpmt_init}}
|
{{:error message="Aucun matériel avec la clé « %s »"|args:$eqpmt_key}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
@ -43,7 +43,7 @@
|
|||||||
{{* types d'entrées *}}
|
{{* types d'entrées *}}
|
||||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
{{#foreach from=$config.input_nature key="label" item="type"}}
|
||||||
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
||||||
{{if $label == $mvt_modif.input_nature}}
|
{{if $label == $mvt_new.input_nature}}
|
||||||
{{:assign nature_defaut=$label}}
|
{{:assign nature_defaut=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
@ -51,7 +51,7 @@
|
|||||||
{{* types de sorties *}}
|
{{* types de sorties *}}
|
||||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||||
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
||||||
{{if $label == $mvt_modif.output_nature}}
|
{{if $label == $mvt_new.output_nature}}
|
||||||
{{:assign nature_defaut=$label}}
|
{{:assign nature_defaut=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
@ -60,32 +60,38 @@
|
|||||||
{{*
|
{{*
|
||||||
-------------------- Traiter la saisie --------------------
|
-------------------- Traiter la saisie --------------------
|
||||||
*}}
|
*}}
|
||||||
{{#form on="change"}}
|
{{#form on="save"}}
|
||||||
{{if $_POST.amount <= 0}}
|
{{if $_POST.amount <= 0}}
|
||||||
{{:error message="La quantité (%s) doit être strictement positive !!"|args:$_POST.amount}}
|
{{:error message="La quantité (%s) doit être strictement positive !!"|args:$_POST.amount}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* préparer le mouvement modifié *}}
|
{{* préparer le mouvement modifié *}}
|
||||||
{{if $_GET.direction == "input"}}
|
{{if $_GET.direction == "input"}}
|
||||||
{{:assign var="mvt_modif.input_nature" from="input_labels.%s"|args:$_POST.nature_operation}}
|
{{:assign var="mvt_new.input_nature" value=$_POST.nature_operation}}
|
||||||
{{:assign var=type_mvt from="config.input_nature.%s"|args:$mvt_modif.input_nature}}
|
{{:assign var="type_mvt" from="config.input_nature.%s"|args:$mvt_new.input_nature}}
|
||||||
|
{{if $type_mvt == "temporaire"}}
|
||||||
|
{{:assign prop=0}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop=1}}
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign var="mvt_modif.output_nature" from="output_labels.%s"|args:$_POST.nature_operation}}
|
{{:assign var="mvt_new.output_nature" value=$_POST.nature_operation}}
|
||||||
{{:assign var=type_mvt from="config.outut_nature.%s"|args:$mvt_modif.input_nature}}
|
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$mvt_new.output_nature}}
|
||||||
|
{{if $type_mvt == "retour"}}
|
||||||
|
{{:assign prop=0}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop=1}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $type_mvt == "temporaire"}}
|
|
||||||
{{:assign prop=0}}
|
{{:assign var="mvt_new.amount" value=$_POST.amount}}
|
||||||
{{else}}
|
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
|
||||||
{{:assign prop=1}}
|
{{:assign var="mvt_new.comment" value=$_POST.comment}}
|
||||||
{{/if}}
|
|
||||||
{{:assign var="mvt_modif.amount" value=$_POST.amount}}
|
|
||||||
{{:assign var="mvt_modif.equipment" value=$key_eqpmt_init}}
|
|
||||||
{{:assign var="mvt_modif.date" value=$_POST.date|parse_date}}
|
|
||||||
{{:assign var="mvt_modif.comment" value=$_POST.comment}}
|
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
lister les mouvements et remplacer le mouvement sélectionné par sa version modifiée
|
lister les mouvements
|
||||||
en l'insérant à sa place par date croissante
|
- ignorer le mouvement à modifier
|
||||||
|
- insérer le mvt modifié à sa place par date croissante
|
||||||
*}}
|
*}}
|
||||||
{{:assign insere=false}}
|
{{:assign insere=false}}
|
||||||
{{#load
|
{{#load
|
||||||
@ -93,59 +99,60 @@
|
|||||||
$$.type = 'movement'
|
$$.type = 'movement'
|
||||||
AND
|
AND
|
||||||
$$.equipment = :eqpmt_key"
|
$$.equipment = :eqpmt_key"
|
||||||
:eqpmt_key=$key_eqpmt_init
|
:eqpmt_key=$eqpmt_key
|
||||||
order="$$.date"
|
order="$$.date"
|
||||||
assign="movement"
|
assign="movement"
|
||||||
}}
|
}}
|
||||||
{{if $key != $_GET.key}}
|
{{if $key != $_GET.key}}
|
||||||
{{if $_GET.direction == "input" && ! $insere && $date >= $mvt_modif.date}}
|
{{if! $insere}}
|
||||||
{{:assign var="movements_modif." from=mvt_modif}}
|
{{if
|
||||||
{{:assign insere=true}}
|
$_GET.direction == "input" && $date >= $mvt_new.date ||
|
||||||
{{elseif $_GET.direction == "output" && ! $insere && $date > $mvt_modif.date}}
|
$_GET.direction == "output" && $date > $mvt_new.date
|
||||||
{{:assign var="movements_modif." from=mvt_modif}}
|
}}
|
||||||
{{:assign insere=true}}
|
{{:assign var="movements_new." from=mvt_new}}
|
||||||
|
{{:assign insere=true}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign var="movements_modif." from=movement}}
|
{{:assign var="movements_new." from=movement}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{if ! $insere}}
|
{{if ! $insere}}
|
||||||
{{:assign var="movements_modif." from=mvt_modif}}
|
{{:assign var="movements_new." from=mvt_new}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* Vérifier la cohérence des mouvements du matériel *}}
|
{{* Vérifier la cohérence des mouvements du matériel *}}
|
||||||
{{:include
|
{{:include
|
||||||
file="./valider_modification.html"
|
file="./valider_modification.html"
|
||||||
keep="erreur"
|
keep="erreur"
|
||||||
movements=$movements_modif
|
movements=$movements_new
|
||||||
eqpmt_key=$key_eqpmt_init
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{if $erreur}}
|
{{if $erreur}}
|
||||||
<p class="block error">
|
<p class="block error">
|
||||||
Modification demandée impossible :
|
Modification demandée impossible :
|
||||||
{{if $_GET.direction == "input"}}
|
« {{$mvt_nature}} de {{$eqpmt.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||||
{{$input_init}} de « {{$eqpmt_init.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
{{if $_GET.direction == "input"}}
|
||||||
« {{$mvt_modif.input_nature}} de {{$eqpmt_init.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
« {{$mvt_new.input_nature}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{$output_init}} de « {{$eqpmt_init.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
« {{$mvt_new.output_nature}}
|
||||||
« {{$mvt_modif.output_nature}} de {{$eqpmt_init.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
{{/if}}
|
||||||
{{/if}}
|
de {{$eqpmt.designation}} (qté : {{$mvt_new.amount}}) à la date du {{$mvt_new.date|date_short}} »
|
||||||
</p>
|
</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* vérification réussie : modifier le mouvement *}}
|
{{* vérification réussie : enregistrer le mouvement modifié *}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$_GET.key
|
key=$_GET.key
|
||||||
validate_schema="./movement.schema.json"
|
validate_schema="movement.schema.json"
|
||||||
type="movement"
|
type="movement"
|
||||||
direction=$_GET.direction
|
direction=$_GET.direction
|
||||||
input_nature=$mvt_modif.input_nature
|
input_nature=$mvt_new.input_nature
|
||||||
output_nature=$mvt_modif.output_nature
|
output_nature=$mvt_new.output_nature
|
||||||
amount=$mvt_modif.amount|intval
|
amount=$mvt_new.amount|intval
|
||||||
equipment=$key_eqpmt_init
|
equipment=$eqpmt_key
|
||||||
date=$mvt_modif.date
|
date=$mvt_new.date
|
||||||
comment=$mvt_modif.comment
|
comment=$mvt_new.comment
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=modification"|args:$key_eqpmt_init:$prop}}
|
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
@ -155,31 +162,32 @@
|
|||||||
-------------------- Préparer la saisie --------------------
|
-------------------- Préparer la saisie --------------------
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* lister les catégories et matériels associés *}}
|
{{* récupérer les infos de la catégorie *}}
|
||||||
{{#load key=$eqpmt_init.category assign="category"}}{{/load}}
|
{{#load key=$eqpmt.category assign="category"}}{{/load}}
|
||||||
|
|
||||||
{{* formulaire de modification du mouvement *}}
|
{{* formulaire de modification du mouvement *}}
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
|
|
||||||
<fieldset class="entree">
|
<fieldset>
|
||||||
{{if $_GET.direction == "input"}}
|
{{if $_GET.direction == "input"}}
|
||||||
<legend>Modifier l'entrée « {{$input_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
<legend>Modifier l'entrée « {{$mvt_nature}} {{$eqpmt.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="select" name="nature_operation" label="Type" required=true options=$input_labels default=$nature_defaut}}
|
{{:input type="select" name="nature_operation" label="Type" required=true options=$input_labels default=$nature_defaut}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<legend>Modifier la sortie « {{$output_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
<legend>Modifier la sortie « {{$mvt_nature}} {{$eqpmt.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="select" name="nature_operation" label="Type" required=true options=$output_labels default=$nature_defaut}}
|
{{:input type="select" name="nature_operation" label="Type" required=true options=$output_labels default=$nature_defaut}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$mvt_modif.date}}
|
{{:input type="date" name="date" label="Date" required=true default=$mvt_new.date}}
|
||||||
{{:input type="text" name="designation" label="Matériel" disabled=true default=$eqpmt_init.designation}}
|
{{:input type="text" name="designation" label="Matériel" disabled=true default=$eqpmt.designation}}
|
||||||
{{:input type="text" name="category" label="Catégorie" disabled=true default=$category.name}}
|
{{:input type="text" name="category" label="Catégorie" disabled=true default=$category.name}}
|
||||||
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_modif.amount}}
|
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}}
|
||||||
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_modif.comment}}
|
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
{{:button type="submit" name="change" label="Enregistrer" shape="right" class="main"}}
|
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
@ -106,13 +106,13 @@
|
|||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{* Extraire et compiler les infos de la base *}}
|
{{* Extraire et compiler les infos de la base *}}
|
||||||
{{:include file="../../_calcul_dispo.html" keep="equipments"}}
|
{{:include file="../../_calcul_dispo.html" keep="categories,equipments"}}
|
||||||
{{:assign var=present from="equipments.%s.nonproprio"|args:$_GET.key}}
|
{{:assign var=present from="equipments.%s.nonproprio"|args:$_GET.key}}
|
||||||
|
|
||||||
{{if $present > 0}}
|
{{if $present > 0}}
|
||||||
{{* déterminer le matériel concerné par le mouvement *}}
|
{{* déterminer le matériel concerné par le mouvement *}}
|
||||||
{{#load key=$_GET.key assign="equipment"}}
|
{{#load key=$_GET.key assign="equipment"}}{{/load}}
|
||||||
{{/load}}
|
{{:assign var=cat_name from=categories.%s|args:$equipment.category}}
|
||||||
|
|
||||||
{{* formulaire de sortie de matériel *}}
|
{{* formulaire de sortie de matériel *}}
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
@ -122,7 +122,8 @@
|
|||||||
{{:input type="select" name="type_operation" label="Type" required=true options=$output_labels}}
|
{{:input type="select" name="type_operation" label="Type" required=true options=$output_labels}}
|
||||||
{{:input type="date" name="date" label="Date de sortie" required=true default=$now|date_short}}
|
{{:input type="date" name="date" label="Date de sortie" required=true default=$now|date_short}}
|
||||||
{{:input type="text" name="equipment" label="Matériel" required=true disabled=true default=$equipment.designation}}
|
{{:input type="text" name="equipment" label="Matériel" required=true disabled=true default=$equipment.designation}}
|
||||||
{{:input type="text" name="present" label="Qté présente" disabled=true default=$present}}
|
{{:input type="text" name="category" label="Catégorie" required=true disabled=true default=$cat_name}}
|
||||||
|
{{:input type="text" name="present" label="Quantité présente" disabled=true default=$present}}
|
||||||
<p><span class="alert">La quantité présente est celle à la date du jour</span></p>
|
<p><span class="alert">La quantité présente est celle à la date du jour</span></p>
|
||||||
{{:input type="number" name="quantite" label="Quantité" required=true default=1 min=1}}
|
{{:input type="number" name="quantite" label="Quantité" required=true default=1 min=1}}
|
||||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||||
|
@ -143,7 +143,7 @@
|
|||||||
{{:input type="date" name="date" label="Date de sortie" required=true default=$now|date_short}}
|
{{:input type="date" name="date" label="Date de sortie" required=true default=$now|date_short}}
|
||||||
{{:input type="text" name="equipment" label="Matériel" required=true disabled=true default=$equipment.designation}}
|
{{:input type="text" name="equipment" label="Matériel" required=true disabled=true default=$equipment.designation}}
|
||||||
{{:input type="text" name="category" label="Catégorie" required=true disabled=true default=$cat_name}}
|
{{:input type="text" name="category" label="Catégorie" required=true disabled=true default=$cat_name}}
|
||||||
{{:input type="text" name="dispo" label="Qté disponible" disabled=true default=$dispo}}
|
{{:input type="text" name="dispo" label="Quantité disponible" disabled=true default=$dispo}}
|
||||||
<p><span class="alert">La quantité indiquée est celle à la date du jour</span></p>
|
<p><span class="alert">La quantité indiquée est celle à la date du jour</span></p>
|
||||||
{{:input type="number" name="quantite" label="Quantité" required=true default=1 min=1}}
|
{{:input type="number" name="quantite" label="Quantité" required=true default=1 min=1}}
|
||||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
Vérifier la cohérence des E/S d'un matériel
|
Vérifier la cohérence des E/S d'un matériel
|
||||||
- paramètres :
|
- paramètres :
|
||||||
- movements : liste de mouvements
|
- movements : liste de mouvements d'un matériel
|
||||||
- eqpmt_key : clé du matériel à vérifier
|
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
@ -13,33 +12,33 @@
|
|||||||
{{:assign stock=0}}
|
{{:assign stock=0}}
|
||||||
{{:assign exterieur=0}}
|
{{:assign exterieur=0}}
|
||||||
{{:assign nonprop=0}}
|
{{:assign nonprop=0}}
|
||||||
|
|
||||||
{{#foreach from=$movements item="mvt"}}
|
{{#foreach from=$movements item="mvt"}}
|
||||||
{{* déterminer le type de mouvement *}}
|
{{* déterminer le type de mouvement *}}
|
||||||
{{:assign var="mvt_nature" from="mvt.%s_nature"|args:$mvt.direction}}
|
{{: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}}
|
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$mvt.direction:$mvt_nature}}
|
||||||
|
|
||||||
{{if $mvt.equipment == $eqpmt_key}}
|
{{if $mvt.direction == 'input'}}
|
||||||
{{if $mvt.direction == 'input'}}
|
{{if $type_mvt == 'définitif'}}
|
||||||
{{if $type_mvt == 'définitif'}}
|
{{:assign stock="%d+%d"|math:$stock:$mvt.amount}}
|
||||||
{{:assign stock="%d+%d"|math:$stock:$mvt.amount}}
|
{{elseif $type_mvt == 'retour'}}
|
||||||
{{elseif $type_mvt == 'retour'}}
|
{{:assign exterieur="%d-%d"|math:$exterieur:$mvt.amount}}
|
||||||
{{:assign exterieur="%d-%d"|math:$exterieur:$mvt.amount}}
|
{{elseif $type_mvt == 'temporaire'}}
|
||||||
{{elseif $type_mvt == 'temporaire'}}
|
{{:assign nonprop="%d+%d"|math:$nonprop:$mvt.amount}}
|
||||||
{{: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}}
|
{{/if}}
|
||||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
{{elseif $mvt.direction == 'output'}}
|
||||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonprop < 0}}
|
{{if $type_mvt == 'définitif'}}
|
||||||
{{:assign erreur=true}}
|
{{:assign stock="%d-%d"|math:$stock:$mvt.amount}}
|
||||||
{{:break}}
|
{{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}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||||
|
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonprop < 0}}
|
||||||
|
{{:assign erreur=true}}
|
||||||
|
{{:break}}
|
||||||
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
Loading…
Reference in New Issue
Block a user