Compare commits
26 commits
main
...
reorganisa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17b8812f43 | ||
|
|
e692cf0b2c | ||
|
|
e4e717dfb1 | ||
|
|
8bbd0b8101 | ||
|
|
1961431942 | ||
|
|
e28d1b8195 | ||
|
|
90276cb026 | ||
|
|
a0f688fb31 | ||
|
|
05d92d97e6 | ||
|
|
ca7b21bdea | ||
|
|
fc802e7449 | ||
|
|
f007eef3b8 | ||
|
|
00d1a697e1 | ||
|
|
54a42ed5d2 | ||
|
|
bc2aefe26a | ||
|
|
03d278ab2c | ||
|
|
546a9ea677 | ||
|
|
974f87e5a4 | ||
|
|
83c2b9af80 | ||
|
|
b14463ecf2 | ||
|
|
1b1680af5c | ||
|
|
84b35adcfa | ||
|
|
59b13e6e4c | ||
|
|
05b2b9b252 | ||
|
|
2f3785831e | ||
|
|
e2c8ac2d84 |
31 changed files with 1397 additions and 584 deletions
|
|
@ -16,21 +16,13 @@
|
||||||
{{:assign var="nature" from="module.config.%s_nature"|args:$direction}}
|
{{:assign var="nature" from="module.config.%s_nature"|args:$direction}}
|
||||||
{{if $nature != null}}
|
{{if $nature != null}}
|
||||||
{{#foreach from=$nature item="elem"}}
|
{{#foreach from=$nature item="elem"}}
|
||||||
{{:assign var="item" label=$label type=$type}}
|
{{:assign var="config.%s_nature.%s"|args:$direction:$key value=$elem}}
|
||||||
{{:assign var="config.%s_nature.%s"|args:$direction:$key value=$item}}
|
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
{{* pas de config enregistrée : utiliser la config par défaut *}}
|
||||||
{{:assign var="nature" from="config_defaut.%ss"|args:$direction}}
|
{{:assign var="nature" from="config_defaut.%ss"|args:$direction}}
|
||||||
{{#foreach from=$nature item="elem"}}
|
{{#foreach from=$nature item="elem"}}
|
||||||
{{:assign var="item" label=$label type=$type}}
|
{{:assign var="config.%s_nature.%s"|args:$direction:$key value=$elem}}
|
||||||
{{:assign var="config.%s_nature.%s"|args:$direction:$key value=$item}}
|
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
{{if $module.config.loan_duration != null}}
|
|
||||||
{{:assign loan_duration=$module.config.loan_duration}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign loan_duration=$config_defaut.loan_duration}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
|
||||||
113
_inventory.html
113
_inventory.html
|
|
@ -1,18 +1,65 @@
|
||||||
{{* -*- brindille -*- *}}
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
inventaire des entrées/sorties des matériels permanents
|
Inventaire des matériels en stock dans l'association
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* Sélecteur catégories *}}
|
{{* filtrer selon la catégorie *}}
|
||||||
{{:assign var="options." value="" label="Toutes les catégories" href="?prop=1"}}
|
{{:assign saved_filters=$module.config.filters}}
|
||||||
|
{{:assign var="user_filters" from="saved_filters.%s"|args:$logged_user.id}}
|
||||||
|
|
||||||
|
{{if $_GET.cat_key == null}}
|
||||||
|
{{:assign selected_category=$user_filters.stock_cat_key}}
|
||||||
|
{{else}}
|
||||||
|
{{if $_GET.cat_key == -1}}
|
||||||
|
{{:assign selected_category=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_category=$_GET.cat_key}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign var="user_filters.stock_cat_key" value=$selected_category}}
|
||||||
|
{{:assign var="saved_filters.%s"|args:$logged_user.id value=$user_filters}}
|
||||||
|
{{:save key="config" filters=$saved_filters}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* condition de filtrage *}}
|
||||||
|
{{if $selected_category != null}}
|
||||||
|
{{:assign cat_key=$selected_category|quote_sql}}
|
||||||
|
{{:assign cat_condition="$$.category = %s"|args:$cat_key}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign cat_condition="1"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* filtrer selon appartenance *}}
|
||||||
|
{{if $_GET.prop == null}}
|
||||||
|
{{:assign selected_prop=$user_filters.stock_prop}}
|
||||||
|
{{else}}
|
||||||
|
{{if $_GET.prop == -1}}
|
||||||
|
{{:assign selected_prop=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_prop=$_GET.prop}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign var="user_filters.stock_prop" value=$selected_prop}}
|
||||||
|
{{:assign var="saved_filters.%s"|args:$logged_user.id value=$user_filters}}
|
||||||
|
{{:save key="config" filters=$saved_filters}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{:assign prop_condition="1"}}
|
||||||
|
{{elseif $selected_prop == 1}}
|
||||||
|
{{:assign prop_condition="$$.stock NOT NULL"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop_condition="$$.notowned != 0"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* sélecteurs de catégorie et d'appartenance *}}
|
||||||
|
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}}
|
||||||
{{#load type="category" order="$$.name"}}
|
{{#load type="category" order="$$.name"}}
|
||||||
{{:assign var="categories.%s"|args:$key value=$name}}
|
{{:assign var="categories.%s"|args:$key value=$name}}
|
||||||
{{:assign
|
{{:assign
|
||||||
var="options."
|
var="cat_options."
|
||||||
value=$key
|
value=$key
|
||||||
label=$name
|
label=$name
|
||||||
href="?cat_key=%s&prop=1"|args:$key
|
href="?cat_key=%s"|args:$key
|
||||||
}}
|
}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
|
|
@ -20,23 +67,28 @@
|
||||||
<legend>Filtrer par catégorie</legend>
|
<legend>Filtrer par catégorie</legend>
|
||||||
{{:dropdown
|
{{:dropdown
|
||||||
title="Filtrer par catégorie"
|
title="Filtrer par catégorie"
|
||||||
options=$options
|
options=$cat_options
|
||||||
value="%s"|args:$_GET.cat_key
|
value="%s"|args:$selected_category
|
||||||
|
}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{:assign var="prop_options." value="" label="Tous les matériels" href="?prop=-1"}}
|
||||||
|
{{:assign var="prop_options." value="1" label="Matériels propriété de l'association" href="?prop=1"}}
|
||||||
|
{{:assign var="prop_options." value="0" label="Matériels NON propriété de l'association" href="?prop=0"}}
|
||||||
|
|
||||||
|
<fieldset class="shortFormRight">
|
||||||
|
<legend>Filtrer par appartenance</legend>
|
||||||
|
{{:dropdown
|
||||||
|
title="Filtrer par appartenance"
|
||||||
|
options=$prop_options
|
||||||
|
value="%s"|args:$selected_prop
|
||||||
}}
|
}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div class="shortFormLeft">
|
<div class="shortFormLeft">
|
||||||
<p class="help">Inventaire des matériels propriété de l'association</p>
|
<p class="help">Inventaire des matériels présents dans l'association</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{* filtrer selon la catégorie *}}
|
|
||||||
{{if $_GET.cat_key == null}}
|
|
||||||
{{:assign condition="1"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign cat_key=$_GET.cat_key|quote_sql}}
|
|
||||||
{{:assign condition="$$.category = %s"|args:$cat_key}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#list
|
{{#list
|
||||||
select="
|
select="
|
||||||
$$.name AS 'Matériel' ;
|
$$.name AS 'Matériel' ;
|
||||||
|
|
@ -44,35 +96,32 @@
|
||||||
FROM @TABLE as cat
|
FROM @TABLE as cat
|
||||||
WHERE cat.key = @TABLE.$$.category) AS 'Catégorie' ;
|
WHERE cat.key = @TABLE.$$.category) AS 'Catégorie' ;
|
||||||
$$.stock AS 'Stock' ;
|
$$.stock AS 'Stock' ;
|
||||||
|
(SELECT COALESCE($$.notowned, 0)) AS 'Temp' ;
|
||||||
|
(SELECT $$.stock + COALESCE($$.notowned, 0)) AS 'Total' ;
|
||||||
$$.out AS 'Sorti' ;
|
$$.out AS 'Sorti' ;
|
||||||
(SELECT $$.stock - $$.out) AS 'Disponible'
|
(SELECT $$.stock - $$.out) AS 'Disponible'
|
||||||
"
|
"
|
||||||
type="equipment"
|
type="equipment"
|
||||||
where="$$.status <> 'archived' AND $$.stock NOT NULL AND %s"|args:$condition
|
where="$$.status <> 'archived' AND %s AND %s"|args:$cat_condition:$prop_condition
|
||||||
order=1
|
order=1
|
||||||
}}
|
}}
|
||||||
{{:assign var=cat_name from=categories.%s|args:$category}}
|
{{:assign var=cat_name from=categories.%s|args:$category}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{:link href="equipment_history.html?key=%s&prop=1"|args:$key" label=$name}}</td>
|
{{if $selected_prop == null}}
|
||||||
|
{{:assign prop=""}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop="&prop=%s"|args:$selected_prop}}
|
||||||
|
{{/if}}
|
||||||
|
<td>{{:link href="equipment_history.html?key=%s&prop=%s"|args:$key:$selected_prop label=$name}}</td>
|
||||||
<td>{{$cat_name}}</td>
|
<td>{{$cat_name}}</td>
|
||||||
<td class="num">{{$stock}}</td>
|
<td class="num">{{$stock}}</td>
|
||||||
|
<td class="num">{{$col4}}</td>
|
||||||
|
<td class="num">{{$col5}}
|
||||||
<td class="num">{{$out}}</td>
|
<td class="num">{{$out}}</td>
|
||||||
<td class="num">{{$col5}}</td>
|
<td class="num">{{$col7}}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if $col5 > 0}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Sortie"
|
|
||||||
shape="minus"
|
|
||||||
href="movements/output_equipment.html?key=%s"|args:$key
|
|
||||||
target="_dialog"}}
|
|
||||||
{{/if}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Entrée"
|
|
||||||
shape="plus"
|
|
||||||
href="movements/input_equipment.html?key=%s"|args:$key
|
|
||||||
target="_dialog"}}
|
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Historique"
|
label="Mouvements"
|
||||||
href="equipment_history.html?key=%s&prop=1"|args:$key
|
href="equipment_history.html?key=%s&prop=1"|args:$key
|
||||||
shape="table"}}
|
shape="table"}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
|
|
|
||||||
75
_nav.html
75
_nav.html
|
|
@ -3,63 +3,72 @@
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
{{if $current == 'inventaire'}}
|
{{if $current == 'inventaire'}}
|
||||||
<aside>
|
<aside>
|
||||||
{{if $subsubcurrent == null && $cat == 0}}
|
{{if $subcurrent == 'stock'}}
|
||||||
{{:linkbutton label="Ajouter une catégorie" shape="plus" href="categories/add_category.html" target="_dialog"}}
|
{{if $cat == 0}}
|
||||||
{{else}}
|
{{:linkbutton label="Ajouter une catégorie" shape="plus" href="categories/add_category.html" target="_dialog"}}
|
||||||
{{:linkbutton label="Ajouter un nouveau matériel" shape="plus" href="movements/add_new_equipment.html" target="_dialog"}}
|
{{else}}
|
||||||
|
{{:exportmenu right=true}}
|
||||||
|
{{:linkbutton label="Ajouter un nouveau matériel" shape="plus" href="movements/add_new_equipment.html" target="_dialog"}}
|
||||||
|
{{/if}}
|
||||||
|
{{elseif $subcurrent == "mouvements"}}
|
||||||
|
{{if $sortie != null}}
|
||||||
|
{{:linkbutton label="Sortie" shape="minus" href="movements/output_equipment.html?key=%s"|args:$key target="_dialog"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:linkbutton label="Entrée" shape="plus" href="movements/input_equipment.html?key=%s"|args:$key target="_dialog"}}
|
||||||
|
{{/if}}
|
||||||
|
</aside>
|
||||||
|
{{elseif $current == 'config'}}
|
||||||
|
<aside>
|
||||||
|
{{if $subcurrent == 'categories'}}
|
||||||
|
{{:linkbutton label="Ajouter une catégorie" shape="plus" href="add_category.html" target="_dialog"}}
|
||||||
|
{{elseif $subcurrent == 'storage'}}
|
||||||
|
{{:linkbutton label="Ajouter un lieu de stockage" shape="plus" href="add_storage.html" target="_dialog"}}
|
||||||
|
{{elseif $subcurrent == 'typesES'}}
|
||||||
|
{{:linkbutton label="Ajouter un type d'entrée" shape="plus" href="config/add_movement_type.html?dir=input" target="_dialog"}}
|
||||||
|
{{:linkbutton label="Ajouter un type de sortie" shape="plus" href="config/add_movement_type.html?dir=output" target="_dialog"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</aside>
|
</aside>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li {{if $current == 'inventaire'}} class="current"{{/if}}><a href="{{$module.url}}index.html?prop=1">Inventaire</a></li>
|
<li {{if $current == 'inventaire'}} class="current"{{/if}}><a href="{{$module.url}}index.html">Inventaire</a></li>
|
||||||
<li {{if $current == 'historique'}} class="current"{{/if}}><a href="{{$module.url}}global_history.html">Historique</a></li>
|
<li {{if $current == 'historique'}} class="current"{{/if}}><a href="{{$module.url}}global_history.html">Historique</a></li>
|
||||||
|
<li {{if $current == 'prêt'}} class="current"{{/if}}><a href="{{$module.url}}loan_history.html?output_type=loan">Prêts</a></li>
|
||||||
|
<li {{if $current == 'location'}} class="current"{{/if}}><a href="{{$module.url}}loan_history.html?output_type=rent">Locations</a></li>
|
||||||
<li {{if $current == 'archives'}} class="current"{{/if}}><a href="{{$module.url}}archives.html">Archives</a></li>
|
<li {{if $current == 'archives'}} class="current"{{/if}}><a href="{{$module.url}}archives.html">Archives</a></li>
|
||||||
<li {{if $current == 'config'}} class="current"{{/if}}><a href="{{$module.url}}categories/index.html">Configuration</a></li>
|
<li {{if $current == 'config'}} class="current"{{/if}}><a href="{{$module.url}}categories/index.html">Configuration</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{if $current == 'inventaire'}}
|
{{if $current == 'inventaire'}}
|
||||||
<ul class="sub">
|
{{if $subcurrent == 'mouvements'}}
|
||||||
<li {{if $subcurrent == 'proprio'}} class="current"{{/if}}><a href="{{$module.url}}index.html?prop=1">Matériels permanents</a></li>
|
|
||||||
<li {{if $subcurrent == 'nonproprio'}} class="current"{{/if}}><a href="{{$module.url}}index.html?prop=0">Matériels temporaires</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{{if $subsubcurrent == 'historique'}}
|
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li class="title"><strong>Historique — {{$eqpmt}} ({{$category}})</strong></li>
|
<li class="title"><strong>Mouvements — {{$eqpmt}} ({{$category}})</strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{elseif $current == 'historique'}}
|
{{elseif $current == 'prêt'}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li {{if $subcurrent == 'tous'}} class="current"{{/if}}><a href="{{$module.url}}global_history.html">Tous</a></li>
|
<li {{if $subcurrent == 'encours'}} class="current"{{/if}}><a href="{{$module.url}}loan_history.html?output_type=loan">En cours</a></li>
|
||||||
<li {{if $subcurrent == 'prêts'}} class="current"{{/if}}><a href="{{$module.url}}loan_history.html">Prêts</a></li>
|
<li {{if $subcurrent == 'historique'}} class="current"{{/if}}><a href="{{$module.url}}loan_movements.html?output_type=loan">Historique</a></li>
|
||||||
|
<li {{if $subcurrent == 'membres'}} class="current"{{/if}}><a href="{{$module.url}}member_loan.html?output_type=loan">Prêts en cours aux membres</a></li>
|
||||||
|
</ul>
|
||||||
|
{{elseif $current == 'location'}}
|
||||||
|
<ul class="sub">
|
||||||
|
<li {{if $subcurrent == 'encours'}} class="current"{{/if}}><a href="{{$module.url}}loan_history.html?output_type=rent">En cours</a></li>
|
||||||
|
<li {{if $subcurrent == 'historique'}} class="current"{{/if}}><a href="{{$module.url}}loan_movements.html?output_type=rent">Historique</a></li>
|
||||||
|
<li {{if $subcurrent == 'membres'}} class="current"{{/if}}><a href="{{$module.url}}member_loan.html?output_type=rent">Locations en cours aux membres</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{elseif $current == 'archives'}}
|
{{elseif $current == 'archives'}}
|
||||||
{{if $subsubcurrent == 'historique'}}
|
{{if $subcurrent == 'mouvements'}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li class="title"><strong>Historique — {{$eqpmt}} ({{$category}})</strong></li>
|
<li class="title"><strong>Historique — {{$eqpmt}} ({{$category}})</strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{elseif $current == 'config'}}
|
{{elseif $current == 'config'}}
|
||||||
{{if $subcurrent == 'categories'}}
|
|
||||||
<aside>
|
|
||||||
{{:linkbutton label="Ajouter une catégorie" shape="plus" href="add_category.html" target="_dialog"}}
|
|
||||||
</aside>
|
|
||||||
{{elseif $subcurrent == 'storage'}}
|
|
||||||
<aside>
|
|
||||||
{{:linkbutton label="Ajouter un lieu de stockage" shape="plus" href="add_storage.html" target="_dialog"}}
|
|
||||||
</aside>
|
|
||||||
{{elseif $subcurrent == 'typesES'}}
|
|
||||||
<aside>
|
|
||||||
{{:linkbutton label="Ajouter un type d'entrée" shape="plus" href="config/add_movement_type.html?dir=input" target="_dialog"}}
|
|
||||||
{{:linkbutton label="Ajouter un type de sortie" shape="plus" href="config/add_movement_type.html?dir=output" target="_dialog"}}
|
|
||||||
</aside>
|
|
||||||
{{/if}}
|
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li {{if $subcurrent == 'categories'}} class="current"{{/if}}><a href="{{$module.url}}categories/index.html">Catégories</a></li>
|
<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 == '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 == '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>
|
<li {{if $subcurrent == 'divers'}} class="current"{{/if}}><a href="{{$module.url}}config/misc.html">Divers</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,30 @@
|
||||||
<p class="block confirm">Matériel remis en service</p>
|
<p class="block confirm">Matériel remis en service</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{* filtrer selon la catégorie *}}
|
||||||
|
{{if $_GET.cat_key == null}}
|
||||||
|
{{:assign selected_category=$module.config.archive_cat_key}}
|
||||||
|
{{elseif $_GET.cat_key == -1}}
|
||||||
|
{{:assign selected_category=null}}
|
||||||
|
{{:save key="config" archive_cat_key=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_category=$_GET.cat_key}}
|
||||||
|
{{:save key="config" archive_cat_key=$selected_category}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* condition de filtrage *}}
|
||||||
|
{{if $selected_category == null}}
|
||||||
|
{{:assign cat_condition="1"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign cat_key=$selected_category|quote_sql}}
|
||||||
|
{{:assign cat_condition="$$.category == %s"|args:$cat_key}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* Sélecteur catégories *}}
|
{{* Sélecteur catégories *}}
|
||||||
{{:assign var="options." value="" label="Toutes les catégories" href="?prop=1"}}
|
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}}
|
||||||
{{#load type="category" order="$$.name"}}
|
{{#load type="category" order="$$.name"}}
|
||||||
{{:assign
|
{{:assign
|
||||||
var="options."
|
var="cat_options."
|
||||||
value=$key
|
value=$key
|
||||||
label=$name
|
label=$name
|
||||||
href="?cat_key=%s"|args:$key
|
href="?cat_key=%s"|args:$key
|
||||||
|
|
@ -24,8 +43,8 @@
|
||||||
<legend>Filtrer par catégorie</legend>
|
<legend>Filtrer par catégorie</legend>
|
||||||
{{:dropdown
|
{{:dropdown
|
||||||
title="Filtrer par catégorie"
|
title="Filtrer par catégorie"
|
||||||
options=$options
|
options=$cat_options
|
||||||
value="%s"|args:$_GET.cat_key
|
value="%s"|args:$selected_category
|
||||||
}}
|
}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
@ -33,14 +52,6 @@
|
||||||
<p class="help">Matériels qui ne sont plus dans l'association</p>
|
<p class="help">Matériels qui ne sont plus dans l'association</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{* filtrer selon la catégorie *}}
|
|
||||||
{{if $_GET.cat_key == null}}
|
|
||||||
{{:assign condition="1"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign cat_key=$_GET.cat_key|quote_sql}}
|
|
||||||
{{:assign condition="$$.category == %s"|args:$cat_key}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* Liste des matériels archivés *}}
|
{{* Liste des matériels archivés *}}
|
||||||
{{#list
|
{{#list
|
||||||
select="
|
select="
|
||||||
|
|
@ -50,16 +61,16 @@
|
||||||
WHERE cat.key = @TABLE.$$.category) AS "Catégorie"
|
WHERE cat.key = @TABLE.$$.category) AS "Catégorie"
|
||||||
"
|
"
|
||||||
type="equipment"
|
type="equipment"
|
||||||
where="$$.status='archived' AND %s"|args:$condition
|
where="$$.status='archived' AND %s"|args:$cat_condition
|
||||||
order=1
|
order=1
|
||||||
}}
|
}}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$name}}</td>
|
<td>{{:link href="equipment_history.html?key=%s&prop=1¤t=archives"|args:$key label=$name}}</td>
|
||||||
<td>{{$col2}}</td>
|
<td>{{$col2}}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Historique"
|
label="Mouvements"
|
||||||
href="equipment_history.html?key=%s&prop=1¤t=archives"|args:$key
|
href="equipment_history.html?key=%s&prop=1¤t=archives"|args:$key
|
||||||
shape="table"}}
|
shape="table"}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
|
|
|
||||||
27
config.html
27
config.html
|
|
@ -11,15 +11,22 @@
|
||||||
<p class="block confirm">Configuration enregistrée.</p>
|
<p class="block confirm">Configuration enregistrée.</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* lecture config (défaut ou enregistrée) *}}
|
{{* lecture config *}}
|
||||||
{{:include file="./_get_config.html" keep="config, directions"}}
|
{{:include file="./_get_config.html" keep="config_defaut, config, directions"}}
|
||||||
|
|
||||||
|
{{* interdire la modification et la suppression des types de mouvement prédéfinis *}}
|
||||||
|
{{#foreach from=$directions key="direction"}}
|
||||||
|
{{:assign var="nature" from="config_defaut.%ss"|args:$direction}}
|
||||||
|
{{#foreach from=$nature item="elem"}}
|
||||||
|
{{:assign var="default_keys." value=$key}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
{{#foreach from=$directions key="direction" item="item"}}
|
{{#foreach from=$directions key="direction" item="item"}}
|
||||||
|
|
||||||
{{* types de mouvements qui ne peuvent être supprimés *}}
|
{{* types de mouvements qui ne peuvent être supprimés *}}
|
||||||
{{#load type="movement" where="$$.direction='%s'"|args:$direction group="$$.operation"}}
|
{{#load type="movement" where="$$.direction='%s'"|args:$direction group="$$.operation"}}
|
||||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
{{:assign var="locked." value=$operation}}
|
||||||
{{:assign var="locked_%ss."|args:$direction value=$op_label}}
|
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
<h2 class="ruler">{{$item|ucfirst}}s</h2>
|
<h2 class="ruler">{{$item|ucfirst}}s</h2>
|
||||||
|
|
@ -34,15 +41,23 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
||||||
{{#foreach from=$nature key=key}}
|
{{#foreach from=$nature key=key}}
|
||||||
|
{{:assign sortie_temp=false}}
|
||||||
|
{{if $direction == 'output'}}
|
||||||
|
{{:assign var="type" from="nature.%s.type"|args:$key}}
|
||||||
|
{{if $type == 'temporaire'}}
|
||||||
|
{{:assign sortie_temp=true}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$label}}</td>
|
<td>{{$label}}</td>
|
||||||
<td>{{$type}}</td>
|
<td>{{$type}}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{:assign var="locked" from="locked_%ss"|args:$direction}}
|
{{if ! $default_keys|has:$key && ! $locked|has:$key}}
|
||||||
{{if ! $locked|has:$label}}
|
|
||||||
{{:linkbutton label="Supprimer" shape="delete" href="config/delete_movement_type.html?dir=%s&op_key=%s"|args:$direction:$key target="_dialog"}}
|
{{:linkbutton label="Supprimer" shape="delete" href="config/delete_movement_type.html?dir=%s&op_key=%s"|args:$direction:$key target="_dialog"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if ! $default_keys|has:$key || $sortie_temp}}
|
||||||
{{:linkbutton label="Modifier" shape="edit" href="config/modify_movement_type.html?dir=%s&op_key=%s"|args:$direction:$key target="_dialog"}}
|
{{:linkbutton label="Modifier" shape="edit" href="config/modify_movement_type.html?dir=%s&op_key=%s"|args:$direction:$key target="_dialog"}}
|
||||||
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@
|
||||||
"type" : {
|
"type" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"enum" : ["définitif", "temporaire", "retour"]
|
"enum" : ["définitif", "temporaire", "retour"]
|
||||||
|
},
|
||||||
|
"fee" : {
|
||||||
|
"description" : "tarif sortie temporaire",
|
||||||
|
"type" : ["string", "null"],
|
||||||
|
"enum" : ["gratuit", "payant"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,18 +12,28 @@
|
||||||
{{* lecture config *}}
|
{{* lecture config *}}
|
||||||
{{:include file="../_get_config.html" keep="config, directions, config_defaut"}}
|
{{:include file="../_get_config.html" keep="config, directions, config_defaut"}}
|
||||||
|
|
||||||
|
{{if ! $directions|has_key:$_GET.dir}}
|
||||||
|
{{:error message="Direction « %s » inconnue !"|args:$_GET.dir}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
|
{{if $_POST.output_fields.type == "temporaire"}}
|
||||||
|
{{* vérifier si le tarif a été choisi *}}
|
||||||
|
{{if $_POST.tarif == null}}
|
||||||
|
{{:error message="Vous n'avez pas choisi le tarif"}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* vérifier s'il existe un libellé de même nom dans la même direction *}}
|
{{* vérifier s'il existe un libellé de même nom dans la même direction *}}
|
||||||
{{#foreach from=$directions key="direction"}}
|
{{#foreach from=$directions key="direction"}}
|
||||||
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
||||||
{{#foreach from=$nature key="key"}}
|
{{#foreach from=$nature key="key" item="elem"}}
|
||||||
{{:assign var="fields" from="_POST.%s_fields"|args:$_GET.dir}}
|
{{:assign var="fields" from="_POST.%s_fields"|args:$_GET.dir}}
|
||||||
{{if $_GET.dir == $direction && $label|trim|tolower == $fields.label|trim|tolower}}
|
{{if $_GET.dir == $direction && $fields.label|trim|tolower == $elem.label|trim|tolower}}
|
||||||
{{:error message="Ce libellé est déjà présent"}}
|
{{:error message="Le libellé « %s » est déjà présent"|args:$fields.label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{:assign var="%s_nature"|args:$direction value=$elem}}
|
||||||
{{:assign var="%s_nature.key"|args:$direction value=$key}}
|
{{:assign var="%s_nature.key"|args:$direction value=$key}}
|
||||||
{{:assign var="%s_nature.label"|args:$direction value=$label}}
|
|
||||||
{{:assign var="%s_nature.type"|args:$direction value=$type}}
|
|
||||||
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
|
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
|
|
@ -34,6 +44,13 @@
|
||||||
{{:assign var="%s_nature.key"|args:$direction value=""|uuid}}
|
{{:assign var="%s_nature.key"|args:$direction value=""|uuid}}
|
||||||
{{:assign var="%s_nature.label"|args:$direction value=$newlabel}}
|
{{:assign var="%s_nature.label"|args:$direction value=$newlabel}}
|
||||||
{{:assign var="%s_nature.type"|args:$direction from="_POST.%s_fields.type"|args:$direction}}
|
{{:assign var="%s_nature.type"|args:$direction from="_POST.%s_fields.type"|args:$direction}}
|
||||||
|
{{if $_POST.output_fields != null}}
|
||||||
|
{{if $_POST.output_fields.type == "temporaire"}}
|
||||||
|
{{:assign var="output_nature.fee" value=$_POST.tarif}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign var="output_nature.fee" value=null}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
|
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -104,34 +121,63 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Type de sortie</legend>
|
<legend>Type de sortie</legend>
|
||||||
<dl>
|
<dl>
|
||||||
<td>
|
{{:input type="select"
|
||||||
{{:input type="select"
|
label="Type de sortie"
|
||||||
label="Type de sortie"
|
name="output_fields[type]"
|
||||||
name="output_fields[type]"
|
options=$output_types
|
||||||
options=$output_types
|
default=$type
|
||||||
default=$type
|
required=true
|
||||||
required=true
|
default_empty="— Choisir un type —"}}
|
||||||
default_empty="— Choisir un type —"}}
|
{{:input
|
||||||
</td>
|
type="text"
|
||||||
<td>
|
label="Libellé de la sortie"
|
||||||
{{:input
|
name="output_fields[label]"
|
||||||
type="text"
|
|
||||||
label="Libellé de la sortie"
|
|
||||||
name="output_fields[label]"
|
|
||||||
required=true}}
|
required=true}}
|
||||||
</td>
|
<div id="tarif">
|
||||||
|
{{:input type="radio-btn" name="tarif" value="gratuit" label="Gratuit" required=true prefix_title="Tarification"}}
|
||||||
|
{{:input type="radio-btn" name="tarif" value="payant" label="Payant" required=true}}
|
||||||
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
<div class="help block">
|
<div class="help block">
|
||||||
<h3>Signification du type de sortie</h3>
|
<h3>Signification du type de sortie</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>définitif</b> : le matériel n'appartient plus à l'asso (ex : vente, casse, perte, vol, ...)</li>
|
<li><b>définitif</b> : le matériel n'appartient plus à l'asso (ex : vente, casse, perte, vol, ...)</li>
|
||||||
<li><b>temporaire</b> : le matériel sort temporairement de l'asso qui en reste propriétaire (ex : location, prêt)</li>
|
<li><b>temporaire</b> : le matériel sort temporairement de l'asso qui en reste propriétaire (ex : location, prêt) ; dans ce cas, il faut indiquer si ce type de sortie est gratuit ou payant</li>
|
||||||
<li><b>retour</b> : le matériel <strong>non propriété de l'asso</strong> est rendu à son propriétaire (ex : retour de location ou d'emprunt)</li>
|
<li><b>retour</b> : le matériel <strong>non propriété de l'asso</strong> est rendu à son propriétaire (ex : retour de location ou d'emprunt)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="help block tarif">
|
||||||
|
<h3>Tarification</h3>
|
||||||
|
<ul>
|
||||||
|
<li>Une sortie temporaire gratuite sera classée dans l'onglet Prêt</li>
|
||||||
|
<li>Une sortie temporaire payante sera classée dans l'onglet Locations</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
// afficher/masquer le choix du tarif
|
||||||
|
function toggleTarif(event) {
|
||||||
|
const output_fieldstype = document.getElementById('f_output_fieldstype');
|
||||||
|
const value = output_fieldstype.value;
|
||||||
|
if (value == 'temporaire') {
|
||||||
|
g.toggle('#tarif', true);
|
||||||
|
g.toggle('div.tarif', true);
|
||||||
|
} else {
|
||||||
|
g.toggle('#tarif', false);
|
||||||
|
g.toggle('div.tarif', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
toggleTarif();
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
const output_fieldstype = document.getElementById('f_output_fieldstype');
|
||||||
|
output_fieldstype.addEventListener("change", toggleTarif);
|
||||||
|
})();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,28 @@
|
||||||
|
|
||||||
|
|
||||||
{{* lecture config (défaut ou enregistrée) *}}
|
{{* lecture config (défaut ou enregistrée) *}}
|
||||||
{{:include file="../_get_config.html" keep="config, directions"}}
|
{{:include file="../_get_config.html" keep="config_defaut, config, directions"}}
|
||||||
|
|
||||||
|
{{if ! $directions|has_key:$_GET.dir}}
|
||||||
|
{{:error message="Direction « %s » inconnue !"|args:$_GET.dir}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* interdire la suppression des types de mouvement prédéfinis *}}
|
||||||
|
{{:assign var="nature" from="config_defaut.%ss"|args:$_GET.dir}}
|
||||||
|
{{#foreach from=$nature item="elem"}}
|
||||||
|
{{:assign var="default_keys." value=$key}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{if $default_keys|has:$_GET.op_key}}
|
||||||
|
{{:error message="Ce type de mouvement ne peut être supprimé"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#form on="delete"}}
|
{{#form on="delete"}}
|
||||||
{{#foreach from=$directions key="direction"}}
|
{{#foreach from=$directions key="direction"}}
|
||||||
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
||||||
{{#foreach from=$nature key="key"}}
|
{{#foreach from=$nature key="key" item="elem"}}
|
||||||
{{if $_GET.dir == $direction && $key != $_GET.op_key || $_GET.dir != $direction}}
|
{{if $_GET.dir == $direction && $key != $_GET.op_key || $_GET.dir != $direction}}
|
||||||
|
{{:assign var="%s_nature"|args:$direction value=$elem}}
|
||||||
{{:assign var="%s_nature.key"|args:$direction value=$key}}
|
{{:assign var="%s_nature.key"|args:$direction value=$key}}
|
||||||
{{:assign var="%s_nature.label"|args:$direction value=$label}}
|
|
||||||
{{:assign var="%s_nature.type"|args:$direction value=$type}}
|
|
||||||
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
|
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
|
||||||
|
|
@ -2,31 +2,35 @@
|
||||||
|
|
||||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||||
|
|
||||||
{{:admin_header title="Configuration" current="module_equipment"}}
|
|
||||||
|
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
|
{{* vérifier la validité de la durée saisie *}}
|
||||||
|
{{if $_POST.loan_duration < 0}}
|
||||||
|
{{:error message="Durée (%s) erronée ; doit être >= 0"|args:$_POST.loan_duration}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{:save
|
{{:save
|
||||||
key="config"
|
key="config"
|
||||||
loan_duration=$_POST.loan_duration
|
loan_duration=$_POST.loan_duration
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{:admin_header title="Configuration" current="module_equipment"}}
|
||||||
{{:include file="../_nav.html" current="config" subcurrent="divers"}}
|
{{:include file="../_nav.html" current="config" subcurrent="divers"}}
|
||||||
|
{{:form_errors}}
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
<p class="block confirm">Configuration enregistrée.</p>
|
<p class="block confirm">Configuration enregistrée.</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* lecture config (défaut ou enregistrée) *}}
|
{{* lecture config *}}
|
||||||
{{:include file="../_get_config.html" keep="loan_duration"}}
|
{{:include file="../_get_config.html" keep="loan_duration"}}
|
||||||
|
|
||||||
<form method="post" action="" data-focus="1">
|
<form method="post" action="" data-focus="1">
|
||||||
<fieldset class="storage">
|
<fieldset>
|
||||||
<legend>Autres paramètres</legend>
|
<legend>Autres paramètres</legend>
|
||||||
<dl>
|
<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"}}
|
{{:input type="number" name="loan_duration" label="Durée de prêt par défaut" min=0 default=$module.config.loan_duration help="Durée en nombre de jours ; mettre 0 pour supprimer la durée par défaut"}}
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
|
|
|
||||||
|
|
@ -5,27 +5,38 @@
|
||||||
{{*
|
{{*
|
||||||
paramètres :
|
paramètres :
|
||||||
- dir : input ou output
|
- dir : input ou output
|
||||||
- op_key : clé du type de mouvement dont on veut modifier le libellé
|
- op_key : clé du type de mouvement dont on veut modifier le libellé ou le tarif
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* lecture config (défaut ou enregistrée) *}}
|
{{* lecture config (défaut ou enregistrée) *}}
|
||||||
{{:include file="../_get_config.html" keep="config, directions"}}
|
{{:include file="../_get_config.html" keep="config_defaut, config, directions"}}
|
||||||
|
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
|
{{if $_POST.tarif == null && $_POST.name == null}}
|
||||||
|
{{:redirect to="./config.html"}}
|
||||||
|
{{/if}}
|
||||||
{{#foreach from=$directions key="direction"}}
|
{{#foreach from=$directions key="direction"}}
|
||||||
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
||||||
{{#foreach from=$nature key="key"}}
|
{{#foreach from=$nature key="key" item="elem"}}
|
||||||
{{:assign var="%s_nature.key"|args:$direction value=$key}}
|
{{if $_POST.name == null}}
|
||||||
{{if $_GET.dir == $direction}}
|
{{:assign label=$elem.label}}
|
||||||
{{if $key == $_GET.op_key}}
|
|
||||||
{{:assign var="%s_nature.label"|args:$direction value=$_POST.name|trim}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign var="%s_nature.label"|args:$direction value=$label}}
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign var="%s_nature.label"|args:$direction value=$label}}
|
{{if $_GET.dir == $direction && $key != $_GET.op_key &&
|
||||||
|
$_POST.name|trim|tolower == $elem.label|trim|tolower}}
|
||||||
|
{{:error message="Le libellé « %s » est déjà présent"|args:$_POST.name}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.dir == $direction && $key == $_GET.op_key}}
|
||||||
|
{{:assign label=$_POST.name|trim}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign label=$elem.label}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign var="%s_nature"|args:$direction value=$elem}}
|
||||||
|
{{:assign var="%s_nature.label"|args:$direction value=$label}}
|
||||||
|
{{:assign var="%s_nature.key"|args:$direction value=$key}}
|
||||||
|
{{if $_POST.tarif != null && $key == $_GET.op_key}}
|
||||||
|
{{:assign var="%s_nature.fee"|args:$direction value=$_POST.tarif}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign var="%s_nature.type"|args:$direction value=$type}}
|
|
||||||
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
|
{{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -40,19 +51,71 @@
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
{{:admin_header title="Gestion des matériels" current="module_equipment"}}
|
||||||
{{* barre de navigation *}}
|
|
||||||
{{if ! $dialog}}
|
{{if ! $dialog}}
|
||||||
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
|
{{:include file="../_nav.html" current="config" subcurrent="typesES"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
|
{{* vérifier que $_GET.dir est bien une direction connue *}}
|
||||||
|
{{if ! $directions|has_key:$_GET.dir}}
|
||||||
|
{{:error message="Direction « %s » inconnue !"|args:$_GET.dir}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* vérifier que $_GET.op_key est bien dans la liste des opérations *}}
|
||||||
|
{{:assign var="config_nature" from="config.%s_nature"|args:$_GET.dir}}
|
||||||
|
{{if ! $config_nature|keys|has:$_GET.op_key}}
|
||||||
|
{{:error message="Type de mouvement inconnu !"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* sortie temporaire ? *}}
|
||||||
|
{{:assign sortie_temp=false}}
|
||||||
|
{{if $_GET.dir == 'output'}}
|
||||||
|
{{:assign var="elem" from="config_nature.%s"|args:$_GET.op_key}}
|
||||||
|
{{if $elem.type == 'temporaire'}}
|
||||||
|
{{:assign sortie_temp=true}}
|
||||||
|
{{:assign fee=$elem.fee}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* mouvement prédéfini ? *}}
|
||||||
|
{{:assign var="default_nature" from="config_defaut.%ss"|args:$_GET.dir}}
|
||||||
|
{{#foreach from=$default_nature item="elem"}}
|
||||||
|
{{:assign var="default_keys." value=$key}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
{{:assign label_mod=true}}
|
||||||
|
{{if $default_keys|has:$_GET.op_key}}
|
||||||
|
{{:assign label_mod=false}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if ! $label_mod && ! $sortie_temp}}
|
||||||
|
{{:error message="Ce type de mouvement ne peut être modifié"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{:assign var="default_label" from="config.%s_nature.%s.label"|args:$_GET.dir:$_GET.op_key}}
|
{{:assign var="default_label" from="config.%s_nature.%s.label"|args:$_GET.dir:$_GET.op_key}}
|
||||||
<form method="post" action="" data-focus="1">
|
<form method="post" action="" data-focus="1">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Modifier le libellé</legend>
|
<legend>Paramètres</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="text" name="name" label="Libellé" default=$default_label required=true maxlength="100"}}
|
{{if $label_mod}}
|
||||||
|
{{:input type="text" name="name" label="Libellé" default=$default_label required=true maxlength="100"}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $sortie_temp}}
|
||||||
|
<div>
|
||||||
|
{{:input type="radio-btn" name="tarif" value="gratuit" label="Gratuit" required=true default=$fee prefix_title=Tarif}}
|
||||||
|
{{:input type="radio-btn" name="tarif" value="payant" label="Payant" required=true default=$fee}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
|
{{if $sortie_temp}}
|
||||||
|
<div class="help block">
|
||||||
|
<h3>Tarification</h3>
|
||||||
|
<ul>
|
||||||
|
<li>Une sortie temporaire gratuite sera classée dans l'onglet Prêt</li>
|
||||||
|
<li>Une sortie temporaire payante sera classée dans l'onglet Locations</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
12
default.json
12
default.json
|
|
@ -26,13 +26,19 @@
|
||||||
{
|
{
|
||||||
"key" : "c9ba00d9-26ee-448b-9f02-73e479ec2980",
|
"key" : "c9ba00d9-26ee-448b-9f02-73e479ec2980",
|
||||||
"label" : "Prêt",
|
"label" : "Prêt",
|
||||||
"type" : "temporaire"
|
"type" : "temporaire",
|
||||||
|
"fee" : "gratuit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key" : "5c6c20bf-53e9-49dc-bcd6-e3cac23a6786",
|
||||||
|
"label" : "Location",
|
||||||
|
"type" : "temporaire",
|
||||||
|
"fee" : "payant"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key" : "fefefa51-1a85-46ca-ab78-b594b10390ff",
|
"key" : "fefefa51-1a85-46ca-ab78-b594b10390ff",
|
||||||
"label" : "Retour de Location/Emprunt",
|
"label" : "Retour de Location/Emprunt",
|
||||||
"type" : "retour"
|
"type" : "retour"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"loan_duration" : "30"
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,6 @@
|
||||||
- msg : message de retour
|
- msg : message de retour
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
|
||||||
{{if $_GET.prop == 1}}
|
|
||||||
{{:assign proprio="proprio"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign proprio="nonproprio"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{:assign equipment_key=$_GET.key|trim}}
|
{{:assign equipment_key=$_GET.key|trim}}
|
||||||
{{#load key=$equipment_key assign="equipment"}}
|
{{#load key=$equipment_key assign="equipment"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
@ -33,62 +25,85 @@
|
||||||
|
|
||||||
{{:admin_header title="Gestion des matériels" custom_css="./style.css" current="module_equipment"}}
|
{{:admin_header title="Gestion des matériels" custom_css="./style.css" current="module_equipment"}}
|
||||||
|
|
||||||
|
{{* barre de navigation *}}
|
||||||
{{if $_GET.current != null}}
|
{{if $_GET.current != null}}
|
||||||
{{:assign current=$_GET.current}}
|
{{:assign current=$_GET.current}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign current="inventaire"}}
|
{{:assign current="inventaire"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:include file="./_nav.html" current=$current subcurrent=$proprio subsubcurrent="historique" eqpmt=$equipment.name category=$category.name}}
|
|
||||||
|
|
||||||
{{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 == "retour"}}
|
|
||||||
<p class="block confirm">Retour enregistré</p>
|
|
||||||
{{elseif $_GET.msg == "suppression"}}
|
|
||||||
<p class="block confirm">Mouvement supprimé</p>
|
|
||||||
{{else}}
|
|
||||||
<p class="block confirm">Mouvement enregistré</p>
|
|
||||||
{{/if}}
|
|
||||||
{{elseif $_GET.err}}
|
|
||||||
{{if $_GET.msg == "suppression"}}
|
|
||||||
<p class="block error">Ce mouvement ne peut être supprimé</p>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="./_get_config.html" keep="config"}}
|
{{:include file="./_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{* déterminer les types de mouvements selon l'affection du matériel *}}
|
{{* filtrer selon appartenance *}}
|
||||||
{{#foreach from=$config.input_nature}}
|
{{:assign saved_filters=$module.config.filters}}
|
||||||
{{if $_GET.prop}}
|
{{:assign var="user_filters" from="saved_filters.%s"|args:$logged_user.id}}
|
||||||
|
|
||||||
|
{{if $_GET.prop == null}}
|
||||||
|
{{:assign selected_prop=$user_filters.eqpmt_hist_prop}}
|
||||||
|
{{else}}
|
||||||
|
{{if $_GET.prop == -1}}
|
||||||
|
{{:assign selected_prop=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_prop=$_GET.prop}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign var="user_filters.eqpmt_hist_prop value=$selected_prop}}
|
||||||
|
{{:assign var="saved_filters.%s"|args:$logged_user.id value=$user_filters}}
|
||||||
|
{{:save key="config" filters=$saved_filters}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* déterminer les types de mouvements selon l'appartenance du matériel *}}
|
||||||
|
{{#foreach from=$config.input_nature key="key"}}
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{* les deux sortes de matériel *}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{if $type == 'temporaire'}}
|
||||||
|
{{:assign var="temp_inputs." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{elseif $selected_prop == 1}}
|
||||||
{{* matériel propriété de l'asso *}}
|
{{* matériel propriété de l'asso *}}
|
||||||
{{if $type != 'temporaire'}}
|
{{if $type != 'temporaire'}}
|
||||||
{{:assign var="input_types." value=$label}}
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* matériel non propriété de l'asso *}}
|
{{* matériel non propriété de l'asso *}}
|
||||||
{{if $type == 'temporaire'}}
|
{{if $type == 'temporaire'}}
|
||||||
{{:assign var="input_types." value=$label}}
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{:assign var="temp_inputs." value=$key|quote_sql}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
||||||
{{#foreach from=$config.output_nature}}
|
{{#foreach from=$config.output_nature key="key"}}
|
||||||
{{if $_GET.prop}}
|
{{if $selected_prop == null}}
|
||||||
|
{{* les deux sortes de matériel *}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{if $type == "temporaire"}}
|
||||||
|
{{:assign var="temp_outputs." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{elseif $selected_prop == 1}}
|
||||||
{{* matériel propriété de l'asso *}}
|
{{* matériel propriété de l'asso *}}
|
||||||
{{if $type != 'retour'}}
|
{{if $type != 'retour'}}
|
||||||
{{:assign var="output_types." value=$label}}
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{if $type == "temporaire"}}
|
||||||
|
{{:assign var="temp_outputs." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* matériel non propriété de l'asso *}}
|
{{* matériel non propriété de l'asso *}}
|
||||||
{{if $type == 'retour'}}
|
{{if $type == 'retour'}}
|
||||||
{{:assign var="output_types." value=$label}}
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
{{:assign key_cond=$mvt_keys|implode:","}}
|
||||||
|
{{:assign key_cond="("|cat:$key_cond|cat:")"}}
|
||||||
|
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{:assign prop_condition="1"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop_condition="$$.operation in %s"|args:$key_cond}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* calculer et mémoriser les quantités pour que le tri de la liste affiche les valeurs correctes *}}
|
{{* calculer et mémoriser les quantités pour que le tri de la liste affiche les valeurs correctes *}}
|
||||||
{{:assign stock=0}}
|
{{:assign stock=0}}
|
||||||
|
|
@ -122,209 +137,222 @@
|
||||||
{{:assign var="quantites.%s.nonproprio"|args:$id value=$nonproprio}}
|
{{:assign var="quantites.%s.nonproprio"|args:$id value=$nonproprio}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{if $current != "archives"}}
|
{{if $selected_prop == null || $selected_prop}}
|
||||||
<nav class="tabs">
|
{{* calculer la quantité sortie temporairement de chaque matériel *}}
|
||||||
<aside>
|
{{:assign output_ops=$temp_outputs|implode:","}}
|
||||||
{{if $_GET.prop && $dispo_final > 0}}
|
{{:assign output_ops="("|cat:$output_ops|cat:")"}}
|
||||||
{{:linkbutton label="Sortie" 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"}}
|
|
||||||
</aside>
|
|
||||||
</nav>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* lister tous les mouvements du matériel passé en paramètre *}}
|
|
||||||
{{if $_GET.prop}}
|
|
||||||
{{* calculer la quantité temporairement l'extérieur de chaque matériel *}}
|
|
||||||
{{#foreach from=$config.output_nature key=key}}
|
|
||||||
{{if $type == "temporaire"}}
|
|
||||||
{{:assign var="temp_outputs." value=$key|quote_sql}}
|
|
||||||
{{/if}}
|
|
||||||
{{/foreach}}
|
|
||||||
{{:assign operations=$temp_outputs|implode:","}}
|
|
||||||
{{:assign operations="("|cat:$operations|cat:")"}}
|
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
mvt.key AS mvt_key,
|
mvt.key AS mvt_key,
|
||||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste
|
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste
|
||||||
FROM {!$module.table} AS mvt
|
FROM !table AS mvt
|
||||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
LEFT JOIN !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')
|
LEFT JOIN !table AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||||
WHERE
|
WHERE
|
||||||
json_extract(mvt.document, '$.operation') IN !op
|
json_extract(mvt.document, '$.operation') IN !op
|
||||||
AND json_extract(mvt.document, '$.equipment') = :eqpmt_key
|
AND json_extract(mvt.document, '$.equipment') = :eqpmt_key
|
||||||
GROUP by mvt.key
|
GROUP by mvt.key
|
||||||
;
|
;
|
||||||
!op = $operations
|
!table=$module.table
|
||||||
|
!op = $output_ops
|
||||||
:eqpmt_key = $_GET.key
|
:eqpmt_key = $_GET.key
|
||||||
}}
|
}}
|
||||||
{{:assign var="reste.%s"|args:$mvt_key value=$reste}}
|
{{:assign var="reste.%s"|args:$mvt_key value=$reste}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#list
|
{{if $selected_prop == null || ! $selected_prop}}
|
||||||
type="movement"
|
|
||||||
select="
|
|
||||||
($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
|
||||||
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mouvement';
|
|
||||||
$$.operation AS 'Opération';
|
|
||||||
$$.amount AS 'Quantité';
|
|
||||||
'' AS 'Stock';
|
|
||||||
'' AS 'Sorti';
|
|
||||||
'' AS 'Disponible';
|
|
||||||
CASE WHEN $$.user NOT NULL
|
|
||||||
THEN (SELECT %s AS nom FROM users WHERE id = $$.user)
|
|
||||||
ELSE ''
|
|
||||||
END AS 'Dépositaire';
|
|
||||||
CASE WHEN $$.storage NOT NULL
|
|
||||||
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
|
||||||
ELSE ''
|
|
||||||
END AS 'Stockage';
|
|
||||||
'' AS 'Documents';
|
|
||||||
$$.transactions AS 'Écritures'
|
|
||||||
"|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}}
|
|
||||||
|
|
||||||
{{if $direction === "input" && $op_label|in:$input_types ||
|
|
||||||
$direction === "output"&& $op_label|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}}
|
|
||||||
|
|
||||||
{{: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 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 class="actions">
|
|
||||||
{{if $current != "archives"}}
|
|
||||||
{{if $direction == "output" && $type_mvt == "temporaire"}}
|
|
||||||
{{:assign var="temp_ext" from="reste.%s"|args:$key}}
|
|
||||||
{{if $temp_ext != null && $temp_ext > 0}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Retour"
|
|
||||||
href="movements/output_return.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
|
||||||
shape="reset"
|
|
||||||
target="_dialog"}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Détails"
|
|
||||||
href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop
|
|
||||||
shape="eye"
|
|
||||||
}}
|
|
||||||
{{/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 *}}
|
{{* calculer la quantité présente temporairement de chaque matériel *}}
|
||||||
{{#foreach from=$config.input_nature key=key}}
|
{{:assign input_ops=$temp_inputs|implode:","}}
|
||||||
{{if $type == "temporaire"}}
|
{{:assign input_ops="("|cat:$input_ops|cat:")"}}
|
||||||
{{:assign var="temp_inputs." value=$key|quote_sql}}
|
|
||||||
{{/if}}
|
|
||||||
{{/foreach}}
|
|
||||||
{{:assign operations=$temp_inputs|implode:","}}
|
|
||||||
{{:assign operations="("|cat:$operations|cat:")"}}
|
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
mvt.key AS mvt_key,
|
mvt.key AS mvt_key,
|
||||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
|
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
|
||||||
FROM {!$module.table} AS mvt
|
FROM !table AS mvt
|
||||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
LEFT JOIN !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')
|
LEFT JOIN !table AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||||
WHERE
|
WHERE
|
||||||
json_extract(mvt.document, '$.operation') IN !op
|
json_extract(mvt.document, '$.operation') IN !op
|
||||||
AND json_extract(mvt.document, '$.equipment') = :eqpmt_key
|
AND json_extract(mvt.document, '$.equipment') = :eqpmt_key
|
||||||
GROUP by mvt.key
|
GROUP by mvt.key
|
||||||
;
|
;
|
||||||
!op = $operations
|
!table=$module.table
|
||||||
|
!op = $input_ops
|
||||||
:eqpmt_key = $_GET.key
|
:eqpmt_key = $_GET.key
|
||||||
}}
|
}}
|
||||||
{{:assign var="present.%s"|args:$mvt_key value=$present}}
|
{{:assign var="present.%s"|args:$mvt_key value=$present}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{#list
|
|
||||||
type="movement"
|
|
||||||
select="($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
|
||||||
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mouvement';
|
|
||||||
$$.operation AS 'Opération';
|
|
||||||
$$.amount AS 'Quantité';
|
|
||||||
"" as 'Présent';
|
|
||||||
CASE WHEN $$.storage NOT NULL
|
|
||||||
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
|
||||||
ELSE ''
|
|
||||||
END as 'Stockage';
|
|
||||||
'' AS 'Documents';
|
|
||||||
$$.transactions AS 'Écritures'
|
|
||||||
"
|
|
||||||
equipment=$equipment_key
|
|
||||||
order=1
|
|
||||||
}}
|
|
||||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$col3}}
|
|
||||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
|
||||||
|
|
||||||
{{if $direction === "input" && $op_label|in:$input_types ||
|
|
||||||
$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 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 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"
|
|
||||||
href="movements/input_return.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
|
||||||
shape="reset"
|
|
||||||
target="_dialog"}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Détails"
|
|
||||||
href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop
|
|
||||||
shape="eye"
|
|
||||||
}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/if}}
|
|
||||||
{{/list}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{:assign
|
||||||
|
select_debut="
|
||||||
|
($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
||||||
|
CASE $$.direction WHEN 'input' THEN 'Entrée' WHEN 'output' THEN 'Sortie' END AS 'Mouvement';
|
||||||
|
$$.operation AS 'Opération';
|
||||||
|
$$.amount AS 'Quantité';"
|
||||||
|
}}
|
||||||
|
{{:assign
|
||||||
|
select_prop="'' AS 'Stock';
|
||||||
|
'' AS 'Sorti';
|
||||||
|
'' AS 'Disponible';"
|
||||||
|
}}
|
||||||
|
{{:assign
|
||||||
|
select_depositaire="CASE WHEN $$.user NOT NULL
|
||||||
|
THEN (SELECT %s AS nom FROM users WHERE id = $$.user)
|
||||||
|
ELSE ''
|
||||||
|
END AS 'Dépositaire';
|
||||||
|
"|args:$config.user_fields.name_sql
|
||||||
|
}}
|
||||||
|
{{:assign
|
||||||
|
select_non_prop="'' as 'Temporaire';"
|
||||||
|
}}
|
||||||
|
{{:assign select_final="
|
||||||
|
CASE WHEN $$.storage NOT NULL
|
||||||
|
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
||||||
|
ELSE ''
|
||||||
|
END AS 'Stockage';
|
||||||
|
'' AS 'Documents';
|
||||||
|
$$.transactions AS 'Écritures'
|
||||||
|
"
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{:assign select_clause=$select_debut|cat:$select_prop|cat:$select_non_prop|cat:$select_depositaire|cat:$select_final}}
|
||||||
|
{{elseif $selected_prop}}
|
||||||
|
{{:assign select_clause=$select_debut|cat:$select_prop|cat:$select_depositaire|cat:$select_final}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign select_clause=$select_debut|cat:$select_non_prop|cat:$select_final}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:assign var="prop_options." value="" label="Tous les matériels" href="?key=%s&prop=-1"|args:$_GET.key}}
|
||||||
|
{{:assign var="prop_options." value="1" label="Matériels propriété de l'association" href="?key=%s&prop=1"|args:$_GET.key}}
|
||||||
|
{{:assign var="prop_options." value="0" label="Matériels NON propriété de l'association" href="?key=%s&prop=0"|args:$_GET.key}}
|
||||||
|
|
||||||
|
{{if $dispo_final > 0 && $selected_prop == null || $selected_prop}}
|
||||||
|
{{:assign sortie="sortie"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:include file="./_nav.html" current=$current subcurrent="mouvements" eqpmt=$equipment.name category=$category.name sortie=$sortie key=$_GET.key}}
|
||||||
|
|
||||||
|
{{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 == "retour"}}
|
||||||
|
<p class="block confirm">Retour enregistré</p>
|
||||||
|
{{elseif $_GET.msg == "suppression"}}
|
||||||
|
<p class="block confirm">Mouvement supprimé</p>
|
||||||
|
{{else}}
|
||||||
|
<p class="block confirm">Mouvement enregistré</p>
|
||||||
|
{{/if}}
|
||||||
|
{{elseif $_GET.err}}
|
||||||
|
{{if $_GET.msg == "suppression"}}
|
||||||
|
<p class="block error">Ce mouvement ne peut être supprimé</p>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<fieldset class="shortFormRight">
|
||||||
|
<legend>Filtrer par appartenance</legend>
|
||||||
|
{{:dropdown
|
||||||
|
title="Filtrer par appartenance"
|
||||||
|
options=$prop_options
|
||||||
|
value="%s"|args:$selected_prop
|
||||||
|
}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{* lister les mouvements du matériel passé en paramètre *}}
|
||||||
|
{{#list
|
||||||
|
type="movement"
|
||||||
|
select="%s"|args:$select_clause
|
||||||
|
where="%s"|args:$prop_condition
|
||||||
|
equipment=$equipment_key
|
||||||
|
order=1
|
||||||
|
desc=true
|
||||||
|
}}
|
||||||
|
{{: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="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 var="tempo" 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}}
|
||||||
|
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{:assign user_details=$col9}}
|
||||||
|
{{:assign storage=$col10}}
|
||||||
|
{{elseif $selected_prop}}
|
||||||
|
{{:assign user_details=$col8}}
|
||||||
|
{{:assign storage=$col9}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign user_details=$col6}}
|
||||||
|
{{:assign storage=$col6}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{$date|date_short}}</td>
|
||||||
|
<td>{{$col2}}</td>
|
||||||
|
<td class="nosort">{{$op_label}}</td>
|
||||||
|
<td class="num">{{$amount}}</td>
|
||||||
|
{{if $selected_prop == null || $selected_prop}}
|
||||||
|
<td class="num nosort">{{$stock}}</td>
|
||||||
|
<td class="num nosort">{{$exterieur}}</td>
|
||||||
|
<td class="num nosort">{{$dispo}}</td>
|
||||||
|
{{/if}}
|
||||||
|
{{if $selected_prop == null || ! $selected_prop}}
|
||||||
|
<td class="num nosort">{{$tempo}}</td>
|
||||||
|
{{/if}}
|
||||||
|
{{if $selected_prop == null || $selected_prop}}
|
||||||
|
<td>{{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$user_details}}</td>
|
||||||
|
{{/if}}
|
||||||
|
<td>{{$storage}}</td>
|
||||||
|
<td class="num nosort">{{if $nb_files > 0}}{{$nb_files}}{{/if}}</td>
|
||||||
|
<td class="num">{{if $transactions|count > 0}}{{"Oui"}}{{/if}}</td>
|
||||||
|
<td class="actions">
|
||||||
|
{{if $current != "archives"}}
|
||||||
|
{{if $direction == "output" && $type_mvt == "retour"}}
|
||||||
|
{{:assign prop = 0}}
|
||||||
|
{{elseif $direction == "input" && $type_mvt == "temporaire"}}
|
||||||
|
{{:assign prop = 0}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop = 1}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $direction == "output" && $type_mvt == "temporaire"}}
|
||||||
|
{{:assign var="temp_ext" from="reste.%s"|args:$key}}
|
||||||
|
{{if $temp_ext != null && $temp_ext > 0}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Retour"
|
||||||
|
href="movements/output_return.html?key=%s&prop=%s"|args:$key:$prop
|
||||||
|
shape="reset"
|
||||||
|
target="_dialog"}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{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"
|
||||||
|
href="movements/input_return.html?key=%s&prop=%s"|args:$key:$prop
|
||||||
|
shape="reset"
|
||||||
|
target="_dialog"}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Détails"
|
||||||
|
href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$prop
|
||||||
|
shape="eye"
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/list}}
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
<script type="text/javascript" src="scripts.js"></script>
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -8,17 +8,102 @@
|
||||||
|
|
||||||
{{:admin_header title="Historique des mouvements" custom_css="./style.css" current="module_equipment"}}
|
{{: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 *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="./_get_config.html" keep="config"}}
|
{{:include file="./_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{* Sélecteur catégories *}}
|
{{* filtrer selon la catégorie *}}
|
||||||
{{:assign var="options." value="" label="Toutes les catégories" href="?"}}
|
{{:assign saved_filters=$module.config.filters}}
|
||||||
|
{{:assign var="user_filters" from="saved_filters.%s"|args:$logged_user.id}}
|
||||||
|
|
||||||
|
{{if $_GET.cat_key == null}}
|
||||||
|
{{:assign selected_category=$user_filters.hist_cat_key}}
|
||||||
|
{{else}}
|
||||||
|
{{if $_GET.cat_key == -1}}
|
||||||
|
{{:assign selected_category=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_category=$_GET.cat_key}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign var="user_filters.hist_cat_key" value=$selected_category}}
|
||||||
|
{{:assign var="saved_filters.%s"|args:$logged_user.id value=$user_filters}}
|
||||||
|
{{:save key="config" filters=$saved_filters}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* condition de filtrage *}}
|
||||||
|
{{if $selected_category != null}}
|
||||||
|
{{:assign cat_condition="(SELECT key
|
||||||
|
FROM @TABLE AS cat
|
||||||
|
WHERE cat.key = (SELECT $$.category
|
||||||
|
FROM @TABLE AS mat
|
||||||
|
WHERE mat.key = @TABLE.$$.equipment)) = '%s'"|args:$selected_category}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign cat_condition=1}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* filtrer selon appartenance *}}
|
||||||
|
{{if $_GET.prop == null}}
|
||||||
|
{{:assign selected_prop=$user_filters.hist_prop}}
|
||||||
|
{{else}}
|
||||||
|
{{if $_GET.prop == -1}}
|
||||||
|
{{:assign selected_prop=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_prop=$_GET.prop}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign var="user_filters.hist_prop" value=$selected_prop}}
|
||||||
|
{{:assign var="saved_filters.%s"|args:$logged_user.id value=$user_filters}}
|
||||||
|
{{:save key="config" filters=$saved_filters}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* déterminer les types de mouvements selon l'appartenance du matériel *}}
|
||||||
|
{{#foreach from=$config.input_nature key="key"}}
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{* les deux sortes de matériel *}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{elseif $selected_prop == 1}}
|
||||||
|
{{* matériel propriété de l'asso *}}
|
||||||
|
{{if $type != 'temporaire'}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{* matériel non propriété de l'asso *}}
|
||||||
|
{{if $type == 'temporaire'}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
{{#foreach from=$config.output_nature key="key"}}
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{* les deux sortes de matériel *}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{elseif $selected_prop == 1}}
|
||||||
|
{{* matériel propriété de l'asso *}}
|
||||||
|
{{if $type != 'retour'}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{* matériel non propriété de l'asso *}}
|
||||||
|
{{if $type == 'retour'}}
|
||||||
|
{{:assign var="mvt_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign key_cond=$mvt_keys|implode:","}}
|
||||||
|
{{:assign key_cond="("|cat:$key_cond|cat:")"}}
|
||||||
|
|
||||||
|
{{if $selected_prop == null}}
|
||||||
|
{{:assign prop_condition="1"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop_condition="$$.operation in %s"|args:$key_cond}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* sélecteurs de catégorie et d'appartenance *}}
|
||||||
|
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?cat_key=-1"}}
|
||||||
{{#load type="category" order="$$.name"}}
|
{{#load type="category" order="$$.name"}}
|
||||||
{{:assign var="categories.%s"|args:$key value=$name}}
|
{{:assign var="categories.%s"|args:$key value=$name}}
|
||||||
{{:assign
|
{{:assign
|
||||||
var="options."
|
var="cat_options."
|
||||||
value=$key
|
value=$key
|
||||||
label=$name
|
label=$name
|
||||||
href="?cat_key=%s"|args:$key
|
href="?cat_key=%s"|args:$key
|
||||||
|
|
@ -29,8 +114,21 @@
|
||||||
<legend>Filtrer par catégorie</legend>
|
<legend>Filtrer par catégorie</legend>
|
||||||
{{:dropdown
|
{{:dropdown
|
||||||
title="Filtrer par catégorie"
|
title="Filtrer par catégorie"
|
||||||
options=$options
|
options=$cat_options
|
||||||
value="%s"|args:$_GET.cat_key
|
value="%s"|args:$selected_category
|
||||||
|
}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{:assign var="prop_options." value="" label="Tous les matériels" href="?prop=-1"}}
|
||||||
|
{{:assign var="prop_options." value="1" label="Matériels propriété de l'association" href="?prop=1"}}
|
||||||
|
{{:assign var="prop_options." value="0" label="Matériels NON propriété de l'association" href="?prop=0"}}
|
||||||
|
|
||||||
|
<fieldset class="shortFormRight">
|
||||||
|
<legend>Filtrer par appartenance</legend>
|
||||||
|
{{:dropdown
|
||||||
|
title="Filtrer par appartenance"
|
||||||
|
options=$prop_options
|
||||||
|
value="%s"|args:$selected_prop
|
||||||
}}
|
}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
@ -38,18 +136,7 @@
|
||||||
<p class="help">Historique de tous les mouvements de matériel</p>
|
<p class="help">Historique de tous les mouvements de matériel</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{* condition de filtrage *}}
|
{{* lister les mouvements *}}
|
||||||
{{if $_GET.cat_key != null}}
|
|
||||||
{{:assign condition="(SELECT key
|
|
||||||
FROM @TABLE AS cat
|
|
||||||
WHERE cat.key = (SELECT $$.category
|
|
||||||
FROM @TABLE AS mat
|
|
||||||
WHERE mat.key = @TABLE.$$.equipment)) = '%s'"|args:$_GET.cat_key}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign condition=1}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* lister tous les mouvements *}}
|
|
||||||
{{#list
|
{{#list
|
||||||
type="movement"
|
type="movement"
|
||||||
select="($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
select="($$.date || '_' || substr('000000' || id, -6, 6)) AS 'Date';
|
||||||
|
|
@ -67,9 +154,9 @@
|
||||||
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage)
|
||||||
ELSE ''
|
ELSE ''
|
||||||
END as 'Stockage';
|
END as 'Stockage';
|
||||||
$$.comment AS 'Commentaire'
|
$$.comment AS 'Remarque'
|
||||||
"|args:$config.user_fields.name_sql
|
"|args:$config.user_fields.name_sql
|
||||||
where="%s"|args:$condition
|
where="%s AND %s"|args:$cat_condition:$prop_condition
|
||||||
order=1
|
order=1
|
||||||
max=50
|
max=50
|
||||||
desc=true
|
desc=true
|
||||||
|
|
|
||||||
16
index.html
16
index.html
|
|
@ -14,14 +14,8 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||||
|
|
||||||
{{if $_GET.prop == null || $_GET.prop}}
|
{{#load type="category" count=true limit=1 assign="result"}}{{/load}}
|
||||||
{{:assign proprio="proprio"}}
|
{{:include file="_nav.html" current="inventaire" cat="%d"|args:$result.count subcurrent="stock"}}
|
||||||
{{else}}
|
|
||||||
{{:assign proprio="nonproprio"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#load type="category" count=true assign="result"}}{{/load}}
|
|
||||||
{{:include file="_nav.html" current="inventaire" cat="%d"|args:$result.count subcurrent="%s"|args:$proprio}}
|
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
{{if $_GET.msg == "ajout" }}
|
{{if $_GET.msg == "ajout" }}
|
||||||
|
|
@ -40,11 +34,7 @@
|
||||||
{{if $result.count == 0}}
|
{{if $result.count == 0}}
|
||||||
<p class="block alert">Il n'y a aucune catégorie : vous devez en ajouter.</p>
|
<p class="block alert">Il n'y a aucune catégorie : vous devez en ajouter.</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if $_GET.prop == null || $_GET.prop == "1"}}
|
{{:include file="./_inventory.html"}}
|
||||||
{{:include file="./_inventory.html"}}
|
|
||||||
{{else}}
|
|
||||||
{{:include file="./_temp_inventory.html"}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,21 @@
|
||||||
|
|
||||||
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||||
|
|
||||||
{{:admin_header title="Matériels hors de l'asso" custom_css="../style.css" current="module_equipment"}}
|
{{if $_GET.output_type == "loan"}}
|
||||||
{{:include file="./_nav.html" current="historique" subcurrent="prêts"}}
|
{{:assign label="prêt"}}
|
||||||
|
{{elseif $_GET.output_type == "rent"}}
|
||||||
|
{{:assign label="location"}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Cette page n'existe pas !"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:admin_header title="%ss en cours"|args:$label|ucfirst custom_css="../style.css" current="module_equipment"}}
|
||||||
|
{{:include file="./_nav.html" current="%s"|args:$label subcurrent="encours"}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
vérifier l'existence de la table du module
|
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
|
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"}}
|
{{#load limit="1"}}
|
||||||
{{:assign table_presente=true}}
|
{{:assign table_presente=true}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
@ -31,20 +38,66 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="shortFormLeft">
|
{{* lecture config *}}
|
||||||
<p class="help">Historique des prêts de matériel</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{* lecture config (défaut ou enregistrée) *}}
|
|
||||||
{{:include file="./_get_config.html" keep="config"}}
|
{{:include file="./_get_config.html" keep="config"}}
|
||||||
|
|
||||||
|
{{* filtrer selon la catégorie *}}
|
||||||
|
{{:assign saved_filters=$module.config.filters}}
|
||||||
|
{{:assign var="user_filters" from="saved_filters.%s"|args:$logged_user.id}}
|
||||||
|
|
||||||
|
{{if $_GET.cat_key == null}}
|
||||||
|
{{:assign var="selected_category" from="user_filters.%s_hist_cat_key"|args:$_GET.output_type}}
|
||||||
|
{{else}}
|
||||||
|
{{if $_GET.cat_key == -1}}
|
||||||
|
{{:assign selected_category=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_category=$_GET.cat_key}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign var="user_filters.%s_hist_cat_key"|args:$_GET.output_type value=$selected_category}}
|
||||||
|
{{:assign var="saved_filters.%s"|args:$logged_user.id value=$user_filters}}
|
||||||
|
{{:save key="config" filters=$saved_filters}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* condition de filtrage *}}
|
||||||
|
{{if $selected_category != null}}
|
||||||
|
{{:assign cat_key=$selected_category|quote_sql}}
|
||||||
|
{{:assign cat_condition="json_extract(mat.document, '$.category') = %s"|args:$cat_key}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign cat_condition=1}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#foreach from=$config.output_nature key="key"}}
|
{{#foreach from=$config.output_nature key="key"}}
|
||||||
{{if $type == 'temporaire'}}
|
{{if $type != 'temporaire'}}
|
||||||
{{:assign var="output_types." value=$key|quote_sql}}
|
{{:continue}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.output_type == "loan" && $fee != 'payant'}}
|
||||||
|
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||||
|
{{elseif $_GET.output_type == "rent" && $fee == 'payant'}}
|
||||||
|
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{:assign output_ops=$output_types|implode:","}}
|
{{:assign out_keys=$out_keys|implode:","}}
|
||||||
{{:assign output_ops="("|cat:$output_ops|cat:")"}}
|
{{:assign out_keys="("|cat:$out_keys|cat:")"}}
|
||||||
|
|
||||||
|
{{* sélecteur de catégorie *}}
|
||||||
|
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?output_type=%s&cat_key=-1"|args:$_GET.output_type}}
|
||||||
|
{{#load type="category" order="$$.name"}}
|
||||||
|
{{:assign
|
||||||
|
var="cat_options."
|
||||||
|
value=$key
|
||||||
|
label=$name
|
||||||
|
href="?output_type=%s&cat_key=%s"|args:$_GET.output_type:$key
|
||||||
|
}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
<fieldset class="shortFormRight">
|
||||||
|
<legend>Filtrer par catégorie</legend>
|
||||||
|
{{:dropdown
|
||||||
|
title="Filtrer par catégorie"
|
||||||
|
options=$cat_options
|
||||||
|
value="%s"|args:$selected_category
|
||||||
|
}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
{{:assign premier=true}}
|
{{:assign premier=true}}
|
||||||
{{#select
|
{{#select
|
||||||
|
|
@ -56,33 +109,34 @@
|
||||||
json_extract(mvt.document, '$.amount') AS out_amount,
|
json_extract(mvt.document, '$.amount') AS out_amount,
|
||||||
json_extract(mvt.document, '$.return_date') AS return_date,
|
json_extract(mvt.document, '$.return_date') AS return_date,
|
||||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain
|
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain
|
||||||
FROM {!$module.table} AS mvt
|
FROM !table AS mvt
|
||||||
LEFT JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
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 !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')
|
LEFT JOIN !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')
|
INNER JOIN !table AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
|
||||||
WHERE
|
WHERE json_extract(mvt.document, '$.type') = 'movement'
|
||||||
json_extract(mvt.document, '$.type') = 'movement'
|
AND json_extract(mvt.document, '$.operation') IN !op
|
||||||
AND
|
AND !cat_condition
|
||||||
json_extract(mvt.document, '$.operation') IN !op
|
|
||||||
GROUP BY mvt.key
|
GROUP BY mvt.key
|
||||||
HAVING remain != 0
|
HAVING remain != 0
|
||||||
ORDER BY out_date, nom
|
ORDER BY out_date DESC, nom
|
||||||
;
|
;
|
||||||
!op = $output_ops
|
!table=$module.table
|
||||||
|
!op = $out_keys
|
||||||
|
!cat_condition=$cat_condition
|
||||||
}}
|
}}
|
||||||
{{if $premier}}
|
{{if $premier}}
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Matériel</th>
|
<td>Matériel</td>
|
||||||
<th>Date prêt</th>
|
<td>Date prêt</td>
|
||||||
<th>Quantité</th>
|
<td>Quantité</td>
|
||||||
<th>Membre</th>
|
<td>Membre</td>
|
||||||
<th>Date retour</th>
|
<td>Date retour</td>
|
||||||
<th>Reste à rendre</th>
|
<td>Reste à rendre</td>
|
||||||
<th>Remarque</th>
|
<td>Remarque</td>
|
||||||
<th class="actions"></th>
|
<td class="actions"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
@ -121,9 +175,14 @@
|
||||||
href="movements/output_return.html?key=%s&prop=1"|args:$mvt_key
|
href="movements/output_return.html?key=%s&prop=1"|args:$mvt_key
|
||||||
shape="reset"
|
shape="reset"
|
||||||
target="_dialog"}}
|
target="_dialog"}}
|
||||||
|
{{if $_GET.output_type == "loan"}}
|
||||||
|
{{:assign from="lh"}}
|
||||||
|
{{elseif $_GET.output_type == "rent"}}
|
||||||
|
{{:assign from="rh"}}
|
||||||
|
{{/if}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Détails"
|
label="Détails"
|
||||||
href="movements/movement_details.html?key=%s&prop=1&from=lh"|args:$mvt_key
|
href="movements/movement_details.html?key=%s&prop=1&from=%s"|args:$mvt_key:$from
|
||||||
shape="eye"
|
shape="eye"
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
228
loan_movements.html
Normal file
228
loan_movements.html
Normal file
|
|
@ -0,0 +1,228 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Afficher l'historique des prêts ou locations
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{if $_GET.output_type == "loan"}}
|
||||||
|
{{:assign label="prêt"}}
|
||||||
|
{{elseif $_GET.output_type == "rent"}}
|
||||||
|
{{:assign label="location"}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Cette page n'existe pas !"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:admin_header title="Historique des %ss"|args:$label custom_css="./style.css" current="module_equipment"}}
|
||||||
|
{{:include file="./_nav.html" current="%s"|args:$label subcurrent="historique"}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
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}}
|
||||||
|
|
||||||
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
|
{{:include file="./_get_config.html" keep="config"}}
|
||||||
|
|
||||||
|
{{* filtrer selon la catégorie *}}
|
||||||
|
{{:assign saved_filters=$module.config.filters}}
|
||||||
|
{{:assign var="user_filters" from="saved_filters.%s"|args:$logged_user.id}}
|
||||||
|
|
||||||
|
{{if $_GET.cat_key == null}}
|
||||||
|
{{:assign var="selected_category" from="user_filters.%s_cat_key"|args:$_GET.output_type}}
|
||||||
|
{{else}}
|
||||||
|
{{if $_GET.cat_key == -1}}
|
||||||
|
{{:assign selected_category=null}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign selected_category=$_GET.cat_key}}
|
||||||
|
{{/if}}
|
||||||
|
{{:assign var="user_filters.%s_cat_key"|args:$_GET.output_type value=$selected_category}}
|
||||||
|
{{:assign var="saved_filters.%s"|args:$logged_user.id value=$user_filters}}
|
||||||
|
{{:save key="config" filters=$saved_filters}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* condition de filtrage *}}
|
||||||
|
{{if $selected_category != null}}
|
||||||
|
{{:assign cat_key=$selected_category|quote_sql}}
|
||||||
|
{{:assign cat_condition="category = %s"|args:$cat_key}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign cat_condition=1}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* déterminer les types de mouvements *}}
|
||||||
|
{{#foreach from=$config.output_nature key="key"}}
|
||||||
|
{{if $type != 'temporaire'}}
|
||||||
|
{{:continue}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.output_type == "loan" && $fee != 'payant'}}
|
||||||
|
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||||
|
{{elseif $_GET.output_type == "rent" && $fee == 'payant'}}
|
||||||
|
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign out_keys=$out_keys|implode:","}}
|
||||||
|
{{:assign out_keys="("|cat:$out_keys|cat:")"}}
|
||||||
|
|
||||||
|
{{* sélecteur de catégorie *}}
|
||||||
|
{{:assign var="cat_options." value="" label="Toutes les catégories" href="?output_type=%s&cat_key=-1"|args:$_GET.output_type}}
|
||||||
|
{{#load type="category" order="$$.name"}}
|
||||||
|
{{:assign
|
||||||
|
var="cat_options."
|
||||||
|
value=$key
|
||||||
|
label=$name
|
||||||
|
href="?output_type=%s&cat_key=%s"|args:$_GET.output_type:$key
|
||||||
|
}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
<fieldset class="shortFormRight">
|
||||||
|
<legend>Filtrer par catégorie</legend>
|
||||||
|
{{:dropdown
|
||||||
|
title="Filtrer par catégorie"
|
||||||
|
options=$cat_options
|
||||||
|
value="%s"|args:$selected_category
|
||||||
|
}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{* lister les mouvements *}}
|
||||||
|
{{:assign premier=true}}
|
||||||
|
{{#select * FROM
|
||||||
|
(WITH
|
||||||
|
sorties AS
|
||||||
|
(SELECT
|
||||||
|
mvt.key,
|
||||||
|
json_extract(mvt.document, '$.date') AS date,
|
||||||
|
json_extract(mvt.document, '$.direction') AS direction,
|
||||||
|
json_extract(mvt.document, '$.operation') AS operation,
|
||||||
|
json_extract(mat.document, '$.name') AS materiel,
|
||||||
|
json_extract(mat.document, '$.category') AS category,
|
||||||
|
json_extract(mvt.document, '$.amount') AS amount,
|
||||||
|
users.id AS user_id,
|
||||||
|
users.nom AS user,
|
||||||
|
json_extract(storage.document, '$.name') AS stockage,
|
||||||
|
json_extract(mvt.document, '$.transactions') AS transactions,
|
||||||
|
json_extract(mvt.document, '$.comment') AS comment,
|
||||||
|
json_extract(mvt.document, '$.return_date') AS return_date
|
||||||
|
FROM !table AS mvt
|
||||||
|
INNER JOIN !table AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
|
||||||
|
LEFT JOIN users ON users.id = json_extract(mvt.document, '$.user')
|
||||||
|
LEFT JOIN !table AS storage ON storage.key = json_extract(mvt.document, '$.storage')
|
||||||
|
WHERE json_extract(mvt.document, '$.type') = 'movement'
|
||||||
|
AND json_extract(mvt.document, '$.operation') IN !op
|
||||||
|
AND !cat_condition
|
||||||
|
),
|
||||||
|
entrees AS
|
||||||
|
(SELECT
|
||||||
|
mvt.key,
|
||||||
|
json_extract(mvt.document, '$.date') AS date,
|
||||||
|
json_extract(mvt.document, '$.direction') AS direction,
|
||||||
|
json_extract(mvt.document, '$.operation') AS operation,
|
||||||
|
json_extract(mat.document, '$.name') AS materiel,
|
||||||
|
json_extract(mat.document, '$.category') AS category,
|
||||||
|
json_extract(mvt.document, '$.amount') AS amount,
|
||||||
|
users.id AS user_id,
|
||||||
|
users.nom AS user,
|
||||||
|
json_extract(storage.document, '$.name') AS stockage,
|
||||||
|
json_extract(mvt.document, '$.transactions') AS transactions,
|
||||||
|
json_extract(mvt.document, '$.comment') AS comment,
|
||||||
|
json_extract(mvt.document, '$.return_date') AS return_date
|
||||||
|
FROM !table AS mvt
|
||||||
|
INNER JOIN !table AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
|
||||||
|
LEFT JOIN users ON users.id = json_extract(mvt.document, '$.user')
|
||||||
|
LEFT JOIN !table AS storage ON storage.key = json_extract(mvt.document, '$.storage')
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT json_extract(links.document, '$.return') AS return_key
|
||||||
|
FROM !table AS links
|
||||||
|
INNER JOIN sorties ON json_extract(links.document, '$.temp_key') = sorties.key
|
||||||
|
) AS filtered_links ON filtered_links.return_key = mvt.key
|
||||||
|
WHERE !cat_condition
|
||||||
|
)
|
||||||
|
SELECT * FROM sorties UNION SELECT * FROM entrees
|
||||||
|
)
|
||||||
|
ORDER BY date DESC, user
|
||||||
|
;
|
||||||
|
!table=$module.table
|
||||||
|
!op = $out_keys
|
||||||
|
!cat_condition=$cat_condition
|
||||||
|
}}
|
||||||
|
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
||||||
|
{{: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}}
|
||||||
|
|
||||||
|
{{if $premier}}
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Date</td>
|
||||||
|
<td>Mouvement</td>
|
||||||
|
<td>Opération</td>
|
||||||
|
<td>Matériel</td>
|
||||||
|
<td class="num">Quantité</td>
|
||||||
|
<td>Dépositaire</td>
|
||||||
|
<td>Stockage</td>
|
||||||
|
<td>Documents</td>
|
||||||
|
<td>Écritures</td>
|
||||||
|
<td>Remarque</td>
|
||||||
|
<td class="actions"></td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{:assign premier=false}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{$date|date_short}}</td>
|
||||||
|
<td>{{if $direction == "input"}}Entrée{{else}}Sortie{{/if}}</td>
|
||||||
|
<td>{{$op_label}}</td>
|
||||||
|
<td>{{$materiel}}</td>
|
||||||
|
<td class="num">{{$amount}}</td>
|
||||||
|
<td>{{:link href="/admin/users/details.php?id=%s"|args:$user_id label="%s"|args:$user}}</td>
|
||||||
|
<td>{{$stockage}}</td>
|
||||||
|
<td class="num">{{if $nb_files > 0}}{{$nb_files}}{{/if}}</td>
|
||||||
|
<td class="num">{{if $transactions != null}}{{"Oui"}}{{/if}}</td>
|
||||||
|
<td>{{$comment}}</td>
|
||||||
|
<td class="actions">
|
||||||
|
{{if $_GET.output_type == "loan"}}
|
||||||
|
{{:assign from="lm"}}
|
||||||
|
{{elseif $_GET.output_type == "rent"}}
|
||||||
|
{{:assign from="rm"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Détails"
|
||||||
|
href="movements/movement_details.html?key=%s&prop=1&from=%s"|args:$key:$from
|
||||||
|
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}}
|
||||||
|
|
@ -51,13 +51,13 @@
|
||||||
json_extract(mvt.document, '$.amount') as amount,
|
json_extract(mvt.document, '$.amount') as amount,
|
||||||
COALESCE((SELECT
|
COALESCE((SELECT
|
||||||
json_extract(links.document, '$.temp_key')
|
json_extract(links.document, '$.temp_key')
|
||||||
FROM {!$module.table} AS links
|
FROM !table AS links
|
||||||
WHERE json_extract(links.document, '$.temp_key') = mvt.key
|
WHERE json_extract(links.document, '$.temp_key') = mvt.key
|
||||||
OR json_extract(links.document, '$.return') = mvt.key), mvt.key)
|
OR json_extract(links.document, '$.return') = mvt.key), mvt.key)
|
||||||
AS out_temp_key
|
AS out_temp_key
|
||||||
FROM {!$module.table} AS mvt
|
FROM !table AS mvt
|
||||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||||
INNER JOIN {!$module.table} AS eqpmt
|
INNER JOIN !table AS eqpmt
|
||||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||||
WHERE users.id = :user
|
WHERE users.id = :user
|
||||||
AND eqpmt.key = :eqpmt_key
|
AND eqpmt.key = :eqpmt_key
|
||||||
|
|
@ -65,6 +65,7 @@
|
||||||
OR json_extract(mvt.document, '$.operation') IN !input_types)
|
OR json_extract(mvt.document, '$.operation') IN !input_types)
|
||||||
ORDER BY out_temp_key, date
|
ORDER BY out_temp_key, date
|
||||||
;
|
;
|
||||||
|
!table=$module.table
|
||||||
:user = $_GET.id
|
:user = $_GET.id
|
||||||
:eqpmt_key = $_GET.key|trim
|
:eqpmt_key = $_GET.key|trim
|
||||||
!output_types=$output_types.temporaire
|
!output_types=$output_types.temporaire
|
||||||
|
|
|
||||||
105
member_loan.html
Normal file
105
member_loan.html
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{#restrict block=true section="accounting" level="write"}}{{/restrict}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
paramètres :
|
||||||
|
- id : id membre
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{if $_GET.output_type == "loan"}}
|
||||||
|
{{:assign label="prêt"}}
|
||||||
|
{{elseif $_GET.output_type == "rent"}}
|
||||||
|
{{:assign label="location"}}
|
||||||
|
{{else}}
|
||||||
|
{{:error message="Cette page n'existe pas !"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:admin_header title="%ss aux membres"|args:$label|ucfirst custom_css="./style.css" current="module_equipment"}}
|
||||||
|
{{:include file="./_nav.html" current="%s"|args:$label subcurrent="membres"}}
|
||||||
|
|
||||||
|
{{* vérifier l'existence de la table du module *}}
|
||||||
|
{{#load limit="1"}}
|
||||||
|
{{:assign table_presente=true}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign table_presente=false}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{if $table_presente}}
|
||||||
|
{{:include file="./_get_config.html" keep="config"}}
|
||||||
|
|
||||||
|
{{* déterminer les types de mouvements *}}
|
||||||
|
{{#foreach from=$config.output_nature key="key"}}
|
||||||
|
{{if $type != 'temporaire'}}
|
||||||
|
{{:continue}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.output_type == "loan" && $fee != 'payant'}}
|
||||||
|
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||||
|
{{elseif $_GET.output_type == "rent" && $fee == 'payant'}}
|
||||||
|
{{:assign var="out_keys." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign out_keys=$out_keys|implode:","}}
|
||||||
|
{{:assign out_keys="("|cat:$out_keys|cat:")"}}
|
||||||
|
|
||||||
|
{{:assign premier=true}}
|
||||||
|
{{#select
|
||||||
|
nom, user, GROUP_CONCAT(mat_name, ", ") AS materiel, SUM(remain) AS quantite
|
||||||
|
FROM
|
||||||
|
(SELECT users.nom AS nom,
|
||||||
|
users.id AS user,
|
||||||
|
json_extract(mat.document, '$.name') AS mat_name,
|
||||||
|
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain
|
||||||
|
FROM !table AS mvt
|
||||||
|
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||||
|
LEFT JOIN !table AS links ON mvt.key = json_extract(links.document, '$.temp_key')
|
||||||
|
LEFT JOIN !table AS retour ON retour.key = json_extract(links.document, '$.return')
|
||||||
|
INNER JOIN !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
|
||||||
|
)
|
||||||
|
GROUP BY user
|
||||||
|
ORDER BY nom
|
||||||
|
;
|
||||||
|
!table=$module.table
|
||||||
|
!op = $out_keys
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{if $premier}}
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Membre</td>
|
||||||
|
<td class="nombre">Quantité</td>
|
||||||
|
<td>Matériels</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{:assign premier=false}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>{{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$nom}}</td>
|
||||||
|
<td class="nombre">{{$quantite}}</td>
|
||||||
|
<td>{{$materiel}}</td>
|
||||||
|
</tr>
|
||||||
|
{{else}}
|
||||||
|
{{if $label == "prêt"}}
|
||||||
|
<p class="block alert">Aucun {{$label}} en cours.</p>
|
||||||
|
{{elseif $label == "location"}}
|
||||||
|
<p class="block alert">Aucune {{$label}} en cours.</p>
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{else}}
|
||||||
|
{{if $label == "prêt"}}
|
||||||
|
<p class="block alert">Aucun {{$label}} en cours.</p>
|
||||||
|
{{elseif $label == "location"}}
|
||||||
|
<p class="block alert">Aucune {{$label}} en cours.</p>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:admin_footer}}
|
||||||
|
|
@ -4,5 +4,7 @@ author="Jean-Christophe Engel"
|
||||||
author_url="https://gitea.zaclys.com/lesanges"
|
author_url="https://gitea.zaclys.com/lesanges"
|
||||||
home_button=true
|
home_button=true
|
||||||
menu=true
|
menu=true
|
||||||
|
restrict_section="connect"
|
||||||
|
restrict_level="read"
|
||||||
restrict_details="Les membres connectés peuvent consulter l'historique de leurs prêts ; les membres ayant accès en lecture aux membres peuvent consulter l'historique des prêts des autres membres ; seuls les membres ayant accès en écriture à la comptabilité peuvent utiliser l'ensemble des fonctionnalités du module."
|
restrict_details="Les membres connectés peuvent consulter l'historique de leurs prêts ; les membres ayant accès en lecture aux membres peuvent consulter l'historique des prêts des autres membres ; seuls les membres ayant accès en écriture à la comptabilité peuvent utiliser l'ensemble des fonctionnalités du module."
|
||||||
allow_user_restrict=false
|
allow_user_restrict=false
|
||||||
|
|
|
||||||
|
|
@ -134,23 +134,23 @@
|
||||||
<fieldset class="entree">
|
<fieldset class="entree">
|
||||||
<legend>Informations obligatoires</legend>
|
<legend>Informations obligatoires</legend>
|
||||||
<dl>
|
<dl>
|
||||||
|
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||||
|
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=1}}
|
||||||
|
{{:input type="text" name="name" label="Désignation" required=true}}
|
||||||
{{if $input_labels|count == 1}}
|
{{if $input_labels|count == 1}}
|
||||||
{{:input type="select" name="operation" label="Type" required=true options=$input_labels}}
|
{{:input type="select" name="operation" label="Type" required=true options=$input_labels}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:input type="select" name="operation" label="Type" required=true default_empty="— Aucun —" options=$input_labels|sort}}
|
{{:input type="select" name="operation" label="Type" required=true default_empty="— Aucun —" options=$input_labels|sort}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
|
||||||
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=1}}
|
|
||||||
{{if $categories|count == 1}}
|
{{if $categories|count == 1}}
|
||||||
{{:input type="select" name="category" label="Catégorie" options=$categories required=true}}
|
{{:input type="select" name="category" label="Catégorie" options=$categories required=true}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:input type="select" name="category" label="Catégorie" default_empty="— Aucune —" options=$categories required=true}}
|
{{:input type="select" name="category" label="Catégorie" default_empty="— Aucune —" options=$categories required=true}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="text" name="name" label="Désignation" required=true}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Informations facultatives</legend>
|
<legend>Autres informations</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{if $storage != null}}
|
{{if $storage != null}}
|
||||||
{{:input type="select" name="storage" label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
{{:input type="select" name="storage" label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="../_get_config.html" keep="config, 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}}
|
{{: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 » *}}
|
{{* interdire de dupliquer un retour => utiliser le bouton « Retour » *}}
|
||||||
|
|
@ -95,8 +95,12 @@
|
||||||
{{:assign var="mvt_new.amount" value=$_POST.amount}}
|
{{:assign var="mvt_new.amount" value=$_POST.amount}}
|
||||||
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
|
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
|
||||||
{{:assign var="mvt_new.comment" value=$_POST.comment}}
|
{{:assign var="mvt_new.comment" value=$_POST.comment}}
|
||||||
{{if $_POST.set_return_date != null}}
|
|
||||||
{{:assign return_date=$_POST.return_date}}
|
{{if $_POST.return_date != null}}
|
||||||
|
{{:assign return_date=$_POST.return_date|parse_date}}
|
||||||
|
{{if $return_date < $_POST.date|parse_date}}
|
||||||
|
{{:error message="La date de retour doit être postérieure à la date de sortie !"}}
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign return_date=null}}
|
{{:assign return_date=null}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -205,14 +209,27 @@
|
||||||
user=$user.id
|
user=$user.id
|
||||||
storage=$_POST.storage
|
storage=$_POST.storage
|
||||||
transactions=$transactions
|
transactions=$transactions
|
||||||
return_date=$return_date|parse_date
|
return_date=$return_date
|
||||||
}}
|
}}
|
||||||
{{if $_GET.from == "lh"}}
|
|
||||||
{{:assign from="../loan_history.html"}}
|
{{if $_GET.from|substr:0:1 == "l"}}
|
||||||
{{else}}
|
{{:assign output_type="loan"}}
|
||||||
{{:assign from="../equipment_history.html"}}
|
{{elseif $_GET.from|substr:0:1 == "r"}}
|
||||||
|
{{:assign output_type="rent"}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.from|substr:1:1 == "h"}}
|
||||||
|
{{:assign suffix="history"}}
|
||||||
|
{{elseif $_GET.from|substr:1:1 == "m"}}
|
||||||
|
{{:assign suffix="movements"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $_GET.from == "eh"}}
|
||||||
|
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}}
|
||||||
|
{{elseif $suffix == null}}
|
||||||
|
{{:redirect force="../index.html"}}
|
||||||
|
{{else}}
|
||||||
|
{{:redirect force="../loan_%s.html?output_type=%s&ok=1&key=%s&prop=%s&msg=copie"|args:$suffix:$output_type:$eqpmt_key:$prop}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=copie"|args:$from:$eqpmt_key:$prop}}
|
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
|
|
@ -227,7 +244,6 @@
|
||||||
-------------------- Préparer la saisie --------------------
|
-------------------- Préparer la saisie --------------------
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* récupérer les infos de la catégorie *}}
|
|
||||||
{{#load key=$equipment.category assign="category"}}{{/load}}
|
{{#load key=$equipment.category assign="category"}}{{/load}}
|
||||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||||
|
|
||||||
|
|
@ -255,17 +271,18 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Informations obligatoires</legend>
|
<legend>Informations obligatoires</legend>
|
||||||
<dl>
|
<dl>
|
||||||
|
{{:input type="date" name="date" label="Date" required=true default=$mvt_new.date}}
|
||||||
|
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}}
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
{{:input type="select" name="operation" label="Type" required=true options=$input_labels|sort default=$mvt_new.operation}}
|
{{:input type="select" name="operation" label="Type" required=true options=$input_labels|sort default=$mvt_new.operation}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:input type="select" name="operation" label="Type" required=true options=$output_labels|sort default=$mvt_new.operation}}
|
{{:input type="select" name="operation" label="Type" required=true options=$output_labels|sort default=$mvt_new.operation}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$mvt_new.date}}
|
|
||||||
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="entree">
|
<fieldset class="entree">
|
||||||
<legend>Informations facultatives</legend>
|
<legend>Autres informations</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{if $prop == 1 && $mvt_new.direction == "output"}}
|
{{if $prop == 1 && $mvt_new.direction == "output"}}
|
||||||
{{:input
|
{{:input
|
||||||
|
|
@ -278,28 +295,26 @@
|
||||||
max=1
|
max=1
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input" && $storage != null}}
|
||||||
{{:input type="select" name="storage" default=$mvt_new.storage label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
{{: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"}}
|
{{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"}}
|
{{: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}}
|
{{: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.direction == "output"}}
|
||||||
{{if $mvt_new.return_date != null}}
|
{{if $mvt_new.return_date != null}}
|
||||||
{{:assign checked="checked"}}
|
|
||||||
{{:assign visibility="visible"}}
|
|
||||||
{{:assign return_date=$mvt_new.return_date}}
|
{{:assign return_date=$mvt_new.return_date}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign visibility="hidden"}}
|
{{if $module.config.loan_duration != null && $module.config.loan_duration > 0}}
|
||||||
{{:assign ts_sortie=$mvt_new.date|strtotime}}
|
{{:assign ts_sortie=$mvt_new.date|strtotime}}
|
||||||
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$loan_duration}}
|
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$module.config.loan_duration}}
|
||||||
{{:assign return_date=$ts_retour|date_short}}
|
{{:assign return_date=$ts_retour|date_short}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/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">
|
||||||
<div id="div_return_date" style="visibility:{{$visibility}}">
|
|
||||||
{{:input type="date" name="return_date" label="Date de retour" default=$return_date}}
|
{{: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}}">
|
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$module.config.loan_duration}}">
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
@ -314,9 +329,17 @@
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
<script type="text/javascript" src="../scripts.js"></script>
|
<script type="text/javascript" src="../scripts.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_return_date']) {
|
let output_nature = {{$config.output_nature|json_encode|raw}};
|
||||||
toggleVisibility(idcheck, fields);
|
|
||||||
|
function changeVisibility(evt,
|
||||||
|
id_date = 'f_date',
|
||||||
|
id_type = 'f_operation',
|
||||||
|
div = 'div_return_date',
|
||||||
|
id_return_date = 'f_return_date')
|
||||||
|
{
|
||||||
|
toggleVisibility(id_date, id_type, div, id_return_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
||||||
|
|
@ -325,7 +348,8 @@ function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_da
|
||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
|
document.getElementById('f_operation').onchange = changeVisibility;
|
||||||
document.getElementById('f_date').onchange = changeReturnDate;
|
document.getElementById('f_date').onchange = changeReturnDate;
|
||||||
|
document.getElementById('f_operation').onchange();
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,25 @@
|
||||||
{{:include file="../_get_config.html" keep="config"}}
|
{{:include file="../_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{#form on="delete"}}
|
{{#form on="delete"}}
|
||||||
{{if $_GET.from == "lh"}}
|
{{if $_GET.from|substr:0:1 == "l"}}
|
||||||
{{:assign from="../loan_history.html"}}
|
{{:assign output_type="loan"}}
|
||||||
{{else}}
|
{{elseif $_GET.from|substr:0:1 == "r"}}
|
||||||
{{:assign from="../equipment_history.html"}}
|
{{:assign output_type="rent"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $_GET.from|substr:1:1 == "h"}}
|
||||||
|
{{:assign suffix="history"}}
|
||||||
|
{{elseif $_GET.from|substr:1:1 == "m"}}
|
||||||
|
{{:assign suffix="movements"}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.from == "eh"}}
|
||||||
|
{{:assign from="../equipment_history.html"}}
|
||||||
|
{{elseif $suffix == null}}
|
||||||
|
{{:assign from="../index.html"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign from="../loan_%s.html"|args:$suffix}}
|
||||||
|
{{:assign param="&output_type=%s"|args:$output_type}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* vérifier s'il est possible de supprimer le mouvement *}}
|
{{* vérifier s'il est possible de supprimer le mouvement *}}
|
||||||
{{if $mvt_suppr.direction == 'input'}}
|
{{if $mvt_suppr.direction == 'input'}}
|
||||||
{{:assign var="type_operation" from="config.input_nature.%s.type"|args:$mvt_suppr.operation}}
|
{{:assign var="type_operation" from="config.input_nature.%s.type"|args:$mvt_suppr.operation}}
|
||||||
|
|
@ -36,7 +50,7 @@
|
||||||
{{:assign link_key=$key}}
|
{{:assign link_key=$key}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{if $link_key != null}}
|
{{if $link_key != null}}
|
||||||
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression%s"|args:$from:$mvt_suppr.equipment:$_GET.prop:$param}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign dispo=0}}
|
{{:assign dispo=0}}
|
||||||
|
|
@ -69,7 +83,7 @@
|
||||||
|
|
||||||
{{* problème ? *}}
|
{{* problème ? *}}
|
||||||
{{if $dispo < 0 || $nonprop < 0}}
|
{{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="%s?key=%s&prop=%s&err=1&msg=suppression%s"|args:$from:$mvt_suppr.equipment:$_GET.prop:$param}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
@ -90,7 +104,7 @@
|
||||||
{{:assign link_key=$key}}
|
{{:assign link_key=$key}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{if $link_key != null}}
|
{{if $link_key != null}}
|
||||||
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression%s"|args:$from:$mvt_suppr.equipment:$_GET.prop:$param}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{elseif $type_operation == 'retour'}}
|
{{elseif $type_operation == 'retour'}}
|
||||||
{{#load type="link" where="$$.return = :key" :key=$_GET.key}}
|
{{#load type="link" where="$$.return = :key" :key=$_GET.key}}
|
||||||
|
|
@ -155,11 +169,11 @@
|
||||||
out=$curr_eqpmt.out
|
out=$curr_eqpmt.out
|
||||||
notowned=$curr_eqpmt.notowned
|
notowned=$curr_eqpmt.notowned
|
||||||
}}
|
}}
|
||||||
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=suppression%s"|args:$from:$mvt_suppr.equipment:$_GET.prop:$param}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* supprimer le matériel *}}
|
{{* supprimer le matériel *}}
|
||||||
{{:delete key=$curr_eqpmt.key}}
|
{{:delete key=$curr_eqpmt.key}}
|
||||||
{{:redirect force="../index.html?ok=1&msg=supprmvtmat"}}
|
{{:redirect force="../index.html?ok=1&msg=supprmvtmat"|args}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,17 +106,17 @@
|
||||||
<fieldset class="entree">
|
<fieldset class="entree">
|
||||||
<legend>Informations obligatoires</legend>
|
<legend>Informations obligatoires</legend>
|
||||||
<dl>
|
<dl>
|
||||||
|
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||||
|
{{:input type="number" name="amount" label="Quantité" required=true min=1 default=1}}
|
||||||
{{if $input_labels|count == 1}}
|
{{if $input_labels|count == 1}}
|
||||||
{{:input type="select" name="operation" label="Type d'entrée" required=true options=$input_labels}}
|
{{:input type="select" name="operation" label="Type d'entrée" required=true options=$input_labels}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:input type="select" name="operation" label="Type d'entrée" required=true default_empty="— Aucun —" options=$input_labels|sort}}
|
{{:input type="select" name="operation" label="Type d'entrée" required=true default_empty="— Aucun —" options=$input_labels|sort}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
|
||||||
{{:input type="number" name="amount" label="Quantité" required=true min=1 default=1}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="entree">
|
<fieldset class="entree">
|
||||||
<legend>Informations facultatives</legend>
|
<legend>Autres informations</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{if $storage != null}}
|
{{if $storage != null}}
|
||||||
{{:input type="select" name="storage" label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
{{:input type="select" name="storage" label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,15 @@
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
|
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present
|
||||||
FROM {!$module.table} AS mvt
|
FROM !table AS mvt
|
||||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
LEFT JOIN !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')
|
LEFT JOIN !table AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||||
WHERE
|
WHERE
|
||||||
json_extract(mvt.document, '$.operation') IN !op
|
json_extract(mvt.document, '$.operation') IN !op
|
||||||
AND mvt.key = :mvt_key
|
AND mvt.key = :mvt_key
|
||||||
GROUP by mvt.key
|
GROUP by mvt.key
|
||||||
;
|
;
|
||||||
|
!table=$module.table
|
||||||
!op = $operations
|
!op = $operations
|
||||||
:mvt_key = $_GET.key
|
:mvt_key = $_GET.key
|
||||||
}}
|
}}
|
||||||
|
|
@ -203,9 +204,9 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Retour de matériel</legend>
|
<legend>Retour de matériel</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="select" name="operation" label="Type de mouvement" required=true options=$return_label}}
|
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||||
{{:input type="number" name="amount" label="Quantité" min=1 max=$present required=true default=1}}
|
{{:input type="number" name="amount" label="Quantité" min=1 max=$present required=true default=1}}
|
||||||
|
{{:input type="select" name="operation" label="Type de mouvement" required=true options=$return_label}}
|
||||||
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false}}
|
{{:input type="textarea" name="comment" label="Remarques" cols="40", rows="3" required=false}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
||||||
|
|
@ -15,22 +15,7 @@
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="../_get_config.html" keep="config, 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"}}
|
|
||||||
{{if $type_mvt == "temporaire"}}
|
|
||||||
{{:assign prop=0}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign prop=1}}
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
{{if $type_mvt == "retour"}}
|
|
||||||
{{:assign prop=0}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign prop=1}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{* infos pour affichage *}}
|
{{* infos pour affichage *}}
|
||||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||||
|
|
@ -45,25 +30,15 @@
|
||||||
{{:error message="Aucun matériel avec la clé « %s »"|args:$eqpmt_key}}
|
{{:error message="Aucun matériel avec la clé « %s »"|args:$eqpmt_key}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{#foreach from=$directions key="direction"}}
|
|
||||||
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
|
||||||
{{#foreach from=$nature key="key"}}
|
|
||||||
{{if $type_mvt != "retour" && $type != "retour" ||
|
|
||||||
$type_mvt == "retour" && $type == "retour"}}
|
|
||||||
{{:assign var="%s_labels.%s"|args:$direction:$key value=$label}}
|
|
||||||
{{/if}}
|
|
||||||
{{/foreach}}
|
|
||||||
{{/foreach}}
|
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
-------------------- Traiter la saisie --------------------
|
-------------------- Traiter la saisie --------------------
|
||||||
*}}
|
*}}
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
|
{{* vérifier la validité de la saisie *}}
|
||||||
{{if $_POST.amount <= 0}}
|
{{if $_POST.amount <= 0}}
|
||||||
{{:error message="La quantité (%s) doit être strictement positive !!"|args:$_POST.amount}}
|
{{:error message="La quantité (%s) doit être strictement positive !!"|args:$_POST.amount}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* vérifier validité des données *}}
|
|
||||||
{{if $_POST.date|parse_date|strtotime > $now}}
|
{{if $_POST.date|parse_date|strtotime > $now}}
|
||||||
{{:error message="Impossible de saisir une date dans le futur (%s)"|args:$_POST.date}}
|
{{:error message="Impossible de saisir une date dans le futur (%s)"|args:$_POST.date}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -86,8 +61,13 @@
|
||||||
{{:assign var="mvt_new.amount" value=$_POST.amount}}
|
{{:assign var="mvt_new.amount" value=$_POST.amount}}
|
||||||
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
|
{{:assign var="mvt_new.date" value=$_POST.date|parse_date}}
|
||||||
{{:assign var="mvt_new.comment" value=$_POST.comment}}
|
{{:assign var="mvt_new.comment" value=$_POST.comment}}
|
||||||
{{if $_POST.set_return_date != null}}
|
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||||
{{:assign return_date=$_POST.return_date}}
|
|
||||||
|
{{if $_POST.return_date != null}}
|
||||||
|
{{:assign return_date=$_POST.return_date|parse_date}}
|
||||||
|
{{if $return_date < $_POST.date|parse_date}}
|
||||||
|
{{:error message="La date de retour doit être postérieure à la date de sortie !"}}
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign return_date=null}}
|
{{:assign return_date=null}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -99,10 +79,7 @@
|
||||||
*}}
|
*}}
|
||||||
{{:assign insere=false}}
|
{{:assign insere=false}}
|
||||||
{{#load
|
{{#load
|
||||||
where="
|
where="$$.type = 'movement' AND $$.equipment = :eqpmt_key"
|
||||||
$$.type = 'movement'
|
|
||||||
AND
|
|
||||||
$$.equipment = :eqpmt_key"
|
|
||||||
:eqpmt_key=$eqpmt_key
|
:eqpmt_key=$eqpmt_key
|
||||||
order="$$.date"
|
order="$$.date"
|
||||||
assign="movement"
|
assign="movement"
|
||||||
|
|
@ -222,14 +199,41 @@
|
||||||
user=$user_id
|
user=$user_id
|
||||||
storage=$_POST.storage
|
storage=$_POST.storage
|
||||||
transactions=$transactions
|
transactions=$transactions
|
||||||
return_date=$return_date|parse_date
|
return_date=$return_date
|
||||||
}}
|
}}
|
||||||
{{if $_GET.from == "lh"}}
|
|
||||||
{{:assign from="../loan_history.html"}}
|
{{if $_GET.from|substr:0:1 == "l"}}
|
||||||
{{else}}
|
{{:assign output_type="loan"}}
|
||||||
{{:assign from="../equipment_history.html"}}
|
{{elseif $_GET.from|substr:0:1 == "r"}}
|
||||||
|
{{:assign output_type="rent"}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.from|substr:1:1 == "h"}}
|
||||||
|
{{:assign suffix="history"}}
|
||||||
|
{{elseif $_GET.from|substr:1:1 == "m"}}
|
||||||
|
{{:assign suffix="movements"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $mvt_new.direction == "input"}}
|
||||||
|
{{if $type_mvt == "temporaire"}}
|
||||||
|
{{:assign prop=0}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop=1}}
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{if $type_mvt == "retour"}}
|
||||||
|
{{:assign prop=0}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign prop=1}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $_GET.from == "eh"}}
|
||||||
|
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
|
||||||
|
{{elseif $suffix == null}}
|
||||||
|
{{:redirect force="../index.html"}}
|
||||||
|
{{else}}
|
||||||
|
{{:redirect force="../loan_%s.html?output_type=%s&ok=1&key=%s&prop=%s&msg=modification"|args:$suffix:$output_type:$eqpmt_key:$prop}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=modification"|args:$from:$eqpmt_key:$prop}}
|
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
|
|
@ -238,14 +242,26 @@
|
||||||
{{:assign mvt_label="sortie"}}
|
{{:assign mvt_label="sortie"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:admin_header title="Modifier une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}}
|
{{:admin_header title="Modifier une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
-------------------- Préparer la saisie --------------------
|
-------------------- Préparer la saisie --------------------
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{#load key=$equipment.category assign="category"}}{{/load}}
|
{{#load key=$equipment.category assign="category"}}{{/load}}
|
||||||
|
|
||||||
|
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt_new.direction:$mvt_new.operation}}
|
||||||
|
{{#foreach from=$directions key="direction"}}
|
||||||
|
{{:assign var="nature" from="config.%s_nature"|args:$direction}}
|
||||||
|
{{#foreach from=$nature key="key"}}
|
||||||
|
{{if $type_mvt != "retour" && $type != "retour" ||
|
||||||
|
$type_mvt == "retour" && $type == "retour"}}
|
||||||
|
{{:assign var="%s_labels.%s"|args:$direction:$key value=$label}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
|
||||||
{{if $mvt_new.user != null}}
|
{{if $mvt_new.user != null}}
|
||||||
{{#select id, !name as nom FROM users WHERE id=:id; !name=$config.user_fields.name_sql :id=$mvt_new.user}}
|
{{#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}}
|
{{:assign var="user.%s"|args:$id value=$nom}}
|
||||||
|
|
@ -278,20 +294,20 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Informations obligatoires</legend>
|
<legend>Informations obligatoires</legend>
|
||||||
<dl>
|
<dl>
|
||||||
|
{{:input type="date" name="date" label="Date" required=true default=$mvt_new.date}}
|
||||||
|
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}}
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
{{:input type="select" name="operation" label="Type" required=true options=$input_labels|sort default=$mvt_new.operation}}
|
{{:input type="select" name="operation" label="Type" required=true options=$input_labels|sort default=$mvt_new.operation}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:input type="select" name="operation" label="Type" required=true options=$output_labels|sort default=$mvt_new.operation}}
|
{{:input type="select" name="operation" label="Type" required=true options=$output_labels|sort default=$mvt_new.operation}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$mvt_new.date}}
|
|
||||||
{{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="entree">
|
<fieldset class="entree">
|
||||||
<legend>Informations facultatives</legend>
|
<legend>Autres informations</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{if $prop == 1 && $mvt_new.direction == "output"}}
|
{{if $mvt_new.direction == "output" && $type_mvt != "retour"}}
|
||||||
{{:input
|
{{:input
|
||||||
type="list"
|
type="list"
|
||||||
name="user"
|
name="user"
|
||||||
|
|
@ -302,30 +318,26 @@
|
||||||
max=1
|
max=1
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input" && $storage != null}}
|
||||||
{{if $storage != null}}
|
{{:input type="select" name="storage" label="Lieu de stockage" default=$mvt_new.storage default_empty="— Aucun —" options=$storage required=false}}
|
||||||
{{:input type="select" name="storage" label="Lieu de stockage" default=$mvt_new.storage default_empty="— Aucun —" options=$storage required=false}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $type_mvt != "retour"}}
|
{{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"}}
|
{{:input type="list" name="transactions" label="Écritures liées" default=$mvt_new.transactions 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}}
|
{{: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.direction == "output"}}
|
||||||
{{if $mvt_new.return_date != null}}
|
{{if $mvt_new.return_date != null}}
|
||||||
{{:assign checked="checked"}}
|
|
||||||
{{:assign visibility="visible"}}
|
|
||||||
{{:assign return_date=$mvt_new.return_date}}
|
{{:assign return_date=$mvt_new.return_date}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign visibility="hidden"}}
|
{{if $module.config.loan_duration != null && $module.config.loan_duration > 0}}
|
||||||
{{:assign ts_sortie=$mvt_new.date|strtotime}}
|
{{:assign ts_sortie=$mvt_new.date|strtotime}}
|
||||||
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$loan_duration}}
|
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$module.config.loan_duration}}
|
||||||
{{:assign return_date=$ts_retour|date_short}}
|
{{:assign return_date=$ts_retour|date_short}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/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">
|
||||||
<div id="div_return_date" style="visibility:{{$visibility}}">
|
|
||||||
{{:input type="date" name="return_date" label="Date de retour" default=$return_date}}
|
{{: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}}">
|
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$module.config.loan_duration}}">
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
@ -340,9 +352,17 @@
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
<script type="text/javascript" src="../scripts.js"></script>
|
<script type="text/javascript" src="../scripts.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_return_date']) {
|
let output_nature = {{$config.output_nature|json_encode|raw}};
|
||||||
toggleVisibility(idcheck, fields);
|
|
||||||
|
function changeVisibility(evt,
|
||||||
|
id_date = 'f_date',
|
||||||
|
id_type = 'f_operation',
|
||||||
|
div = 'div_return_date',
|
||||||
|
id_return_date = 'f_return_date')
|
||||||
|
{
|
||||||
|
toggleVisibility(id_date, id_type, div, id_return_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
||||||
|
|
@ -351,7 +371,8 @@ function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_da
|
||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
|
document.getElementById('f_operation').onchange = changeVisibility;
|
||||||
document.getElementById('f_date').onchange = changeReturnDate;
|
document.getElementById('f_date').onchange = changeReturnDate;
|
||||||
|
document.getElementById('f_operation').onchange();
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
paramètres :
|
paramètres :
|
||||||
- key : clé du mouvement
|
- key : clé du mouvement
|
||||||
- prop = 1 si matériel appartient à l'asso
|
- prop = 1 si matériel appartient à l'asso
|
||||||
|
- from = page d'appel
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{:admin_header title="Détails du mouvement" custom_css="../style.css" current="module_equipment"}}
|
{{:admin_header title="Détails du mouvement" custom_css="../style.css" current="module_equipment"}}
|
||||||
|
|
@ -114,7 +115,5 @@
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<form method="post" action="">
|
{{:admin_files path=$mvt.key upload=true edit=true use_trash=false}}
|
||||||
{{:admin_files path=$_GET.key upload=true edit=true use_trash=false}}
|
|
||||||
</form>
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,25 @@
|
||||||
{{*
|
{{*
|
||||||
paramètres :
|
paramètres :
|
||||||
- key : clé du matériel à sortir
|
- key : clé du matériel à sortir
|
||||||
|
- output_type : loan (prêt), rent (location), rien (cas général)
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* récupérer la config des entrées/sorties *}}
|
{{* récupérer la config des entrées/sorties *}}
|
||||||
{{:include file="../_get_config.html" keep="config, loan_duration"}}
|
{{:include file="../_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{* types de sorties *}}
|
{{* types de sorties *}}
|
||||||
{{#foreach from=$config.output_nature key=key}}
|
{{#foreach from=$config.output_nature key=key}}
|
||||||
{{if $type != 'retour'}}
|
{{if $type == 'retour'}}
|
||||||
|
{{:continue}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $type == 'temporaire' && $fee == 'payant'}}
|
||||||
|
{{:assign var="paid_keys." value=$key}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $_GET.output_type == null}}
|
||||||
|
{{:assign var="output_labels.%s"|args:$key value=$label}}
|
||||||
|
{{elseif $type == 'temporaire' && $_GET.output_type == "loan" && $fee != 'payant'}}
|
||||||
|
{{:assign var="output_labels.%s"|args:$key value=$label}}
|
||||||
|
{{elseif $type == 'temporaire' && $_GET.output_type == "rent" && $fee == 'payant'}}
|
||||||
{{:assign var="output_labels.%s"|args:$key value=$label}}
|
{{:assign var="output_labels.%s"|args:$key value=$label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
@ -22,22 +33,27 @@
|
||||||
|
|
||||||
{{* Traiter l'envoi du formulaire *}}
|
{{* Traiter l'envoi du formulaire *}}
|
||||||
{{#form on="save"}}
|
{{#form on="save"}}
|
||||||
|
{{* vérifier la validité de la saisie *}}
|
||||||
|
|
||||||
{{* interdire date dans le futur *}}
|
{{* interdire date dans le futur *}}
|
||||||
{{if $_POST.date|parse_date|strtotime > $now}}
|
{{if $_POST.date|parse_date|strtotime > $now}}
|
||||||
{{:error message="Impossible de saisir une date dans le futur (%s)"|args:$_POST.date}}
|
{{:error message="Impossible de saisir une date dans le futur (%s)"|args:$_POST.date}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* vérifier les infos saisies *}}
|
|
||||||
{{if $_POST.operation == ""}}
|
{{if $_POST.operation == ""}}
|
||||||
{{:error message="Vous devez choisir un type de sortie"}}
|
{{:error message="Vous devez choisir un type de sortie"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}}
|
{{:assign var="type_mvt" from="config.output_nature.%s.type"|args:$_POST.operation}}
|
||||||
{{if $type_mvt != "temporaire" && $_POST.set_return_date != null}}
|
{{if $type_mvt != "temporaire" && $_POST.return_date != null}}
|
||||||
{{:error message="On ne peut associer une date de retour qu'à une sortie temporaire"}}
|
{{:error message="On ne peut associer une date de retour qu'à une sortie temporaire"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $_POST.set_return_date != null}}
|
|
||||||
{{:assign return_date=$_POST.return_date}}
|
{{if $_POST.return_date != null}}
|
||||||
|
{{:assign return_date=$_POST.return_date|parse_date}}
|
||||||
|
{{if $return_date < $_POST.date|parse_date}}
|
||||||
|
{{:error message="La date de retour doit être postérieure à la date de sortie !"}}
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign return_date=null}}
|
{{:assign return_date=null}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -158,7 +174,7 @@
|
||||||
date=$_POST.date|parse_date
|
date=$_POST.date|parse_date
|
||||||
comment=$_POST.remarques|trim
|
comment=$_POST.remarques|trim
|
||||||
user=$user.id
|
user=$user.id
|
||||||
return_date=$return_date|parse_date
|
return_date=$return_date
|
||||||
transactions=$transactions
|
transactions=$transactions
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=1&msg=sortie"|args:$_GET.key}}
|
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=1&msg=sortie"|args:$_GET.key}}
|
||||||
|
|
@ -169,13 +185,16 @@
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{:include file="../_nav.html" current="sorties"}}
|
{{:include file="../_nav.html" current="sorties"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{:form_errors}}
|
||||||
|
|
||||||
{{#load key=$equipment.category assign="category"}}{{/load}}
|
{{#load key=$equipment.category assign="category"}}{{/load}}
|
||||||
{{:assign dispo="%d-%d"|math:$equipment.stock:$equipment.out}}
|
{{:assign dispo="%d-%d"|math:$equipment.stock:$equipment.out}}
|
||||||
|
|
||||||
{{if $dispo > 0}}
|
{{if $dispo > 0}}
|
||||||
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$now:$loan_duration}}
|
{{if $module.config.loan_duration != null && $module.config.loan_duration > 0}}
|
||||||
{{:assign date_retour=$ts_retour|date_short}}
|
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$now:$module.config.loan_duration}}
|
||||||
|
{{:assign date_retour=$ts_retour|date_short}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{* formulaire de sortie de matériel *}}
|
{{* formulaire de sortie de matériel *}}
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
|
|
@ -193,17 +212,17 @@
|
||||||
<fieldset class="sortie">
|
<fieldset class="sortie">
|
||||||
<legend>Informations obligatoires</legend>
|
<legend>Informations obligatoires</legend>
|
||||||
<dl>
|
<dl>
|
||||||
|
{{:input type="date" name="date" label="Date de sortie" required=true default=$now|date_short}}
|
||||||
|
{{:input type="number" name="amount" label="Quantité" required=true default=1 min=1 max=$dispo}}
|
||||||
{{if $output_labels|count == 1}}
|
{{if $output_labels|count == 1}}
|
||||||
{{:input type="select" name="operation" label="Type de sortie" required=true options=$output_labels}}
|
{{:input type="select" name="operation" label="Type de sortie" required=true options=$output_labels}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:input type="select" name="operation" label="Type de sortie" required=true default_empty="— Aucun —" options=$output_labels|sort}}
|
{{:input type="select" name="operation" label="Type de sortie" required=true default_empty="— Aucun —" options=$output_labels|sort}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:input type="date" name="date" label="Date de sortie" required=true default=$now|date_short}}
|
|
||||||
{{:input type="number" name="amount" label="Quantité" required=true default=1 min=1 max=$dispo}}
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="entree">
|
<fieldset class="entree">
|
||||||
<legend>Informations facultatives</legend>
|
<legend>Autres informations</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input
|
{{:input
|
||||||
type="list"
|
type="list"
|
||||||
|
|
@ -215,10 +234,9 @@
|
||||||
}}
|
}}
|
||||||
{{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}}
|
{{: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 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">
|
||||||
<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="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}}">
|
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$module.config.loan_duration}}">
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
@ -230,13 +248,20 @@
|
||||||
<p class="block error">Il n'y a aucune unité de ce matériel disponible à la date du {{$now|date_short}}</p>
|
<p class="block error">Il n'y a aucune unité de ce matériel disponible à la date du {{$now|date_short}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
<script type="text/javascript" src="../scripts.js"></script>
|
<script type="text/javascript" src="../scripts.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_return_date']) {
|
let output_nature = {{$config.output_nature|json_encode|raw}};
|
||||||
toggleVisibility(idcheck, fields);
|
|
||||||
|
function changeVisibility(evt,
|
||||||
|
id_date = 'f_date',
|
||||||
|
id_type = 'f_operation',
|
||||||
|
div = 'div_return_date',
|
||||||
|
id_return_date = 'f_return_date')
|
||||||
|
{
|
||||||
|
toggleVisibility(id_date, id_type, div, id_return_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
||||||
|
|
@ -245,8 +270,8 @@ function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_da
|
||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
document.getElementById('f_set_return_date_1').checked = false;
|
document.getElementById('f_operation').onchange = changeVisibility;
|
||||||
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
|
|
||||||
document.getElementById('f_date').onchange = changeReturnDate;
|
document.getElementById('f_date').onchange = changeReturnDate;
|
||||||
|
document.getElementById('f_operation').onchange();
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,15 @@
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur
|
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur
|
||||||
FROM {!$module.table} AS mvt
|
FROM !table AS mvt
|
||||||
LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key')
|
LEFT JOIN !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')
|
LEFT JOIN !table AS mvt2 ON mvt2.key = json_extract(link.document, '$.return')
|
||||||
WHERE
|
WHERE
|
||||||
json_extract(mvt.document, '$.operation') IN !op
|
json_extract(mvt.document, '$.operation') IN !op
|
||||||
AND mvt.key = :mvt_key
|
AND mvt.key = :mvt_key
|
||||||
GROUP by mvt.key
|
GROUP by mvt.key
|
||||||
;
|
;
|
||||||
|
!table=$module.table
|
||||||
!op = $operations
|
!op = $operations
|
||||||
:mvt_key = $_GET.key
|
:mvt_key = $_GET.key
|
||||||
}}
|
}}
|
||||||
|
|
@ -213,13 +214,13 @@
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Informations obligatoires</legend>
|
<legend>Informations obligatoires</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{:input type="select" name="operation" label="Type de mouvement" required=true options=$return_label}}
|
|
||||||
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
{{:input type="date" name="date" label="Date" required=true default=$now|date_short}}
|
||||||
{{:input type="number" name="amount" label="Quantité" min=1 max=$exterieur required=true default=1}}
|
{{:input type="number" name="amount" label="Quantité" min=1 max=$exterieur required=true default=1}}
|
||||||
|
{{:input type="select" name="operation" label="Type de mouvement" required=true options=$return_label}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="entree">
|
<fieldset class="entree">
|
||||||
<legend>Informations facultatives</legend>
|
<legend>Autres informations</legend>
|
||||||
<dl>
|
<dl>
|
||||||
{{if $storage != null}}
|
{{if $storage != null}}
|
||||||
{{:input type="select" name="storage" label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
{{:input type="select" name="storage" label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
||||||
|
|
|
||||||
40
scripts.js
40
scripts.js
|
|
@ -26,18 +26,6 @@ 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
|
* renvoyer la valeur en secondes d'une date au format j/m/a
|
||||||
* @param {string} date
|
* @param {string} date
|
||||||
|
|
@ -59,7 +47,29 @@ function getDate(idelem) {
|
||||||
function setReturnDate(id_date, id_return_date, id_loan_duration)
|
function setReturnDate(id_date, id_return_date, id_loan_duration)
|
||||||
{
|
{
|
||||||
const loan_duration = document.getElementById(id_loan_duration).value;
|
const loan_duration = document.getElementById(id_loan_duration).value;
|
||||||
let nbsec = getDate(id_date) + loan_duration*24*60*60;
|
if (loan_duration !== undefined && loan_duration > 0) {
|
||||||
const date_retour = new Date(nbsec * 1000);
|
let nbsec = getDate(id_date) + loan_duration*24*60*60;
|
||||||
document.getElementById(id_return_date).value = date_retour.toLocaleDateString();
|
const date_retour = new Date(nbsec * 1000);
|
||||||
|
document.getElementById(id_return_date).value = date_retour.toLocaleDateString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* changer la visibilité de la date de retour
|
||||||
|
*/
|
||||||
|
function toggleVisibility(id_date, id_type, div, id_return_date)
|
||||||
|
{
|
||||||
|
const key = document.getElementById(id_type).value;
|
||||||
|
let type_sortie;
|
||||||
|
if (key !== undefined && key != '') {
|
||||||
|
type_sortie = output_nature[key].type;
|
||||||
|
}
|
||||||
|
const div_date = document.getElementById(div);
|
||||||
|
if (type_sortie == 'temporaire') {
|
||||||
|
div_date.style.visibility = "visible";
|
||||||
|
document.getElementById(id_date).onchange();
|
||||||
|
} else {
|
||||||
|
div_date.style.visibility = "hidden";
|
||||||
|
document.getElementById(id_return_date).value = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,9 @@
|
||||||
json_extract(mvt.document, '$.amount') AS qte,
|
json_extract(mvt.document, '$.amount') AS qte,
|
||||||
json_extract(mvt.document, '$.return_date') AS return_date,
|
json_extract(mvt.document, '$.return_date') AS return_date,
|
||||||
json_extract(mvt.document, '$.operation') AS operation
|
json_extract(mvt.document, '$.operation') AS operation
|
||||||
FROM {!$module.table} AS mvt
|
FROM !table AS mvt
|
||||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
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
|
INNER JOIN !table AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||||
WHERE
|
WHERE
|
||||||
users.id = :user
|
users.id = :user
|
||||||
AND
|
AND
|
||||||
|
|
@ -57,6 +57,7 @@
|
||||||
json_extract(mvt.document, '$.operation') IN !input_types)
|
json_extract(mvt.document, '$.operation') IN !input_types)
|
||||||
ORDER BY eqpmt_name, date
|
ORDER BY eqpmt_name, date
|
||||||
;
|
;
|
||||||
|
!table=$module.table
|
||||||
:user = $user.id
|
:user = $user.id
|
||||||
!output_types=$output_types.temporaire
|
!output_types=$output_types.temporaire
|
||||||
!input_types=$input_types.retour
|
!input_types=$input_types.retour
|
||||||
|
|
@ -134,9 +135,9 @@
|
||||||
{{if $retard < 0}}
|
{{if $retard < 0}}
|
||||||
{{:assign delai="abs(%d)"|math:$retard}}
|
{{:assign delai="abs(%d)"|math:$retard}}
|
||||||
{{"Reste %s jours"|args:$delai}}
|
{{"Reste %s jours"|args:$delai}}
|
||||||
{{elseif $retard >0 }}
|
{{elseif $retard > 0 }}
|
||||||
{{:tag color="darkred" label="Retard %s jours"|args:$retard}}
|
{{:tag color="darkred" label="Retard %s jours"|args:$retard}}
|
||||||
{{else}}
|
{{elseif $return_date != null}}
|
||||||
{{:tag color="darkgreen" label="À rendre aujourdh'ui"}}
|
{{:tag color="darkgreen" label="À rendre aujourdh'ui"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -165,15 +166,16 @@
|
||||||
json_extract(mvt.document, '$.operation') as operation,
|
json_extract(mvt.document, '$.operation') as operation,
|
||||||
MIN(json_extract(mvt.document, '$.date')) as date,
|
MIN(json_extract(mvt.document, '$.date')) as date,
|
||||||
SUM(json_extract(mvt.document, '$.amount')) as amount
|
SUM(json_extract(mvt.document, '$.amount')) as amount
|
||||||
FROM {!$module.table} AS mvt
|
FROM !table AS mvt
|
||||||
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||||
INNER JOIN {!$module.table} AS eqpmt
|
INNER JOIN !table AS eqpmt
|
||||||
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
ON json_extract(mvt.document, '$.equipment') = eqpmt.key
|
||||||
WHERE users.id = :user
|
WHERE users.id = :user
|
||||||
AND json_extract(mvt.document, '$.operation') IN !output_types
|
AND json_extract(mvt.document, '$.operation') IN !output_types
|
||||||
GROUP BY eqpmt_key, operation
|
GROUP BY eqpmt_key, operation
|
||||||
ORDER BY eqpmt_name, date
|
ORDER BY eqpmt_name, date
|
||||||
;
|
;
|
||||||
|
!table=$module.table
|
||||||
:user = $user.id
|
:user = $user.id
|
||||||
!output_types=$output_types.définitif
|
!output_types=$output_types.définitif
|
||||||
assign="def_mat."
|
assign="def_mat."
|
||||||
|
|
|
||||||
|
|
@ -24,3 +24,7 @@
|
||||||
table.list > thead th[class~=nosort] a:hover {
|
table.list > thead th[class~=nosort] a:hover {
|
||||||
background-color : rgba(var(--gSecondColor), 0.);
|
background-color : rgba(var(--gSecondColor), 0.);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nombre {
|
||||||
|
text-align: right !important;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue