221 lines
7.1 KiB
HTML
221 lines
7.1 KiB
HTML
{{* -*- brindille -*- *}}
|
|
|
|
{{*
|
|
Afficher l'historique des mouvements d'un matériel
|
|
paramètres
|
|
- key : clé du matériel
|
|
- prop : = 1 si matériel appartient à l'asso
|
|
- ok : vrai si opération terminée avec succès
|
|
- err : vrai si opération terminée en erreur (ça fait doublon avec ok, non ?)
|
|
- msg : message de retour
|
|
*}}
|
|
|
|
{{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}}
|
|
<p class="block confirm">{{$_GET.msg}}</p>
|
|
{{/if}}
|
|
{{elseif $_GET.err}}
|
|
{{if $_GET.msg == "suppression"}}
|
|
<p class="block error">Ce mouvement ne peut être supprimé</p>
|
|
{{else}}
|
|
<p class="block error">{{$_GET.msg}}</p>
|
|
{{/if}}
|
|
{{/if}}
|
|
|
|
{{* barre de navigation *}}
|
|
{{if $_GET.prop == 1}}
|
|
{{:assign proprio="proprio"}}
|
|
{{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 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 *}}
|
|
{{if $type_mvt != 'temporaire'}}
|
|
{{:assign var="input_types." value=$mvt}}
|
|
{{/if}}
|
|
{{else}}
|
|
{{* matériel non propriété de l'asso *}}
|
|
{{if $type_mvt == 'temporaire'}}
|
|
{{:assign var="input_types." value=$mvt}}
|
|
{{/if}}
|
|
{{/if}}
|
|
{{/foreach}}
|
|
|
|
{{#foreach from=$config.output_nature key=mvt item=type_mvt}}
|
|
{{if $_GET.prop}}
|
|
{{* matériel propriété de l'asso *}}
|
|
{{if $type_mvt != 'retour'}}
|
|
{{:assign var="output_types." value=$mvt}}
|
|
{{/if}}
|
|
{{else}}
|
|
{{* matériel non propriété de l'asso *}}
|
|
{{if $type_mvt == 'retour'}}
|
|
{{:assign var="output_types." value=$mvt}}
|
|
{{/if}}
|
|
{{/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}}
|
|
|
|
{{:admin_footer}}
|