Compare commits
7 Commits
74ee34104f
...
e8da809830
Author | SHA1 | Date | |
---|---|---|---|
e8da809830 | |||
e4ad0b6982 | |||
77b8f892cc | |||
d40b17ef2c | |||
1c395c48e0 | |||
11806b11da | |||
7364deda87 |
@ -3,35 +3,38 @@
|
||||
{{*
|
||||
Calcul des entrées/sorties de matériels à une date donnée
|
||||
paramètres :
|
||||
- category_keys : liste de clés de catégories
|
||||
- date : date supérieure des mouvements
|
||||
résultat : cumul_mvt,category_keys,equipments
|
||||
- key : clé du matériel concerné
|
||||
- cat_key : clé de la catégorie des matériels concernés
|
||||
- date
|
||||
résultat :
|
||||
- categories : tableau clé => nom
|
||||
- equipments : tableau clé => { clé cat, libellé mat, stock, exter, nonproprio }
|
||||
*}}
|
||||
|
||||
{{* liste des catégories *}}
|
||||
{{if $category_keys === null}}
|
||||
{{#load type="category"}}
|
||||
{{:assign var="cumul_mvt.%s.name"|args:$key value=$name}}
|
||||
{{* liste des matériels *}}
|
||||
{{:assign equipments=null}}
|
||||
{{if $_GET.key}}
|
||||
{{* le matériel paramètre *}}
|
||||
{{#load key=$_GET.key}}
|
||||
{{:assign var="equipments.%s.category"|args:$key value=$category}}
|
||||
{{:assign var="equipments.%s.designation"|args:$key value=$designation}}
|
||||
{{:assign var="in_equipments." value="'%s'"|args:$key}}
|
||||
{{/load}}
|
||||
{{elseif $_GET.cat_key}}
|
||||
{{* matériels de la catégorie paramètre *}}
|
||||
{{#load type="equipment" where="$$.category = :category_key" :category_key=$_GET.cat_key}}
|
||||
{{:assign var="equipments.%s.category"|args:$key value=$category}}
|
||||
{{:assign var="equipments.%s.designation"|args:$key value=$designation}}
|
||||
{{:assign var="in_equipments." value="'%s'"|args:$key}}
|
||||
{{/load}}
|
||||
{{else}}
|
||||
{{#load type="category" where="key"|sql_where:'IN':$category_keys}}
|
||||
{{:assign var="cumul_mvt.%s.name"|args:$key value=$name}}
|
||||
{{* tous les matériels *}}
|
||||
{{#load type="equipment"}}
|
||||
{{:assign var="equipments.%s.category"|args:$key value=$category}}
|
||||
{{:assign var="equipments.%s.designation"|args:$key value=$designation}}
|
||||
{{:assign var="in_equipments." value="'%s'"|args:$key}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
||||
{{#foreach from=$cumul_mvt key="cat_key" item="elem"}}
|
||||
{{:assign var="in_categories." value="'%s'"|args:$cat_key}}
|
||||
{{/foreach}}
|
||||
|
||||
{{:assign in_categories=$in_categories|implode:","}}
|
||||
{{:assign in_categories="("|cat:$in_categories|cat:")"}}
|
||||
|
||||
{{* liste des matériels dans les catégories passées en paramètre *}}
|
||||
{{#load type="equipment" where="$$.category IN %s"|args:$in_categories}}
|
||||
{{:assign var="equipments.%s.category"|args:$key value=$category}}
|
||||
{{:assign var="equipments.%s.designation"|args:$key value=$designation}}
|
||||
{{:assign var="in_equipments." value="'%s'"|args:$key}}
|
||||
{{/load}}
|
||||
{{:assign in_equipments=$in_equipments|implode:","}}
|
||||
{{:assign in_equipments="("|cat:$in_equipments|cat:")"}}
|
||||
|
||||
@ -109,12 +112,9 @@
|
||||
from=nonproprio}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{/load}}
|
||||
|
||||
{{* grouper les résultats par catégorie *}}
|
||||
{{#foreach from=$equipments key="eqpmt_key" item="eqpmt"}}
|
||||
{{:assign
|
||||
var="cumul_mvt.%s.eqpmt.%s"|args:$eqpmt.category:$eqpmt_key
|
||||
value=$eqpmt}}
|
||||
{{/foreach}}
|
||||
{{* catégories *}}
|
||||
{{#load type="category" order="$$.name"}}
|
||||
{{:assign var="categories.%s"|args:$key value=$name}}
|
||||
{{/load}}
|
||||
|
205
historique.html
205
historique.html
@ -10,21 +10,11 @@
|
||||
- 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.msg == "modification"}}
|
||||
<p class="block confirm">Modification enregistrée</p>
|
||||
{{elseif $_GET.msg == "copie"}}
|
||||
<p class="block confirm">Mouvement copié</p>
|
||||
{{elseif $_GET.msg == "suppression"}}
|
||||
<p class="block confirm">Mouvement supprimé</p>
|
||||
{{else}}
|
||||
@ -44,12 +34,25 @@
|
||||
{{else}}
|
||||
{{:assign proprio="nonproprio"}}
|
||||
{{/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}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{: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}}
|
||||
{{if $_GET.prop}}
|
||||
{{* matériel propriété de l'asso *}}
|
||||
@ -78,58 +81,140 @@
|
||||
{{/if}}
|
||||
{{/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 *}}
|
||||
{{if $_GET.prop}}
|
||||
<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}}
|
||||
<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}}
|
||||
|
||||
{{#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}}
|
||||
|
@ -22,11 +22,9 @@
|
||||
<p class="block error">Modification refusée</p>
|
||||
{{/if}}
|
||||
|
||||
{{#load type="category"}}
|
||||
{{:assign var="category_keys." value=$key}}
|
||||
{{/load}}
|
||||
{{#load type="category" count=true assign="result"}}{{/load}}
|
||||
|
||||
{{if $category_keys|count == 0}}
|
||||
{{if $result.count == 0}}
|
||||
<p class="block alert">Il n'y a aucune catégorie : vous devez en ajouter.</p>
|
||||
{{else}}
|
||||
{{if $_GET.prop == null || $_GET.prop}}
|
||||
|
@ -2,12 +2,28 @@
|
||||
|
||||
{{*
|
||||
inventaire des entrées/sorties des matériels permanents
|
||||
paramètres
|
||||
- category_keys : catégories dont on veut faire l'inventaire
|
||||
*}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include file="./_calcul_dispo.html" keep="cumul_mvt,equipments"}}
|
||||
{{:include file="./_calcul_dispo.html" keep="categories,equipments"}}
|
||||
|
||||
{{* Sélecteur catégories *}}
|
||||
<fieldset class="shortForm" style="width: 30%;">
|
||||
<legend>Filtrer par catégorie</legend>
|
||||
<nav class="dropdown">
|
||||
<ul>
|
||||
<li><a></a></li>
|
||||
<li{{if $_GET.cat_key == null}} class="selected"{{/if}}><a href="?prop=1">Toutes les catégories</a></li>
|
||||
{{#foreach from=$categories key=key item=name}}
|
||||
<li {{if $_GET.cat_key == $key}}class="selected"{{/if}}>
|
||||
<a href="?cat_key={{$key}}&prop=1">
|
||||
<strong>{{$name}}</strong>
|
||||
</a>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
</nav>
|
||||
</fieldset>
|
||||
|
||||
{{* Vérifier s'il y a au moins un matériel propriété de l'asso *}}
|
||||
{{:assign mat_present=false}}
|
||||
@ -20,50 +36,29 @@
|
||||
|
||||
{{if $mat_present}}
|
||||
|
||||
{{* Sélecteur catégories *}}
|
||||
<fieldset class="shortForm" style="width: 30%;">
|
||||
<legend>Filtrer par catégorie</legend>
|
||||
<nav class="dropdown">
|
||||
<ul>
|
||||
<li><a></a></li>
|
||||
<li{{if $_GET.cat_key == null}} class="selected"{{/if}}><a href="?prop=1">Toutes les catégories</a></li>
|
||||
{{#load type="category" assign="category" order="$$.name"}}
|
||||
<li {{if $_GET.cat_key == $key}}class="selected"{{/if}}>
|
||||
<a href="?cat_key={{$key}}&prop=1">
|
||||
<strong>{{$category.name}}</strong>
|
||||
</a>
|
||||
</li>
|
||||
{{/load}}
|
||||
</ul>
|
||||
</nav>
|
||||
</fieldset>
|
||||
|
||||
<h2>Matériels propriété de l'association</h2>
|
||||
|
||||
{{#list
|
||||
select="
|
||||
(SELECT $$.designation
|
||||
FROM @TABLE AS b
|
||||
WHERE b.key = @TABLE.$$.equipment) AS 'Matériel' ;
|
||||
"" as 'Catégorie' ;
|
||||
$$.designation AS 'Matériel' ;
|
||||
"" AS 'Catégorie' ;
|
||||
"" AS 'Stock' ;
|
||||
"" AS 'Sorti' ;
|
||||
"" AS 'Dispo'
|
||||
"
|
||||
type="movement"
|
||||
group="$$.equipment"
|
||||
direction="input"
|
||||
type="equipment"
|
||||
order=1
|
||||
}}
|
||||
{{:assign var=eqpmt_key value=$key}}
|
||||
{{:assign var=cat_key value=$category}}
|
||||
{{:assign var=cat_name from=categories.%s|args:$cat_key}}
|
||||
|
||||
{{:assign var=cat_key from="equipments.%s.category"|args:$equipment}}
|
||||
{{if $_GET.cat_key != null && $_GET.cat_key != $cat_key}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign var=cat_name from="cumul_mvt.%s.name"|args:$cat_key}}
|
||||
{{:assign var=stock from="equipments.%s.stock"|args:$equipment}}
|
||||
{{:assign var=exterieur from="equipments.%s.exterieur"|args:$equipment}}
|
||||
{{:assign var=stock from="equipments.%s.stock"|args:$eqpmt_key}}
|
||||
{{:assign var=exterieur from="equipments.%s.exterieur"|args:$eqpmt_key}}
|
||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||
|
||||
{{if $stock == null}}
|
||||
@ -71,7 +66,7 @@
|
||||
{{/if}}
|
||||
|
||||
<tr>
|
||||
<td>{{$col1}}</td>
|
||||
<td>{{$designation}}</td>
|
||||
<td>{{$cat_name}}</td>
|
||||
<td>{{$stock}}</td>
|
||||
<td>{{if $exterieur == null}}0{{else}}{{$exterieur}}{{/if}}</td>
|
||||
@ -80,7 +75,7 @@
|
||||
{{if $exterieur > 0}}
|
||||
{{:linkbutton
|
||||
label="Retour"
|
||||
href="mouvements/entrees/retour.html?key=%s"|args:$equipment
|
||||
href="mouvements/entrees/retour.html?key=%s"|args:$eqpmt_key
|
||||
shape="history"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
@ -88,21 +83,21 @@
|
||||
{{:linkbutton
|
||||
label="Sortie"
|
||||
shape="plus"
|
||||
href="mouvements/sorties/stock_disponible.html?key=%s"|args:$equipment
|
||||
href="mouvements/sorties/stock_disponible.html?key=%s"|args:$eqpmt_key
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Entrée"
|
||||
shape="plus"
|
||||
href="mouvements/entrees/repertorie.html?key=%s"|args:$equipment
|
||||
href="mouvements/entrees/repertorie.html?key=%s"|args:$eqpmt_key
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Mouvements"
|
||||
href="historique.html?key=%s&prop=1"|args:$equipment
|
||||
href="historique.html?key=%s&prop=1"|args:$eqpmt_key
|
||||
shape="table"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="modifier_materiel.html?key=%s&prop=1"|args:$equipment
|
||||
href="modifier_materiel.html?key=%s&prop=1"|args:$eqpmt_key
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
</td>
|
||||
|
@ -2,12 +2,28 @@
|
||||
|
||||
{{*
|
||||
inventaire des entrées/sorties des matériels temporaires
|
||||
paramètres
|
||||
- category_keys : catégories dont on veut faire l'inventaire
|
||||
*}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include file="./_calcul_dispo.html" keep="cumul_mvt,equipments"}}
|
||||
{{:include file="./_calcul_dispo.html" keep="categories,equipments"}}
|
||||
|
||||
{{* Sélecteur catégories *}}
|
||||
<fieldset class="shortForm" style="width: 30%;">
|
||||
<legend>Filtrer par catégorie</legend>
|
||||
<nav class="dropdown">
|
||||
<ul>
|
||||
<li><a></a></li>
|
||||
<li{{if $_GET.cat_key == null}} class="selected"{{/if}}><a href="?prop=0">Toutes les catégories</a></li>
|
||||
{{#foreach from=$categories key=key item=name}}
|
||||
<li {{if $_GET.cat_key == $key}}class="selected"{{/if}}>
|
||||
<a href="?cat_key={{$key}}&prop=0">
|
||||
<strong>{{$name}}</strong>
|
||||
</a>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
</nav>
|
||||
</fieldset>
|
||||
|
||||
{{* Vérifier s'il y a au moins un matériel non propriété de l'asso *}}
|
||||
{{:assign mat_present=false}}
|
||||
@ -20,75 +36,55 @@
|
||||
|
||||
{{if $mat_present}}
|
||||
|
||||
{{* Sélecteur catégories *}}
|
||||
<fieldset class="shortForm" style="width: 30%;">
|
||||
<legend>Filtrer par catégorie</legend>
|
||||
<nav class="dropdown">
|
||||
<ul>
|
||||
<li><a></a></li>
|
||||
<li{{if $_GET.cat_key == null}} class="selected"{{/if}}><a href="?prop=0">Toutes les catégories</a></li>
|
||||
{{#load type="category" assign="category" order="$$.name"}}
|
||||
<li {{if $_GET.cat_key == $key}}class="selected"{{/if}}>
|
||||
<a href="?cat_key={{$key}}&prop=0">
|
||||
<strong>{{$category.name}}</strong>
|
||||
</a>
|
||||
</li>
|
||||
{{/load}}
|
||||
</ul>
|
||||
</nav>
|
||||
</fieldset>
|
||||
|
||||
<h2>Matériels temporairement dans l'association</h2>
|
||||
|
||||
{{#list
|
||||
select="
|
||||
(SELECT $$.designation
|
||||
FROM @TABLE AS b
|
||||
WHERE b.key = @TABLE.$$.equipment) AS 'Matériel' ;
|
||||
"" as 'Catégorie' ;
|
||||
$$.designation AS 'Matériel' ;
|
||||
"" AS 'Catégorie' ;
|
||||
"" AS 'Quantité'
|
||||
"
|
||||
type="movement"
|
||||
group="$$.equipment"
|
||||
direction="input"
|
||||
type="equipment"
|
||||
order=1
|
||||
}}
|
||||
{{:assign var=eqpmt_key value=$key}}
|
||||
{{:assign var=cat_key value=$category}}
|
||||
{{:assign var=cat_name from=categories.%s|args:$cat_key}}
|
||||
|
||||
{{:assign var=cat_key from="equipments.%s.category"|args:$equipment}}
|
||||
{{if $_GET.cat_key != null && $_GET.cat_key != $cat_key}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign var=cat_name from="cumul_mvt.%s.name"|args:$cat_key}}
|
||||
{{:assign var=qte from="equipments.%s.nonproprio"|args:$equipment}}
|
||||
{{:assign var=qte from="equipments.%s.nonproprio"|args:$eqpmt_key}}
|
||||
|
||||
{{if $qte == null}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
<tr>
|
||||
<td>{{$col1}}</td>
|
||||
<td>{{$designation}}</td>
|
||||
<td>{{$cat_name}}</td>
|
||||
<td>{{$qte}}</td>
|
||||
<td class="actions">
|
||||
{{if $qte > 0}}
|
||||
{{:linkbutton
|
||||
label="Retour"
|
||||
href="mouvements/sorties/emprunte.html?key=%s"|args:$equipment
|
||||
href="mouvements/sorties/emprunte.html?key=%s"|args:$eqpmt_key
|
||||
shape="history"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Entrée"
|
||||
shape="plus"
|
||||
href="mouvements/entrees/repertorie.html?key=%s"|args:$equipment
|
||||
href="mouvements/entrees/repertorie.html?key=%s"|args:$eqpmt_key
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Mouvements"
|
||||
href="historique.html?key=%s&prop=0"|args:$equipment
|
||||
href="historique.html?key=%s&prop=0"|args:$eqpmt_key
|
||||
shape="table"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="modifier_materiel.html?key=%s&prop=0"|args:$equipment
|
||||
href="modifier_materiel.html?key=%s&prop=0"|args:$eqpmt_key
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
</td>
|
||||
|
@ -4,7 +4,8 @@
|
||||
Dupliquer un mouvement
|
||||
paramètres :
|
||||
- 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"}}
|
||||
@ -14,55 +15,58 @@
|
||||
{{/if}}
|
||||
{{: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 *}}
|
||||
{{#load key=$mvt_key assign="mvt_copie"}}
|
||||
{{#load key=$_GET.key assign="mvt_new"}}
|
||||
{{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}}
|
||||
{{if $direction == "input"}}
|
||||
{{:assign input_init=$mvt_copie.input_nature}}
|
||||
{{:assign url="entrees/index.html"}}
|
||||
|
||||
{{* infos pour affichage *}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{:assign mvt_nature=$mvt_new.input_nature}}
|
||||
{{else}}
|
||||
{{:assign output_init=$mvt_copie.output_nature}}
|
||||
{{:assign url="sorties/index.html"}}
|
||||
{{:assign mvt_nature=$mvt_new.output_nature}}
|
||||
{{/if}}
|
||||
{{:assign amount_init=$mvt_copie.amount}}
|
||||
{{:assign date_init=$mvt_copie.date|date_short}}
|
||||
{{:assign key_eqpmt_init=$mvt_copie.equipment}}
|
||||
{{:assign amount_init=$mvt_new.amount}}
|
||||
{{:assign date_init=$mvt_new.date|date_short}}
|
||||
{{: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 *}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{if $direction == "input"}}
|
||||
{{* limiter les opérations possibles *}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
||||
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
||||
{{if $label == $mvt_copie.input_nature}}
|
||||
{{:assign type_defaut=$label}}
|
||||
{{if $_GET.prop && $type != "temporaire" ||
|
||||
! $_GET.prop && $type == "temporaire"
|
||||
}}
|
||||
{{:assign var="input_labels.%s"|args:$label value="%s"|args:$label}}
|
||||
{{/if}}
|
||||
{{if $label == $mvt_new.input_nature}}
|
||||
{{:assign nature_defaut=$label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{else}}
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
||||
{{if $label == $mvt_copie.output_nature}}
|
||||
{{:assign type_defaut=$label}}
|
||||
{{if $_GET.prop && $type != "retour" ||
|
||||
! $_GET.prop && $type == "retour"
|
||||
}}
|
||||
{{:assign var="output_labels.%s"|args:$label value="%s"|args:$label}}
|
||||
{{/if}}
|
||||
{{if $label == $mvt_new.output_nature}}
|
||||
{{:assign nature_defaut=$label}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{/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 --------------------
|
||||
*}}
|
||||
@ -72,64 +76,121 @@
|
||||
{{/if}}
|
||||
|
||||
{{* préparer le mouvement copié *}}
|
||||
{{if $direction == "input"}}
|
||||
{{: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_copie.input_nature}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{:assign var="mvt_new.input_nature" value=$_POST.nature_operation}}
|
||||
{{: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}}
|
||||
{{: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_copie.output_nature}}
|
||||
{{:assign var="mvt_new.output_nature" value=$_POST.nature_operation}}
|
||||
{{: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}}
|
||||
{{: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 mvt_key=""|uuid}}
|
||||
{{:save
|
||||
key=$mvt_key
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction=$direction
|
||||
input_nature=$mvt_copie.input_nature
|
||||
output_nature=$mvt_copie.output_nature
|
||||
amount=$mvt_copie.amount|intval
|
||||
equipment=$key_eqpmt_init
|
||||
date=$mvt_copie.date
|
||||
comment=$mvt_copie.comment
|
||||
{{: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
|
||||
- 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"
|
||||
}}
|
||||
{{: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_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 *}}
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="%s"|args:direction>
|
||||
{{if $direction == "input"}}
|
||||
<legend>Créer une copie de l'entrée « {{$input_init}} {{$eqpmt_init.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||
<fieldset>
|
||||
{{if $_GET.direction == "input"}}
|
||||
<legend>Créer une copie de l'entrée « {{$mvt_nature}} {{$eqpmt.designation}} ({{$amount_init}}) en date du {{$date_init}} »</legend>
|
||||
<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}}
|
||||
<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>
|
||||
{{: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}}
|
||||
{{: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_init.designation}}
|
||||
{{: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.designation}}
|
||||
{{: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="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_copie.comment}}
|
||||
{{: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_new.comment}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
- key : clé du matériel qui revient
|
||||
*}}
|
||||
|
||||
{{:admin_header title="Entrée de matériel" current="module_equipment"}}
|
||||
{{:admin_header title="Retour de matériel" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
@ -27,19 +27,18 @@
|
||||
{{* récupérer les infos du matériel *}}
|
||||
{{#load type="equipment" key=$_GET.key assign="equipment"}}
|
||||
{{:assign designation=$equipment.designation}}
|
||||
{{:assign var="categories." value=$equipment.category}}
|
||||
{{/load}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include
|
||||
file="../../_calcul_dispo.html"
|
||||
keep="cumul_mvt"
|
||||
keep="equipments"
|
||||
date=$_POST.date|parse_date
|
||||
}}
|
||||
|
||||
{{* déterminer la quantité sortie temporairement de ce matériel à la date donnée *}}
|
||||
{{:assign var=sorti from="cumul_mvt.%s.eqpmt.%s.exterieur"|args:$equipment.category:$_GET.key}}
|
||||
{{*:debug cumul_mvt=$cumul_mvt sorti=$sorti*}}
|
||||
{{:assign var=sorti from="equipments.%s.exterieur"|args:$_GET.key}}
|
||||
|
||||
{{if $_POST.quantite|intval > $sorti}}
|
||||
{{:error message="Erreur : la quantité indiquée (%s) est supérieure à celle sortie (%d) à la date du %s"|args:$_POST.quantite:$sorti:$_POST.date}}
|
||||
{{/if}}
|
||||
@ -61,13 +60,12 @@
|
||||
}}
|
||||
|
||||
{{:redirect force="../../historique.html?ok=1&key=%s&prop=1&msg=retour"|args:$_GET.key}}
|
||||
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
{{/form}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include file="../../_calcul_dispo.html" keep="cumul_mvt,equipments"}}
|
||||
{{:include file="../../_calcul_dispo.html" keep="categories, equipments"}}
|
||||
{{:assign var=sorti from="equipments.%s.exterieur"|args:$_GET.key}}
|
||||
|
||||
{{if $sorti > 0}}
|
||||
@ -75,8 +73,7 @@
|
||||
{{* déterminer le matériel concerné par le mouvement *}}
|
||||
{{#load key=$_GET.key assign="equipment"}}
|
||||
{{/load}}
|
||||
{{#load key=$equipment.category assign="category"}}
|
||||
{{/load}}
|
||||
{{:assign var=cat_name from=categories.%s|args:$equipment.category}}
|
||||
|
||||
{{* formulaire d'entrée de matériel *}}
|
||||
<form method="post" action="">
|
||||
@ -86,9 +83,9 @@
|
||||
{{:input type="select" name="type_operation" label="Type" required=true options=$input_labels}}
|
||||
{{:input type="date" name="date" label="Date" 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="category" label="Catégorie" required=true disabled=true default=$category.name}}
|
||||
{{:input type="text" name="sorti" label="Qté sortie" disabled=true default=$sorti}}
|
||||
<p><span class="alert">La quantité indiquée est celle à la date du jour</span></p>
|
||||
{{:input type="text" name="category" label="Catégorie" required=true disabled=true default=$cat_name}}
|
||||
{{:input type="text" name="sorti" label="Quantité sortie" disabled=true default=$sorti}}
|
||||
<p><span class="alert">La quantité sortie est celle à la date du jour</span></p>
|
||||
{{:input type="number" name="quantite" label="Quantité" min=1 required=true default=1}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40", rows="3" required=false}}
|
||||
</dl>
|
||||
|
@ -15,25 +15,25 @@
|
||||
{{:admin_header title="Modifier une %s"|args:$msg_direction current="module_equipment"}}
|
||||
|
||||
{{* récupérer les infos du mouvement à modifier *}}
|
||||
{{#load key=$_GET.key assign="mvt_modif"}}
|
||||
{{#load key=$_GET.key assign="mvt_new"}}
|
||||
{{else}}
|
||||
{{:error message="Aucune %s avec la clé %s"|args:$msg_direction:$_GET.key}}
|
||||
{{/load}}
|
||||
|
||||
{{* infos pour affichage *}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{:assign input_init=$mvt_modif.input_nature}}
|
||||
{{:assign mvt_nature=$mvt_new.input_nature}}
|
||||
{{else}}
|
||||
{{:assign output_init=$mvt_modif.output_nature}}
|
||||
{{:assign mvt_nature=$mvt_new.output_nature}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign amount_init=$mvt_modif.amount}}
|
||||
{{:assign date_init=$mvt_modif.date|date_short}}
|
||||
{{:assign key_eqpmt_init=$mvt_modif.equipment}}
|
||||
{{:assign amount_init=$mvt_new.amount}}
|
||||
{{:assign date_init=$mvt_new.date|date_short}}
|
||||
{{:assign eqpmt_key=$mvt_new.equipment}}
|
||||
|
||||
{{* récupérer les infos du matériel associé *}}
|
||||
{{#load key=$key_eqpmt_init assign="eqpmt_init"}}
|
||||
{{#load key=$eqpmt_key assign="eqpmt"}}
|
||||
{{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}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
@ -43,7 +43,7 @@
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config.input_nature key="label" item="type"}}
|
||||
{{: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}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
@ -51,7 +51,7 @@
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature key="label" item="type"}}
|
||||
{{: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}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
@ -60,32 +60,38 @@
|
||||
{{*
|
||||
-------------------- Traiter la saisie --------------------
|
||||
*}}
|
||||
{{#form on="change"}}
|
||||
{{#form on="save"}}
|
||||
{{if $_POST.amount <= 0}}
|
||||
{{:error message="La quantité (%s) doit être strictement positive !!"|args:$_POST.amount}}
|
||||
{{/if}}
|
||||
|
||||
{{* préparer le mouvement modifié *}}
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{: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_modif.input_nature}}
|
||||
{{:assign var="mvt_new.input_nature" value=$_POST.nature_operation}}
|
||||
{{: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}}
|
||||
{{: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}}
|
||||
{{:assign var="mvt_new.output_nature" value=$_POST.nature_operation}}
|
||||
{{: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 $type_mvt == "temporaire"}}
|
||||
{{:assign prop=0}}
|
||||
{{else}}
|
||||
{{:assign prop=1}}
|
||||
{{/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}}
|
||||
|
||||
{{: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 et remplacer le mouvement sélectionné par sa version modifiée
|
||||
en l'insérant à sa place par date croissante
|
||||
lister les mouvements
|
||||
- ignorer le mouvement à modifier
|
||||
- insérer le mvt modifié à sa place par date croissante
|
||||
*}}
|
||||
{{:assign insere=false}}
|
||||
{{#load
|
||||
@ -93,59 +99,60 @@
|
||||
$$.type = 'movement'
|
||||
AND
|
||||
$$.equipment = :eqpmt_key"
|
||||
:eqpmt_key=$key_eqpmt_init
|
||||
:eqpmt_key=$eqpmt_key
|
||||
order="$$.date"
|
||||
assign="movement"
|
||||
}}
|
||||
{{if $key != $_GET.key}}
|
||||
{{if $_GET.direction == "input" && ! $insere && $date >= $mvt_modif.date}}
|
||||
{{:assign var="movements_modif." from=mvt_modif}}
|
||||
{{:assign insere=true}}
|
||||
{{elseif $_GET.direction == "output" && ! $insere && $date > $mvt_modif.date}}
|
||||
{{:assign var="movements_modif." from=mvt_modif}}
|
||||
{{:assign insere=true}}
|
||||
{{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_modif." from=movement}}
|
||||
{{:assign var="movements_new." from=movement}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
{{if ! $insere}}
|
||||
{{:assign var="movements_modif." from=mvt_modif}}
|
||||
{{: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_modif
|
||||
eqpmt_key=$key_eqpmt_init
|
||||
movements=$movements_new
|
||||
}}
|
||||
|
||||
{{if $erreur}}
|
||||
<p class="block error">
|
||||
Modification demandée impossible :
|
||||
{{if $_GET.direction == "input"}}
|
||||
{{$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}}
|
||||
{{$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}}
|
||||
« {{$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 : modifier le mouvement *}}
|
||||
{{* vérification réussie : enregistrer le mouvement modifié *}}
|
||||
{{:save
|
||||
key=$_GET.key
|
||||
validate_schema="./movement.schema.json"
|
||||
validate_schema="movement.schema.json"
|
||||
type="movement"
|
||||
direction=$_GET.direction
|
||||
input_nature=$mvt_modif.input_nature
|
||||
output_nature=$mvt_modif.output_nature
|
||||
amount=$mvt_modif.amount|intval
|
||||
equipment=$key_eqpmt_init
|
||||
date=$mvt_modif.date
|
||||
comment=$mvt_modif.comment
|
||||
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=modification"|args:$key_eqpmt_init:$prop}}
|
||||
{{:redirect force="../historique.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:form_errors}}
|
||||
@ -155,31 +162,32 @@
|
||||
-------------------- Préparer la saisie --------------------
|
||||
*}}
|
||||
|
||||
{{* lister les catégories et matériels associés *}}
|
||||
{{#load key=$eqpmt_init.category assign="category"}}{{/load}}
|
||||
{{* récupérer les infos de la catégorie *}}
|
||||
{{#load key=$eqpmt.category assign="category"}}{{/load}}
|
||||
|
||||
{{* formulaire de modification du mouvement *}}
|
||||
<form method="post" action="">
|
||||
|
||||
<fieldset class="entree">
|
||||
<fieldset>
|
||||
{{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>
|
||||
{{:input type="select" name="nature_operation" label="Type" required=true options=$input_labels default=$nature_defaut}}
|
||||
{{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>
|
||||
{{:input type="select" name="nature_operation" label="Type" required=true options=$output_labels default=$nature_defaut}}
|
||||
{{/if}}
|
||||
{{: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_init.designation}}
|
||||
{{: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.designation}}
|
||||
{{: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="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_modif.comment}}
|
||||
{{: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_new.comment}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<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>
|
||||
|
||||
</form>
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
{{*
|
||||
paramètres :
|
||||
- key : clé du matériel à modifier
|
||||
|
||||
TODO : simplifier
|
||||
- key : clé du matériel à rendre
|
||||
*}}
|
||||
|
||||
{{:admin_header title="Sortie de matériel" current="module_equipment"}}
|
||||
@ -28,7 +26,6 @@
|
||||
{{#form on="save"}}
|
||||
{{* récupérer les infos du matériel *}}
|
||||
{{#load type="equipment" key=$_GET.key assign="equipment"}}
|
||||
{{:assign designation=$equipment.designation}}
|
||||
{{/load}}
|
||||
|
||||
{{:assign stock=0}}
|
||||
@ -41,22 +38,11 @@
|
||||
|
||||
{{* traiter le nouveau mouvement *}}
|
||||
{{if ! $insere && $mvt.date > $_POST.date|parse_date}}
|
||||
{{:assign var="operation" from="output_labels.%s|args:$_POST.type_operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$operation}}
|
||||
{{:assign dispo_old=$nonproprio}}
|
||||
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$_POST.quantite}}
|
||||
{{elseif $type_mvt == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$_POST.quantite}}
|
||||
{{elseif $type_mvt == 'retour'}}
|
||||
{{:assign nonproprio="%d-%d"|math:$nonproprio:$_POST.quantite}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign insere=true}}
|
||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||
{{:assign dispo_old=$nonproprio}}
|
||||
{{:assign nonproprio="%d-%d"|math:$nonproprio:$_POST.quantite}}
|
||||
|
||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonproprio < 0}}
|
||||
{{if $nonproprio < 0}}
|
||||
{{:assign date_err=$_POST.date|date:"d/m/Y"}}
|
||||
{{:error message="Erreur : la quantité indiquée (%s) est supérieure à celle disponible (%d) à la date du %s"|args:$_POST.quantite:$dispo_old:$date_err}}
|
||||
{{/if}}
|
||||
@ -85,14 +71,22 @@
|
||||
{{/if}}
|
||||
|
||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||
|
||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonproprio < 0}}
|
||||
{{:assign date_err=$mvt.date|date:"d/m/Y"}}
|
||||
{{:error message="Erreur : la quantité indiquée (%s) est incompatible avec la sortie « %s : %s » à la date du %s"|args:$_POST.quantite:$designation:$mvt.amount:$date_err}}
|
||||
{{:error message="Erreur : la quantité indiquée (%s) est incompatible avec la sortie de %s unités à la date du %s"|args:$_POST.quantite:$mvt.amount:$date_err}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
{{if ! $insere}}
|
||||
{{:assign dispo_old=$nonproprio}}
|
||||
{{:assign nonproprio="%d-%d"|math:$nonproprio:$_POST.quantite}}
|
||||
{{if $nonproprio < 0}}
|
||||
{{:assign date_err=$_POST.date|date:"d/m/Y"}}
|
||||
{{:error message="Erreur : la quantité indiquée (%s) est supérieure à celle disponible (%d) à la date du %s"|args:$_POST.quantite:$dispo_old:$date_err}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="output_labels.%d|args:$_POST.type_operation}}
|
||||
{{:save
|
||||
@ -112,13 +106,13 @@
|
||||
{{/form}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{:include file="../../_calcul_dispo.html" keep="cumul_mvt,equipments"}}
|
||||
{{:include file="../../_calcul_dispo.html" keep="categories,equipments"}}
|
||||
{{:assign var=present from="equipments.%s.nonproprio"|args:$_GET.key}}
|
||||
|
||||
{{if $present > 0}}
|
||||
{{* déterminer le matériel concerné par le mouvement *}}
|
||||
{{#load key=$_GET.key assign="equipment"}}
|
||||
{{/load}}
|
||||
{{#load key=$_GET.key assign="equipment"}}{{/load}}
|
||||
{{:assign var=cat_name from=categories.%s|args:$equipment.category}}
|
||||
|
||||
{{* formulaire de sortie de matériel *}}
|
||||
<form method="post" action="">
|
||||
@ -128,8 +122,9 @@
|
||||
{{: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="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}}
|
||||
<p><span class="alert">La quantité indiquée est celle à la date du jour</span></p>
|
||||
{{: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>
|
||||
{{: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}}
|
||||
</dl>
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
{{*
|
||||
paramètres :
|
||||
- key : clé du matériel à modifier
|
||||
|
||||
TODO : simplifier
|
||||
- key : clé du matériel à sortir
|
||||
*}}
|
||||
|
||||
{{:admin_header title="Sortie de matériel" current="module_equipment"}}
|
||||
@ -28,7 +26,6 @@
|
||||
{{#form on="save"}}
|
||||
{{* récupérer les infos du matériel *}}
|
||||
{{#load type="equipment" key=$_GET.key assign="equipment"}}
|
||||
{{:assign designation=$equipment.designation}}
|
||||
{{/load}}
|
||||
|
||||
{{:assign stock=0}}
|
||||
@ -41,22 +38,19 @@
|
||||
|
||||
{{* traiter le nouveau mouvement *}}
|
||||
{{if ! $insere && $mvt.date > $_POST.date|parse_date}}
|
||||
{{:assign insere=true}}
|
||||
{{:assign dispo_old="%d-%d"|math:$stock:$exterieur}}
|
||||
{{:assign var="operation" from="output_labels.%s|args:$_POST.type_operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$operation}}
|
||||
{{:assign dispo_old="%d-%d"|math:$stock:$exterieur}}
|
||||
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$_POST.quantite}}
|
||||
{{elseif $type_mvt == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$_POST.quantite}}
|
||||
{{elseif $type_mvt == 'retour'}}
|
||||
{{:assign nonproprio="%d-%d"|math:$nonproprio:$_POST.quantite}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign insere=true}}
|
||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||
|
||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonproprio < 0}}
|
||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0}}
|
||||
{{:assign date_err=$_POST.date|date:"d/m/Y"}}
|
||||
{{:error message="Erreur : la quantité indiquée (%s) est supérieure à celle disponible (%d) à la date du %s"|args:$_POST.quantite:$dispo_old:$date_err}}
|
||||
{{/if}}
|
||||
@ -85,14 +79,31 @@
|
||||
{{/if}}
|
||||
|
||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||
|
||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonproprio < 0}}
|
||||
{{:assign date_err=$mvt.date|date:"d/m/Y"}}
|
||||
{{:error message="Erreur : la quantité indiquée (%s) est incompatible avec la sortie « %s : %s » à la date du %s"|args:$_POST.quantite:$designation:$mvt.amount:$date_err}}
|
||||
{{:error message="Erreur : la quantité indiquée (%s) est incompatible avec la sortie de %s unités à la date du %s"|args:$_POST.quantite:$mvt.amount:$date_err}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
{{if ! $insere}}
|
||||
{{:assign dispo_old="%d-%d"|math:$stock:$exterieur}}
|
||||
{{:assign var="operation" from="output_labels.%s|args:$_POST.type_operation}}
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s"|args:$operation}}
|
||||
|
||||
{{if $type_mvt == 'définitif'}}
|
||||
{{:assign stock="%d-%d"|math:$stock:$_POST.quantite}}
|
||||
{{elseif $type_mvt == 'temporaire'}}
|
||||
{{:assign exterieur="%d+%d"|math:$exterieur:$_POST.quantite}}
|
||||
{{/if}}
|
||||
|
||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0}}
|
||||
{{:assign date_err=$_POST.date|date:"d/m/Y"}}
|
||||
{{:error message="Erreur : la quantité indiquée (%s) est supérieure à celle disponible (%d) à la date du %s"|args:$_POST.quantite:$dispo_old:$date_err}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* Enregistrer le mouvement *}}
|
||||
|
||||
{{:assign mvt_key=""|uuid}}
|
||||
{{:assign var="operation" from="output_labels.%d|args:$_POST.type_operation}}
|
||||
{{:save
|
||||
@ -112,20 +123,16 @@
|
||||
{{/form}}
|
||||
|
||||
{{* Extraire et compiler les infos de la base *}}
|
||||
{{* TODO simplifier et peut-être mutualiser *}}
|
||||
|
||||
{{:include file="../../_calcul_dispo.html" keep="cumul_mvt,equipments"}}
|
||||
|
||||
{{:include file="../../_calcul_dispo.html" keep="categories,equipments"}}
|
||||
{{:assign var=stock from="equipments.%s.stock"|args:$_GET.key}}
|
||||
{{:assign var=exterieur from="equipments.%s.exterieur"|args:$_GET.key}}
|
||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||
{{:assign var=category_key from="equipments.%s.category"|args:$_GET.key}}
|
||||
{{:assign var=category from="cumul_mvt.%s.name"|args:$category_key}}
|
||||
|
||||
{{if $dispo > 0}}
|
||||
|
||||
{{* déterminer le matériel concerné par le mouvement *}}
|
||||
{{#load key=$_GET.key assign="equipment"}}
|
||||
{{/load}}
|
||||
{{#load key=$_GET.key assign="equipment"}}{{/load}}
|
||||
{{:assign var=cat_name from=categories.%s|args:$equipment.category}}
|
||||
|
||||
{{* formulaire de sortie de matériel *}}
|
||||
<form method="post" action="">
|
||||
@ -135,8 +142,8 @@
|
||||
{{: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="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=$category.name}}
|
||||
{{:input type="text" name="dispo" label="Qté disponible" disabled=true default=$dispo}}
|
||||
{{: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}}
|
||||
<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="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||
@ -147,8 +154,7 @@
|
||||
</p>
|
||||
</form>
|
||||
{{else}}
|
||||
{{:assign date_err=$now|date:'d/m/Y'}}
|
||||
<p class="block error">Il n'y a aucun matériel disponible à la date du {{$date_err}}</p>
|
||||
<p class="block error">Il y a 0 unité de ce matériel disponible à la date du {{$now|date_short}}</p>
|
||||
{{/if}}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
Vérifier la cohérence des E/S d'un matériel
|
||||
- paramètres :
|
||||
- movements : liste de mouvements
|
||||
- eqpmt_key : clé du matériel à vérifier
|
||||
- movements : liste de mouvements d'un matériel
|
||||
*}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
@ -13,33 +12,33 @@
|
||||
{{:assign stock=0}}
|
||||
{{:assign exterieur=0}}
|
||||
{{:assign nonprop=0}}
|
||||
|
||||
{{#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 $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}}
|
||||
{{:assign dispo="%d-%d"|math:$stock:$exterieur}}
|
||||
{{if $dispo < 0 || $stock < 0 || $exterieur < 0 || $nonprop < 0}}
|
||||
{{:assign erreur=true}}
|
||||
{{:break}}
|
||||
{{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}}
|
||||
{{:assign erreur=true}}
|
||||
{{:break}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
Loading…
Reference in New Issue
Block a user