diff --git a/snippets/user_details.html b/snippets/user_details.html index 3268dec..0908759 100644 --- a/snippets/user_details.html +++ b/snippets/user_details.html @@ -44,6 +44,7 @@ eqpmt.key as eqpmt_key, json_extract(eqpmt.document, '$.name') AS eqpmt_name, json_extract(mvt.document, '$.amount') AS qte, + json_extract(mvt.document, '$.return_date') AS return_date, json_extract(mvt.document, '$.operation') AS operation FROM {!$module.table} AS mvt INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id @@ -65,9 +66,17 @@ {{if $premier}} {{:assign premier=false}} {{:assign total=0}} + {{:assign nb_jours=0}} {{:assign old_eqpmt_key=$eqpmt_key}} {{:assign var="ligne.date" value=$date}} {{:assign var="ligne.materiel" value=$eqpmt_name}} + {{:assign var="ligne.return_date" value=$return_date}} + {{:assign var="ligne.retard" value="0"}} + {{if $return_date != null}} + {{:assign ts_retour=$return_date|strtotime}} + {{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}} + {{:assign var="ligne.retard" value=$nb_jours}} + {{/if}} {{/if}} {{if $eqpmt_key != $old_eqpmt_key}} @@ -76,9 +85,17 @@ {{:assign var="lignes." value=$ligne}} {{/if}} {{:assign total=0}} + {{:assign nb_jours=0}} {{:assign old_eqpmt_key=$eqpmt_key}} {{:assign var="ligne.date" value=$date}} {{:assign var="ligne.materiel" value=$eqpmt_name}} + {{:assign var="ligne.return_date" value=$return_date}} + {{:assign var="ligne.retard" value="0"}} + {{if $return_date != null}} + {{:assign ts_retour=$return_date|strtotime}} + {{:assign nb_jours="floor((%d-%d)/(60*60*24))"|math:$now:$ts_retour}} + {{:assign var="ligne.retard" value=$nb_jours}} + {{/if}} {{/if}} {{if $direction == "output"}} @@ -101,6 +118,8 @@