diff --git a/README.md b/README.md index 16a0479..d6e356b 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,8 @@ Ce module permet de gérer les matériels de l'association: stock, entrées, sorties, classés par catégorie. -Un matériel peut entrer dans l'association : -- temporairement (location, emprunt, ...) -- définitivement (achat, ...) - -Dans les deux cas, il est possible de lui associer une écriture de la -compta ou un fichier. +Un matériel peut entrer temporairement (location, emprunt, ...) ou +définitivement dans l'association (achat, ...). Un matériel appartenant à l'association peut sortir : - temporairement (prêt, ...) : il est possible de lui associer un lieu diff --git a/_get_config.html b/_get_config.html index 095dff9..8f36df8 100644 --- a/_get_config.html +++ b/_get_config.html @@ -1,8 +1,9 @@ {{* -*- brindille -*- *}} {{* - Récupérer la config - résultat : config_defaut, directions, config.input_nature et config.output_nature + Récupérer soit la config enregistrée, soit la config par défaut + @param : default = true si config par défaut + résultat : config.input_nature et config.output_nature *}} {{* config par défaut *}} @@ -14,7 +15,7 @@ {{#foreach from=$directions key="direction"}} {{:assign var="nature" from="module.config.%s_nature"|args:$direction}} - {{if $nature != null}} + {{if $nature != null && ! $default}} {{#foreach from=$nature item="elem"}} {{:assign var="item" label=$label type=$type}} {{:assign var="config.%s_nature.%s"|args:$direction:$key value=$item}} diff --git a/_inventory.html b/_inventory.html index b74bdbb..326070c 100644 --- a/_inventory.html +++ b/_inventory.html @@ -71,10 +71,6 @@ shape="plus" href="movements/input_equipment.html?key=%s"|args:$key target="_dialog"}} - {{:linkbutton - label="Historique" - href="equipment_history.html?key=%s&prop=1"|args:$key - shape="table"}} {{:linkbutton label="Modifier" href="modify_equipment.html?key=%s&prop=1"|args:$key @@ -88,10 +84,7 @@ diff --git a/_temp_inventory.html b/_temp_inventory.html index df4f8aa..f1fd997 100644 --- a/_temp_inventory.html +++ b/_temp_inventory.html @@ -60,10 +60,6 @@ shape="plus" href="movements/input_equipment.html?key=%s"|args:$key target="_dialog"}} - {{:linkbutton - label="Historique" - href="equipment_history.html?key=%s&prop=0"|args:$key - shape="table"}} {{:linkbutton label="Modifier" href="modify_equipment.html?key=%s&prop=0"|args:$key diff --git a/config/add_movement_type.html b/config/add_movement_type.html index 226311f..bb7d64b 100644 --- a/config/add_movement_type.html +++ b/config/add_movement_type.html @@ -12,16 +12,16 @@ {{* Traiter l'envoi du formulaire *}} -{{* lecture config *}} -{{:include file="../_get_config.html" keep="config, directions, config_defaut"}} +{{* lecture config par défaut *}} +{{:include file="../_get_config.html" keep="config, directions" default=true}} {{#form on="save"}} - {{* vérifier s'il existe un libellé de même nom dans la même direction *}} + {{* vérifier s'il existe un type de mouvement de même nom *}} {{#foreach from=$directions key="direction"}} {{:assign var="nature" from="config.%s_nature"|args:$direction}} {{#foreach from=$nature key="key"}} {{:assign var="fields" from="_POST.%s_fields"|args:$_GET.dir}} - {{if $_GET.dir == $direction && $label|trim|tolower == $fields.label|trim|tolower}} + {{if $label|trim|tolower == $fields.label|trim|tolower}} {{:error message="Ce libellé est déjà présent"}} {{/if}} {{:assign var="%s_nature.key"|args:$direction value=$key}} @@ -39,6 +39,7 @@ {{:assign var="%s_nature.type"|args:$direction from="_POST.%s_fields.type"|args:$direction}} {{:assign var="%s_natures."|args:$direction from="%s_nature"|args:$direction}} {{/if}} + {{/foreach}} {{:save @@ -55,7 +56,7 @@ {{if $_GET.dir == 'input'}} {{* types d'entrées *}} - {{#foreach from=$config_defaut.inputs}} + {{#foreach from=$config.input_nature}} {{:assign var='input_types.%s'|args:$type value=$type}} {{/foreach}}
@@ -94,7 +95,7 @@
{{else}} {{* types de sorties *}} - {{#foreach from=$config_defaut.outputs}} + {{#foreach from=$config.output_nature}} {{:assign var='output_types.%s'|args:$type value=$type}} {{/foreach}} diff --git a/equipment_history.html b/equipment_history.html index 9bb584d..3ce6424 100644 --- a/equipment_history.html +++ b/equipment_history.html @@ -28,7 +28,6 @@ {{else}} {{:error message="Le matériel %s n'appartient à aucune catégorie"|args:$equipment.name}} {{/load}} - {{:admin_header title="Gestion des matériels" custom_css="./style.css" current="module_equipment"}} {{if $_GET.current != null}} @@ -113,20 +112,20 @@ {{:assign nonproprio="%d-%d"|math:$nonproprio:$amount}} {{/if}} {{/if}} - {{:assign dispo_final="%d-%d"|math:$stock:$exterieur}} + {{:assign dispo="%d-%d"|math:$stock:$exterieur}} {{:assign var="quantites.%s.stock"|args:$id value=$stock}} {{:assign var="quantites.%s.exterieur"|args:$id value=$exterieur}} - {{:assign var="quantites.%s.dispo"|args:$id value=$dispo_final}} + {{:assign var="quantites.%s.dispo"|args:$id value=$dispo}} {{:assign var="quantites.%s.nonproprio"|args:$id value=$nonproprio}} {{/load}} {{if $current != "archives"}} {{/if}} @@ -145,9 +144,9 @@ {{#select mvt.key AS mvt_key, json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS reste - FROM {!$module.table} AS mvt - LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key') - LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') + FROM module_data_equipment AS mvt + LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key') + LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') WHERE json_extract(mvt.document, '$.operation') IN !op AND json_extract(mvt.document, '$.equipment') = :eqpmt_key @@ -177,12 +176,11 @@ THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage) ELSE '' END AS 'Stockage'; - '' AS 'Documents'; - $$.transactions AS 'Écritures' + $$.comment AS 'Commentaire' "|args:$config.user_fields.name_sql equipment=$equipment_key order=1 - }} + }} {{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}} {{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}} @@ -192,12 +190,6 @@ {{: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}} {{$date|date_short}} {{$col2}} @@ -208,8 +200,7 @@ {{$dispo}} {{:link href="/admin/users/details.php?id=%s"|args:$user label="%s"|args:$col8}} {{$col9}} - {{if $nb_files > 0}}{{:icon shape="attach"}}{{/if}} - {{if $transactions|count > 0}}{{:icon shape="money"}}{{/if}} + {{$comment}} {{if $current != "archives"}} {{if $direction == "output" && $type_mvt == "temporaire"}} @@ -217,24 +208,37 @@ {{if $temp_ext != null && $temp_ext > 0}} {{:linkbutton label="Retour" + title="Enregistrer un retour de sortie temporaire" href="movements/output_return.html?key=%s&prop=%s"|args:$key:$_GET.prop shape="reset" target="_dialog"}} {{/if}} {{/if}} + {{if $direction == "input" && $type_mvt == "retour"}} + {{* interdire dupliquer *}} + {{else}} + {{:linkbutton + label="Dupliquer" + href="movements/copy_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop + shape="plus" + target="_dialog"}} + {{/if}} {{:linkbutton - label="Détails" - href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop - shape="eye" - }} + label="Modifier" + href="movements/modify_movement.html?key=%s"|args:$key + shape="edit" + target="_dialog"}} + {{:linkbutton + label="Supprimer" + href="movements/delete_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop + shape="delete" + target="_dialog"}} {{/if}} {{/if}} {{/list}} - {{if $dispo_final === 0}} - Il n'y a aucun matériel disponible, il n'est donc pas possible d'effectuer une sortie - {{/if}} + {{else}} {{* calculer la quantité présente temporairement de chaque matériel *}} {{#foreach from=$config.input_nature key=key}} @@ -248,9 +252,9 @@ {{#select mvt.key AS mvt_key, json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present - FROM {!$module.table} AS mvt - LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key') - LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') + FROM module_data_equipment AS mvt + LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key') + LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') WHERE json_extract(mvt.document, '$.operation') IN !op AND json_extract(mvt.document, '$.equipment') = :eqpmt_key @@ -273,9 +277,7 @@ THEN (SELECT $$.name FROM @TABLE as storage WHERE storage.key = @TABLE.$$.storage) ELSE '' END as 'Stockage'; - '' AS 'Documents'; - $$.transactions AS 'Écritures' - " + $$.comment AS 'Commentaire'" equipment=$equipment_key order=1 }} @@ -286,12 +288,6 @@ $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}} {{$date|date_short}} {{$col2}} @@ -299,24 +295,38 @@ {{$amount}} {{$stock}} {{$col6}} - {{if $nb_files > 0}}{{:icon shape="attach"}}{{/if}} - {{if $transactions|count > 0}}{{:icon shape="money"}}{{/if}} + {{$comment}} {{if $direction == "input" && $type_mvt == "temporaire"}} {{:assign var="temp_in" from="present.%s"|args:$key}} {{if $temp_in != null && $temp_in > 0}} {{:linkbutton label="Retour" + title="Enregistrer un retour d'entrée temporaire" href="movements/input_return.html?key=%s&prop=%s"|args:$key:$_GET.prop shape="reset" target="_dialog"}} {{/if}} {{/if}} + {{if $direction == "output" && $type_mvt == "retour"}} + {{* interdire dupliquer *}} + {{else}} + {{:linkbutton + label="Dupliquer" + href="movements/copy_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop + shape="plus" + target="_dialog"}} + {{/if}} {{:linkbutton - label="Détails" - href="movements/movement_details.html?key=%s&prop=%s"|args:$key:$_GET.prop - shape="eye" - }} + label="Modifier" + href="movements/modify_movement.html?key=%s"|args:$key + shape="edit" + target="_dialog"}} + {{:linkbutton + label="Supprimer" + href="movements/delete_movement.html?key=%s&prop=%s"|args:$key:$_GET.prop + shape="delete" + target="_dialog"}} {{/if}} @@ -327,10 +337,7 @@ diff --git a/global_history.html b/global_history.html index 8f98f16..726075e 100644 --- a/global_history.html +++ b/global_history.html @@ -88,10 +88,7 @@ diff --git a/movements/copy_movement.html b/movements/copy_movement.html index 459cde5..17f2fa1 100644 --- a/movements/copy_movement.html +++ b/movements/copy_movement.html @@ -202,12 +202,7 @@ {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=copie"|args:$eqpmt_key:$prop}} {{/form}} -{{if $mvt_new.direction == "input"}} - {{:assign mvt_label="entrée"}} -{{else}} - {{:assign mvt_label="sortie"}} -{{/if}} -{{:admin_header title="Dupliquer une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}} +{{:admin_header title="Dupliquer un mouvement" custom_css="./../style.css" current="module_equipment"}} {{:form_errors}} {{* @@ -266,7 +261,9 @@ }} {{/if}} {{if $mvt_new.direction == "input"}} - {{:input type="select" name="storage" default=$mvt_new.storage label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}} + {{if $storage != null}} + {{:input type="select" name="storage" label="Lieu de stockage" default_empty="— Aucun —" options=$storage required=false}} + {{/if}} {{if $type_mvt != "retour"}} {{:input type="list" name="transactions" label="Écritures liées" target="!acc/transactions/selector.php" multiple=true help="par exemple écriture avec facture"}} {{/if}} diff --git a/movements/input_return.html b/movements/input_return.html index 4683205..03e567b 100644 --- a/movements/input_return.html +++ b/movements/input_return.html @@ -32,9 +32,9 @@ {{#select json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS present - FROM {!$module.table} AS mvt - LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key') - LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') + FROM module_data_equipment AS mvt + LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key') + LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') WHERE json_extract(mvt.document, '$.operation') IN !op AND mvt.key = :mvt_key diff --git a/movements/modify_movement.html b/movements/modify_movement.html index e737d9d..bc50aa8 100644 --- a/movements/modify_movement.html +++ b/movements/modify_movement.html @@ -219,12 +219,7 @@ {{:redirect force="../equipment_history.html?ok=1&key=%s&prop=%s&msg=modification"|args:$eqpmt_key:$prop}} {{/form}} -{{if $mvt_new.direction == "input"}} - {{:assign mvt_label="entrée"}} -{{else}} - {{:assign mvt_label="sortie"}} -{{/if}} -{{:admin_header title="Modifier une %s"|args:$mvt_label custom_css="./../style.css" current="module_equipment"}} +{{:admin_header title="Modifier un mouvement" custom_css="./../style.css" current="module_equipment"}} {{:form_errors}} {{* @@ -237,6 +232,11 @@ {{#select id, !name as nom FROM users WHERE id=:id; !name=$config.user_fields.name_sql :id=$mvt_new.user}} {{:assign var="user.%s"|args:$id value=$nom}} {{/select}} + {{#load type="link" where="$$.direction="output" AND $$.temp_key = :mvt_key" :mvt_key=$mvt_new.key limit=1}} + {{:assign retour=true}} + {{else}} + {{:assign retour=false}} + {{/load}} {{/if}} {{#load type="storage" order="$$.name"}} @@ -274,11 +274,10 @@ {{:input type="number" name="amount" label="Quantité" min=1 required=true default=$mvt_new.amount}} -
Informations facultatives
- {{if $prop == 1 && $mvt_new.direction == "output"}} + {{if $prop == 1 && $mvt_new.direction == "output" && ! $retour}} {{:input type="list" name="user" diff --git a/movements/movement_details.html b/movements/movement_details.html deleted file mode 100644 index 16a170f..0000000 --- a/movements/movement_details.html +++ /dev/null @@ -1,109 +0,0 @@ -{{* -*- brindille -*- *}} - -{{* - Afficher les détails d'un mouvement et donner la possibilité : - - d'associer des fichiers - - de modifier, supprimer ou dupliquer le mouvement - paramètres : - - key : clé du mouvement - - prop = 1 si matériel appartient à l'asso -*}} - -{{:admin_header title="Détails du mouvement" custom_css="../style.css" current="module_equipment"}} -{{:form_errors}} - -{{* récupérer les infos du mouvement *}} -{{#load key=$_GET.key assign="mvt"}} -{{else}} - {{:error message="Aucun mouvement avec la clé %s"|args:$_GET.key}} -{{/load}} - -{{* récupérer la config des entrées/sorties *}} -{{:include file="../_get_config.html" keep="config, directions"}} -{{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$mvt.direction:$mvt.operation}} - -{{* récupérer les infos du matériel associé *}} -{{#load key=$mvt.equipment assign="equipment"}} -{{else}} - {{:error message="Aucun matériel avec la clé « %s »"|args:$mvt.equipment}} -{{/load}} - -{{* - -------------------- Afficher les informations du mouvement -------------------- -*}} - -{{:assign var="op_label" from="config.%s_nature.%s.label"|args:$mvt.direction:$mvt.operation}} -{{#load key=$equipment.category assign="category"}}{{/load}} -{{#load key=$mvt.storage assign="storage"}}{{/load}} -{{#select !name as nom FROM users WHERE id=:id; !name=$config.user_fields.name_sql :id=$mvt.user}} - {{:assign user_name=$nom}} -{{/select}} - - - -
-
Opération
-
{{$op_label}}
-
Matériel
-
{{$equipment.name}}
-
Catégorie
-
{{$category.name}}
-
Date
-
{{$mvt.date|date_short}}
-
Quantité
-
{{$mvt.amount}}
- {{if $mvt.direction == "output" && $type_mvt != "retour"}} -
Membre destinataire
-
- {{if $mvt.user != null}} - {{$user_name}} - {{else}}— - {{/if}} -
- {{/if}} - {{if $mvt.direction == "input"}} -
Lieu de stockage
-
- {{if $storage != null}} - {{$storage.name}} - {{else}}— - {{/if}} -
- {{/if}} -
Écritures liées
-
- {{#foreach from=$mvt.transactions item="trans"}} - {{:link class="num" href="!acc/transactions/details.php?id=%d"|args:$trans label=$trans}} - {{else}}— - {{/foreach}} -
-
Remarques
-
{{if $mvt.comment != null}} - {{$mvt.comment}} - {{else}}— - {{/if}} -
-
- -
- {{:admin_files path=$_GET.key upload=true edit=true use_trash=false}} -
-{{:admin_footer}} diff --git a/movements/output_return.html b/movements/output_return.html index 7f5b0af..679de12 100644 --- a/movements/output_return.html +++ b/movements/output_return.html @@ -32,9 +32,9 @@ {{#select json_extract(mvt.document, '$.amount') - IFNULL(SUM(json_extract(mvt2.document, '$.amount')), 0) AS exterieur - FROM {!$module.table} AS mvt - LEFT JOIN {!$module.table} AS link ON mvt.key = json_extract(link.document, '$.temp_key') - LEFT JOIN {!$module.table} AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') + FROM module_data_equipment AS mvt + LEFT JOIN module_data_equipment AS link ON mvt.key = json_extract(link.document, '$.temp_key') + LEFT JOIN module_data_equipment AS mvt2 ON mvt2.key = json_extract(link.document, '$.return') WHERE json_extract(mvt.document, '$.operation') IN !op AND mvt.key = :mvt_key diff --git a/snippets/user_details.html b/snippets/user_details.html index 3268dec..b288eb2 100644 --- a/snippets/user_details.html +++ b/snippets/user_details.html @@ -30,110 +30,97 @@ {{/load}} {{if $table_presente}} - {{* Matériels attribués temporairement *}} {{* vérifier la présence des types d'entrées et de sorties requis *}} {{if $output_types|has_key:"temporaire" && $input_types|has_key:"retour"}} - - {{* - Calculer les quantités de matériel en prêt - *}} - {{:assign premier=true}} {{#select - json_extract(mvt.document, '$.direction') AS direction, - json_extract(mvt.document, '$.date') AS date, eqpmt.key as eqpmt_key, - json_extract(eqpmt.document, '$.name') AS eqpmt_name, - json_extract(mvt.document, '$.amount') AS qte, - json_extract(mvt.document, '$.operation') AS operation - FROM {!$module.table} AS mvt + json_extract(eqpmt.document, '$.name') as eqpmt_name, + mvt.key AS mvt_key, + json_extract(mvt.document, '$.direction') as direction, + json_extract(mvt.document, '$.operation') as operation, + json_extract(mvt.document, '$.date') as date, + json_extract(mvt.document, '$.amount') as amount + FROM module_data_equipment AS mvt INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id - INNER JOIN {!$module.table} AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key - WHERE - users.id = :user - AND - json_extract(mvt.document, '$.type') = 'movement' - AND - (json_extract(mvt.document, '$.operation') IN !output_types - OR - json_extract(mvt.document, '$.operation') IN !input_types) - ORDER BY eqpmt_name, date + INNER JOIN module_data_equipment AS eqpmt + ON json_extract(mvt.document, '$.equipment') = eqpmt.key + WHERE users.id = :user + AND (json_extract(mvt.document, '$.operation') IN !output_types + OR json_extract(mvt.document, '$.operation') IN !input_types) + ORDER BY date ; :user = $user.id !output_types=$output_types.temporaire !input_types=$input_types.retour + assign="temp_mat." }} - {{if $premier}} - {{:assign premier=false}} - {{:assign total=0}} - {{:assign old_eqpmt_key=$eqpmt_key}} - {{:assign var="ligne.date" value=$date}} - {{:assign var="ligne.materiel" value=$eqpmt_name}} - {{/if}} - - {{if $eqpmt_key != $old_eqpmt_key}} - {{if $total > 0}} - {{:assign var="ligne.qte" value=$total}} - {{:assign var="lignes." value=$ligne}} - {{/if}} - {{:assign total=0}} - {{:assign old_eqpmt_key=$eqpmt_key}} - {{:assign var="ligne.date" value=$date}} - {{:assign var="ligne.materiel" value=$eqpmt_name}} - {{/if}} - - {{if $direction == "output"}} - {{:assign total="%d+%d"|math:$total:$qte}} - {{else}} - {{:assign total="%d-%d"|math:$total:$qte}} - {{/if}} {{/select}} - - {{if $total > 0}} - {{:assign var="ligne.qte" value=$total}} - {{:assign var="lignes." value=$ligne}} - {{/if}} - - {{if $lignes|count > 0}} -

Matériels attribués temporairement

- - - - - - - - - - {{#foreach from=$lignes}} - - - - - - {{/foreach}} - -
DateMatérielQuantité
{{$date|date_short}}{{$materiel}}{{$qte}}
- {{/if}} {{/if}} - {{* Matériels attribués définitivement *}} - {{* vérifier la présence des types de sorties requis *}} - {{if $output_types|has_key:"définitif"}} + {{if $temp_mat|count != 0}} +

Matériels attribués temporairement

+ + + + + + + + + + + + + {{#foreach from=$temp_mat}} + {{:assign var="type_mvt" from="config.%s_nature.%s.type"|args:$direction:$operation}} + {{:assign var="op_label" from="config.%s_nature.%s.label"|args:$direction:$operation}} + {{:assign var="total" from="reste.%s"|args:$eqpmt_key}} + {{if $total == null}} + {{:assign total=0}} + {{/if}} + {{if $direction == 'input' && $type_mvt == 'retour'}} + {{:assign var="reste.%s"|args:$eqpmt_key value="%d-%d"|math:$total:$amount}} + {{elseif $direction == 'output' && $type_mvt == 'temporaire'}} + {{:assign var="reste.%s"|args:$eqpmt_key value="%d+%d"|math:$total:$amount}} + {{/if}} + {{:assign var="total" from="reste.%s"|args:$eqpmt_key}} + + + + + + + + + {{/foreach}} + +
DateOpérationMatérielQuantitéTotal
{{$date|date_short}}{{$op_label}}{{$eqpmt_name}}{{$amount}}{{$total}} + {{if $direction == "output" && $type_mvt == "temporaire"}} + {{:linkbutton + label="Retour" + href="%smovements/output_return.html?key=%s&prop=0&user=%s"|args:$module.url:$mvt_key:$user.id + shape="history" + target="_dialog"}} + {{/if}} +
+ {{/if}} + + {{* vérifier la présence des types d'entrées et de sorties requis *}} + {{ if $output_types|has_key:"définitif"}} {{#select eqpmt.key as eqpmt_key, json_extract(eqpmt.document, '$.name') as eqpmt_name, json_extract(mvt.document, '$.direction') as direction, json_extract(mvt.document, '$.operation') as operation, - MIN(json_extract(mvt.document, '$.date')) as date, - SUM(json_extract(mvt.document, '$.amount')) as amount - FROM {!$module.table} AS mvt + json_extract(mvt.document, '$.date') as date, + json_extract(mvt.document, '$.amount') as amount + FROM module_data_equipment AS mvt INNER JOIN users ON json_extract(mvt.document, '$.user') = users.id - INNER JOIN {!$module.table} AS eqpmt + INNER JOIN module_data_equipment AS eqpmt ON json_extract(mvt.document, '$.equipment') = eqpmt.key WHERE users.id = :user AND json_extract(mvt.document, '$.operation') IN !output_types - GROUP BY eqpmt_key, operation - ORDER BY eqpmt_name, date + ORDER BY date DESC ; :user = $user.id !output_types=$output_types.définitif @@ -147,11 +134,11 @@ - - - - - + + + + + @@ -168,8 +155,8 @@ {{:assign var="total" from="reste.%s"|args:$eqpmt_key}} - +
DateMatérielOpérationQuantitéTotalDateOpérationMatérielQuantitéTotal
{{$date|date_short}}{{$eqpmt_name}} {{$op_label}}{{$eqpmt_name}} {{$amount}} {{$total}}