Compare commits
No commits in common. "e8da8098301f23da61895d2198fa7007943856d0" and "1c395c48e0d4be6cb570d27f8c82ec84e5193aaa" have entirely different histories.
e8da809830
...
1c395c48e0
125
historique.html
125
historique.html
@ -10,11 +10,21 @@
|
|||||||
- 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}}
|
||||||
@ -34,25 +44,12 @@
|
|||||||
{{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 types de mouvements selon l'affection du matériel *}}
|
{{* déterminer les type 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 *}}
|
||||||
@ -81,95 +78,12 @@
|
|||||||
{{/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>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#list
|
{{#list
|
||||||
type="movement"
|
type="movement"
|
||||||
@ -177,28 +91,30 @@
|
|||||||
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mvt';
|
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';
|
CASE $$.direction WHEN 'input' THEN $$.input_nature WHEN 'output' THEN $$.output_nature END AS 'Opération';
|
||||||
$$.amount AS 'Quantité';
|
$$.amount AS 'Quantité';
|
||||||
"" as 'Présent';
|
|
||||||
$$.comment AS 'Commentaire'"
|
$$.comment AS 'Commentaire'"
|
||||||
equipment=$equipment_key
|
equipment=$equipment_key
|
||||||
order=1
|
order=1
|
||||||
}}
|
}}
|
||||||
{{:assign var="type_mvt" from="config.%s_nature.%s"|args:$direction:$col3}}
|
{{: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 ||
|
{{if $direction === "input" && $input_nature|in:$input_types ||
|
||||||
$direction === "output"&& $output_nature|in:$output_types
|
$direction === "output"&& $output_nature|in:$output_types
|
||||||
}}
|
}}
|
||||||
{{:assign var="stock" from="quantites.%s.nonproprio"|args:$id}}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$date|date_short}}</td>
|
<td>{{$date|date_short}}</td>
|
||||||
<td>{{$col2}}</td>
|
<td>{{$col2}}</td>
|
||||||
<td>{{$col3}}</td>
|
<td>{{$col3}}</td>
|
||||||
<td>{{$amount}}</td>
|
<td>{{$amount}}</td>
|
||||||
<td>{{$stock}}</td>
|
|
||||||
<td>{{$comment}}</td>
|
<td>{{$comment}}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Dupliquer"
|
label="Dupliquer"
|
||||||
href="mouvements/dupliquer_mouvement.html?key=%s&direction=%s&prop=%s"|args:$key:$direction:$_GET.prop
|
href="mouvements/dupliquer_mouvement.html?key=%s&direction=%s"|args:$key:$direction
|
||||||
shape="plus"
|
shape="plus"
|
||||||
target="_dialog"}}
|
target="_dialog"}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
@ -215,6 +131,5 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/list}}
|
{{/list}}
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
Dupliquer un mouvement
|
Dupliquer un mouvement
|
||||||
paramètres :
|
paramètres :
|
||||||
- key : clé du mouvement à dupliquer
|
- key : clé du mouvement à dupliquer
|
||||||
- direction du mouvement à dupliquer
|
- direction du mouvement input/output)
|
||||||
- prop = 1 si matériel appartient à l'asso
|
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{if $_GET.direction == "input"}}
|
{{if $_GET.direction == "input"}}
|
||||||
@ -15,58 +14,55 @@
|
|||||||
{{/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=$_GET.key assign="mvt_new"}}
|
{{#load key=$mvt_key assign="mvt_copie"}}
|
||||||
{{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:$mvt_key}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
{{if $direction == "input"}}
|
||||||
{{* infos pour affichage *}}
|
{{:assign input_init=$mvt_copie.input_nature}}
|
||||||
{{if $_GET.direction == "input"}}
|
{{:assign url="entrees/index.html"}}
|
||||||
{{:assign mvt_nature=$mvt_new.input_nature}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign mvt_nature=$mvt_new.output_nature}}
|
{{:assign output_init=$mvt_copie.output_nature}}
|
||||||
|
{{:assign url="sorties/index.html"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign amount_init=$mvt_new.amount}}
|
{{:assign amount_init=$mvt_copie.amount}}
|
||||||
{{:assign date_init=$mvt_new.date|date_short}}
|
{{:assign date_init=$mvt_copie.date|date_short}}
|
||||||
{{:assign eqpmt_key=$mvt_new.equipment}}
|
{{:assign key_eqpmt_init=$mvt_copie.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"}}
|
||||||
|
|
||||||
{{* limiter les opérations possibles *}}
|
{{if $direction == "input"}}
|
||||||
{{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"}}
|
||||||
{{if $_GET.prop && $type != "temporaire" ||
|
|
||||||
! $_GET.prop && $type == "temporaire"
|
|
||||||
}}
|
|
||||||
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
||||||
{{/if}}
|
{{if $label == $mvt_copie.input_nature}}
|
||||||
{{if $label == $mvt_new.input_nature}}
|
{{:assign type_defaut=$label}}
|
||||||
{{: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"}}
|
||||||
{{if $_GET.prop && $type != "retour" ||
|
|
||||||
! $_GET.prop && $type == "retour"
|
|
||||||
}}
|
|
||||||
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
||||||
{{/if}}
|
{{if $label == $mvt_copie.output_nature}}
|
||||||
{{if $label == $mvt_new.output_nature}}
|
{{:assign type_defaut=$label}}
|
||||||
{{: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 --------------------
|
||||||
*}}
|
*}}
|
||||||
@ -76,121 +72,64 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* préparer le mouvement copié *}}
|
{{* préparer le mouvement copié *}}
|
||||||
{{if $_GET.direction == "input"}}
|
{{if $direction == "input"}}
|
||||||
{{:assign var="mvt_new.input_nature" value=$_POST.nature_operation}}
|
{{:assign var="mvt_copie.input_nature" from="input_labels.%s"|args:$_POST.type_operation}}
|
||||||
{{:assign var="type_mvt" from="config.input_nature.%s"|args:$mvt_new.input_nature}}
|
{{:assign var="type_mvt" from="config.input_nature.%s"|args:$mvt_copie.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_new.output_nature" value=$_POST.nature_operation}}
|
{{:assign var="mvt_copie.output_nature" from="output_labels.%s"|args:$_POST.type_operation}}
|
||||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$mvt_new.output_nature}}
|
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$mvt_copie.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}}
|
||||||
|
|
||||||
{{:assign var="mvt_new.amount" value=$_POST.amount}}
|
{{* Enregistrer le mouvement *}}
|
||||||
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
|
|
||||||
{{:assign var="mvt_new.comment" value=$_POST.comment}}
|
|
||||||
|
|
||||||
{{*
|
|
||||||
lister les mouvements
|
|
||||||
- insérer le mvt copié à sa place par date croissante
|
|
||||||
*}}
|
|
||||||
{{:assign insere=false}}
|
|
||||||
{{#load
|
|
||||||
where="
|
|
||||||
$$.type = 'movement'
|
|
||||||
AND
|
|
||||||
$$.equipment = :eqpmt_key"
|
|
||||||
:eqpmt_key=$eqpmt_key
|
|
||||||
order="$$.date"
|
|
||||||
assign="movement"
|
|
||||||
}}
|
|
||||||
{{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}}
|
{{:assign mvt_key=""|uuid}}
|
||||||
{{:save
|
{{:save
|
||||||
key=$mvt_key
|
key=$mvt_key
|
||||||
validate_schema="movement.schema.json"
|
validate_schema="movement.schema.json"
|
||||||
type="movement"
|
type="movement"
|
||||||
direction=$_GET.direction
|
direction=$direction
|
||||||
input_nature=$mvt_new.input_nature
|
input_nature=$mvt_copie.input_nature
|
||||||
output_nature=$mvt_new.output_nature
|
output_nature=$mvt_copie.output_nature
|
||||||
amount=$mvt_new.amount|intval
|
amount=$mvt_copie.amount|intval
|
||||||
equipment=$eqpmt_key
|
equipment=$key_eqpmt_init
|
||||||
date=$mvt_new.date
|
date=$mvt_copie.date
|
||||||
comment=$mvt_new.comment
|
comment=$mvt_copie.comment
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}}
|
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=%s"|args:$key_eqpmt_init:$prop:$msg_direction}}
|
||||||
{{/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>
|
<fieldset class="%s"|args:direction>
|
||||||
{{if $_GET.direction == "input"}}
|
{{if $direction == "input"}}
|
||||||
<legend>Créer une copie de l'entrée « {{$mvt_nature}} {{$eqpmt.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
<legend>Créer une copie de l'entrée « {{$input_init}} {{$eqpmt_init.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="type_operation" label="Type" required=true options=$input_labels default=$type_defaut}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<legend>Créer une copie de la sortie « {{$mvt_nature}} {{$eqpmt.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
<legend>Créer une copie de la sortie « {{$output_init}} {{$eqpmt_init.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="type_operation" label="Type" required=true options=$output_labels default=$type_defaut}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$mvt_new.date}}
|
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||||
{{:input type="text" name="designation" label="Matériel" disabled=true default=$eqpmt.designation}}
|
{{:input type="text" name="designation" label="Matériel" disabled=true default=$eqpmt_init.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_new.amount}}
|
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_copie.amount}}
|
||||||
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}}
|
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_copie.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_new"}}
|
{{#load key=$_GET.key assign="mvt_modif"}}
|
||||||
{{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 mvt_nature=$mvt_new.input_nature}}
|
{{:assign input_init=$mvt_modif.input_nature}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign mvt_nature=$mvt_new.output_nature}}
|
{{:assign output_init=$mvt_modif.output_nature}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign amount_init=$mvt_new.amount}}
|
|
||||||
{{:assign date_init=$mvt_new.date|date_short}}
|
{{:assign amount_init=$mvt_modif.amount}}
|
||||||
{{:assign eqpmt_key=$mvt_new.equipment}}
|
{{:assign date_init=$mvt_modif.date|date_short}}
|
||||||
|
{{: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=$eqpmt_key assign="eqpmt"}}
|
{{#load key=$key_eqpmt_init assign="eqpmt_init"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:error message="Aucun matériel avec la clé « %s »"|args:$eqpmt_key}}
|
{{:error message="Aucun matériel avec la clé « %s »"|args:$key_eqpmt_init}}
|
||||||
{{/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_new.input_nature}}
|
{{if $label == $mvt_modif.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_new.output_nature}}
|
{{if $label == $mvt_modif.output_nature}}
|
||||||
{{:assign nature_defaut=$label}}
|
{{:assign nature_defaut=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
@ -60,38 +60,32 @@
|
|||||||
{{*
|
{{*
|
||||||
-------------------- Traiter la saisie --------------------
|
-------------------- Traiter la saisie --------------------
|
||||||
*}}
|
*}}
|
||||||
{{#form on="save"}}
|
{{#form on="change"}}
|
||||||
{{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_new.input_nature" value=$_POST.nature_operation}}
|
{{:assign var="mvt_modif.input_nature" from="input_labels.%s"|args:$_POST.nature_operation}}
|
||||||
{{:assign var="type_mvt" from="config.input_nature.%s"|args:$mvt_new.input_nature}}
|
{{:assign var=type_mvt from="config.input_nature.%s"|args:$mvt_modif.input_nature}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign var="mvt_modif.output_nature" from="output_labels.%s"|args:$_POST.nature_operation}}
|
||||||
|
{{:assign var=type_mvt from="config.outut_nature.%s"|args:$mvt_modif.input_nature}}
|
||||||
|
{{/if}}
|
||||||
{{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}}
|
{{:assign var="mvt_modif.amount" value=$_POST.amount}}
|
||||||
{{:assign var="mvt_new.output_nature" value=$_POST.nature_operation}}
|
{{:assign var="mvt_modif.equipment" value=$key_eqpmt_init}}
|
||||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$mvt_new.output_nature}}
|
{{:assign var="mvt_modif.date" value=$_POST.date|parse_date}}
|
||||||
{{if $type_mvt == "retour"}}
|
{{:assign var="mvt_modif.comment" value=$_POST.comment}}
|
||||||
{{:assign prop=0}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign prop=1}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{:assign var="mvt_new.amount" value=$_POST.amount}}
|
|
||||||
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
|
|
||||||
{{:assign var="mvt_new.comment" value=$_POST.comment}}
|
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
lister les mouvements
|
lister les mouvements et remplacer le mouvement sélectionné par sa version modifiée
|
||||||
- ignorer le mouvement à modifier
|
en l'insérant à sa place par date croissante
|
||||||
- insérer le mvt modifié à sa place par date croissante
|
|
||||||
*}}
|
*}}
|
||||||
{{:assign insere=false}}
|
{{:assign insere=false}}
|
||||||
{{#load
|
{{#load
|
||||||
@ -99,60 +93,59 @@
|
|||||||
$$.type = 'movement'
|
$$.type = 'movement'
|
||||||
AND
|
AND
|
||||||
$$.equipment = :eqpmt_key"
|
$$.equipment = :eqpmt_key"
|
||||||
:eqpmt_key=$eqpmt_key
|
:eqpmt_key=$key_eqpmt_init
|
||||||
order="$$.date"
|
order="$$.date"
|
||||||
assign="movement"
|
assign="movement"
|
||||||
}}
|
}}
|
||||||
{{if $key != $_GET.key}}
|
{{if $key != $_GET.key}}
|
||||||
{{if! $insere}}
|
{{if $_GET.direction == "input" && ! $insere && $date >= $mvt_modif.date}}
|
||||||
{{if
|
{{:assign var="movements_modif." from=mvt_modif}}
|
||||||
$_GET.direction == "input" && $date >= $mvt_new.date ||
|
{{:assign insere=true}}
|
||||||
$_GET.direction == "output" && $date > $mvt_new.date
|
{{elseif $_GET.direction == "output" && ! $insere && $date > $mvt_modif.date}}
|
||||||
}}
|
{{:assign var="movements_modif." from=mvt_modif}}
|
||||||
{{:assign var="movements_new." from=mvt_new}}
|
|
||||||
{{:assign insere=true}}
|
{{: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_new." from=mvt_new}}
|
{{:assign var="movements_modif." from=mvt_modif}}
|
||||||
{{/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_new
|
movements=$movements_modif
|
||||||
|
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 :
|
||||||
« {{$mvt_nature}} de {{$eqpmt.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
|
||||||
{{if $_GET.direction == "input"}}
|
{{if $_GET.direction == "input"}}
|
||||||
« {{$mvt_new.input_nature}}
|
{{$input_init}} de « {{$eqpmt_init.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||||
|
« {{$mvt_modif.input_nature}} de {{$eqpmt_init.designation}} (qté : {{$mvt_modif.amount}}) à la date du {{$mvt_modif.date|date_short}} »
|
||||||
{{else}}
|
{{else}}
|
||||||
« {{$mvt_new.output_nature}}
|
{{$output_init}} de « {{$eqpmt_init.designation}} (qté : {{$amount_init}}) en date du {{$date_init}} » vers
|
||||||
|
« {{$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 : enregistrer le mouvement modifié *}}
|
{{* vérification réussie : modifier le mouvement *}}
|
||||||
{{: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_new.input_nature
|
input_nature=$mvt_modif.input_nature
|
||||||
output_nature=$mvt_new.output_nature
|
output_nature=$mvt_modif.output_nature
|
||||||
amount=$mvt_new.amount|intval
|
amount=$mvt_modif.amount|intval
|
||||||
equipment=$eqpmt_key
|
equipment=$key_eqpmt_init
|
||||||
date=$mvt_new.date
|
date=$mvt_modif.date
|
||||||
comment=$mvt_new.comment
|
comment=$mvt_modif.comment
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
|
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=modification"|args:$key_eqpmt_init:$prop}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
@ -162,32 +155,31 @@
|
|||||||
-------------------- Préparer la saisie --------------------
|
-------------------- Préparer la saisie --------------------
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* récupérer les infos de la catégorie *}}
|
{{* lister les catégories et matériels associés *}}
|
||||||
{{#load key=$eqpmt.category assign="category"}}{{/load}}
|
{{#load key=$eqpmt_init.category assign="category"}}{{/load}}
|
||||||
|
|
||||||
{{* formulaire de modification du mouvement *}}
|
{{* formulaire de modification du mouvement *}}
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
|
|
||||||
<fieldset>
|
<fieldset class="entree">
|
||||||
{{if $_GET.direction == "input"}}
|
{{if $_GET.direction == "input"}}
|
||||||
<legend>Modifier l'entrée « {{$mvt_nature}} {{$eqpmt.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
<legend>Modifier l'entrée « {{$input_init}} {{$eqpmt_init.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 « {{$mvt_nature}} {{$eqpmt.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
<legend>Modifier la sortie « {{$output_init}} {{$eqpmt_init.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_new.date}}
|
{{:input type="date" name="date" label="Date" required=true default=$mvt_modif.date}}
|
||||||
{{:input type="text" name="designation" label="Matériel" disabled=true default=$eqpmt.designation}}
|
{{:input type="text" name="designation" label="Matériel" disabled=true default=$eqpmt_init.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_new.amount}}
|
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_modif.amount}}
|
||||||
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}}
|
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_modif.comment}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
{{:button type="submit" name="change" 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="categories,equipments"}}
|
{{:include file="../../_calcul_dispo.html" keep="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}}
|
{{#load key=$_GET.key assign="equipment"}}
|
||||||
{{:assign var=cat_name from=categories.%s|args:$equipment.category}}
|
{{/load}}
|
||||||
|
|
||||||
{{* formulaire de sortie de matériel *}}
|
{{* formulaire de sortie de matériel *}}
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
@ -122,8 +122,7 @@
|
|||||||
{{: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="category" label="Catégorie" required=true disabled=true default=$cat_name}}
|
{{:input type="text" name="present" label="Qté présente" disabled=true default=$present}}
|
||||||
{{: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="Quantité disponible" disabled=true default=$dispo}}
|
{{:input type="text" name="dispo" label="Qté 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,7 +2,8 @@
|
|||||||
|
|
||||||
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 d'un matériel
|
- movements : liste de mouvements
|
||||||
|
- 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 *}}
|
||||||
@ -12,12 +13,12 @@
|
|||||||
{{: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}}
|
||||||
@ -35,10 +36,10 @@
|
|||||||
{{:assign nonprop="%d-%d"|math:$nonprop:$mvt.amount}}
|
{{:assign nonprop="%d-%d"|math:$nonprop:$mvt.amount}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonprop < 0}}
|
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonprop < 0}}
|
||||||
{{:assign erreur=true}}
|
{{:assign erreur=true}}
|
||||||
{{:break}}
|
{{:break}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
Loading…
Reference in New Issue
Block a user