Compare commits
No commits in common. "main" and "linked_transactions" have entirely different histories.
main
...
linked_tra
41 changed files with 231 additions and 954 deletions
|
|
@ -3,12 +3,8 @@
|
|||
Ce module permet de gérer les matériels de l'association: stock,
|
||||
entrées, sorties, classés par catégorie.
|
||||
|
||||
Un matériel peut entrer dans l'association :
|
||||
- temporairement (location, emprunt, ...)
|
||||
- définitivement (achat, ...)
|
||||
|
||||
Dans les deux cas, il est possible de lui associer une écriture de la
|
||||
compta ou un fichier.
|
||||
Un matériel peut entrer temporairement (location, emprunt, ...) ou
|
||||
définitivement dans l'association (achat, ...).
|
||||
|
||||
Un matériel appartenant à l'association peut sortir :
|
||||
- temporairement (prêt, ...) : il est possible de lui associer un lieu
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Récupérer la config
|
||||
résultat : config_defaut, directions, config.input_nature et config.output_nature
|
||||
Récupérer soit la config enregistrée, soit la config par défaut
|
||||
@param : default = true si config par défaut
|
||||
résultat : config.input_nature et config.output_nature
|
||||
*}}
|
||||
|
||||
{{* config par défaut *}}
|
||||
|
|
@ -14,7 +15,7 @@
|
|||
|
||||
{{#foreach from=$directions key="direction"}}
|
||||
{{:assign var="nature" from="module.config.%s_nature"|args:$direction}}
|
||||
{{if $nature != null}}
|
||||
{{if $nature != null && ! $default}}
|
||||
{{#foreach from=$nature item="elem"}}
|
||||
{{:assign var="item" label=$label type=$type}}
|
||||
{{:assign var="config.%s_nature.%s"|args:$direction:$key value=$item}}
|
||||
|
|
@ -28,9 +29,3 @@
|
|||
{{/foreach}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
|
||||
{{if $module.config.loan_duration != null}}
|
||||
{{:assign loan_duration=$module.config.loan_duration}}
|
||||
{{else}}
|
||||
{{:assign loan_duration=$config_defaut.loan_duration}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,6 @@
|
|||
shape="plus"
|
||||
href="movements/input_equipment.html?key=%s"|args:$key
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Historique"
|
||||
href="equipment_history.html?key=%s&prop=1"|args:$key
|
||||
shape="table"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="modify_equipment.html?key=%s&prop=1"|args:$key
|
||||
|
|
@ -88,10 +84,7 @@
|
|||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
let table = document.querySelector("table[class=list]");
|
||||
if (table != null) {
|
||||
disableColumSort(table);
|
||||
}
|
||||
})();
|
||||
(function () {
|
||||
disableColumSort(document.querySelector("table[class=list]"));
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -29,11 +29,6 @@
|
|||
<li class="title"><strong>Historique — {{$eqpmt}} ({{$category}})</strong></li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
{{elseif $current == 'historique'}}
|
||||
<ul class="sub">
|
||||
<li {{if $subcurrent == 'tous'}} class="current"{{/if}}><a href="{{$module.url}}global_history.html">Tous</a></li>
|
||||
<li {{if $subcurrent == 'prêts'}} class="current"{{/if}}><a href="{{$module.url}}loan_history.html">Prêts</a></li>
|
||||
</ul>
|
||||
{{elseif $current == 'archives'}}
|
||||
{{if $subsubcurrent == 'historique'}}
|
||||
<ul class="sub">
|
||||
|
|
@ -59,7 +54,6 @@
|
|||
<li {{if $subcurrent == 'categories'}} class="current"{{/if}}><a href="{{$module.url}}categories/index.html">Catégories</a></li>
|
||||
<li {{if $subcurrent == 'storage'}} class="current"{{/if}}><a href="{{$module.url}}storage/index.html">Lieux de stockage</a></li>
|
||||
<li {{if $subcurrent == 'typesES'}} class="current"{{/if}}><a href="{{$module.url}}config.html">Types d'entrées/sorties</a></li>
|
||||
<li {{if $subcurrent == 'divers'}} class="current"{{/if}}><a href="{{$module.url}}config/misc.html">Divers</a></li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -60,10 +60,6 @@
|
|||
shape="plus"
|
||||
href="movements/input_equipment.html?key=%s"|args:$key
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Historique"
|
||||
href="equipment_history.html?key=%s&prop=0"|args:$key
|
||||
shape="table"}}
|
||||
{{:linkbutton
|
||||
label="Modifier"
|
||||
href="modify_equipment.html?key=%s&prop=0"|args:$key
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{:admin_header title="Matériels archivés" current="module_equipment"}}
|
||||
{{:include file="_nav.html" current="archives"}}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="config" subcurrent="categories"}}
|
||||
{{/if}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
|
|
@ -22,11 +25,6 @@
|
|||
{{/form}}
|
||||
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="config" subcurrent="categories"}}
|
||||
{{/if}}
|
||||
|
||||
{{:form_errors}}
|
||||
|
||||
{{* formulaire d'ajout de catégorie *}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{#load key=$_GET.key assign="category"}}
|
||||
{{else}}
|
||||
{{:error message="Catégorie introuvable"}}
|
||||
|
|
@ -9,7 +7,7 @@
|
|||
|
||||
{{#form on="delete"}}
|
||||
{{* Vérifier s'il reste des matériels dans cette catégorie *}}
|
||||
{{#load type="equipment" category=$_GET.key limit="1"}}
|
||||
{{#load type="equipment" category=$_GET.key assign="equipment"}}
|
||||
{{:redirect force="./index.html?err=1&msg=suppression"}}
|
||||
{{else}}
|
||||
{{* supprimer la catégorie sélectionnée*}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{:admin_header title="Configuration" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
|
|
@ -29,17 +27,15 @@
|
|||
{{:assign category_key=$key}}
|
||||
{{* voir s'il y a des matériels dans cette catégorie *}}
|
||||
{{:assign materiel_present=true}}
|
||||
{{#load type="equipment" where="$$.category = :category_key" :category_key=$category_key limit=1}}
|
||||
{{#load type="equipment" where="$$.category = :category_key" :category_key=$category_key}}
|
||||
{{else}}
|
||||
{{:assign materiel_present=false}}
|
||||
{{/load}}
|
||||
<tr>
|
||||
<th>{{$name}}</th>
|
||||
<td class="actions">
|
||||
{{if ! $materiel_present}}
|
||||
{{:linkbutton label="Supprimer" href="delete_category.html?key=%s"|args:$key shape="delete" target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton label="Modifier" href="modify_category.html?key=%s"|args:$key shape="edit" target="_dialog"}}
|
||||
{{:linkbutton label="Supprimer" href="delete_category.html?key=%s"|args:$key shape="delete" target="_dialog"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{#load key=$_GET.key assign="category"}}
|
||||
{{else}}
|
||||
{{:error message="Catégorie introuvable"}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{:admin_header title="Configuration" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,27 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
paramètres :
|
||||
- dir : input ou output
|
||||
*}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
|
||||
{{/if}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
|
||||
{{* lecture config *}}
|
||||
{{:include file="../_get_config.html" keep="config, directions, config_defaut"}}
|
||||
{{* lecture config par défaut *}}
|
||||
{{:include file="../_get_config.html" keep="config, directions" default=true}}
|
||||
|
||||
{{#form on="save"}}
|
||||
{{* vérifier s'il existe un libellé de même nom dans la même direction *}}
|
||||
{{* vérifier s'il existe un type de mouvement de même nom *}}
|
||||
{{#foreach from=$directions key="direction"}}
|
||||
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
||||
{{#foreach from=$nature key="key"}}
|
||||
{{:assign var="fields" from="_POST.%s_fields"|args:$_GET.dir}}
|
||||
{{if $_GET.dir == $direction && $label|trim|tolower == $fields.label|trim|tolower}}
|
||||
{{if $label|trim|tolower == $fields.label|trim|tolower}}
|
||||
{{:error message="Ce libellé est déjà présent"}}
|
||||
{{/if}}
|
||||
{{:assign var="%s_nature.key"|args:$direction value=$key}}
|
||||
|
|
@ -36,6 +39,7 @@
|
|||
{{:assign var="%s_nature.type"|args:$direction from="_POST.%s_fields.type"|args:$direction}}
|
||||
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
|
||||
{{/if}}
|
||||
|
||||
{{/foreach}}
|
||||
|
||||
{{:save
|
||||
|
|
@ -48,16 +52,11 @@
|
|||
{{/form}}
|
||||
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
|
||||
{{/if}}
|
||||
|
||||
{{:form_errors}}
|
||||
|
||||
{{if $_GET.dir == 'input'}}
|
||||
{{* types d'entrées *}}
|
||||
{{#foreach from=$config_defaut.inputs}}
|
||||
{{#foreach from=$config.input_nature}}
|
||||
{{:assign var='input_types.%s'|args:$type value=$type}}
|
||||
{{/foreach}}
|
||||
<form method="post" action="">
|
||||
|
|
@ -96,7 +95,7 @@
|
|||
</form>
|
||||
{{else}}
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config_defaut.outputs}}
|
||||
{{#foreach from=$config.output_nature}}
|
||||
{{:assign var='output_types.%s'|args:$type value=$type}}
|
||||
{{/foreach}}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
paramètres :
|
||||
- dir : input ou output
|
||||
- op_key : clé du type de mouvement à supprimer
|
||||
*}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
|
||||
{{/if}}
|
||||
|
||||
{{* lecture config (défaut ou enregistrée) *}}
|
||||
{{:include file="../_get_config.html" keep="config, directions"}}
|
||||
|
|
@ -35,10 +37,6 @@
|
|||
{{/form}}
|
||||
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
|
||||
{{/if}}
|
||||
{{:form_errors}}
|
||||
|
||||
{{:assign var="mvt_label" from="config.%s_nature.%s.label"|args:$_GET.dir:$_GET.op_key}}
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{:admin_header title="Configuration" current="module_equipment"}}
|
||||
|
||||
{{#form on="save"}}
|
||||
{{:save
|
||||
key="config"
|
||||
loan_duration=$_POST.loan_duration
|
||||
}}
|
||||
{{/form}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{:include file="../_nav.html" current="config" subcurrent="divers"}}
|
||||
|
||||
{{if $_GET.ok}}
|
||||
<p class="block confirm">Configuration enregistrée.</p>
|
||||
{{/if}}
|
||||
|
||||
{{* lecture config (défaut ou enregistrée) *}}
|
||||
{{:include file="../_get_config.html" keep="loan_duration"}}
|
||||
|
||||
<form method="post" action="" data-focus="1">
|
||||
<fieldset class="storage">
|
||||
<legend>Autres paramètres</legend>
|
||||
<dl>
|
||||
{{:input type="number" name="loan_duration" label="Durée de prêt par défaut" min=1 required=true default=$loan_duration help="Durée en nombre de jours"}}
|
||||
|
||||
</dl>
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||
</p>
|
||||
</form>
|
||||
{{:admin_footer}}
|
||||
|
|
@ -1,13 +1,16 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
paramètres :
|
||||
- dir : input ou output
|
||||
- op_key : clé du type de mouvement dont on veut modifier le libellé
|
||||
*}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
|
||||
{{/if}}
|
||||
|
||||
{{* lecture config (défaut ou enregistrée) *}}
|
||||
{{:include file="../_get_config.html" keep="config, directions"}}
|
||||
|
||||
|
|
@ -40,12 +43,7 @@
|
|||
{{/form}}
|
||||
|
||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
|
||||
{{/if}}
|
||||
{{:form_errors}}
|
||||
|
||||
{{:assign var="default_label" from="config.%s_nature.%s.label"|args:$_GET.dir:$_GET.op_key}}
|
||||
<form method="post" action="" data-focus="1">
|
||||
<fieldset>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,5 @@
|
|||
"label" : "Retour de Location/Emprunt",
|
||||
"type" : "retour"
|
||||
}
|
||||
],
|
||||
"loan_duration" : "30"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Afficher l'historique des mouvements d'un matériel
|
||||
paramètres
|
||||
|
|
@ -30,7 +28,6 @@
|
|||
{{else}}
|
||||
{{:error message="Le matériel %s n'appartient à aucune catégorie"|args:$equipment.name}}
|
||||
{{/load}}
|
||||
|
||||
{{:admin_header title="Gestion des matériels" custom_css="./style.css" current="module_equipment"}}
|
||||
|
||||
{{if $_GET.current != null}}
|
||||
|
|
@ -115,20 +112,20 @@
|
|||
{{:assign nonproprio="%d-%d"|math:$nonproprio:$amount}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:assign dispo_final="%d-%d"|math:$stock:$exterieur}}
|
||||
{{: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_final}}
|
||||
{{:assign var="quantites.%s.dispo"|args:$id value=$dispo}}
|
||||
{{:assign var="quantites.%s.nonproprio"|args:$id value=$nonproprio}}
|
||||
{{/load}}
|
||||
|
||||
{{if $current != "archives"}}
|
||||
<nav class="tabs">
|
||||
<aside>
|
||||
{{if $_GET.prop && $dispo_final > 0}}
|
||||
{{:linkbutton label="Sortie" shape="minus" href="movements/output_equipment.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
{{if $_GET.prop && $equipment.stock > 0}}
|
||||
{{:linkbutton label="Sortie" title="Enregistrer une sortie de ce matériel" shape="minus" href="movements/output_equipment.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton label="Entrée" shape="plus" href="movements/input_equipment.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
{{:linkbutton label="Entrée" title="Enregistrer une entrée de ce matériel" shape="plus" href="movements/input_equipment.html?key=%s"|args:$_GET.key target="_dialog"}}
|
||||
</aside>
|
||||
</nav>
|
||||
{{/if}}
|
||||
|
|
@ -147,9 +144,9 @@
|
|||
{{#select
|
||||
mvt.key AS mvt_key,
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste
|
||||
FROM {!$module.table} AS mvt
|
||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
FROM module_data_equipment AS mvt
|
||||
LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
AND json_extract(mvt.document, '$.equipment') = :eqpmt_key
|
||||
|
|
@ -179,12 +176,11 @@
|
|||
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
||||
ELSE ''
|
||||
END AS 'Stockage';
|
||||
'' AS 'Documents';
|
||||
$$.transactions AS 'Écritures'
|
||||
$$.comment AS 'Commentaire'
|
||||
"|args:$config.user_fields.name_sql
|
||||
equipment=$equipment_key
|
||||
order=1
|
||||
}}
|
||||
}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}}
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
||||
|
||||
|
|
@ -194,24 +190,17 @@
|
|||
{{: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}}
|
||||
|
||||
{{:assign file_path="%s/%s/"|args:$module.storage_root:$key}}
|
||||
{{:assign file_path=$file_path|cat:"%"}}
|
||||
{{#select count(*) AS nb FROM files WHERE path LIKE :file_path ; :file_path=$file_path}}
|
||||
{{:assign nb_files=$nb}}
|
||||
{{/select}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$col2}}</td>
|
||||
<td class="nosort">{{$op_label}}</td>
|
||||
<td>{{$op_label}}</td>
|
||||
<td class="num">{{$amount}}</td>
|
||||
<td class="num nosort">{{$stock}}</td>
|
||||
<td class="num nosort">{{$exterieur}}</td>
|
||||
<td class="num nosort">{{$dispo}}</td>
|
||||
<td>{{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$col8}}</td>
|
||||
<td>{{$col9}}</td>
|
||||
<td class="num nosort">{{if $nb_files > 0}}{{:icon shape="attach"}}{{/if}}</td>
|
||||
<td class="num">{{if $transactions|count > 0}}{{:icon shape="money"}}{{/if}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
<td class="actions">
|
||||
{{if $current != "archives"}}
|
||||
{{if $direction == "output" && $type_mvt == "temporaire"}}
|
||||
|
|
@ -219,24 +208,37 @@
|
|||
{{if $temp_ext != null && $temp_ext > 0}}
|
||||
{{:linkbutton
|
||||
label="Retour"
|
||||
title="Enregistrer un retour de sortie temporaire"
|
||||
href="movements/output_return.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="reset"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $direction == "input" && $type_mvt == "retour"}}
|
||||
{{* interdire dupliquer *}}
|
||||
{{else}}
|
||||
{{:linkbutton
|
||||
label="Dupliquer"
|
||||
href="movements/copy_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="plus"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Détails"
|
||||
href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop
|
||||
shape="eye"
|
||||
}}
|
||||
label="Modifier"
|
||||
href="movements/modify_movement.html?key=%s"|args:$key
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Supprimer"
|
||||
href="movements/delete_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="delete"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{/list}}
|
||||
{{if $dispo_final === 0}}
|
||||
<span class="help">Il n'y a aucun matériel disponible, il n'est donc pas possible d'effectuer une sortie</span>
|
||||
{{/if}}
|
||||
|
||||
{{else}}
|
||||
{{* calculer la quantité présente temporairement de chaque matériel *}}
|
||||
{{#foreach from=$config.input_nature key=key}}
|
||||
|
|
@ -250,9 +252,9 @@
|
|||
{{#select
|
||||
mvt.key AS mvt_key,
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
|
||||
FROM {!$module.table} AS mvt
|
||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
FROM module_data_equipment AS mvt
|
||||
LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
AND json_extract(mvt.document, '$.equipment') = :eqpmt_key
|
||||
|
|
@ -275,9 +277,7 @@
|
|||
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
||||
ELSE ''
|
||||
END as 'Stockage';
|
||||
'' AS 'Documents';
|
||||
$$.transactions AS 'Écritures'
|
||||
"
|
||||
$$.comment AS 'Commentaire'"
|
||||
equipment=$equipment_key
|
||||
order=1
|
||||
}}
|
||||
|
|
@ -288,37 +288,45 @@
|
|||
$direction === "output"&& $op_label|in:$output_types
|
||||
}}
|
||||
{{:assign var="stock" from="quantites.%s.nonproprio"|args:$id}}
|
||||
|
||||
{{:assign file_path="%s/%s/"|args:$module.storage_root:$key}}
|
||||
{{:assign file_path=$file_path|cat:"%"}}
|
||||
{{#select count(*) AS nb FROM files WHERE path LIKE :file_path ; :file_path=$file_path}}
|
||||
{{:assign nb_files=$nb}}
|
||||
{{/select}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$col2}}</td>
|
||||
<td class="nosort">{{$op_label}}</td>
|
||||
<td>{{$op_label}}</td>
|
||||
<td class="num">{{$amount}}</td>
|
||||
<td class="num nosort">{{$stock}}</td>
|
||||
<td>{{$col6}}</td>
|
||||
<td class="num nosort">{{if $nb_files > 0}}{{:icon shape="attach"}}{{/if}}</td>
|
||||
<td class="num">{{if $transactions|count > 0}}{{:icon shape="money"}}{{/if}}</td>
|
||||
<td>{{$comment}}</td>
|
||||
<td class="actions">
|
||||
{{if $direction == "input" && $type_mvt == "temporaire"}}
|
||||
{{:assign var="temp_in" from="present.%s"|args:$key}}
|
||||
{{if $temp_in != null && $temp_in > 0}}
|
||||
{{:linkbutton
|
||||
label="Retour"
|
||||
title="Enregistrer un retour d'entrée temporaire"
|
||||
href="movements/input_return.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="reset"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $direction == "output" && $type_mvt == "retour"}}
|
||||
{{* interdire dupliquer *}}
|
||||
{{else}}
|
||||
{{:linkbutton
|
||||
label="Dupliquer"
|
||||
href="movements/copy_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="plus"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Détails"
|
||||
href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop
|
||||
shape="eye"
|
||||
}}
|
||||
label="Modifier"
|
||||
href="movements/modify_movement.html?key=%s"|args:$key
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Supprimer"
|
||||
href="movements/delete_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
||||
shape="delete"
|
||||
target="_dialog"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/if}}
|
||||
|
|
@ -329,10 +337,7 @@
|
|||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
let table = document.querySelector("table[class=list]");
|
||||
if (table != null) {
|
||||
disableColumSort(table);
|
||||
}
|
||||
})();
|
||||
(function () {
|
||||
disableColumSort(document.querySelector("table[class=list]"));
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Afficher l'historique de tous les mouvements
|
||||
*}}
|
||||
|
||||
{{:admin_header title="Historique des mouvements" custom_css="./style.css" current="module_equipment"}}
|
||||
|
||||
{{:include file="./_nav.html" current="historique" subcurrent="tous"}}
|
||||
{{:include file="./_nav.html" current="historique"}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
|
|
@ -90,10 +88,7 @@
|
|||
|
||||
<script type="text/javascript" src="scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
let table = document.querySelector("table[class=list]");
|
||||
if (table != null) {
|
||||
disableColumSort(table);
|
||||
}
|
||||
})();
|
||||
(function () {
|
||||
disableColumSort(document.querySelector("table[class=list]"));
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{:admin_header title="Gestion des matériels" custom_css="./style.css" current="module_equipment"}}
|
||||
|
||||
{{* barre de navigation *}}
|
||||
|
|
|
|||
|
|
@ -1,137 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{:admin_header title="Matériels hors de l'asso" custom_css="../style.css" current="module_equipment"}}
|
||||
{{:include file="./_nav.html" current="historique" subcurrent="prêts"}}
|
||||
|
||||
{{*
|
||||
vérifier l'existence de la table du module
|
||||
eh oui, il se peut qu'elle ne soit pas encore créée si aucune donnée n'a été ajoutée dedans
|
||||
*}}
|
||||
|
||||
{{#load limit="1"}}
|
||||
{{:assign table_presente=true}}
|
||||
{{else}}
|
||||
{{:assign table_presente=false}}
|
||||
{{/load}}
|
||||
|
||||
{{if $table_presente}}
|
||||
{{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>
|
||||
{{/if}}
|
||||
{{elseif $_GET.err}}
|
||||
{{if $_GET.msg == "suppression"}}
|
||||
<p class="block error">Ce mouvement ne peut être supprimé</p>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{* lecture config (défaut ou enregistrée) *}}
|
||||
{{:include file="./_get_config.html" keep="config"}}
|
||||
|
||||
{{#foreach from=$config.output_nature key="key"}}
|
||||
{{if $type == 'temporaire'}}
|
||||
{{:assign var="output_types." value=$key|quote_sql}}
|
||||
{{/if}}
|
||||
{{/foreach}}
|
||||
{{:assign output_ops=$output_types|implode:","}}
|
||||
{{:assign output_ops="("|cat:$output_ops|cat:")"}}
|
||||
|
||||
{{:assign premier=true}}
|
||||
{{#select
|
||||
users.nom AS nom,
|
||||
users.id AS user,
|
||||
mvt.key AS mvt_key,
|
||||
json_extract(mat.document, '$.name') AS mat_name,
|
||||
json_extract(mvt.document, '$.date') AS out_date,
|
||||
json_extract(mvt.document, '$.amount') AS out_amount,
|
||||
json_extract(mvt.document, '$.return_date') AS return_date,
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain
|
||||
FROM {!$module.table} AS mvt
|
||||
LEFT JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||
LEFT JOIN {!$module.table} AS links ON mvt.key = json_extract(links.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS retour ON retour.key = json_extract(links.document, '$.return')
|
||||
INNER JOIN {!$module.table} AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.type') = 'movement'
|
||||
AND
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
GROUP BY mvt.key
|
||||
HAVING remain != 0
|
||||
ORDER BY out_date, nom
|
||||
;
|
||||
!op = $output_ops
|
||||
}}
|
||||
{{if $premier}}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Matériel</th>
|
||||
<th>Date sortie</th>
|
||||
<th>Quantité</th>
|
||||
<th>Membre</th>
|
||||
<th>Date retour</th>
|
||||
<th>Reste à rendre</th>
|
||||
<th>Remarque</th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{:assign premier=false}}
|
||||
{{/if}}
|
||||
|
||||
{{if $return_date != null}}
|
||||
{{:assign ts_retour=$return_date|strtotime}}
|
||||
{{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}}
|
||||
{{/if}}
|
||||
<tr>
|
||||
<td>{{$mat_name}}</td>
|
||||
<td>{{$out_date|date_short}}</td>
|
||||
<td>{{$out_amount}}</td>
|
||||
<td>{{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$nom}}</td>
|
||||
<td>{{$return_date|date_short}}</td>
|
||||
<td>{{$remain}}</td>
|
||||
<td>
|
||||
{{if $return_date != null}}
|
||||
{{:assign jour="jour}}
|
||||
{{if $nb_jours > 0}}
|
||||
{{if $nb_jours > 1}}{{:assign jour="jours"}}{{/if}}
|
||||
{{:tag color="darkred" label="Retard %s %s"|args:$nb_jours:$jour}}
|
||||
{{elseif $nb_jours < 0}}
|
||||
{{:assign delai="abs(%d)"|math:$nb_jours}}
|
||||
{{if $nb_jours < -1}}{{:assign jour="jours"}}{{/if}}
|
||||
{{"Reste %s %s"|args:$delai:$jour}}
|
||||
{{else}}
|
||||
{{:tag color="darkgreen" label="À rendre aujourd'hui"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</td>
|
||||
<td class="actions">
|
||||
{{:linkbutton
|
||||
label="Retour"
|
||||
href="movements/output_return.html?key=%s&prop=1"|args:$mvt_key
|
||||
shape="reset"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Détails"
|
||||
href="movements/movement_details.html?key=%s&prop=1&from=lh"|args:$mvt_key
|
||||
shape="eye"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<p class="block alert">Aucun mouvement.</p>
|
||||
{{/select}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
<p class="block alert">Aucun mouvement.</p>
|
||||
{{/if}}
|
||||
|
||||
{{:admin_footer}}
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{*
|
||||
Afficher l'historique des mouvements d'un matériel pour un membre
|
||||
paramètres
|
||||
- key : clé du matériel
|
||||
- id : id du membre
|
||||
*}}
|
||||
|
||||
{{#restrict block=true section="users" level="read"}}{{/restrict}}
|
||||
|
||||
{{:admin_header title="Historique membre" custom_css="./style.css" current="module_equipment"}}
|
||||
|
||||
{{* lecture config (défaut ou enregistrée) *}}
|
||||
{{:include file="./_get_config.html" keep="config, directions"}}
|
||||
|
||||
{{#foreach from=$directions key="direction"}}
|
||||
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
||||
{{#foreach from=$nature key=key}}
|
||||
{{:assign var="types.%s.%s."|args:$direction:$type value=$key|quote_sql}}
|
||||
{{/foreach}}
|
||||
{{:assign var="io_types" from="types.%s"|args:$direction}}
|
||||
{{#foreach from=$io_types key=key}}
|
||||
{{:assign var=elem from="io_types.%s"|args:$key}}
|
||||
{{:assign elem=$elem|implode:","}}
|
||||
{{:assign elem="("|cat:$elem|cat:")"}}
|
||||
{{:assign var="%s_types.%s"|args:$direction:$key value=$elem}}
|
||||
{{/foreach}}
|
||||
{{/foreach}}
|
||||
|
||||
{{#users id=$_GET.id}}
|
||||
{{:assign user_name=$nom}}
|
||||
{{else}}
|
||||
{{:error message="Il n'existe aucun membre avec l'identifiant %s !"|args:$_GET.id}}
|
||||
{{/users}}
|
||||
|
||||
{{#load key=$_GET.key|trim}}
|
||||
{{:assign eqpmt_name=$name}}
|
||||
{{else}}
|
||||
{{:error message="Il n'existe aucun matériel avec la clé %s !"|args:$_GET.key|trim}}
|
||||
{{/load}}
|
||||
|
||||
<h3>Historique des mouvements de « {{$eqpmt_name}} » du membre « {{$user_name}} »</h3>
|
||||
|
||||
{{:assign otk=null}}
|
||||
{{#select
|
||||
mvt.key AS mvt_key,
|
||||
json_extract(mvt.document, '$.direction') as direction,
|
||||
json_extract(mvt.document, '$.operation') as operation,
|
||||
json_extract(mvt.document, '$.date') as date,
|
||||
json_extract(mvt.document, '$.amount') as amount,
|
||||
COALESCE((SELECT
|
||||
json_extract(links.document, '$.temp_key')
|
||||
FROM {!$module.table} AS links
|
||||
WHERE json_extract(links.document, '$.temp_key') = mvt.key
|
||||
OR json_extract(links.document, '$.return') = mvt.key), mvt.key)
|
||||
AS out_temp_key
|
||||
FROM {!$module.table} AS mvt
|
||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||
INNER JOIN {!$module.table} AS eqpmt
|
||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
WHERE users.id = :user
|
||||
AND eqpmt.key = :eqpmt_key
|
||||
AND (json_extract(mvt.document, '$.operation') IN !output_types
|
||||
OR json_extract(mvt.document, '$.operation') IN !input_types)
|
||||
ORDER BY out_temp_key, date
|
||||
;
|
||||
:user = $_GET.id
|
||||
:eqpmt_key = $_GET.key|trim
|
||||
!output_types=$output_types.temporaire
|
||||
!input_types=$input_types.retour
|
||||
}}
|
||||
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}}
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
||||
{{:assign var="total" from="reste.%s"|args:$out_temp_key}}
|
||||
{{if $total == null}}
|
||||
{{:assign total=0}}
|
||||
{{/if}}
|
||||
|
||||
{{if $otk != null && $otk != $out_temp_key}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/if}}
|
||||
{{if $otk == null || $otk != $out_temp_key}}
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Date</td>
|
||||
<td>Opération</td>
|
||||
<td>Quantité</td>
|
||||
<td>Total</td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{:assign otk=$out_temp_key}}
|
||||
{{/if}}
|
||||
|
||||
{{if $direction == 'input' && $type_mvt == 'retour'}}
|
||||
{{:assign var="reste.%s"|args:$out_temp_key value="%d-%d"|math:$total:$amount}}
|
||||
{{elseif $direction == 'output' && $type_mvt == 'temporaire'}}
|
||||
{{:assign var="reste.%s"|args:$out_temp_key value="%d+%d"|math:$total:$amount}}
|
||||
{{/if}}
|
||||
{{:assign var="total" from="reste.%s"|args:$out_temp_key}}
|
||||
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$op_label}}</td>
|
||||
<td>{{$amount}}</td>
|
||||
<td>{{$total}}</td>
|
||||
<td class="actions">
|
||||
{{#restrict section="accounting" level="write"}}
|
||||
{{if $direction == "output" && $type_mvt == "temporaire"}}
|
||||
{{:linkbutton
|
||||
label="Retour"
|
||||
href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$_GET.id
|
||||
shape="history"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
{{/restrict}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/select}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Paramètres :
|
||||
- key : clé du matériel à modifier
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
name="Gestion des matériels"
|
||||
description="Permet de gérer un inventaire de matériels, ainsi que de suivre les prêts."
|
||||
description="Permet de gérer un inventaire de matériels, ainsi que de suivre les prêts (en test)."
|
||||
author="Jean-Christophe Engel"
|
||||
author_url="https://gitea.zaclys.com/lesanges"
|
||||
home_button=true
|
||||
menu=true
|
||||
restrict_section="users"
|
||||
restrict_level="read"
|
||||
restrict_details="... mais uniquement pour consulter l'historique des prêts des membres ; seuls les membres ayant accès en écriture à la comptabilité pourront utiliser l'ensemble des fonctionalités du module."
|
||||
allow_user_restrict=false
|
||||
restrict_section="accounting"
|
||||
restrict_level="write"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="entrees"}}
|
||||
{{/if}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
|
@ -117,10 +120,6 @@
|
|||
{{/form}}
|
||||
|
||||
{{:admin_header title="Entrée de matériel" current="module_equipment"}}
|
||||
{{* barre de navigation *}}
|
||||
{{if ! $dialog}}
|
||||
{{:include file="../_nav.html" current="entrees"}}
|
||||
{{/if}}
|
||||
{{:form_errors}}
|
||||
|
||||
{{if $categories != null}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Dupliquer un mouvement
|
||||
paramètres :
|
||||
|
|
@ -16,7 +14,7 @@
|
|||
{{/load}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config, directions, loan_duration"}}
|
||||
{{:include file="../_get_config.html" keep="config, directions"}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
|
||||
{{* interdire de dupliquer un retour => utiliser le bouton « Retour » *}}
|
||||
|
|
@ -95,11 +93,6 @@
|
|||
{{: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}}
|
||||
{{if $_POST.set_return_date != null}}
|
||||
{{:assign return_date=$_POST.return_date}}
|
||||
{{else}}
|
||||
{{:assign return_date=null}}
|
||||
{{/if}}
|
||||
|
||||
{{*
|
||||
lister les mouvements
|
||||
|
|
@ -205,22 +198,11 @@
|
|||
user=$user.id
|
||||
storage=$_POST.storage
|
||||
transactions=$transactions
|
||||
return_date=$return_date|parse_date
|
||||
}}
|
||||
{{if $_GET.from == "lh"}}
|
||||
{{:assign from="../loan_history.html"}}
|
||||
{{else}}
|
||||
{{:assign from="../equipment_history.html"}}
|
||||
{{/if}}
|
||||
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=copie"|args:$from:$eqpmt_key:$prop}}
|
||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}}
|
||||
{{/form}}
|
||||
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{:assign mvt_label="entrée"}}
|
||||
{{else}}
|
||||
{{:assign mvt_label="sortie"}}
|
||||
{{/if}}
|
||||
{{:admin_header title="Dupliquer une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}}
|
||||
{{:admin_header title="Dupliquer un mouvement" custom_css="./../style.css" current="module_equipment"}}
|
||||
{{:form_errors}}
|
||||
|
||||
{{*
|
||||
|
|
@ -279,29 +261,14 @@
|
|||
}}
|
||||
{{/if}}
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{:input type="select" name="storage" default=$mvt_new.storage label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
||||
{{/if}}
|
||||
{{if $type_mvt != "retour"}}
|
||||
{{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}}
|
||||
{{if $storage != null}}
|
||||
{{:input type="select" name="storage" label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
||||
{{/if}}
|
||||
{{if $type_mvt != "retour"}}
|
||||
{{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}}
|
||||
{{if $mvt_new.direction == "output" && $type_mvt == "temporaire"}}
|
||||
{{if $mvt_new.return_date != null}}
|
||||
{{:assign checked="checked"}}
|
||||
{{:assign visibility="visible"}}
|
||||
{{:assign return_date=$mvt_new.return_date}}
|
||||
{{else}}
|
||||
{{:assign visibility="hidden"}}
|
||||
{{:assign ts_sortie=$mvt_new.date|strtotime}}
|
||||
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$loan_duration}}
|
||||
{{:assign return_date=$ts_retour|date_short}}
|
||||
{{/if}}
|
||||
{{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour" checked="%s"|args:$checked}}
|
||||
<div id="div_return_date" style="visibility:{{$visibility}}">
|
||||
{{:input type="date" name="return_date" label="Date de retour" default=$return_date}}
|
||||
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$loan_duration}}">
|
||||
</div>
|
||||
{{/if}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
|
@ -312,20 +279,3 @@
|
|||
</form>
|
||||
|
||||
{{:admin_footer}}
|
||||
|
||||
<script type="text/javascript" src="../scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_return_date']) {
|
||||
toggleVisibility(idcheck, fields);
|
||||
}
|
||||
|
||||
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
||||
{
|
||||
setReturnDate(id_date, id_return_date, id_loan_duration);
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
|
||||
document.getElementById('f_date').onchange = changeReturnDate;
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
{{* -*- brindille -*-}}
|
||||
|
||||
{{*
|
||||
paramètres GET :
|
||||
|
|
@ -23,11 +21,6 @@
|
|||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{#form on="delete"}}
|
||||
{{if $_GET.from == "lh"}}
|
||||
{{:assign from="../loan_history.html"}}
|
||||
{{else}}
|
||||
{{:assign from="../equipment_history.html"}}
|
||||
{{/if}}
|
||||
{{* vérifier s'il est possible de supprimer le mouvement *}}
|
||||
{{if $mvt_suppr.direction == 'input'}}
|
||||
{{:assign var="type_operation" from="config.input_nature.%s.type"|args:$mvt_suppr.operation}}
|
||||
|
|
@ -36,7 +29,7 @@
|
|||
{{:assign link_key=$key}}
|
||||
{{/load}}
|
||||
{{if $link_key != null}}
|
||||
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign dispo=0}}
|
||||
|
|
@ -69,7 +62,7 @@
|
|||
|
||||
{{* problème ? *}}
|
||||
{{if $dispo < 0 || $nonprop < 0}}
|
||||
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/load}}
|
||||
|
|
@ -90,7 +83,7 @@
|
|||
{{:assign link_key=$key}}
|
||||
{{/load}}
|
||||
{{if $link_key != null}}
|
||||
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{/if}}
|
||||
{{elseif $type_operation == 'retour'}}
|
||||
{{#load type="link" where="$$.return = :key" :key=$_GET.key}}
|
||||
|
|
@ -155,7 +148,7 @@
|
|||
out=$curr_eqpmt.out
|
||||
notowned=$curr_eqpmt.notowned
|
||||
}}
|
||||
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
||||
{{else}}
|
||||
{{* supprimer le matériel *}}
|
||||
{{:delete key=$curr_eqpmt.key}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Enregistrer une entrée de matériel
|
||||
paramètres :
|
||||
|
|
@ -44,7 +42,7 @@
|
|||
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
||||
{{/if}}
|
||||
|
||||
{{* écritures liées *}}
|
||||
{{* documents liés *}}
|
||||
{{#foreach from=$_POST.transactions item="value"}}
|
||||
{{:assign var="transactions." value=$value|intval}}
|
||||
{{/foreach}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Enregistrer un retour d'entrée temporaire
|
||||
paramètres :
|
||||
|
|
@ -34,9 +32,9 @@
|
|||
|
||||
{{#select
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
|
||||
FROM {!$module.table} AS mvt
|
||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
FROM module_data_equipment AS mvt
|
||||
LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
AND mvt.key = :mvt_key
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Modifier un mouvement
|
||||
paramètres :
|
||||
|
|
@ -15,7 +13,7 @@
|
|||
{{/load}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config, directions, loan_duration"}}
|
||||
{{:include file="../_get_config.html" keep="config, directions"}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
|
|
@ -86,11 +84,6 @@
|
|||
{{: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}}
|
||||
{{if $_POST.set_return_date != null}}
|
||||
{{:assign return_date=$_POST.return_date}}
|
||||
{{else}}
|
||||
{{:assign return_date=null}}
|
||||
{{/if}}
|
||||
|
||||
{{*
|
||||
lister les mouvements
|
||||
|
|
@ -204,7 +197,7 @@
|
|||
|
||||
{{* enregistrer le mouvement modifié *}}
|
||||
{{if $user == null}}
|
||||
{{:assign user_id=null}}
|
||||
{{:assign user_id=$mvt_new.user}}
|
||||
{{else}}
|
||||
{{:assign user_id=$user.id}}
|
||||
{{/if}}
|
||||
|
|
@ -222,24 +215,13 @@
|
|||
user=$user_id
|
||||
storage=$_POST.storage
|
||||
transactions=$transactions
|
||||
return_date=$return_date|parse_date
|
||||
}}
|
||||
{{if $_GET.from == "lh"}}
|
||||
{{:assign from="../loan_history.html"}}
|
||||
{{else}}
|
||||
{{:assign from="../equipment_history.html"}}
|
||||
{{/if}}
|
||||
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=modification"|args:$from:$eqpmt_key:$prop}}
|
||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
|
||||
{{/form}}
|
||||
|
||||
{{if $mvt_new.direction == "input"}}
|
||||
{{:assign mvt_label="entrée"}}
|
||||
{{else}}
|
||||
{{:assign mvt_label="sortie"}}
|
||||
{{/if}}
|
||||
{{:admin_header title="Modifier une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}}
|
||||
|
||||
{{:admin_header title="Modifier un mouvement" custom_css="./../style.css" current="module_equipment"}}
|
||||
{{:form_errors}}
|
||||
|
||||
{{*
|
||||
-------------------- Préparer la saisie --------------------
|
||||
*}}
|
||||
|
|
@ -250,6 +232,11 @@
|
|||
{{#select id, !name as nom FROM users WHERE id=:id; !name=$config.user_fields.name_sql :id=$mvt_new.user}}
|
||||
{{:assign var="user.%s"|args:$id value=$nom}}
|
||||
{{/select}}
|
||||
{{#load type="link" where="$$.direction="output" AND $$.temp_key = :mvt_key" :mvt_key=$mvt_new.key limit=1}}
|
||||
{{:assign retour=true}}
|
||||
{{else}}
|
||||
{{:assign retour=false}}
|
||||
{{/load}}
|
||||
{{/if}}
|
||||
|
||||
{{#load type="storage" order="$$.name"}}
|
||||
|
|
@ -287,11 +274,10 @@
|
|||
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="entree">
|
||||
<legend>Informations facultatives</legend>
|
||||
<dl>
|
||||
{{if $prop == 1 && $mvt_new.direction == "output"}}
|
||||
{{if $prop == 1 && $mvt_new.direction == "output" && ! $retour}}
|
||||
{{:input
|
||||
type="list"
|
||||
name="user"
|
||||
|
|
@ -306,28 +292,11 @@
|
|||
{{if $storage != null}}
|
||||
{{:input type="select" name="storage" label="Lieu de stockage" default=$mvt_new.storage default_empty="— Aucun —" options=$storage required=false}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{if $type_mvt != "retour"}}
|
||||
{{:input type="list" name="transactions" default=$mvt_new.transactions label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}}
|
||||
{{if $type_mvt != "retour"}}
|
||||
{{:input type="list" name="transactions" default=$mvt_new.transactions label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false default=$mvt_new.comment}}
|
||||
{{if $mvt_new.direction == "output" && $type_mvt == "temporaire"}}
|
||||
{{if $mvt_new.return_date != null}}
|
||||
{{:assign checked="checked"}}
|
||||
{{:assign visibility="visible"}}
|
||||
{{:assign return_date=$mvt_new.return_date}}
|
||||
{{else}}
|
||||
{{:assign visibility="hidden"}}
|
||||
{{:assign ts_sortie=$mvt_new.date|strtotime}}
|
||||
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$loan_duration}}
|
||||
{{:assign return_date=$ts_retour|date_short}}
|
||||
{{/if}}
|
||||
{{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour" checked="%s"|args:$checked}}
|
||||
<div id="div_return_date" style="visibility:{{$visibility}}">
|
||||
{{:input type="date" name="return_date" label="Date de retour" default=$return_date}}
|
||||
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$loan_duration}}">
|
||||
</div>
|
||||
{{/if}}
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
|
@ -338,20 +307,3 @@
|
|||
</form>
|
||||
|
||||
{{:admin_footer}}
|
||||
|
||||
<script type="text/javascript" src="../scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_return_date']) {
|
||||
toggleVisibility(idcheck, fields);
|
||||
}
|
||||
|
||||
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
||||
{
|
||||
setReturnDate(id_date, id_return_date, id_loan_duration);
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
|
||||
document.getElementById('f_date').onchange = changeReturnDate;
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -46,11 +46,6 @@
|
|||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"return_date" : {
|
||||
"description": "Date de retour du matériel",
|
||||
"type" : ["null", "string"],
|
||||
"format" : "date"
|
||||
}
|
||||
},
|
||||
"required": ["type", "direction", "operation", "amount", "equipment", "date", "comment"]
|
||||
|
|
|
|||
|
|
@ -1,120 +0,0 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Afficher les détails d'un mouvement et donner la possibilité :
|
||||
- d'associer des fichiers
|
||||
- de modifier, supprimer ou dupliquer le mouvement
|
||||
paramètres :
|
||||
- key : clé du mouvement
|
||||
- prop = 1 si matériel appartient à l'asso
|
||||
*}}
|
||||
|
||||
{{:admin_header title="Détails du mouvement" custom_css="../style.css" current="module_equipment"}}
|
||||
{{:form_errors}}
|
||||
|
||||
{{* récupérer les infos du mouvement *}}
|
||||
{{#load key=$_GET.key assign="mvt"}}
|
||||
{{else}}
|
||||
{{:error message="Aucun mouvement avec la clé %s"|args:$_GET.key}}
|
||||
{{/load}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config, directions"}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}}
|
||||
|
||||
{{* récupérer les infos du matériel associé *}}
|
||||
{{#load key=$mvt.equipment assign="equipment"}}
|
||||
{{else}}
|
||||
{{:error message="Aucun matériel avec la clé « %s »"|args:$mvt.equipment}}
|
||||
{{/load}}
|
||||
|
||||
{{*
|
||||
-------------------- Afficher les informations du mouvement --------------------
|
||||
*}}
|
||||
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt.direction:$mvt.operation}}
|
||||
{{#load key=$equipment.category assign="category"}}{{/load}}
|
||||
{{#load key=$mvt.storage assign="storage"}}{{/load}}
|
||||
{{#select !name as nom FROM users WHERE id=:id; !name=$config.user_fields.name_sql :id=$mvt.user}}
|
||||
{{:assign user_name=$nom}}
|
||||
{{/select}}
|
||||
|
||||
<nav class="tabs">
|
||||
{{:linkbutton
|
||||
label="Modifier ce mouvement"
|
||||
href="modify_movement.html?key=%s&from=%s"|args:$_GET.key:$_GET.from
|
||||
shape="edit"
|
||||
target="_dialog"}}
|
||||
{{:linkbutton
|
||||
label="Supprimer ce mouvement"
|
||||
href="delete_movement.html?key=%s&prop=%s&from=%s"|args:$_GET.key:$_GET.prop:$_GET.from
|
||||
shape="delete"
|
||||
target="_dialog"}}
|
||||
{{if $type_mvt != "retour"}}
|
||||
{{:linkbutton
|
||||
label="Dupliquer ce mouvement"
|
||||
href="copy_movement.html?key=%s&prop=%s&from=%s"|args:$_GET.key:$_GET.prop:$_GET.from
|
||||
shape="plus"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
</nav>
|
||||
|
||||
<dl class="describe">
|
||||
<dt>Opération</dt>
|
||||
<dd>{{$op_label}}</dd>
|
||||
<dt>Matériel</dt>
|
||||
<dd>{{:link href="../equipment_history.html?key=%s&prop=%s"|args:$equipment.key:$_GET.prop label=$equipment.name}}</dd>
|
||||
<dt>Catégorie</dt>
|
||||
<dd>{{:link href="../index.html?cat_key=%s&prop=1"|args:$category.key label=$category.name}}</dd>
|
||||
<dt>Date</dt>
|
||||
<dd>{{$mvt.date|date_short}}</dd>
|
||||
<dt>Quantité</dt>
|
||||
<dd>{{$mvt.amount}}</dd>
|
||||
{{if $mvt.direction == "output" && $type_mvt != "retour"}}
|
||||
<dt>Membre destinataire</dt>
|
||||
<dd>
|
||||
{{if $mvt.user != null}}
|
||||
{{:link href="/admin/users/details.php?id=%s"|args:$mvt.user label=$user_name}}
|
||||
{{else}}—
|
||||
{{/if}}
|
||||
</dd>
|
||||
{{/if}}
|
||||
{{if $mvt.direction == "input"}}
|
||||
<dt>Lieu de stockage</dt>
|
||||
<dd>
|
||||
{{if $storage != null}}
|
||||
{{$storage.name}}
|
||||
{{else}}—
|
||||
{{/if}}
|
||||
</dd>
|
||||
{{/if}}
|
||||
<dt>Écritures liées</dt>
|
||||
<dd>
|
||||
{{#foreach from=$mvt.transactions item="trans"}}
|
||||
{{:link class="num" href="!acc/transactions/details.php?id=%d"|args:$trans label=$trans}}
|
||||
{{else}}—
|
||||
{{/foreach}}
|
||||
</dd>
|
||||
{{if $mvt.direction == "output" && $type_mvt != "retour"}}
|
||||
<dt>Date de retour</dt>
|
||||
<dd>
|
||||
{{if $mvt.return_date != null}}
|
||||
{{$mvt.return_date|date_short}}
|
||||
{{else}}—
|
||||
{{/if}}
|
||||
</dd>
|
||||
{{/if}}
|
||||
<dt>Remarques</dt>
|
||||
<dd>{{if $mvt.comment != null}}
|
||||
{{$mvt.comment}}
|
||||
{{else}}—
|
||||
{{/if}}
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<form method="post" action="">
|
||||
{{:admin_files path=$_GET.key upload=true edit=true use_trash=false}}
|
||||
</form>
|
||||
{{:admin_footer}}
|
||||
|
|
@ -1,14 +1,12 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
paramètres :
|
||||
- key : clé du matériel à sortir
|
||||
*}}
|
||||
|
||||
{{* récupérer la config des entrées/sorties *}}
|
||||
{{:include file="../_get_config.html" keep="config, loan_duration"}}
|
||||
{{:include file="../_get_config.html" keep="config"}}
|
||||
|
||||
{{* types de sorties *}}
|
||||
{{#foreach from=$config.output_nature key=key}}
|
||||
|
|
@ -33,15 +31,6 @@
|
|||
{{/if}}
|
||||
|
||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}}
|
||||
{{if $type_mvt != "temporaire" && $_POST.set_return_date != null}}
|
||||
{{:error message="On ne peut associer une date de retour qu'à une sortie temporaire"}}
|
||||
{{/if}}
|
||||
{{if $_POST.set_return_date != null}}
|
||||
{{:assign return_date=$_POST.return_date}}
|
||||
{{else}}
|
||||
{{:assign return_date=null}}
|
||||
{{/if}}
|
||||
|
||||
{{if $_POST.user|count > 1}}
|
||||
{{:error message="Un membre au plus peut être associé à une sortie"}}
|
||||
{{/if}}
|
||||
|
|
@ -128,11 +117,6 @@
|
|||
{{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$_POST.amount|intval}}
|
||||
{{/if}}
|
||||
|
||||
{{* écritures liées *}}
|
||||
{{#foreach from=$_POST.transactions item="value"}}
|
||||
{{:assign var="transactions." value=$value|intval}}
|
||||
{{/foreach}}
|
||||
|
||||
{{:save
|
||||
key=$equipment.key
|
||||
validate_schema="../equipment.schema.json"
|
||||
|
|
@ -158,8 +142,6 @@
|
|||
date=$_POST.date|parse_date
|
||||
comment=$_POST.remarques|trim
|
||||
user=$user.id
|
||||
return_date=$return_date|parse_date
|
||||
transactions=$transactions
|
||||
}}
|
||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=1&msg=sortie"|args:$_GET.key}}
|
||||
{{/form}}
|
||||
|
|
@ -174,8 +156,6 @@
|
|||
{{:assign dispo="%d-%d"|math:$equipment.stock:$equipment.out}}
|
||||
|
||||
{{if $dispo > 0}}
|
||||
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$now:$loan_duration}}
|
||||
{{:assign date_retour=$ts_retour|date_short}}
|
||||
|
||||
{{* formulaire de sortie de matériel *}}
|
||||
<form method="post" action="">
|
||||
|
|
@ -213,13 +193,7 @@
|
|||
multiple=true
|
||||
max=1
|
||||
}}
|
||||
{{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}}
|
||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||
{{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour"}}
|
||||
<div id="div_return_date" style="visibility:hidden">
|
||||
{{:input type="date" id="return_date" name="return_date" label="Date de retour" default=$date_retour}}
|
||||
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$loan_duration}}">
|
||||
</div>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<p class="submit">
|
||||
|
|
@ -232,21 +206,3 @@
|
|||
|
||||
{{:form_errors}}
|
||||
{{:admin_footer}}
|
||||
|
||||
<script type="text/javascript" src="../scripts.js"></script>
|
||||
<script type="text/javascript">
|
||||
function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_return_date']) {
|
||||
toggleVisibility(idcheck, fields);
|
||||
}
|
||||
|
||||
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
||||
{
|
||||
setReturnDate(id_date, id_return_date, id_loan_duration);
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.getElementById('f_set_return_date_1').checked = false;
|
||||
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
|
||||
document.getElementById('f_date').onchange = changeReturnDate;
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Enregistrer un retour de sortie temporaire
|
||||
paramètres :
|
||||
|
|
@ -34,9 +32,9 @@
|
|||
|
||||
{{#select
|
||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur
|
||||
FROM {!$module.table} AS mvt
|
||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
FROM module_data_equipment AS mvt
|
||||
LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
||||
LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||
WHERE
|
||||
json_extract(mvt.document, '$.operation') IN !op
|
||||
AND mvt.key = :mvt_key
|
||||
|
|
|
|||
38
scripts.js
38
scripts.js
|
|
@ -25,41 +25,3 @@ function disableColumSort(liste) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleVisibility(idcheck, fields) {
|
||||
const elem = document.getElementById(idcheck);
|
||||
for (let id of fields) {
|
||||
const field = document.getElementById(id);
|
||||
if (elem.checked) {
|
||||
field.style.visibility = "visible";
|
||||
} else {
|
||||
field.style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* renvoyer la valeur en secondes d'une date au format j/m/a
|
||||
* @param {string} date
|
||||
*/
|
||||
function str2sec(date) {
|
||||
const jma = date.split('/');
|
||||
const dd = new Date(jma[2], jma[1]-1, jma[0]);
|
||||
return dd.getTime()/1000;
|
||||
}
|
||||
|
||||
// renvoyer la valeur en secondes d'un champ date
|
||||
function getDate(idelem) {
|
||||
return str2sec(document.getElementById(idelem).value);
|
||||
}
|
||||
|
||||
/**
|
||||
* modifier la date de retour en fonction de la date de sortie et de la durée du prêt
|
||||
*/
|
||||
function setReturnDate(id_date, id_return_date, id_loan_duration)
|
||||
{
|
||||
const loan_duration = document.getElementById(id_loan_duration).value;
|
||||
let nbsec = getDate(id_date) + loan_duration*24*60*60;
|
||||
const date_retour = new Date(nbsec * 1000);
|
||||
document.getElementById(id_return_date).value = date_retour.toLocaleDateString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,151 +30,97 @@
|
|||
{{/load}}
|
||||
|
||||
{{if $table_presente}}
|
||||
{{* Matériels attribués temporairement *}}
|
||||
{{* vérifier la présence des types d'entrées et de sorties requis *}}
|
||||
{{if $output_types|has_key:"temporaire" && $input_types|has_key:"retour"}}
|
||||
|
||||
{{*
|
||||
Calculer les quantités de matériel en prêt
|
||||
*}}
|
||||
{{:assign premier=true}}
|
||||
{{#select
|
||||
json_extract(mvt.document, '$.direction') AS direction,
|
||||
json_extract(mvt.document, '$.date') AS date,
|
||||
eqpmt.key as eqpmt_key,
|
||||
json_extract(eqpmt.document, '$.name') AS eqpmt_name,
|
||||
json_extract(mvt.document, '$.amount') AS qte,
|
||||
json_extract(mvt.document, '$.return_date') AS return_date,
|
||||
json_extract(mvt.document, '$.operation') AS operation
|
||||
FROM {!$module.table} AS mvt
|
||||
json_extract(eqpmt.document, '$.name') as eqpmt_name,
|
||||
mvt.key AS mvt_key,
|
||||
json_extract(mvt.document, '$.direction') as direction,
|
||||
json_extract(mvt.document, '$.operation') as operation,
|
||||
json_extract(mvt.document, '$.date') as date,
|
||||
json_extract(mvt.document, '$.amount') as amount
|
||||
FROM module_data_equipment AS mvt
|
||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||
INNER JOIN {!$module.table} AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
WHERE
|
||||
users.id = :user
|
||||
AND
|
||||
json_extract(mvt.document, '$.type') = 'movement'
|
||||
AND
|
||||
(json_extract(mvt.document, '$.operation') IN !output_types
|
||||
OR
|
||||
json_extract(mvt.document, '$.operation') IN !input_types)
|
||||
ORDER BY eqpmt_name, date
|
||||
INNER JOIN module_data_equipment AS eqpmt
|
||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
WHERE users.id = :user
|
||||
AND (json_extract(mvt.document, '$.operation') IN !output_types
|
||||
OR json_extract(mvt.document, '$.operation') IN !input_types)
|
||||
ORDER BY date
|
||||
;
|
||||
:user = $user.id
|
||||
!output_types=$output_types.temporaire
|
||||
!input_types=$input_types.retour
|
||||
assign="temp_mat."
|
||||
}}
|
||||
{{if $premier}}
|
||||
{{:assign premier=false}}
|
||||
{{:assign total=0}}
|
||||
{{:assign nb_jours=0}}
|
||||
{{:assign old_eqpmt_key=$eqpmt_key}}
|
||||
{{:assign var="ligne.date" value=$date}}
|
||||
{{:assign var="ligne.eqpmt_key" value=$eqpmt_key}}
|
||||
{{:assign var="ligne.materiel" value=$eqpmt_name}}
|
||||
{{:assign var="ligne.return_date" value=$return_date}}
|
||||
{{:assign var="ligne.retard" value="0"}}
|
||||
{{if $return_date != null}}
|
||||
{{:assign ts_retour=$return_date|strtotime}}
|
||||
{{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}}
|
||||
{{:assign var="ligne.retard" value=$nb_jours}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $eqpmt_key != $old_eqpmt_key}}
|
||||
{{if $total > 0}}
|
||||
{{:assign var="ligne.qte" value=$total}}
|
||||
{{:assign var="lignes." value=$ligne}}
|
||||
{{/if}}
|
||||
{{:assign total=0}}
|
||||
{{:assign nb_jours=0}}
|
||||
{{:assign old_eqpmt_key=$eqpmt_key}}
|
||||
{{:assign var="ligne.date" value=$date}}
|
||||
{{:assign var="ligne.eqpmt_key" value=$eqpmt_key}}
|
||||
{{:assign var="ligne.materiel" value=$eqpmt_name}}
|
||||
{{:assign var="ligne.return_date" value=$return_date}}
|
||||
{{:assign var="ligne.retard" value="0"}}
|
||||
{{if $return_date != null}}
|
||||
{{:assign ts_retour=$return_date|strtotime}}
|
||||
{{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}}
|
||||
{{:assign var="ligne.retard" value=$nb_jours}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{if $direction == "output"}}
|
||||
{{:assign total="%d+%d"|math:$total:$qte}}
|
||||
{{else}}
|
||||
{{:assign total="%d-%d"|math:$total:$qte}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
|
||||
{{if $total > 0}}
|
||||
{{:assign var="ligne.qte" value=$total}}
|
||||
{{:assign var="lignes." value=$ligne}}
|
||||
{{/if}}
|
||||
|
||||
{{if $lignes|count > 0}}
|
||||
<h3 class="ruler">Matériels attribués temporairement</h3>
|
||||
<table class="list" id="liste_temporaires">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Matériel</th>
|
||||
<th>Quantité</th>
|
||||
<th>Date de retour</th>
|
||||
<th>Remarque</th>
|
||||
<th class="actions">
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$lignes}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$materiel}}</td>
|
||||
<td>{{$qte}}</td>
|
||||
<td>{{$return_date|date_short}}</td>
|
||||
<td>
|
||||
{{if $retard < 0}}
|
||||
{{:assign delai="abs(%d)"|math:$retard}}
|
||||
{{"Reste %s jours"|args:$delai}}
|
||||
{{elseif $retard >0 }}
|
||||
{{:tag color="darkred" label="Retard %s jours"|args:$retard}}
|
||||
{{else}}
|
||||
{{:tag color="darkgreen" label="À rendre aujourdh'ui"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
<td class="actions">
|
||||
{{:linkbutton
|
||||
label="Historique"
|
||||
href="%smember_history.html?key=%s&id=%s"|args:$module.url:$eqpmt_key:$user.id
|
||||
shape="table"
|
||||
target="_dialog"
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{* Matériels attribués définitivement *}}
|
||||
{{* vérifier la présence des types de sorties requis *}}
|
||||
{{if $output_types|has_key:"définitif"}}
|
||||
{{if $temp_mat|count != 0}}
|
||||
<h3 class="ruler">Matériels attribués temporairement</h3>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Date</td>
|
||||
<td>Opération</td>
|
||||
<td>Matériel</td>
|
||||
<td>Quantité</td>
|
||||
<td>Total</td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$temp_mat}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}}
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
||||
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
||||
{{if $total == null}}
|
||||
{{:assign total=0}}
|
||||
{{/if}}
|
||||
{{if $direction == 'input' && $type_mvt == 'retour'}}
|
||||
{{:assign var="reste.%s"|args:$eqpmt_key value="%d-%d"|math:$total:$amount}}
|
||||
{{elseif $direction == 'output' && $type_mvt == 'temporaire'}}
|
||||
{{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}}
|
||||
{{/if}}
|
||||
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$op_label}}</td>
|
||||
<td>{{$eqpmt_name}}</td>
|
||||
<td>{{$amount}}</td>
|
||||
<td>{{$total}}</td>
|
||||
<td class="actions">
|
||||
{{if $direction == "output" && $type_mvt == "temporaire"}}
|
||||
{{:linkbutton
|
||||
label="Retour"
|
||||
href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$user.id
|
||||
shape="history"
|
||||
target="_dialog"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/if}}
|
||||
|
||||
{{* vérifier la présence des types d'entrées et de sorties requis *}}
|
||||
{{ if $output_types|has_key:"définitif"}}
|
||||
{{#select
|
||||
eqpmt.key as eqpmt_key,
|
||||
json_extract(eqpmt.document, '$.name') as eqpmt_name,
|
||||
json_extract(mvt.document, '$.direction') as direction,
|
||||
json_extract(mvt.document, '$.operation') as operation,
|
||||
MIN(json_extract(mvt.document, '$.date')) as date,
|
||||
SUM(json_extract(mvt.document, '$.amount')) as amount
|
||||
FROM {!$module.table} AS mvt
|
||||
json_extract(mvt.document, '$.date') as date,
|
||||
json_extract(mvt.document, '$.amount') as amount
|
||||
FROM module_data_equipment AS mvt
|
||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||
INNER JOIN {!$module.table} AS eqpmt
|
||||
INNER JOIN module_data_equipment AS eqpmt
|
||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||
WHERE users.id = :user
|
||||
AND json_extract(mvt.document, '$.operation') IN !output_types
|
||||
GROUP BY eqpmt_key, operation
|
||||
ORDER BY eqpmt_name, date
|
||||
ORDER BY date DESC
|
||||
;
|
||||
:user = $user.id
|
||||
!output_types=$output_types.définitif
|
||||
|
|
@ -188,20 +134,31 @@
|
|||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Matériel</th>
|
||||
<th>Opération</th>
|
||||
<th>Quantité</th>
|
||||
<td>Date</td>
|
||||
<td>Opération</td>
|
||||
<td>Matériel</td>
|
||||
<td>Quantité</td>
|
||||
<td>Total</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$def_mat}}
|
||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}}
|
||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
||||
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
||||
{{if $total == null}}
|
||||
{{:assign total=0}}
|
||||
{{/if}}
|
||||
{{if $direction == 'output' && $type_mvt == 'définitif'}}
|
||||
{{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}}
|
||||
{{/if}}
|
||||
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
||||
<tr>
|
||||
<td>{{$date|date_short}}</td>
|
||||
<td>{{$eqpmt_name}}</td>
|
||||
<td>{{$op_label}}</td>
|
||||
<td>{{$eqpmt_name}}</td>
|
||||
<td>{{$amount}}</td>
|
||||
<td>{{$total}}</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{* Traiter l'envoi du formulaire *}}
|
||||
{{#form on="save"}}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
paramètres :
|
||||
- key : clé du stockage à supprimer
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Afficher les lieux de stockage
|
||||
*}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{* récupérer les infos du lieu de stockage *}}
|
||||
{{#load key=$_GET.key assign="storage"}}
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@
|
|||
}
|
||||
|
||||
/* désactiver rétroaction pour colonnes non triables */
|
||||
table.list > thead th[class~=nosort] a:hover {
|
||||
table.list > thead td[class~=nosort] a:hover {
|
||||
background-color : rgba(var(--gSecondColor), 0.);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{{* -*- brindille -*- *}}
|
||||
|
||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||
|
||||
{{*
|
||||
Remettre le matériel en service
|
||||
Paramètres :
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue