Compare commits
12 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fc09554f0 | ||
|
|
09fa44e6aa | ||
|
|
6e2a9104ef | ||
|
|
2f8a3a9db8 | ||
|
|
83c4a46342 | ||
|
|
572dfc172a | ||
|
|
65ee10453c | ||
|
|
c9345fd67f | ||
|
|
aee34623f4 | ||
|
|
ada1115192 | ||
|
|
ec29f26176 | ||
|
|
fc526918f9 |
16 changed files with 421 additions and 36 deletions
|
|
@ -28,3 +28,9 @@
|
||||||
{{/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}}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,11 @@
|
||||||
<li class="title"><strong>Historique — {{$eqpmt}} ({{$category}})</strong></li>
|
<li class="title"><strong>Historique — {{$eqpmt}} ({{$category}})</strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{elseif $current == 'historique'}}
|
||||||
|
<ul class="sub">
|
||||||
|
<li {{if $subcurrent == 'tous'}} class="current"{{/if}}><a href="{{$module.url}}global_history.html">Tous</a></li>
|
||||||
|
<li {{if $subcurrent == 'prêts'}} class="current"{{/if}}><a href="{{$module.url}}loan_history.html">Prêts</a></li>
|
||||||
|
</ul>
|
||||||
{{elseif $current == 'archives'}}
|
{{elseif $current == 'archives'}}
|
||||||
{{if $subsubcurrent == 'historique'}}
|
{{if $subsubcurrent == 'historique'}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
|
|
@ -54,6 +59,7 @@
|
||||||
<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>
|
||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
||||||
34
config/misc.html
Normal file
34
config/misc.html
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{:admin_header title="Configuration" current="module_equipment"}}
|
||||||
|
|
||||||
|
{{#form on="save"}}
|
||||||
|
{{:save
|
||||||
|
key="config"
|
||||||
|
loan_duration=$_POST.loan_duration
|
||||||
|
}}
|
||||||
|
{{/form}}
|
||||||
|
|
||||||
|
{{* barre de navigation *}}
|
||||||
|
{{:include file="../_nav.html" current="config" subcurrent="divers"}}
|
||||||
|
|
||||||
|
{{if $_GET.ok}}
|
||||||
|
<p class="block confirm">Configuration enregistrée.</p>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* lecture config (défaut ou enregistrée) *}}
|
||||||
|
{{:include file="../_get_config.html" keep="loan_duration"}}
|
||||||
|
|
||||||
|
<form method="post" action="" data-focus="1">
|
||||||
|
<fieldset class="storage">
|
||||||
|
<legend>Autres paramètres</legend>
|
||||||
|
<dl>
|
||||||
|
{{:input type="number" name="loan_duration" label="Durée de prêt par défaut" min=1 required=true default=$loan_duration help="Durée en nombre de jours"}}
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
<p class="submit">
|
||||||
|
{{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}}
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
{{:admin_footer}}
|
||||||
|
|
@ -33,5 +33,6 @@
|
||||||
"label" : "Retour de Location/Emprunt",
|
"label" : "Retour de Location/Emprunt",
|
||||||
"type" : "retour"
|
"type" : "retour"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"loan_duration" : "30"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Détails"
|
label="Détails"
|
||||||
href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop
|
||||||
shape="eye"
|
shape="eye"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -314,7 +314,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Détails"
|
label="Détails"
|
||||||
href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop
|
href="movements/movement_details.html?key=%s&prop=%s&from=eh"|args:$key:$_GET.prop
|
||||||
shape="eye"
|
shape="eye"
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
{{: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"}}
|
{{:include file="./_nav.html" current="historique" subcurrent="tous"}}
|
||||||
|
|
||||||
{{* 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"}}
|
||||||
|
|
|
||||||
135
loan_history.html
Normal file
135
loan_history.html
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{:admin_header title="Matériels hors de l'asso" custom_css="../style.css" current="module_equipment"}}
|
||||||
|
{{:include file="./_nav.html" current="historique" subcurrent="prêts"}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
vérifier l'existence de la table du module
|
||||||
|
eh oui, il se peut qu'elle ne soit pas encore créée si aucune donnée n'a été ajoutée dedans
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{#load limit="1"}}
|
||||||
|
{{:assign table_presente=true}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign table_presente=false}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{if $table_presente}}
|
||||||
|
{{if $_GET.ok}}
|
||||||
|
{{if $_GET.msg == "modification"}}
|
||||||
|
<p class="block confirm">Modification enregistrée</p>
|
||||||
|
{{elseif $_GET.msg == "copie"}}
|
||||||
|
<p class="block confirm">Mouvement copié</p>
|
||||||
|
{{elseif $_GET.msg == "suppression"}}
|
||||||
|
<p class="block confirm">Mouvement supprimé</p>
|
||||||
|
{{/if}}
|
||||||
|
{{elseif $_GET.err}}
|
||||||
|
{{if $_GET.msg == "suppression"}}
|
||||||
|
<p class="block error">Ce mouvement ne peut être supprimé</p>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
|
{{* lecture config (défaut ou enregistrée) *}}
|
||||||
|
{{:include file="./_get_config.html" keep="config"}}
|
||||||
|
|
||||||
|
{{#foreach from=$config.output_nature key="key"}}
|
||||||
|
{{if $type == 'temporaire'}}
|
||||||
|
{{:assign var="output_types." value=$key|quote_sql}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
{{:assign output_ops=$output_types|implode:","}}
|
||||||
|
{{:assign output_ops="("|cat:$output_ops|cat:")"}}
|
||||||
|
|
||||||
|
{{:assign premier=true}}
|
||||||
|
{{#select
|
||||||
|
users.nom AS nom,
|
||||||
|
users.id AS user,
|
||||||
|
mvt.key AS mvt_key,
|
||||||
|
json_extract(mat.document, '$.name') AS mat_name,
|
||||||
|
json_extract(mvt.document, '$.date') AS out_date,
|
||||||
|
json_extract(mvt.document, '$.amount') AS out_amount,
|
||||||
|
json_extract(mvt.document, '$.return_date') AS return_date,
|
||||||
|
json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(retour.document, '$.amount')), 0) AS remain
|
||||||
|
FROM {!$module.table} AS mvt
|
||||||
|
LEFT JOIN users ON json_extract(mvt.document, '$.user') = users.id
|
||||||
|
LEFT JOIN {!$module.table} AS links ON mvt.key = json_extract(links.document, '$.temp_key')
|
||||||
|
LEFT JOIN {!$module.table} AS retour ON retour.key = json_extract(links.document, '$.return')
|
||||||
|
INNER JOIN {!$module.table} AS mat ON mat.key = json_extract(mvt.document, '$.equipment')
|
||||||
|
WHERE
|
||||||
|
json_extract(mvt.document, '$.type') = 'movement'
|
||||||
|
AND
|
||||||
|
json_extract(mvt.document, '$.operation') IN !op
|
||||||
|
GROUP BY mvt.key
|
||||||
|
HAVING remain != 0
|
||||||
|
ORDER BY out_date, nom
|
||||||
|
;
|
||||||
|
!op = $output_ops
|
||||||
|
}}
|
||||||
|
{{if $premier}}
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Matériel</th>
|
||||||
|
<th>Date sortie</th>
|
||||||
|
<th>Quantité</th>
|
||||||
|
<th>Membre</th>
|
||||||
|
<th>Date retour</th>
|
||||||
|
<th>Reste à rendre</th>
|
||||||
|
<th>Remarque</th>
|
||||||
|
<th class="actions"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{:assign premier=false}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{if $return_date != null}}
|
||||||
|
{{:assign ts_retour=$return_date|strtotime}}
|
||||||
|
{{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}}
|
||||||
|
{{/if}}
|
||||||
|
<tr>
|
||||||
|
<td>{{$mat_name}}</td>
|
||||||
|
<td>{{$out_date|date_short}}</td>
|
||||||
|
<td>{{$out_amount}}</td>
|
||||||
|
<td>{{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$nom}}</td>
|
||||||
|
<td>{{$return_date|date_short}}</td>
|
||||||
|
<td>{{$remain}}</td>
|
||||||
|
<td>
|
||||||
|
{{if $return_date != null}}
|
||||||
|
{{:assign jour="jour}}
|
||||||
|
{{if $nb_jours > 0}}
|
||||||
|
{{if $nb_jours > 1}}{{:assign jour="jours"}}{{/if}}
|
||||||
|
{{:tag color="darkred" label="Retard %s %s"|args:$nb_jours:$jour}}
|
||||||
|
{{elseif $nb_jours < 0}}
|
||||||
|
{{:assign delai="abs(%d)"|math:$nb_jours}}
|
||||||
|
{{if $nb_jours < -1}}{{:assign jour="jours"}}{{/if}}
|
||||||
|
{{"Reste %s %s"|args:$delai:$jour}}
|
||||||
|
{{else}}
|
||||||
|
{{:tag color="darkgreen" label="À rendre aujourdh'ui"}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{:linkbutton
|
||||||
|
label="Retour"
|
||||||
|
href="movements/output_return.html?key=%s&prop=1"|args:$mvt_key
|
||||||
|
shape="reset"
|
||||||
|
target="_dialog"}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Détails"
|
||||||
|
href="movements/movement_details.html?key=%s&prop=1&from=lh"|args:$mvt_key
|
||||||
|
shape="eye"
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{else}}
|
||||||
|
<p class="block alert">Aucun mouvement.</p>
|
||||||
|
{{/select}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{else}}
|
||||||
|
<p class="block alert">Aucun mouvement.</p>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:admin_footer}}
|
||||||
|
|
@ -14,7 +14,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"}}
|
{{:include file="../_get_config.html" keep="config, directions, loan_duration"}}
|
||||||
{{: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 » *}}
|
||||||
|
|
@ -93,6 +93,11 @@
|
||||||
{{: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}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign return_date=null}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
lister les mouvements
|
lister les mouvements
|
||||||
|
|
@ -198,8 +203,14 @@
|
||||||
user=$user.id
|
user=$user.id
|
||||||
storage=$_POST.storage
|
storage=$_POST.storage
|
||||||
transactions=$transactions
|
transactions=$transactions
|
||||||
|
return_date=$return_date|parse_date
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}}
|
{{if $_GET.from == "lh"}}
|
||||||
|
{{:assign from="../loan_history.html"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign from="../equipment_history.html"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=copie"|args:$from:$eqpmt_key:$prop}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
|
|
@ -267,11 +278,28 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
{{:input type="select" name="storage" default=$mvt_new.storage label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
{{:input type="select" name="storage" default=$mvt_new.storage label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}}
|
||||||
|
{{/if}}
|
||||||
{{if $type_mvt != "retour"}}
|
{{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}}
|
||||||
{{/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.return_date != null}}
|
||||||
|
{{:assign checked="checked"}}
|
||||||
|
{{:assign visibility="visible"}}
|
||||||
|
{{:assign return_date=$mvt_new.return_date}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign visibility="hidden"}}
|
||||||
|
{{:assign ts_sortie=$mvt_new.date|strtotime}}
|
||||||
|
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$loan_duration}}
|
||||||
|
{{:assign return_date=$ts_retour|date_short}}
|
||||||
|
{{/if}}
|
||||||
|
{{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour" checked="%s"|args:$checked}}
|
||||||
|
<div id="div_return_date" style="visibility:{{$visibility}}">
|
||||||
|
{{:input type="date" name="return_date" label="Date de retour" default=$return_date}}
|
||||||
|
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$loan_duration}}">
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
@ -282,3 +310,20 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../scripts.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_return_date']) {
|
||||||
|
toggleVisibility(idcheck, fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
||||||
|
{
|
||||||
|
setReturnDate(id_date, id_return_date, id_loan_duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
|
||||||
|
document.getElementById('f_date').onchange = changeReturnDate;
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,11 @@
|
||||||
{{:include file="../_get_config.html" keep="config"}}
|
{{:include file="../_get_config.html" keep="config"}}
|
||||||
|
|
||||||
{{#form on="delete"}}
|
{{#form on="delete"}}
|
||||||
|
{{if $_GET.from == "lh"}}
|
||||||
|
{{:assign from="../loan_history.html"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign from="../equipment_history.html"}}
|
||||||
|
{{/if}}
|
||||||
{{* vérifier s'il est possible de supprimer le mouvement *}}
|
{{* 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}}
|
||||||
|
|
@ -29,7 +34,7 @@
|
||||||
{{:assign link_key=$key}}
|
{{:assign link_key=$key}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{if $link_key != null}}
|
{{if $link_key != null}}
|
||||||
{{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign dispo=0}}
|
{{:assign dispo=0}}
|
||||||
|
|
@ -62,7 +67,7 @@
|
||||||
|
|
||||||
{{* problème ? *}}
|
{{* problème ? *}}
|
||||||
{{if $dispo < 0 || $nonprop < 0}}
|
{{if $dispo < 0 || $nonprop < 0}}
|
||||||
{{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
@ -83,7 +88,7 @@
|
||||||
{{:assign link_key=$key}}
|
{{:assign link_key=$key}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
{{if $link_key != null}}
|
{{if $link_key != null}}
|
||||||
{{:redirect force="../equipment_history.html?key=%s&prop=%s&err=1&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
{{:redirect force="%s?key=%s&prop=%s&err=1&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
||||||
{{/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}}
|
||||||
|
|
@ -148,7 +153,7 @@
|
||||||
out=$curr_eqpmt.out
|
out=$curr_eqpmt.out
|
||||||
notowned=$curr_eqpmt.notowned
|
notowned=$curr_eqpmt.notowned
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=suppression"|args:$mvt_suppr.equipment:$_GET.prop}}
|
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=suppression"|args:$from:$mvt_suppr.equipment:$_GET.prop}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* supprimer le matériel *}}
|
{{* supprimer le matériel *}}
|
||||||
{{:delete key=$curr_eqpmt.key}}
|
{{:delete key=$curr_eqpmt.key}}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
{{:assign var="equipment.notowned" value="%d+%d"|math:$equipment.notowned:$_POST.amount|intval}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* documents liés *}}
|
{{* écritures liées *}}
|
||||||
{{#foreach from=$_POST.transactions item="value"}}
|
{{#foreach from=$_POST.transactions item="value"}}
|
||||||
{{:assign var="transactions." value=$value|intval}}
|
{{:assign var="transactions." value=$value|intval}}
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,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"}}
|
{{:include file="../_get_config.html" keep="config, directions, loan_duration"}}
|
||||||
{{: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}}
|
||||||
|
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
|
|
@ -84,6 +84,11 @@
|
||||||
{{: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}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign return_date=null}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{*
|
{{*
|
||||||
lister les mouvements
|
lister les mouvements
|
||||||
|
|
@ -197,7 +202,7 @@
|
||||||
|
|
||||||
{{* enregistrer le mouvement modifié *}}
|
{{* enregistrer le mouvement modifié *}}
|
||||||
{{if $user == null}}
|
{{if $user == null}}
|
||||||
{{:assign user_id=$mvt_new.user}}
|
{{:assign user_id=null}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign user_id=$user.id}}
|
{{:assign user_id=$user.id}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -215,8 +220,14 @@
|
||||||
user=$user_id
|
user=$user_id
|
||||||
storage=$_POST.storage
|
storage=$_POST.storage
|
||||||
transactions=$transactions
|
transactions=$transactions
|
||||||
|
return_date=$return_date|parse_date
|
||||||
}}
|
}}
|
||||||
{{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}}
|
{{if $_GET.from == "lh"}}
|
||||||
|
{{:assign from="../loan_history.html"}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign from="../equipment_history.html"}}
|
||||||
|
{{/if}}
|
||||||
|
{{:redirect force="%s?ok=1&key=%s&prop=%s&msg=modification"|args:$from:$eqpmt_key:$prop}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
||||||
{{if $mvt_new.direction == "input"}}
|
{{if $mvt_new.direction == "input"}}
|
||||||
|
|
@ -225,8 +236,8 @@
|
||||||
{{: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 --------------------
|
||||||
*}}
|
*}}
|
||||||
|
|
@ -293,11 +304,28 @@
|
||||||
{{if $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" default=$mvt_new.transactions label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}}
|
||||||
{{/if}}
|
{{/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.return_date != null}}
|
||||||
|
{{:assign checked="checked"}}
|
||||||
|
{{:assign visibility="visible"}}
|
||||||
|
{{:assign return_date=$mvt_new.return_date}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign visibility="hidden"}}
|
||||||
|
{{:assign ts_sortie=$mvt_new.date|strtotime}}
|
||||||
|
{{:assign ts_retour="%d+%d*(60*60*24)"|math:$ts_sortie:$loan_duration}}
|
||||||
|
{{:assign return_date=$ts_retour|date_short}}
|
||||||
|
{{/if}}
|
||||||
|
{{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour" checked="%s"|args:$checked}}
|
||||||
|
<div id="div_return_date" style="visibility:{{$visibility}}">
|
||||||
|
{{:input type="date" name="return_date" label="Date de retour" default=$return_date}}
|
||||||
|
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$loan_duration}}">
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
@ -308,3 +336,20 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../scripts.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_return_date']) {
|
||||||
|
toggleVisibility(idcheck, fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
||||||
|
{
|
||||||
|
setReturnDate(id_date, id_return_date, id_loan_duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
|
||||||
|
document.getElementById('f_date').onchange = changeReturnDate;
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,11 @@
|
||||||
"items": {
|
"items": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"return_date" : {
|
||||||
|
"description": "Date de retour du matériel",
|
||||||
|
"type" : ["null", "string"],
|
||||||
|
"format" : "date"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["type", "direction", "operation", "amount", "equipment", "date", "comment"]
|
"required": ["type", "direction", "operation", "amount", "equipment", "date", "comment"]
|
||||||
|
|
|
||||||
|
|
@ -42,18 +42,18 @@
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Modifier ce mouvement"
|
label="Modifier ce mouvement"
|
||||||
href="modify_movement.html?key=%s"|args:$_GET.key
|
href="modify_movement.html?key=%s&from=%s"|args:$_GET.key:$_GET.from
|
||||||
shape="edit"
|
shape="edit"
|
||||||
target="_dialog"}}
|
target="_dialog"}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Supprimer ce mouvement"
|
label="Supprimer ce mouvement"
|
||||||
href="delete_movement.html?key=%s&prop=%s"|args:$_GET.key:$_GET.prop
|
href="delete_movement.html?key=%s&prop=%s&from=%s"|args:$_GET.key:$_GET.prop:$_GET.from
|
||||||
shape="delete"
|
shape="delete"
|
||||||
target="_dialog"}}
|
target="_dialog"}}
|
||||||
{{if $type_mvt != "retour"}}
|
{{if $type_mvt != "retour"}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Dupliquer ce mouvement"
|
label="Dupliquer ce mouvement"
|
||||||
href="copy_movement.html?key=%s&prop=%s"|args:$_GET.key:$_GET.prop
|
href="copy_movement.html?key=%s&prop=%s&from=%s"|args:$_GET.key:$_GET.prop:$_GET.from
|
||||||
shape="plus"
|
shape="plus"
|
||||||
target="_dialog"}}
|
target="_dialog"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -101,6 +101,10 @@
|
||||||
{{else}}—
|
{{else}}—
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</dd>
|
</dd>
|
||||||
|
{{if $mvt.return_date != null}}
|
||||||
|
<dt>Date de retour</dt>
|
||||||
|
<dd>{{$mvt.return_date|date_short}}</dd>
|
||||||
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
*}}
|
*}}
|
||||||
|
|
||||||
{{* 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, loan_duration"}}
|
||||||
|
|
||||||
{{* types de sorties *}}
|
{{* types de sorties *}}
|
||||||
{{#foreach from=$config.output_nature key=key}}
|
{{#foreach from=$config.output_nature key=key}}
|
||||||
|
|
@ -31,6 +31,15 @@
|
||||||
{{/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}}
|
||||||
|
{{:error message="On ne peut associer une date de retour qu'à une sortie temporaire"}}
|
||||||
|
{{/if}}
|
||||||
|
{{if $_POST.set_return_date != null}}
|
||||||
|
{{:assign return_date=$_POST.return_date}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign return_date=null}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{if $_POST.user|count > 1}}
|
{{if $_POST.user|count > 1}}
|
||||||
{{:error message="Un membre au plus peut être associé à une sortie"}}
|
{{:error message="Un membre au plus peut être associé à une sortie"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -117,6 +126,11 @@
|
||||||
{{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$_POST.amount|intval}}
|
{{:assign var="equipment.out" value="%d+%d"|math:$equipment.out:$_POST.amount|intval}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{* écritures liées *}}
|
||||||
|
{{#foreach from=$_POST.transactions item="value"}}
|
||||||
|
{{:assign var="transactions." value=$value|intval}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
{{:save
|
{{:save
|
||||||
key=$equipment.key
|
key=$equipment.key
|
||||||
validate_schema="../equipment.schema.json"
|
validate_schema="../equipment.schema.json"
|
||||||
|
|
@ -142,6 +156,8 @@
|
||||||
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
|
||||||
|
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}}
|
||||||
{{/form}}
|
{{/form}}
|
||||||
|
|
@ -156,6 +172,8 @@
|
||||||
{{: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}}
|
||||||
|
{{:assign date_retour=$ts_retour|date_short}}
|
||||||
|
|
||||||
{{* formulaire de sortie de matériel *}}
|
{{* formulaire de sortie de matériel *}}
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
|
|
@ -193,7 +211,13 @@
|
||||||
multiple=true
|
multiple=true
|
||||||
max=1
|
max=1
|
||||||
}}
|
}}
|
||||||
|
{{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}}
|
||||||
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
{{:input type="textarea" name="remarques" label="Remarques" cols="40" rows="3" required=false}}
|
||||||
|
{{:input id="set_return_date" type="checkbox" value=1 name="set_return_date" label="Fixer une date de retour" help="Cocher pour fixer une date de retour"}}
|
||||||
|
<div id="div_return_date" style="visibility:hidden">
|
||||||
|
{{:input type="date" id="return_date" name="return_date" label="Date de retour" default=$date_retour}}
|
||||||
|
<input type="hidden" id="loan_duration" name="loan_duration" value="{{$loan_duration}}">
|
||||||
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
|
|
@ -206,3 +230,21 @@
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../scripts.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function changeVisibility(evt, idcheck = 'f_set_return_date_1', fields = ['div_return_date']) {
|
||||||
|
toggleVisibility(idcheck, fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeReturnDate(evt, id_date = 'f_date', id_return_date = 'f_return_date', id_loan_duration='loan_duration')
|
||||||
|
{
|
||||||
|
setReturnDate(id_date, id_return_date, id_loan_duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
document.getElementById('f_set_return_date_1').checked = false;
|
||||||
|
document.getElementById('f_set_return_date_1').onclick = changeVisibility;
|
||||||
|
document.getElementById('f_date').onchange = changeReturnDate;
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
|
||||||
38
scripts.js
38
scripts.js
|
|
@ -25,3 +25,41 @@ function disableColumSort(liste) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleVisibility(idcheck, fields) {
|
||||||
|
const elem = document.getElementById(idcheck);
|
||||||
|
for (let id of fields) {
|
||||||
|
const field = document.getElementById(id);
|
||||||
|
if (elem.checked) {
|
||||||
|
field.style.visibility = "visible";
|
||||||
|
} else {
|
||||||
|
field.style.visibility = "hidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* renvoyer la valeur en secondes d'une date au format j/m/a
|
||||||
|
* @param {string} date
|
||||||
|
*/
|
||||||
|
function str2sec(date) {
|
||||||
|
const jma = date.split('/');
|
||||||
|
const dd = new Date(jma[2], jma[1]-1, jma[0]);
|
||||||
|
return dd.getTime()/1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// renvoyer la valeur en secondes d'un champ date
|
||||||
|
function getDate(idelem) {
|
||||||
|
return str2sec(document.getElementById(idelem).value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* modifier la date de retour en fonction de la date de sortie et de la durée du prêt
|
||||||
|
*/
|
||||||
|
function setReturnDate(id_date, id_return_date, id_loan_duration)
|
||||||
|
{
|
||||||
|
const loan_duration = document.getElementById(id_loan_duration).value;
|
||||||
|
let nbsec = getDate(id_date) + loan_duration*24*60*60;
|
||||||
|
const date_retour = new Date(nbsec * 1000);
|
||||||
|
document.getElementById(id_return_date).value = date_retour.toLocaleDateString();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@
|
||||||
eqpmt.key as eqpmt_key,
|
eqpmt.key as eqpmt_key,
|
||||||
json_extract(eqpmt.document, '$.name') AS eqpmt_name,
|
json_extract(eqpmt.document, '$.name') AS eqpmt_name,
|
||||||
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, '$.operation') AS operation
|
json_extract(mvt.document, '$.operation') AS operation
|
||||||
FROM {!$module.table} AS mvt
|
FROM {!$module.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
|
||||||
|
|
@ -65,9 +66,17 @@
|
||||||
{{if $premier}}
|
{{if $premier}}
|
||||||
{{:assign premier=false}}
|
{{:assign premier=false}}
|
||||||
{{:assign total=0}}
|
{{:assign total=0}}
|
||||||
|
{{:assign nb_jours=0}}
|
||||||
{{:assign old_eqpmt_key=$eqpmt_key}}
|
{{:assign old_eqpmt_key=$eqpmt_key}}
|
||||||
{{:assign var="ligne.date" value=$date}}
|
{{:assign var="ligne.date" value=$date}}
|
||||||
{{:assign var="ligne.materiel" value=$eqpmt_name}}
|
{{:assign var="ligne.materiel" value=$eqpmt_name}}
|
||||||
|
{{:assign var="ligne.return_date" value=$return_date}}
|
||||||
|
{{:assign var="ligne.retard" value="0"}}
|
||||||
|
{{if $return_date != null}}
|
||||||
|
{{:assign ts_retour=$return_date|strtotime}}
|
||||||
|
{{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}}
|
||||||
|
{{:assign var="ligne.retard" value=$nb_jours}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $eqpmt_key != $old_eqpmt_key}}
|
{{if $eqpmt_key != $old_eqpmt_key}}
|
||||||
|
|
@ -76,9 +85,17 @@
|
||||||
{{:assign var="lignes." value=$ligne}}
|
{{:assign var="lignes." value=$ligne}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:assign total=0}}
|
{{:assign total=0}}
|
||||||
|
{{:assign nb_jours=0}}
|
||||||
{{:assign old_eqpmt_key=$eqpmt_key}}
|
{{:assign old_eqpmt_key=$eqpmt_key}}
|
||||||
{{:assign var="ligne.date" value=$date}}
|
{{:assign var="ligne.date" value=$date}}
|
||||||
{{:assign var="ligne.materiel" value=$eqpmt_name}}
|
{{:assign var="ligne.materiel" value=$eqpmt_name}}
|
||||||
|
{{:assign var="ligne.return_date" value=$return_date}}
|
||||||
|
{{:assign var="ligne.retard" value="0"}}
|
||||||
|
{{if $return_date != null}}
|
||||||
|
{{:assign ts_retour=$return_date|strtotime}}
|
||||||
|
{{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}}
|
||||||
|
{{:assign var="ligne.retard" value=$nb_jours}}
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $direction == "output"}}
|
{{if $direction == "output"}}
|
||||||
|
|
@ -101,6 +118,8 @@
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Matériel</th>
|
<th>Matériel</th>
|
||||||
<th>Quantité</th>
|
<th>Quantité</th>
|
||||||
|
<th>Date de retour</th>
|
||||||
|
<th>Remarque</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
@ -109,6 +128,17 @@
|
||||||
<td>{{$date|date_short}}</td>
|
<td>{{$date|date_short}}</td>
|
||||||
<td>{{$materiel}}</td>
|
<td>{{$materiel}}</td>
|
||||||
<td>{{$qte}}</td>
|
<td>{{$qte}}</td>
|
||||||
|
<td>{{$return_date|date_short}}</td>
|
||||||
|
<td>
|
||||||
|
{{if $retard < 0}}
|
||||||
|
{{:assign delai="abs(%d)"|math:$retard}}
|
||||||
|
{{"Reste %s jours"|args:$delai}}
|
||||||
|
{{elseif $retard >0 }}
|
||||||
|
{{:tag color="darkred" label="Retard %s jours"|args:$retard}}
|
||||||
|
{{else}}
|
||||||
|
{{:tag color="darkgreen" label="À rendre aujourdh'ui"}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
@ -151,27 +181,16 @@
|
||||||
<th>Matériel</th>
|
<th>Matériel</th>
|
||||||
<th>Opération</th>
|
<th>Opération</th>
|
||||||
<th>Quantité</th>
|
<th>Quantité</th>
|
||||||
<th>Total</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#foreach from=$def_mat}}
|
{{#foreach from=$def_mat}}
|
||||||
{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}}
|
|
||||||
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}}
|
||||||
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
|
||||||
{{if $total == null}}
|
|
||||||
{{:assign total=0}}
|
|
||||||
{{/if}}
|
|
||||||
{{if $direction == 'output' && $type_mvt == 'définitif'}}
|
|
||||||
{{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}}
|
|
||||||
{{/if}}
|
|
||||||
{{:assign var="total" from="reste.%s"|args:$eqpmt_key}}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$date|date_short}}</td>
|
<td>{{$date|date_short}}</td>
|
||||||
<td>{{$eqpmt_name}}</td>
|
<td>{{$eqpmt_name}}</td>
|
||||||
<td>{{$op_label}}</td>
|
<td>{{$op_label}}</td>
|
||||||
<td>{{$amount}}</td>
|
<td>{{$amount}}</td>
|
||||||
<td>{{$total}}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue