From 5c34c127eec55e44bb58413906cf0c770f99a735 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 26 Jun 2025 09:57:48 +0200 Subject: [PATCH 01/48] =?UTF-8?q?Harmonisation=20libell=C3=A9s=20pour=20cl?= =?UTF-8?q?assification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _immobilisations.html | 2 +- _immobilisations_autres.html | 6 +++--- _nav.html | 2 +- add_asset.html | 6 +++--- add_infos.html | 2 +- amortization.html | 2 +- index.html | 2 +- write_exit.html | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/_immobilisations.html b/_immobilisations.html index 2d8281d..f59530c 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -1,6 +1,6 @@ {{* -*- brindille -*- *}} -{{* Liste des immobilisations amortissable ou à définir *}} +{{* Liste des immobilisations en cours ou amorties *}}
{{if $type_immo == "encours"}} diff --git a/_immobilisations_autres.html b/_immobilisations_autres.html index a24f4b7..0b3a22b 100644 --- a/_immobilisations_autres.html +++ b/_immobilisations_autres.html @@ -110,21 +110,21 @@ {{if $status == "nsp"}} {{:linkbutton label="Paramètres" - href="add_infos.html?immo_id=%s&amort=0&op=new&type_immo=autres"|args:$immo_id + href="add_infos.html?immo_id=%s&amort=0&op=new&type_immo=autre"|args:$immo_id shape="settings" target="_dialog" }} {{else}} {{:linkbutton label="Paramètres" - href="add_infos.html?immo_id=%s&amort=0&op=modif&type_immo=autres"|args:$immo_id + href="add_infos.html?immo_id=%s&amort=0&op=modif&type_immo=autre"|args:$immo_id shape="settings" target="_dialog" }} {{/if}} {{:linkbutton label="Amortissements" - href="amortization.html?immo_id=%s&type_immo=autres"|args:$immo_id + href="amortization.html?immo_id=%s&type_immo=autre"|args:$immo_id shape="table" }} diff --git a/_nav.html b/_nav.html index f847605..1ef59e0 100644 --- a/_nav.html +++ b/_nav.html @@ -20,7 +20,7 @@
  • En cours
  • Terminées
  • Archivées
  • -
  • Autres
  • +
  • Autres
  • {{/if}} diff --git a/add_asset.html b/add_asset.html index 06393f6..666df24 100644 --- a/add_asset.html +++ b/add_asset.html @@ -117,11 +117,11 @@ status=$status }} {{if $_POST.amortir}} - {{:assign amort="encours"}} + {{:assign type_immo="encours"}} {{else}} - {{:assign amort="autres"}} + {{:assign type_immo="autre"}} {{/if}} - {{:redirect force="index.html?ok=1&msg=immobilisation&amort=%s"|args:$amort}} + {{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}} {{/form}} {{:admin_header title="Ajout immobilisation" current="module_amortissement"}} diff --git a/add_infos.html b/add_infos.html index a823e2e..455c690 100644 --- a/add_infos.html +++ b/add_infos.html @@ -63,7 +63,7 @@ }} {{if ! $_POST.amortir}} - {{:assign type_immo="autres"}} + {{:assign type_immo="autre"}} {{else}} {{:assign type_immo=$_GET.type_immo}} {{/if}} diff --git a/amortization.html b/amortization.html index 0e97af0..a3bcca2 100644 --- a/amortization.html +++ b/amortization.html @@ -75,7 +75,7 @@ {{elseif $_GET.type_immo == null || $_GET.type_immo == "encours"}} {{:assign subcurrent="encours"}} {{else}} - {{:assign subcurrent="autres"}} + {{:assign subcurrent="autre"}} {{/if}} {{:include file="_nav.html" current="index" subcurrent="%s"|args:$subcurrent subsubcurrent="amortization"}} diff --git a/index.html b/index.html index 9af0454..11373b9 100644 --- a/index.html +++ b/index.html @@ -34,7 +34,7 @@ {{/select}} {{/load}} -{{if $type_immo == "autres"}} +{{if $type_immo == "autre"}} {{:include file="_immobilisations_autres.html"}} {{elseif $type_immo == "archive"}} {{:include file="_archives.html"}} diff --git a/write_exit.html b/write_exit.html index 77acbb8..023fb14 100644 --- a/write_exit.html +++ b/write_exit.html @@ -260,7 +260,7 @@ }} {{/if}} - {{:redirect to="index.html?amort=archive"}} + {{:redirect to="index.html?type_immo=archive"}} {{/form}} {{:admin_header title="Sortie du bilan" custom_css="./style.css" current="module_amortissement"}} From ec94358f471b20949878e16ae61d597c67ad9289 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 1 Jul 2025 13:08:01 +0200 Subject: [PATCH 02/48] Classification manuelle des immobilisations --- _immobilisations.html | 26 ++++++------- _immobilisations_autres.html | 13 ++++--- add_infos.html | 75 +++++++++++++++++++++--------------- amortization.html | 14 +++++-- balance_sheet_exit.html | 9 ++++- compute_exit_data.html | 2 +- schema.json | 2 +- 7 files changed, 81 insertions(+), 60 deletions(-) diff --git a/_immobilisations.html b/_immobilisations.html index 64df5fb..2f28b30 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -58,18 +58,16 @@ {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}} {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}} {{:assign duration=null}} + {{* voir si l'immo est prise en charge *}} {{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}} {{:assign duration=$duration}} - {{if $status == "ignored"}} - {{:assign amortissable="non"}} - {{else}} - {{:assign amortissable="oui"}} - {{/if}} + {{:assign status=$status}} {{else}} {{:assign amortissable="nsp"}} + {{:assign status="unknown"}} {{/load}} - {{if $amortissable == "non"}} + {{if $status == "ignored"}} {{:continue}} {{/if}} @@ -93,8 +91,9 @@ :line_id = $immo_id|intval }} {{:assign ignore=true}} + {{:assign status="archived"}} {{/select}} - {{if $ignore}} + {{if $status == "archived"}} {{:continue}} {{/if}} @@ -132,13 +131,12 @@ {{/if}} {{/select}} + {{* classement par onglet *}} - {{if $type_immo == "encours" && $amort_amount >= $debit || - $type_immo == "amortie" && $amort_amount < $debit || - $amortissable == "nsp" && ! $exist_amort - }} - {{:continue}} - {{/if}} + {{if $type_immo == "encours" && $amort_amount >= $debit}}{{:continue}}{{/if}} + {{if $type_immo == "encours" && $status == "amortized"}}{{:continue}}{{/if}} + {{if $status == "unknown" && ! $exist_amort}}{{:continue}}{{/if}} + {{if $type_immo == "amortie" && $amort_amount < $debit && $status != "amortized"}}{{:continue}}{{/if}} {{:assign nb_immo="%d+1"|math:$nb_immo}} #{{$trans_id}} @@ -156,7 +154,7 @@ shape="settings" target="_dialog" }} - {{elseif $amortissable == "nsp"}} + {{elseif $status == "unknown"}} {{:linkbutton label="Paramètres" href="add_infos.html?immo_id=%s&amort=1&op=new&type_immo=%s"|args:$immo_id:$type_immo diff --git a/_immobilisations_autres.html b/_immobilisations_autres.html index 9924fed..76f9b0d 100644 --- a/_immobilisations_autres.html +++ b/_immobilisations_autres.html @@ -52,13 +52,14 @@ }} {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}} {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}} + {{* voir si l'immo est prise en charge *}} {{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}} {{:assign status=$status}} {{else}} - {{:assign status="nsp"}} + {{:assign status="unknown"}} {{/load}} - {{if $status != "ignored" && $status != "nsp"}} + {{if $status != "unknown"}} {{:continue}} {{/if}} @@ -87,7 +88,7 @@ account.code LIKE '28%'; :line_id = $immo_id|intval }} - {{if $status == "nsp" && $amort_amount != null}} + {{if $status == "unknown" && $amort_amount != null}} {{:assign ignore=true}} {{else}} {{:assign ignore=false}} @@ -107,16 +108,16 @@ {{$account_code}} {{$account_label}} - {{if $status == "nsp"}} + {{if $status == "unknown"}} {{:linkbutton - label="Amortir" + label="Paramètres" href="add_infos.html?immo_id=%s&amort=0&op=new&type_immo=autre"|args:$immo_id shape="settings" target="_dialog" }} {{else}} {{:linkbutton - label="Amortir" + label="Paramètres" href="add_infos.html?immo_id=%s&amort=0&op=modif&type_immo=autre"|args:$immo_id shape="settings" target="_dialog" diff --git a/add_infos.html b/add_infos.html index 706179f..fb5ccb0 100644 --- a/add_infos.html +++ b/add_infos.html @@ -4,7 +4,7 @@ @param immo_id @param amort = 1 si immo amortissable, 0 si non @param op = new ou modif - @param type_immo : encours, sortie, amortie, autre + @param type_immo : encours, amortie, sortie, autre *}} {{if $_GET.op == "modif"}} @@ -14,6 +14,9 @@ {{* Traiter l'envoi du formulaire *}} {{#form on="save"}} + {{if $_POST.classify == null}} + {{:error message="Vous devez choisir une action"}} + {{/if}} {{* chercher la date d'acquisition de l'immobilisation *}} {{#select @@ -26,7 +29,7 @@ }} {{/select}} - {{if ! $_POST.amortir}} + {{if $_POST.classify == "ignored"}} {{* ne pas amortir *}} {{:assign duration=0}} {{:assign date_debut=$ligne_immo.date_achat|parse_date}} @@ -39,11 +42,16 @@ {{:assign da=$ligne_immo.date_achat|date_short}} {{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}} {{/if}} - {{:assign duration=$_POST.duree|intval}} - {{if $duration <= 0}} - {{:error message="Erreur : la durée d'amortissement doit être strictement positive"}} + {{if $_POST.classify == "amortized"}} + {{:assign duration=0}} + {{:assign status="amortized"}} + {{else}} + {{:assign duration=$_POST.duree|intval}} + {{if $duration <= 0}} + {{:error message="Erreur : la durée d'amortissement doit être strictement positive"}} + {{/if}} + {{:assign status="managed"}} {{/if}} - {{:assign status="managed"}} {{/if}} {{* enregistrer les infos de l'immobilisation *}} @@ -62,8 +70,10 @@ status=$status }} - {{if ! $_POST.amortir}} - {{:assign type_immo="autre"}} + {{if $_POST.classify == "managed"}} + {{:assign type_immo="encours"}} + {{elseif $_POST.classify == "amortized"}} + {{:assign type_immo="amortie"}} {{else}} {{:assign type_immo=$_GET.type_immo}} {{/if}} @@ -81,31 +91,32 @@ {{* renseigner ou modifier la date de mise en service et la durée d'amortissement *}} {{if $_GET.amort == 0}} - {{:assign checked=0}} {{:assign disabled=1}} + {{:assign default=""}} {{else}} - {{:assign checked=1}} {{:assign disabled=0}} + {{:assign default="managed"}} {{/if}}
    - {{if $checked}} - {{:assign helptext = "Dé-cocher pour ne pas amortir"}} - {{else}} - {{:assign helptext = "Cocher pour amortir"}} - {{/if}} - {{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir" default=$checked help=$helptext onclick="toggleInputs('infos_immo','f_amortir_1')"}} +
    (obligatoire)
    + {{:input type="radio" name="classify" value="managed" label="Amortir" help="Amortir cette immobilisation" default=$default onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} + {{:input type="radio" name="classify" value="amortized" label="Marquer amortie" help="Cette immobilisation sera classée parmi les immobilisations amorties" onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} + {{:input type="radio" name="classify" value="ignored" label="Ignorer l'écriture" help="Cette écriture n'apparaitra plus dans la liste des immobilisations" onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} + {{if $info_immo != null}} {{:assign date_defaut=$info_immo.date}} {{:assign duree_defaut=$info_immo.duration}} {{else}} - {{:assign duree_defaut=1}} + {{:assign duree_defaut=null}} {{/if}} - {{:input type="number" name="duree" label="Durée d'amortissement" default=$duree_defaut required=true min=1 disabled=$disabled}} - {{:input type="date" name="date_mes" label="Date de mise en service" default=$date_defaut disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}} +
    + {{:input type="number" name="duree" label="Durée d'amortissement" default=$duree_defaut required=true min=1 disabled=$disabled}} + {{:input type="date" name="date_mes" label="Date de mise en service" default=$date_defaut disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}} +
    @@ -117,19 +128,19 @@ {{* activer/désactiver les champs de saisie *}} {{:admin_footer}} diff --git a/amortization.html b/amortization.html index 1e12668..c8280c0 100644 --- a/amortization.html +++ b/amortization.html @@ -29,6 +29,7 @@ {{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}} {{:assign duree=$duration}} {{:assign date_debut=$date}} + {{:assign status=$status}} {{/load}} {{* chercher des écritures d'amortissement liées à l'immobilisation *}} @@ -67,10 +68,15 @@ {{/if}} {{/select}} -{{:assign valeur_residuelle=$ligne_immo.montant}} -{{#foreach from=$linked_lines}} - {{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$amort_amount}} -{{/foreach}} +{{if $status == "amortized"}} + {{:assign amort_amount=$ligne_immo.montant}} + {{:assign valeur_residuelle=0}} +{{else}} + {{:assign valeur_residuelle=$ligne_immo.montant}} + {{#foreach from=$linked_lines}} + {{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$amort_amount}} + {{/foreach}} +{{/if}} {{* Autres amortissements non rattachés *}} {{#select diff --git a/balance_sheet_exit.html b/balance_sheet_exit.html index b557a8e..3a56e4a 100644 --- a/balance_sheet_exit.html +++ b/balance_sheet_exit.html @@ -57,7 +57,11 @@ {{/select}} {{if $amort_line.amort_number == 0}} - {{:assign amort_amount=0}} + {{if $info_immo.status == "amortized"}} + {{:assign amort_amount=$ligne_immo.montant}} + {{else}} + {{:assign amort_amount=0}} + {{/if}} {{else}} {{:assign amort_amount=$amort_line.amort_amount}} {{:assign date_debut=$amort_line.last_amort_date|strtotime}} @@ -153,8 +157,9 @@ lister les exercices ouverts : {{:break}} {{/if}} {{/if}} + {{* voir si des amortissements ont été oubliés *}} - {{if $start_date|strtotime > $amort_line.last_amort_date|strtotime && $end_date|strtotime < $now}} + {{if $info_immo.status != "amortized" && $start_date|strtotime > $amort_line.last_amort_date|strtotime && $end_date|strtotime < $now}} {{:assign debut=$start_date|date_short}} {{:assign fin=$end_date|date_short}} {{:assign msg_amort=$msg_amort|cat:"\n"|cat:" - "|cat:$label|cat:" : du "|cat:$debut|cat:" au "|cat:$fin}} diff --git a/compute_exit_data.html b/compute_exit_data.html index 6672a69..f046e77 100644 --- a/compute_exit_data.html +++ b/compute_exit_data.html @@ -69,7 +69,7 @@
    Date de mise en service
    {{$_GET.date_mes|date:"d/m/Y"}}
    {{/if}} - {{if $_GET.duree_amort != null}} + {{if $_GET.duree_amort != null && $_GET.duree_amort != 0}}
    Durée de l'amortissement
    {{$_GET.duree_amort}} ans
    {{/if}} diff --git a/schema.json b/schema.json index ea8e31c..4279385 100644 --- a/schema.json +++ b/schema.json @@ -21,7 +21,7 @@ }, "status" : { "type" : ["string", "null"], - "enum" : ["managed", "archived", "ignored"] + "enum" : ["managed", "amortized", "archived", "ignored"] } }, "required": ["type", "line", "duration", "date"] From bb7cbc9d3b31a4eed19f4711d875247be94bb8f7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 30 Jun 2025 21:06:47 +0200 Subject: [PATCH 03/48] Classification des immobilisations par lot --- _immobilisations.html | 26 ++++++------ _immobilisations_autres.html | 46 ++++++++++++++++++--- add_infos.html | 78 +++++++++++++++++++++--------------- amortization.html | 14 +++++-- balance_sheet_exit.html | 9 ++++- compute_exit_data.html | 2 +- confirm_action.html | 50 +++++++++++++++++++++++ schema.json | 2 +- 8 files changed, 167 insertions(+), 60 deletions(-) create mode 100644 confirm_action.html diff --git a/_immobilisations.html b/_immobilisations.html index 64df5fb..2f28b30 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -58,18 +58,16 @@ {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}} {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}} {{:assign duration=null}} + {{* voir si l'immo est prise en charge *}} {{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}} {{:assign duration=$duration}} - {{if $status == "ignored"}} - {{:assign amortissable="non"}} - {{else}} - {{:assign amortissable="oui"}} - {{/if}} + {{:assign status=$status}} {{else}} {{:assign amortissable="nsp"}} + {{:assign status="unknown"}} {{/load}} - {{if $amortissable == "non"}} + {{if $status == "ignored"}} {{:continue}} {{/if}} @@ -93,8 +91,9 @@ :line_id = $immo_id|intval }} {{:assign ignore=true}} + {{:assign status="archived"}} {{/select}} - {{if $ignore}} + {{if $status == "archived"}} {{:continue}} {{/if}} @@ -132,13 +131,12 @@ {{/if}} {{/select}} + {{* classement par onglet *}} - {{if $type_immo == "encours" && $amort_amount >= $debit || - $type_immo == "amortie" && $amort_amount < $debit || - $amortissable == "nsp" && ! $exist_amort - }} - {{:continue}} - {{/if}} + {{if $type_immo == "encours" && $amort_amount >= $debit}}{{:continue}}{{/if}} + {{if $type_immo == "encours" && $status == "amortized"}}{{:continue}}{{/if}} + {{if $status == "unknown" && ! $exist_amort}}{{:continue}}{{/if}} + {{if $type_immo == "amortie" && $amort_amount < $debit && $status != "amortized"}}{{:continue}}{{/if}} {{:assign nb_immo="%d+1"|math:$nb_immo}} #{{$trans_id}} @@ -156,7 +154,7 @@ shape="settings" target="_dialog" }} - {{elseif $amortissable == "nsp"}} + {{elseif $status == "unknown"}} {{:linkbutton label="Paramètres" href="add_infos.html?immo_id=%s&amort=1&op=new&type_immo=%s"|args:$immo_id:$type_immo diff --git a/_immobilisations_autres.html b/_immobilisations_autres.html index 9924fed..4444ac8 100644 --- a/_immobilisations_autres.html +++ b/_immobilisations_autres.html @@ -6,9 +6,14 @@

    Autres immobilisations

    {{:assign nb_immo=0}} + + @@ -52,13 +57,14 @@ }} {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}} {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}} + {{* voir si l'immo est prise en charge *}} {{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}} {{:assign status=$status}} {{else}} - {{:assign status="nsp"}} + {{:assign status="unknown"}} {{/load}} - {{if $status != "ignored" && $status != "nsp"}} + {{if $status != "unknown"}} {{:continue}} {{/if}} @@ -87,7 +93,7 @@ account.code LIKE '28%'; :line_id = $immo_id|intval }} - {{if $status == "nsp" && $amort_amount != null}} + {{if $status == "unknown" && $amort_amount != null}} {{:assign ignore=true}} {{else}} {{:assign ignore=false}} @@ -100,6 +106,11 @@ {{:assign nb_immo="%d+1"|math:$nb_immo}} + @@ -107,16 +118,16 @@ {{/select}} + + {{:assign var="actions.amortize" value="Marquer l'immobilisation amortie"}} + {{:assign var="actions.ignore" value="Ignorer l'écriture"}} + + + + + + + +
    + + + Date Libellé
    + {{:input type="checkbox" name="check[%s]"|args:$immo_id value=$immo_id default=0}} + + + #{{$trans_id}} {{$trans_date|date_short}} {{$trans_label}}{{$account_code}} {{$account_label}} - {{if $status == "nsp"}} + {{if $status == "unknown"}} {{:linkbutton - label="Amortir" + label="Paramètres" href="add_infos.html?immo_id=%s&amort=0&op=new&type_immo=autre"|args:$immo_id shape="settings" target="_dialog" }} {{else}} {{:linkbutton - label="Amortir" + label="Paramètres" href="add_infos.html?immo_id=%s&amort=0&op=modif&type_immo=autre"|args:$immo_id shape="settings" target="_dialog" @@ -131,7 +142,30 @@
    + + + Pour les écritures cochées : +{{* + + + {csrf_field key="projects_action"} +*}} + + {{:input type="select" name="actions" options=$actions default_empty="— Choisir une action à effectuer —"}} +
    + {{if $nb_immo == 0}}

    Aucune immobilisation

    {{/if}} diff --git a/add_infos.html b/add_infos.html index 706179f..3008736 100644 --- a/add_infos.html +++ b/add_infos.html @@ -4,7 +4,7 @@ @param immo_id @param amort = 1 si immo amortissable, 0 si non @param op = new ou modif - @param type_immo : encours, sortie, amortie, autre + @param type_immo : encours, amortie, sortie, autre *}} {{if $_GET.op == "modif"}} @@ -14,6 +14,10 @@ {{* Traiter l'envoi du formulaire *}} {{#form on="save"}} + {{:debug post=$_POST}} + {{if $_POST.classify == null}} + {{:error message="Vous devez choisir une action"}} + {{/if}} {{* chercher la date d'acquisition de l'immobilisation *}} {{#select @@ -26,7 +30,7 @@ }} {{/select}} - {{if ! $_POST.amortir}} + {{if $_POST.classify == "ignored"}} {{* ne pas amortir *}} {{:assign duration=0}} {{:assign date_debut=$ligne_immo.date_achat|parse_date}} @@ -39,11 +43,16 @@ {{:assign da=$ligne_immo.date_achat|date_short}} {{:error message="Erreur : la date de mise en service (%s) ne peut être antérieure à la date d'acquisition (%s)"|args:$dd:$da}} {{/if}} - {{:assign duration=$_POST.duree|intval}} - {{if $duration <= 0}} - {{:error message="Erreur : la durée d'amortissement doit être strictement positive"}} + {{if $_POST.classify == "amortized"}} + {{:assign duration=0}} + {{:assign status="amortized"}} + {{else}} + {{:assign duration=$_POST.duree|intval}} + {{if $duration <= 0}} + {{:error message="Erreur : la durée d'amortissement doit être strictement positive"}} + {{/if}} + {{:assign status="managed"}} {{/if}} - {{:assign status="managed"}} {{/if}} {{* enregistrer les infos de l'immobilisation *}} @@ -52,6 +61,8 @@ {{else}} {{:assign key=$info_immo.key}} {{/if}} +{{:debug duree=$duration date=$date_debut classif=$_POST.classify status=$status}} + {{:save key=$key validate_schema="schema.json" @@ -62,8 +73,10 @@ status=$status }} - {{if ! $_POST.amortir}} - {{:assign type_immo="autre"}} + {{if $_POST.classify == "managed"}} + {{:assign type_immo="encours"}} + {{elseif $_POST.classify == "amortized"}} + {{:assign type_immo="amortie"}} {{else}} {{:assign type_immo=$_GET.type_immo}} {{/if}} @@ -81,31 +94,32 @@ {{* renseigner ou modifier la date de mise en service et la durée d'amortissement *}} {{if $_GET.amort == 0}} - {{:assign checked=0}} {{:assign disabled=1}} + {{:assign default=""}} {{else}} - {{:assign checked=1}} {{:assign disabled=0}} + {{:assign default="managed"}} {{/if}}
    - {{if $checked}} - {{:assign helptext = "Dé-cocher pour ne pas amortir"}} - {{else}} - {{:assign helptext = "Cocher pour amortir"}} - {{/if}} - {{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir" default=$checked help=$helptext onclick="toggleInputs('infos_immo','f_amortir_1')"}} +
    (obligatoire)
    + {{:input type="radio" name="classify" value="managed" label="Amortir" help="Amortir cette immobilisation" default=$default onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} + {{:input type="radio" name="classify" value="amortized" label="Marquer amortie" help="Cette immobilisation sera classée parmi les immobilisations amorties" onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} + {{:input type="radio" name="classify" value="ignored" label="Ignorer l'écriture" help="Cette écriture n'apparaitra plus dans la liste des immobilisations" onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} + {{if $info_immo != null}} {{:assign date_defaut=$info_immo.date}} {{:assign duree_defaut=$info_immo.duration}} {{else}} - {{:assign duree_defaut=1}} + {{:assign duree_defaut=null}} {{/if}} - {{:input type="number" name="duree" label="Durée d'amortissement" default=$duree_defaut required=true min=1 disabled=$disabled}} - {{:input type="date" name="date_mes" label="Date de mise en service" default=$date_defaut disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}} +
    + {{:input type="number" name="duree" label="Durée d'amortissement" default=$duree_defaut required=true min=1 disabled=$disabled}} + {{:input type="date" name="date_mes" label="Date de mise en service" default=$date_defaut disabled=$disabled help="à renseigner uniquement si différente de la date d'acquisition"}} +
    @@ -117,19 +131,19 @@ {{* activer/désactiver les champs de saisie *}} {{:admin_footer}} diff --git a/amortization.html b/amortization.html index 1e12668..c8280c0 100644 --- a/amortization.html +++ b/amortization.html @@ -29,6 +29,7 @@ {{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}} {{:assign duree=$duration}} {{:assign date_debut=$date}} + {{:assign status=$status}} {{/load}} {{* chercher des écritures d'amortissement liées à l'immobilisation *}} @@ -67,10 +68,15 @@ {{/if}} {{/select}} -{{:assign valeur_residuelle=$ligne_immo.montant}} -{{#foreach from=$linked_lines}} - {{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$amort_amount}} -{{/foreach}} +{{if $status == "amortized"}} + {{:assign amort_amount=$ligne_immo.montant}} + {{:assign valeur_residuelle=0}} +{{else}} + {{:assign valeur_residuelle=$ligne_immo.montant}} + {{#foreach from=$linked_lines}} + {{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$amort_amount}} + {{/foreach}} +{{/if}} {{* Autres amortissements non rattachés *}} {{#select diff --git a/balance_sheet_exit.html b/balance_sheet_exit.html index b557a8e..3a56e4a 100644 --- a/balance_sheet_exit.html +++ b/balance_sheet_exit.html @@ -57,7 +57,11 @@ {{/select}} {{if $amort_line.amort_number == 0}} - {{:assign amort_amount=0}} + {{if $info_immo.status == "amortized"}} + {{:assign amort_amount=$ligne_immo.montant}} + {{else}} + {{:assign amort_amount=0}} + {{/if}} {{else}} {{:assign amort_amount=$amort_line.amort_amount}} {{:assign date_debut=$amort_line.last_amort_date|strtotime}} @@ -153,8 +157,9 @@ lister les exercices ouverts : {{:break}} {{/if}} {{/if}} + {{* voir si des amortissements ont été oubliés *}} - {{if $start_date|strtotime > $amort_line.last_amort_date|strtotime && $end_date|strtotime < $now}} + {{if $info_immo.status != "amortized" && $start_date|strtotime > $amort_line.last_amort_date|strtotime && $end_date|strtotime < $now}} {{:assign debut=$start_date|date_short}} {{:assign fin=$end_date|date_short}} {{:assign msg_amort=$msg_amort|cat:"\n"|cat:" - "|cat:$label|cat:" : du "|cat:$debut|cat:" au "|cat:$fin}} diff --git a/compute_exit_data.html b/compute_exit_data.html index 6672a69..f046e77 100644 --- a/compute_exit_data.html +++ b/compute_exit_data.html @@ -69,7 +69,7 @@
    Date de mise en service
    {{$_GET.date_mes|date:"d/m/Y"}}
    {{/if}} - {{if $_GET.duree_amort != null}} + {{if $_GET.duree_amort != null && $_GET.duree_amort != 0}}
    Durée de l'amortissement
    {{$_GET.duree_amort}} ans
    {{/if}} diff --git a/confirm_action.html b/confirm_action.html new file mode 100644 index 0000000..ee82683 --- /dev/null +++ b/confirm_action.html @@ -0,0 +1,50 @@ +{{* -*- brindille -*- *}} + +{{#form on="validate"}} + {{:debug get=$_GET post=$_POST}} +{{/form}} + +{{:admin_header title="Confirmer"}} +{{:assign .="infos"}} +{{*:debug post=$_POST*}} +{{if $_POST.actions == "amortize"}} + {{:assign action="Marquer l'immobilisation amortie"}} +{{elseif $_POST.actions == "ignore"}} + {{:assign action="Ignorer l'écriture"}} +{{/if}} +{{:assign msg_titre="Appliquer l'opération « %s » sur les écritures : "|args:$action}} + +{{:assign msg_lines=""}} + +{{:admin_header title="Confirmer l'opération" custom_css="./style.css" current="module_amortissement"*}} + + +
    +

    Appliquer l'opération « {{$action}} » sur les écritures :

    +
    + + + + + + + + + {{#foreach from=$_POST.check item="line"}} + + {{:assign var="label" from="_POST.label.%s"|args:$line}} + {{:assign var="trans_id" from="_POST.trans.%s"|args:$line}} + {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}} + + + + + {{/foreach}} + +
    Libellé
    #{{$trans_id}}{{$label}}
    +

    + {{:button type="submit" name="validate" label="Confirmer" shape="right" class="main"}} +

    +
    + +{{:admin_footer}} diff --git a/schema.json b/schema.json index ea8e31c..4279385 100644 --- a/schema.json +++ b/schema.json @@ -21,7 +21,7 @@ }, "status" : { "type" : ["string", "null"], - "enum" : ["managed", "archived", "ignored"] + "enum" : ["managed", "amortized", "archived", "ignored"] } }, "required": ["type", "line", "duration", "date"] From eae9a2f31c7a798a02079cfe0d14aa3c9aba70ef Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 2 Jul 2025 10:00:48 +0200 Subject: [PATCH 04/48] Correction typo --- add_asset.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add_asset.html b/add_asset.html index 666df24..0c2a654 100644 --- a/add_asset.html +++ b/add_asset.html @@ -182,7 +182,7 @@
    Amortissement
    - {{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur plusieurs années" checked="cheched" help="Dé-cocher pour ne pas amortir"}} + {{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}}
    {{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}} {{:input type="date" name="date_mes" label="Date de mise en service" help="C'est la date de première utilisation ; à renseigner uniquement si différente de la date d'acquisition"}} From 61b900751400935aa51aafa8ba18d975ed5efd4e Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 2 Jul 2025 10:05:14 +0200 Subject: [PATCH 05/48] Correction typo --- add_asset.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add_asset.html b/add_asset.html index 666df24..0c2a654 100644 --- a/add_asset.html +++ b/add_asset.html @@ -182,7 +182,7 @@
    Amortissement
    - {{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur plusieurs années" checked="cheched" help="Dé-cocher pour ne pas amortir"}} + {{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}}
    {{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}} {{:input type="date" name="date_mes" label="Date de mise en service" help="C'est la date de première utilisation ; à renseigner uniquement si différente de la date d'acquisition"}} From 688cada3e83e717dbbfeeb6091ee6db4b0b995fb Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 3 Jul 2025 10:42:45 +0200 Subject: [PATCH 06/48] Harmonisation types immo --- _immobilisations.html | 15 ++++++++------- _nav.html | 18 +++++++++--------- add_asset.html | 4 ++-- amortization.html | 18 +++++++++--------- index.html | 8 ++++---- other_amortizations.html | 4 ++-- save_amort.html | 2 +- 7 files changed, 35 insertions(+), 34 deletions(-) diff --git a/_immobilisations.html b/_immobilisations.html index 2f28b30..8765d7f 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -3,9 +3,9 @@ {{* Liste des immobilisations en cours ou amorties *}}
    - {{if $type_immo == "encours"}} + {{if $type_immo == "managed"}}

    Immobilisations en cours

    - {{elseif $type_immo == "amortie"}} + {{elseif $type_immo == "amortized"}}

    Immobilisations amorties

    {{/if}} {{:assign nb_immo=0}} @@ -133,10 +133,11 @@ {{* classement par onglet *}} - {{if $type_immo == "encours" && $amort_amount >= $debit}}{{:continue}}{{/if}} - {{if $type_immo == "encours" && $status == "amortized"}}{{:continue}}{{/if}} + {{if $type_immo == "managed" && $amort_amount >= $debit}}{{:continue}}{{/if}} + {{if $type_immo == "managed" && $status == "amortized"}}{{:continue}}{{/if}} {{if $status == "unknown" && ! $exist_amort}}{{:continue}}{{/if}} - {{if $type_immo == "amortie" && $amort_amount < $debit && $status != "amortized"}}{{:continue}}{{/if}} + {{if $type_immo == "amortized" && $amort_amount < $debit && $status != "amortized"}}{{:continue}}{{/if}} + {{:assign nb_immo="%d+1"|math:$nb_immo}} #{{$trans_id}} @@ -150,14 +151,14 @@ {{if ! $exist_amort}} {{:linkbutton label="Paramètres" - href="add_infos.html?immo_id=%s&amort=1&op=modif&type_immo=%s"|args:$immo_id:$type_immo + href="add_infos.html?immo_id=%s&op=modif&type_immo=%s"|args:$immo_id:$type_immo shape="settings" target="_dialog" }} {{elseif $status == "unknown"}} {{:linkbutton label="Paramètres" - href="add_infos.html?immo_id=%s&amort=1&op=new&type_immo=%s"|args:$immo_id:$type_immo + href="add_infos.html?immo_id=%s&op=new&type_immo=%s"|args:$immo_id:$type_immo shape="settings" target="_dialog" }} diff --git a/_nav.html b/_nav.html index f5c6b94..fc5c3c3 100644 --- a/_nav.html +++ b/_nav.html @@ -1,11 +1,11 @@ {{* -*- brindille -*- *}}
    -
    -
    Immobilisation
    -
    #{{$ligne_immo.trans_id}} {{$ligne_immo.label}}
    -
    Montant
    -
    {{"%f"|math:$ligne_immo.montant|money_currency}}
    -
    Début d'amortissement
    -
    {{$date_debut|date_short}}
    - {{if $duree != null}} -
    Durée
    -
    {{$duree}} ans
    - {{/if}} - {{if $valeur_residuelle > 0}} -
    Montant déjà amorti
    -
    {{"%d-%d"|math:$ligne_immo.montant:$valeur_residuelle|money_currency:false}}
    -
    Valeur résiduelle
    -
    {{$valeur_residuelle|money_currency}}
    - {{/if}} - {{if $duree != null && $valeur_residuelle > 0}} -
    Annuité estimée
    -
    {{"%f/%d"|math:$ligne_immo.montant:$duree|money_currency}}
    - {{/if}} -
    +
    +
    +
    Immobilisation
    +
    #{{$ligne_immo.trans_id}} {{$ligne_immo.label}}
    +
    Montant
    +
    {{"%f"|math:$ligne_immo.montant|money_currency}}
    +
    Début d'amortissement
    +
    {{$date_debut|date_short}}
    + {{if $duree != null}} +
    Durée
    +
    {{$duree}} ans
    + {{/if}} + {{if $valeur_residuelle > 0}} +
    Montant déjà amorti
    +
    {{"%d-%d"|math:$ligne_immo.montant:$valeur_residuelle|money_currency:false}}
    +
    Valeur résiduelle
    +
    {{$valeur_residuelle|money_currency}}
    + {{/if}} + {{if $duree != null && $valeur_residuelle > 0}} +
    Annuité estimée
    +
    {{"%f/%d"|math:$ligne_immo.montant:$duree|money_currency}}
    + {{/if}} +
    +

    Amortissements enregistrés

    {{if $linked_lines != null}} diff --git a/style.css b/style.css index fd1cbfb..c9c23f9 100644 --- a/style.css +++ b/style.css @@ -41,7 +41,3 @@ h2[class="aide"], h3[class="aide"] { nav.amort aside { margin-top : 0; } - -.describe dt::after { - content: ' :'; -} From 9bfc389fa222f6086fd3822e48d762a08c1e2a99 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 12 Nov 2025 20:38:24 +0100 Subject: [PATCH 25/48] Correction typos --- add_asset.html | 4 ++-- config.html | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/add_asset.html b/add_asset.html index c5f7756..898042d 100644 --- a/add_asset.html +++ b/add_asset.html @@ -153,7 +153,7 @@
    {{:input type="select" name="id_year" label="Exercice" default=$selected_year required=true default_empty="— Faire un choix —" options=$open_years}} {{:input type="date" name="date_achat" label="Date d'acquisition" required=true default=$now|date_short}} - {{:input type="text" name="designation" label="Désignation" required=true}} + {{:input type="text" name="designation" label="Libellé" required=true}} {{:input type="money" name="montant" label="Montant" required=true}} {{:input type="list" @@ -180,7 +180,7 @@
    Amortissement
    - {{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}} + {{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur une ou plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}}
    {{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}} {{:input type="date" name="date_mes" label="Date de mise en service" help="C'est la date de première utilisation ; à renseigner uniquement si différente de la date d'acquisition"}} diff --git a/config.html b/config.html index 624a4ba..25b2dc3 100644 --- a/config.html +++ b/config.html @@ -188,11 +188,10 @@ {{:assign var="unfinished_account.%s.%s"|args:$code:$code value="%s — "|args:$code|cat:$elem.label}} {{:assign var="current_account" from="unfinished_account.%s"|args:$code}} - {{:input type="list" name="unfinished_accounts[]" - target="!acc/charts/accounts/selector.php?codes=%s*&id_year=%d"|args:$code::$selected_year + target="!acc/charts/accounts/selector.php?codes=%s*&id_year=%d"|args:$code:$selected_year default=$current_account }} @@ -226,7 +225,7 @@ + diff --git a/scripts.js b/scripts.js index 9764bcc..818d3ed 100644 --- a/scripts.js +++ b/scripts.js @@ -119,7 +119,6 @@ function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_mo } if (id_date != null) { const date_choisie = str2sec(document.getElementById(id_date).value); - console.log("date_choisie = " + date_choisie + ", date_debut=" + date_debut + ", date_fin = " + date_fin); if (date_debut <= date_choisie && date_choisie <= date_fin) { date_fin = date_choisie; } else { @@ -161,7 +160,6 @@ function initLine(row) { // Associer au bouton « Ajouter » de chaque table l'action d'ajouter une ligne function addLine(button, codes) { - console.log("codes=" + JSON.stringify(codes)); button.onclick = () => { let lines = button.closest("table").querySelectorAll('tbody tr'); let line = lines[lines.length - 1]; @@ -190,3 +188,50 @@ function addLine(button, codes) { initLine(newNode); }; } + +// calculer et afficher le total des lignes sélectionnées +function computeTotal(id_total, id_url) { + + // calculer le total par compte + let total = new Object; + const transactions = []; + let lines = document.querySelectorAll('.list tbody tr'); + for (const line of lines) { + let button = line.querySelector('input[type=checkbox]'); + if (button.checked) { + let money = line.querySelector('.money'); + let code = line.querySelector('.account_code a').innerText; + if (code in total) { + total[code] += getNumber(money.innerText) * 100; + } else { + total[code] = getNumber(money.innerText) * 100; + } + const number = line.querySelector('.num a').innerText.slice(1); + transactions.push(number); + } + } + // afficher les totaux + const liste = document.getElementById(id_total).querySelector('ul'); + while (liste.firstChild) { + liste.removeChild(liste.firstChild); + } + for (const code in total) { + const node = document.createElement("li"); + const para = document.createElement("p"); + const libelle = document.createTextNode("Compte " + code + " : "); + const span = document.createElement("strong"); + span.classList.add("money"); + const montant = document.createTextNode(new Intl.NumberFormat("fr-FR", { style: "currency", currency: "EUR" }).format(total[code] / 100., )); + + span.appendChild(montant); + para.appendChild(libelle); + para.appendChild(span); + node.appendChild(para); + liste.appendChild(node); + } + + // mettre à jour les paramètres de l'url + let url = document.getElementById(id_url); + let new_href = url.href.replace(/trans=.*/, 'trans=' + Object.values(transactions)); + url.href = new_href; +} diff --git a/style.css b/style.css index c9c23f9..40922ee 100644 --- a/style.css +++ b/style.css @@ -41,3 +41,9 @@ h2[class="aide"], h3[class="aide"] { nav.amort aside { margin-top : 0; } + +fieldset.shortFormLeft div.informations { + border: 1px solid var(--gLightBorderColor); + background: rgba(var(--gSecondColor), 0.2); + border-radius: .5em; +} diff --git a/transfer.html b/transfer.html new file mode 100644 index 0000000..c7f5dfc --- /dev/null +++ b/transfer.html @@ -0,0 +1,317 @@ +{{* -*- brindille -*- *}} + +{{:admin_header title="Transfert d'immobilisation en cours" current="module_amortissement"}} +{{:include file="_get_config.html" keep="module.config.prefixes"}} + +{{#years closed=false order="start_date" assign=years.}} + {{:assign ts_debut=$start_date|strtotime}} + {{:assign ts_fin=$end_date|strtotime}} + {{:assign debut=$start_date|date_short}} + {{:assign fin=$end_date|date_short}} + {{:assign var="years_data.%d"|args:$id value=$ts_debut|cat:" "|cat:$ts_fin}} + {{:assign var="open_years.%d"|args:$id value=$label|cat:" ("|cat:$debut|cat:" - "|cat:$fin|cat:")"}} + {{if $ts_debut <= $now && $now <= $ts_fin}} + {{:assign selected_year=$id}} + {{/if}} +{{else}} + {{:error message="Aucun exercice ouvert"}} +{{/years}} + +{{* Traiter l'envoi du formulaire *}} +{{#form on="transfer"}} + {{* vérifier que la date de mise en service est située dans l'exercice sélectionné *}} + {{:assign ts_date = $_POST.date_mes|parse_date|strtotime}} + {{:assign ok=false}} + {{#foreach from=$years}} + {{if $id == $_POST.id_year}} + {{:assign selected_chart=$id_chart}} + {{if $start_date|strtotime <= $ts_date && $ts_date <= $end_date|strtotime}} + {{:assign ok=true}} + {{:break}} + {{/if}} + {{/if}} + {{/foreach}} + {{if ! $ok}} + {{:error message="La date saisie n'est pas dans l'exercice choisi !"}} + {{/if}} + + {{if ! $_POST.amortir}} + {{* ne pas amortir *}} + {{:assign duration=0}} + {{:assign date_debut=$_POST.date_achat|parse_date}} + {{:assign status="ignored"}} + {{else}} + {{* vérifier que la date d'acquisition est antérieure à la date de mise en service *}} + {{:assign date_debut=$_POST.date_mes|parse_date}} + {{:assign duration=$_POST.duree|intval}} + {{:assign status="managed"}} + {{/if}} + + {{* comptes de débit *}} + {{#foreach from=$_POST.credit_accounts key="rang" item="elem"}} + {{:include + file="_get_codes.html" + account=$elem + keep="account_code" + }} + {{:assign debit_account=$account_code|keys|key:0}} + {{:assign var="amount" from="_POST.credit_lines.%s"|args:$rang}} + {{:assign var="label" from="_POST.line_labels.%s"|args:$rang}} + {{:assign + var="lines." + account=$debit_account + credit=$amount + label=$label + }} + {{/foreach}} + + {{* compte de crédit *}} + {{:include + file="_get_codes.html" + account=$_POST.debit_account + keep="account_code" + }} + {{:assign credit_account=$account_code|keys|key:0}} + {{:assign var="amount" from="_POST.debit_lines.%s"|args:0}} + {{:assign count=$_POST.line_labels|count}} + {{:assign count="%d-1"|math:$count}} + {{:assign var="label" from="_POST.line_labels.%s"|args:$count}} + {{:assign + var="lines." + account=$credit_account + debit=$amount + label=$label + }} + + {{* vérifier : + - que le compte d'immo débute par un préfixe correct (20, 21, ...) + - est présent dans le PC de l'exercice correspondant à la date + *}} + + {{:include + file="_check_account.html" + account=$account_code + chart_id=$selected_chart + prefix_array=$module.config.prefixes + keep="account_ok" + }} + + {{if $account_ok == null}} + {{:assign compte=$credit_account|implode:""}} + {{:error message="Le compte « %s » n'est pas un compte d'immobilisation ou n'est pas dans le plan comptable de l'exercice choisi"|args:$compte}} + {{/if}} + + {{* écritures liées *}} + {{:assign var="linked_transactions" value=$_GET.trans|explode:","}} + + {{* enregistrer l'écriture *}} + {{:api + method="POST" + path="accounting/transaction" + assign="result" + id_year=$_POST.id_year + type="advanced" + date=$_POST.date_mes + label=$_POST.designation|trim + lines=$lines + linked_transactions=$linked_transactions + }} + + {{:assign lines_count=$lines|count}} + {{:assign lines_count="%d-1"|math:$lines_count}} + {{:assign var="immo_id" from="result.lines.%s.id"|args:$lines_count}} + + {{* enregistrer les infos de l'immobilisation *}} + {{:save + key=""|uuid + validate_schema="schema.json" + type="immo" + line=$immo_id + duration=$duration + date=$date_debut + status=$status + }} + {{if $_POST.amortir}} + {{:assign type_immo="managed"}} + {{else}} + {{:assign type_immo="other"}} + {{/if}} + {{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}} + +{{/form}} + +{{* barre de navigation *}} +{{if ! $dialog}} + {{:include file="_nav.html" current="index"}} +{{/if}} + +{{:form_errors}} + +{{* formulaire d'ajout d'immobilisation *}} + +{{#select id,label FROM acc_projects WHERE archived = 0;}} + {{:assign var="projects.%d"|args:$id value=$label}} +{{/select}} + +{{#foreach from=$module.config.prefixes item="code"}} + {{:assign var="pattern_array." value="%s*"|args:$code}} +{{/foreach}} +{{:assign var="patterns" value=$pattern_array|implode:"|"}} + + + +{{if $_GET.trans == null}} + {{:error message="Vous n'avez sélectionné aucune écriture !"}} +{{/if}} + +{{* déterminer les comptes d'immo en cours *}} +{{:include file="_get_config.html" keep="module.config.unfinished"}} +{{:assign condition="("}} +{{#foreach from=$module.config.unfinished item="elem"}} + {{:assign code=$elem.code|cat:"%"|quote_sql}} + {{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}} +{{/foreach}} +{{:assign condition=$condition|cat:"0)"}} + +{{* détails des écritures paramètres *}} +{{:assign trans=$_GET.trans|explode:","}} +{{:assign var="trans_list" value=$trans|map:quote_sql}} +{{:assign trans_list=$trans_list|implode:","}} +{{:assign trans_list="("|cat:$trans_list|cat:")"}} +{{:assign condition=$condition|cat:" AND trans.id IN "|cat:$trans_list}} +{{:assign condition=$condition|cat:" AND NOT (trans.status & 16)"}} + +{{#select + trans.id as trans_id, + trans.label AS trans_label, + trans.date AS trans_date, + SUM(line.debit) AS line_debit, + account.code AS account_code, + account.label AS account_label, + line.id_project as project_id + FROM acc_transactions AS trans + INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id + INNER JOIN acc_accounts AS account ON line.id_account = account.id + WHERE !condition + GROUP BY trans.id + ; + !condition=$condition +}} + {{:assign var="transactions.%s"|args:$trans_id amount=$line_debit date=$trans_date code=$account_code label=$account_label project=$project_id}} +{{/select}} + +
    +
    + Données de l'immobilisation +
    + {{:input type="select" name="id_year" label="Exercice" default=$selected_year required=true + default_empty="— Faire un choix —" options=$open_years}} + {{:input type="date" name="date_mes" label="Date de mise en service" required=true default=$now|date_short}} + {{:input type="text" name="designation" label="Libellé" required=true}} +
    +
    + +
    + Comptes +
    + + + + + + + + + + + + {{:assign total=0}} + {{#foreach from=$transactions key="id"}} + {{:assign total="%f+%f"|math:$total:$amount}} + {{:assign current_account=null}} + {{:assign var="current_account.%s"|args:$code value="%s — %s"|args:$code:$label}} + + + + + + + + {{/foreach}} + + + + + + + + + + +
    CompteDébitCréditLibellé ligneProjet
    + {{:input + type="list" + name="credit_accounts[]" + required=true + target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$code:$selected_year + default=$current_account + }} + {{:input name="credit_lines[]" type="text" class="money" size="8" default=$amount|money}}{{:input name="debit_lines[]" type="text" class="money" size="8" disabled=true}}{{:input type="text" name="line_labels[]" size="40"}} + {{if $projects != null}} + {{:input type="select" name="id_project" options=$projects default_empty="— Aucun —"}} + {{/if}} +
    + {{:input + type="list" + name="debit_account" + label="Compte d'immobilisation amortissable" + required=true + target="!acc/charts/accounts/selector.php?codes=%s&id_year=%d"|args:$patterns:$selected_year + }} + {{:input name="credit_lines[]" type="text" class="money" size="8" disabled=true}}{{:input name="debit_lines[]" type="text" class="money" size="8" default=$total|money}}{{:input type="text" name="line_labels[]" size="40"}} + {{if $projects != null}} + {{:input type="select" name="id_project" options=$projects default_empty="— Aucun —"}} + {{/if}} +
    + + +
    +
    + +
    + Amortissement +
    + {{:input id="amortir" type="checkbox" value=1 name="amortir" label="Amortir cette immobilisation sur une ou plusieurs années" checked="checked" help="Dé-cocher pour ne pas amortir"}} +
    + {{:input type="number" name="duree" label="Durée d'amortissement" required=true min=0 default=1 suffix="année(s)"}} +
    +
    +
    + +

    + {{:button type="submit" name="transfer" label="Transférer" shape="right" class="main"}} +

    + +
    +{{:admin_footer}} + + + From 262b25889bab8ab3be00ead50e596f98039ec03f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 18 Nov 2025 12:03:38 +0100 Subject: [PATCH 27/48] =?UTF-8?q?Classer=20ou=20d=C3=A9classer=20manuellem?= =?UTF-8?q?ent=20une=20=C3=A9criture=20=C2=AB=20=C3=A0=20ignorer=20=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _unfinished.html | 31 +++++++++++++++++- ignore.html | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ style.css | 5 +++ 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 ignore.html diff --git a/_unfinished.html b/_unfinished.html index 5db1083..3565470 100644 --- a/_unfinished.html +++ b/_unfinished.html @@ -31,6 +31,9 @@

    +
    + {{:input type="checkbox" value=1 name="unhide" label="Afficher les écritures marquées ignorées" }} +
    @@ -79,6 +82,15 @@ ORDER BY trans.date DESC; !condition=$condition }} + {{* voir si l'écriture a été marquée ignorée *}} + {{:assign ignore=false}} + {{#load type="immo" assign="info_immo" where="$$.line = :line_id AND $$.status = 'ignored'" :line_id=$immo_id|intval}} + {{:assign ignore=true}} + {{/load}} + {{if $ignore && $_POST.unhide == null}} + {{:continue}} + {{/if}} + {{* voir s'il existe une écriture qui solde l'immobilisation *}} {{#select count(*) AS count @@ -92,6 +104,7 @@ }} {{:assign count=$count}} {{/select}} + {{* S'il y a plus d'une écriture de même montant on ne peut pas décider *}} {{if $count == 1}} {{:continue}} @@ -109,7 +122,14 @@ - + {{/select}} @@ -132,4 +152,13 @@ } +function changeVisibility(evt, idcheck = 'f_unhide_1') { + this.form.dispatchEvent(new Event('submit')); + this.form.submit(); +} + +(function () { + document.getElementById('f_unhide_1').onclick = changeVisibility; +})(); + diff --git a/ignore.html b/ignore.html new file mode 100644 index 0000000..a8d4ec6 --- /dev/null +++ b/ignore.html @@ -0,0 +1,85 @@ +{{* -*- brindille -*- *}} + +{{* + Marquer la ligne d'écriture « à ignorer » + @param immo_id : numéro de ligne +*}} + +{{#select + trans.id AS trans_id, + trans.date AS date, + trans.label AS label, + line.debit AS amount + FROM acc_transactions_lines AS line + INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id + WHERE line.id = :line_id + ; + :line_id = $_GET.immo_id + assign=ligne_immo +}} +{{else}} + {{:error message="Il n'y a aucune écriture avec le numéro de ligne %s !"|args:$_GET.immo_id}} +{{/select}} +{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}{{/load}} + +{{* Traiter l'envoi du formulaire *}} +{{#form on="proceed"}} + {{if $_POST.ignore != null && $info_immo == null}} + {{* ignorer l'écriture *}} + {{:assign duration=0}} + {{:assign status="ignored"}} + {{:save + key=""|uuid + validate_schema="schema.json" + type="immo" + line=$_GET.immo_id|intval + duration=$duration + date=$ligne_immo.date + status=$status + }} + {{:redirect force="index.html?ok=1&msg=infos&type_immo=unfinished"}} + {{elseif $_POST.ignore == null && $info_immo != null}} + {{* dés-ignorer l'écriture *}} + {{:delete id=$info_immo.id}} + {{:redirect force="index.html?ok=1&msg=infos&type_immo=unfinished"}} + {{else}} + {{:redirect force="index.html?type_immo=unfinished"}} + {{/if}} +{{else}} + {{:form_errors}} +{{/form}} + +{{:admin_header title="Ignorer l'écriture" custom_css="./style.css" current="module_amortissement"}} + +{{* barre de navigation *}} +{{if ! $dialog}} + {{:include file="_nav.html" current="index"}} +{{/if}} + + +
    + Ignorer +
    +
    +
    Écriture
    +
    #{{$ligne_immo.trans_id}} {{$ligne_immo.label}}
    +
    Montant
    +
    {{"%f"|math:$ligne_immo.amount|money_currency}}
    +
    +
    +
    + {{if $info_immo != null && $info_immo.status == "ignored"}} + {{:input type="checkbox" name="ignore" checked="checked" value="1" label="Ignoré" help="Décocher pour ne plus ignorer l'écriture"}} + {{else}} + {{:input type="checkbox" name="ignore" value="1" label="Ignoré" help="Cocher pour ignorer l'écriture ; elle n'apparaitra plus dans la liste des immobilisations"}} + {{/if}} +
    +
    + +

    + {{:button type="submit" name="proceed" label="Confirmer" shape="right" class="main"}} +

    + + + +{{:admin_footer}} diff --git a/style.css b/style.css index 40922ee..5c0e9c6 100644 --- a/style.css +++ b/style.css @@ -38,6 +38,11 @@ h2[class="aide"], h3[class="aide"] { margin-right: 0; } +.informations dl.describe > dd { + margin-left: 0; + margin-right: 0; +} + nav.amort aside { margin-top : 0; } From 900b0f5a4751209995f0a663f484ac118cc2f084 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 19 Nov 2025 11:27:59 +0100 Subject: [PATCH 28/48] =?UTF-8?q?Filtrer=20les=20libell=C3=A9s=20des=20?= =?UTF-8?q?=C3=A9critures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _immobilisations.html | 10 +++- _immobilisations_autres.html | 12 ++++- _nav.html | 8 +++ _unfinished.html | 13 ++++- amortization.html | 11 ++++- config.html | 6 +-- filters.html | 94 ++++++++++++++++++++++++++++++++++++ other_amortizations.html | 11 ++++- scripts.js | 17 ++++++- 9 files changed, 171 insertions(+), 11 deletions(-) create mode 100644 filters.html diff --git a/_immobilisations.html b/_immobilisations.html index 57ca24e..337fc0b 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -37,8 +37,16 @@ {{/foreach}} {{:assign condition=$condition|cat:"0)"}} {{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}} - {{:assign nb_immo=0}} + {{:assign filter_condition=" NOT ("}} + {{#foreach from=$module.config.filters item="filter"}} + {{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}} + {{:assign filter_condition=$filter_condition|cat:" trans_label LIKE "|cat:$filter|cat:" OR "}} + {{/foreach}} + {{:assign filter_condition=$filter_condition|cat:"0)"}} + {{:assign condition=$condition|cat:" AND "|cat:$filter_condition}} + + {{:assign nb_immo=0}} {{#select trans.id as trans_id, trans.label as trans_label, diff --git a/_immobilisations_autres.html b/_immobilisations_autres.html index fb1970b..41a547f 100644 --- a/_immobilisations_autres.html +++ b/_immobilisations_autres.html @@ -29,7 +29,7 @@ {{* lister les immobilisations *}} - {{:include file="_get_config.html" keep="module.config.prefixes"}} + {{:include file="_get_config.html" keep="module.config"}} {{:assign condition="("}} {{#foreach from=$module.config.prefixes item="code"}} @@ -38,8 +38,16 @@ {{/foreach}} {{:assign condition=$condition|cat:"0)"}} {{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}} - {{:assign nb_immo=0}} + {{:assign filter_condition=" NOT ("}} + {{#foreach from=$module.config.filters item="filter"}} + {{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}} + {{:assign filter_condition=$filter_condition|cat:" trans_label LIKE "|cat:$filter|cat:" OR "}} + {{/foreach}} + {{:assign filter_condition=$filter_condition|cat:"0)"}} + {{:assign condition=$condition|cat:" AND "|cat:$filter_condition}} + + {{:assign nb_immo=0}} {{#select trans.id as trans_id, trans.label as trans_label, diff --git a/_nav.html b/_nav.html index 1cc3608..9c56bfb 100644 --- a/_nav.html +++ b/_nav.html @@ -33,4 +33,12 @@
  • Sortie de bilan
  • {{/if}} + + {{if $current == "config"}} + + {{/if}} diff --git a/_unfinished.html b/_unfinished.html index 3565470..ab7e1e0 100644 --- a/_unfinished.html +++ b/_unfinished.html @@ -52,7 +52,7 @@ {{* lister les immobilisations en cours de constitution *}} - {{:include file="_get_config.html" keep="module.config.unfinished"}} + {{:include file="_get_config.html" keep="module.config"}} {{:assign accounts_condition="("}} {{#foreach from=$module.config.unfinished item="elem"}} @@ -61,8 +61,17 @@ {{/foreach}} {{:assign accounts_condition=$accounts_condition|cat:"0)"}} {{:assign condition=$accounts_condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}} - {{:assign nb_immo=0}} + {{:assign filter_condition=" NOT ("}} + {{#foreach from=$module.config.filters item="filter"}} + {{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}} + {{:assign filter_condition=$filter_condition|cat:" trans_label LIKE "|cat:$filter|cat:" OR "}} + {{/foreach}} + {{:assign filter_condition=$filter_condition|cat:"0)"}} + {{:assign condition=$condition|cat:" AND "|cat:$filter_condition}} + {{*:debug condition=$condition*}} + + {{:assign nb_immo=0}} {{#select trans.id as trans_id, trans.label as trans_label, diff --git a/amortization.html b/amortization.html index 1801ea8..9eb9874 100644 --- a/amortization.html +++ b/amortization.html @@ -79,6 +79,14 @@ {{/if}} {{* Autres amortissements non rattachés *}} +{{:include file="_get_config.html" keep="module.config"}} +{{:assign filter_condition=" NOT ("}} +{{#foreach from=$module.config.filters item="filter"}} + {{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}} + {{:assign filter_condition=$filter_condition|cat:" trans.label LIKE "|cat:$filter|cat:" OR "}} +{{/foreach}} +{{:assign filter_condition=$filter_condition|cat:"0)"}} + {{#select line.id as l_id, line.id_transaction as t_id, @@ -94,8 +102,9 @@ INNER JOIN acc_accounts AS account ON account.id = line.id_account INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction INNER JOIN acc_years AS y ON y.id = trans.id_year - WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) + WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) AND !filter_condition ORDER BY trans.date, trans.label; + !filter_condition=$filter_condition assign=autre_amort }} {{#select diff --git a/config.html b/config.html index 25b2dc3..7695c17 100644 --- a/config.html +++ b/config.html @@ -1,8 +1,5 @@ {{* -*- brindille -*- *}} -{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortissement"}} -{{:include file="_nav.html" current="config"}} - {{if $_GET.ok == 1}}

    Configuration enregistrée.

    {{/if}} @@ -52,6 +49,9 @@ {{:form_errors}} {{/form}} +{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortissement"}} +{{:include file="_nav.html" current="config"}} + {{* récupérer l'exercice courant ou sinon le plus récent *}} {{:assign var="selected_year" from="logged_user.preferences.accounting_year"}} {{if $selected_year == null}} diff --git a/filters.html b/filters.html new file mode 100644 index 0000000..36228af --- /dev/null +++ b/filters.html @@ -0,0 +1,94 @@ +{{* -*- brindille -*- *}} + +{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortissement"}} +{{:include file="_nav.html" current="config" subcurrent="filters"}} + +{{if $_GET.ok == 1}} +

    Configuration enregistrée.

    +{{/if}} + +{{* lecture config *}} +{{:include file="./_get_config.html" keep="module.config"}} + +{{#form on="save"}} + {{* enregistrer les filtres dans la config *}} + {{#foreach from=$_POST.filters item="filter"}} + {{if $filter != ""}} + {{:assign var="filters." value=$filter}} + {{/if}} + {{/foreach}} + {{:save key="config" filters=$filters}} + {{:redirect to="./filters.html"}} +{{/form}} + + +

    Liste de libellés à ignorer

    +

    + Les écritures dont le libellé contient un des textes ci-dessous seront ignorées +

    + +
    {{"%f"|math:$debit|money:false}} {{$account_label}} + {{:linkbutton + label="Modifier" + href="ignore.html?immo_id=%s"|args:$immo_id + shape="edit" + target="_dialog" + }} +
    + + + + + + + + {{if $module.config.filters == null}} + + + + + {{else}} + {{#foreach from=$module.config.filters item="filter"}} + + + + + {{/foreach}} + {{/if}} + + + + + + + +
    Libellé
    + {{:input type="text" name="filters[]" required=false}} + + {{:button + label="Enlever" + title="Enlever une ligne" + shape="minus" + name="remove_line" + }} +
    + {{:input type="text" name="filters[]" default=$filter required=false}} + + {{:button + label="Enlever" + title="Enlever une ligne" + shape="minus" + name="remove_line" + }} +
    {{:button shape="plus" label="Ajouter" title="Ajouter un libellé"}}
    +

    + {{:button type="submit" name="save" label="Enregistrer" shape="right" class="main"}} +

    + + + + diff --git a/other_amortizations.html b/other_amortizations.html index 84d6eaa..a3758d9 100644 --- a/other_amortizations.html +++ b/other_amortizations.html @@ -23,6 +23,14 @@ {{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}} {{/select}} +{{:include file="_get_config.html" keep="module.config"}} +{{:assign filter_condition=" NOT ("}} +{{#foreach from=$module.config.filters item="filter"}} + {{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}} + {{:assign filter_condition=$filter_condition|cat:" trans.label LIKE "|cat:$filter|cat:" OR "}} +{{/foreach}} +{{:assign filter_condition=$filter_condition|cat:"0)"}} + {{#select line.id as l_id, line.id_transaction as t_id, @@ -38,8 +46,9 @@ INNER JOIN acc_accounts AS account ON account.id = line.id_account INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction INNER JOIN acc_years AS y ON y.id = trans.id_year - WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) + WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) AND !filter_condition ORDER BY trans.date, trans.label; + !filter_condition=$filter_condition assign=autre_amort }} {{#select diff --git a/scripts.js b/scripts.js index 818d3ed..15369ff 100644 --- a/scripts.js +++ b/scripts.js @@ -149,7 +149,7 @@ function initLine(row) { var min = removeBtn.getAttribute('min'); if (count <= min) { - alert("Il n'est pas possible d'avoir moins de " + min + " compte(s)."); + alert("Il n'est pas possible d'avoir moins de " + min + " ligne(s)."); return false; } @@ -235,3 +235,18 @@ function computeTotal(id_total, id_url) { let new_href = url.href.replace(/trans=.*/, 'trans=' + Object.values(transactions)); url.href = new_href; } + +// dupliquer la dernière ligne d'une table +function copyLine(button) { + button.onclick = () => { + let lines = button.closest("table").querySelectorAll('tbody tr'); + let line = lines[lines.length - 1]; + let newNode = line.cloneNode(true); + let libelle = newNode.querySelector('input'); + libelle.value = ''; + + // ajouter la nouvelle ligne + line.parentNode.appendChild(newNode); + initLine(newNode); + }; +} From 3e9f215816b62d8c481b26b8202be80214a6adff Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 25 Nov 2025 13:53:21 +0100 Subject: [PATCH 29/48] Ajout totaux dans les onglets Amortissables, Amorties et En cours --- _archives.html | 54 ++++++++++++++++++++++++++++++++++++++++++- _immobilisations.html | 20 +++++++++++++++- _unfinished.html | 18 +++++++++++++++ style.css | 31 +++++++++++++++++++++++-- 4 files changed, 119 insertions(+), 4 deletions(-) diff --git a/_archives.html b/_archives.html index 22ce879..4385dff 100644 --- a/_archives.html +++ b/_archives.html @@ -31,7 +31,6 @@ FROM acc_transactions AS trans INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id INNER JOIN acc_accounts AS account ON line.id_account = account.id - INNER JOIN acc_years AS years ON trans.id_year = years.id INNER JOIN acc_transactions_lines AS line2 ON line.debit = line2.credit INNER JOIN acc_transactions AS trans2 ON trans2.id = line2.id_transaction INNER JOIN acc_accounts AS acc2 ON acc2.id = line2.id_account @@ -61,10 +60,15 @@ {{:assign nb_immo=0}} + {{:assign total_immo = 0}} + {{:assign total_cessions = 0}} {{#foreach from=$immo_archivees}} {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}} {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}} {{:assign nb_immo="%d+1"|math:$nb_immo}} + {{:assign total_immo="%d+%d"|math:$total_immo:$debit}} + {{:assign var="montant" from="sommes_immo.%s"|args:$account_code}} + {{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}} #{{$trans_id}} {{$trans_date|date_short}} @@ -77,10 +81,58 @@ + {{* voir s'il y a une écriture de cession associée à cette immo *}} + {{#select + trans.id, + trans.label, + trans.date, + line.id, + line.debit, + acc.code, + acc.label + FROM acc_transactions_links AS link + INNER JOIN acc_transactions AS trans ON (CASE + WHEN link.id_transaction = :trans_id THEN link.id_related + WHEN link.id_related = :trans_id THEN link.id_transaction + END) = trans.id + INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id + INNER JOIN acc_accounts AS acc ON line.id_account = acc.id + WHERE (link.id_transaction = :trans_id OR link.id_related = :trans_id) AND acc.code = 462 + ; + :trans_id = $trans_id + }} + {{:assign var="montant" from="montant_cessions.%d"|args:$account_code}} + {{:assign var="montant_cessions.%d"|args:$account_code value="%d+%d"|math:$montant:$debit}} + {{:assign total_cessions="%d+%d"|math:$total_cessions:$debit}} + {{/select}} {{/foreach}} {{if $nb_immo == 0}}

    Aucune immobilisation

    + {{else}} + {{/if}}
    diff --git a/_immobilisations.html b/_immobilisations.html index 337fc0b..d823bc6 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -47,6 +47,7 @@ {{:assign condition=$condition|cat:" AND "|cat:$filter_condition}} {{:assign nb_immo=0}} + {{:assign total_immo = 0}} {{#select trans.id as trans_id, trans.label as trans_label, @@ -148,11 +149,14 @@ {{if $type_immo == "amortized" && $amort_amount < $debit && $status != "amortized"}}{{:continue}}{{/if}} {{:assign nb_immo="%d+1"|math:$nb_immo}} + {{:assign total_immo="%d+%d"|math:$total_immo:$debit}} + {{:assign var="montant" from="sommes_immo.%s"|args:$account_code}} + {{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}} #{{$trans_id}} {{$trans_date|date_short}} {{$trans_label}} - {{"%f"|math:$debit|money}} + {{$debit|money}} {{if $duration != null}}{{$duration}}{{/if}} {{$account_code}} {{$account_label}} @@ -184,5 +188,19 @@ {{if $nb_immo == 0}}

    Aucune immobilisation

    + {{else}} + {{/if}} diff --git a/_unfinished.html b/_unfinished.html index ab7e1e0..68feff2 100644 --- a/_unfinished.html +++ b/_unfinished.html @@ -72,6 +72,7 @@ {{*:debug condition=$condition*}} {{:assign nb_immo=0}} + {{:assign total_immo = 0}} {{#select trans.id as trans_id, trans.label as trans_label, @@ -122,6 +123,9 @@ {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}} {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}} {{:assign nb_immo="%d+1"|math:$nb_immo}} + {{:assign total_immo="%d+%d"|math:$total_immo:$debit}} + {{:assign var="montant" from="sommes_immo.%s"|args:$account_code}} + {{:assign var="sommes_immo.%s"|args:$account_code value="%d+%d"|math:$montant:$debit}} {{:input type="checkbox" name="selected[]" value=$trans_id}} @@ -145,6 +149,20 @@ {{if $nb_immo == 0}}

    Aucune immobilisation

    + {{else}} + {{/if}} diff --git a/style.css b/style.css index 5c0e9c6..3f65a59 100644 --- a/style.css +++ b/style.css @@ -31,7 +31,7 @@ h2[class="aide"], h3[class="aide"] { } .informations dt::after { - content: ' :'; + content: ' : '; } .informations dl.describe > dt { @@ -39,7 +39,6 @@ h2[class="aide"], h3[class="aide"] { } .informations dl.describe > dd { - margin-left: 0; margin-right: 0; } @@ -52,3 +51,31 @@ fieldset.shortFormLeft div.informations { background: rgba(var(--gSecondColor), 0.2); border-radius: .5em; } + +span.strong { + font-weight: bold; +} + +aside.totals { + float : left; + width : 30em; +} + +aside.totals dl.describe { + display: flex; +} + +aside.totals dl.describe dt { + text-align : right; + flex : 0 0 20rem; +} + +aside.totals dl.describe dt::after { + content: ' : '; +} + +aside.totals dl.describe dd { + flex : 0 0 calc(100% - 25rem); + text-align : right; +} + From 79d5afc1472fbae36575e044bcb3bd2e7d155217 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Wed, 26 Nov 2025 11:52:07 +0100 Subject: [PATCH 30/48] =?UTF-8?q?module.ini=20:=20ajout=20num=C3=A9ro=20ve?= =?UTF-8?q?rsion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.ini b/module.ini index 89362b0..5027cdf 100644 --- a/module.ini +++ b/module.ini @@ -1,5 +1,5 @@ name="Amortissements" -description="Immobilisations et amortissements" +description="Immobilisations et amortissements\nversion 0.23" author="Jean-Christophe Engel" author_url="https://gitea.zaclys.com/lesanges" home_button=false From 018ee5583ce2d42e9911b4a9361478523bacd6b9 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Thu, 27 Nov 2025 12:02:26 +0100 Subject: [PATCH 31/48] Ajout colonnes Amortissements et Valeur nette dans tables des immos --- _immobilisations.html | 8 +++++--- _unfinished.html | 2 +- amortization.html | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/_immobilisations.html b/_immobilisations.html index d823bc6..ee13934 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -15,13 +15,14 @@ - + + + - @@ -158,8 +159,9 @@ + + - - + diff --git a/amortization.html b/amortization.html index 9eb9874..fc6aa7c 100644 --- a/amortization.html +++ b/amortization.html @@ -192,9 +192,9 @@
    {{$duree}} ans
    {{/if}} {{if $valeur_residuelle > 0}} -
    Montant déjà amorti
    +
    Montant des amortissements
    {{"%d-%d"|math:$ligne_immo.montant:$valeur_residuelle|money_currency:false}}
    -
    Valeur résiduelle
    +
    Valeur nette comptable
    {{$valeur_residuelle|money_currency}}
    {{/if}} {{if $duree != null && $valeur_residuelle > 0}} From a9fdb1a1950dd1def69dc82a4ba442b30e26d1ec Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 2 Dec 2025 14:43:10 +0100 Subject: [PATCH 32/48] =?UTF-8?q?Modification=20pr=C3=A9sentation=20totaux?= =?UTF-8?q?=20(fin=20tableau)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _archives.html | 82 ++++++++++++++++++++++++++++++------------- _immobilisations.html | 42 ++++++++++++++-------- _nav.html | 1 - _unfinished.html | 40 +++++++++++++-------- style.css | 24 ------------- 5 files changed, 112 insertions(+), 77 deletions(-) diff --git a/_archives.html b/_archives.html index 4385dff..0eed040 100644 --- a/_archives.html +++ b/_archives.html @@ -107,32 +107,66 @@ {{/select}} {{/foreach}} + + + {{if $total_immo != 0}} + {{#foreach from=$sommes_immo|ksort key="code" item="value"}} + + + + + + + + + + + + {{/foreach}} + + + + + + + + + + + + {{/if}} + {{if $total_cessions != 0}} + + + {{#foreach from=$montant_cessions|ksort key="code" item="value"}} + + + + + + + + + + + + {{/foreach}} + + + + + + + + + + + + {{/if}} +
    Date Libellé Montant DuréeAmortissementsValeur nette N° compteCompte
    {{$trans_label}} {{$debit|money}} {{if $duration != null}}{{$duration}}{{/if}}{{$amort_amount|money|or:"0,00"}}{{"%d-%d"|math:$debit:$amort_amount|money|or:"0,00"}} {{$account_code}}{{$account_label}} {{if ! $exist_amort}} {{:linkbutton diff --git a/_unfinished.html b/_unfinished.html index 68feff2..7e8ae46 100644 --- a/_unfinished.html +++ b/_unfinished.html @@ -43,7 +43,7 @@ Date LibelléMontantMontant N° compte Compte
    Total du compte {{$code}}{{$value|money}}
    Total des immobilisations{{$total_immo|money}}
    +
    Cessions du compte {{$code}}{{$value|money}}
    Total des cessions{{$total_cessions|money}}
    {{if $nb_immo == 0}}

    Aucune immobilisation

    - {{else}} - {{/if}} diff --git a/_immobilisations.html b/_immobilisations.html index ee13934..d27239d 100644 --- a/_immobilisations.html +++ b/_immobilisations.html @@ -187,22 +187,36 @@ {{/select}} + + {{if $total_immo != 0}} + {{#foreach from=$sommes_immo|ksort key="code" item="value"}} + + + + Total du compte {{$code}} + {{$value|money}} + + + + + + + {{/foreach}} + + + + Total des immobilisations + {{$total_immo|money}} + + + + + + + {{/if}} + {{if $nb_immo == 0}}

    Aucune immobilisation

    - {{else}} - {{/if}} diff --git a/_nav.html b/_nav.html index 9c56bfb..979bbb4 100644 --- a/_nav.html +++ b/_nav.html @@ -37,7 +37,6 @@ {{if $current == "config"}} {{/if}} diff --git a/_unfinished.html b/_unfinished.html index 7e8ae46..3e41d55 100644 --- a/_unfinished.html +++ b/_unfinished.html @@ -146,23 +146,35 @@ {{/select}} + + {{if $total_immo != 0}} + {{#foreach from=$sommes_immo|ksort key="code" item="value"}} + + + + + Total du compte {{$code}} + {{$value|money}} + + + + + {{/foreach}} + + + + + Total des immobilisations + {{$total_immo|money}} + + + + + {{/if}} + {{if $nb_immo == 0}}

    Aucune immobilisation

    - {{else}} - {{/if}} diff --git a/style.css b/style.css index 3f65a59..55f8cdd 100644 --- a/style.css +++ b/style.css @@ -55,27 +55,3 @@ fieldset.shortFormLeft div.informations { span.strong { font-weight: bold; } - -aside.totals { - float : left; - width : 30em; -} - -aside.totals dl.describe { - display: flex; -} - -aside.totals dl.describe dt { - text-align : right; - flex : 0 0 20rem; -} - -aside.totals dl.describe dt::after { - content: ' : '; -} - -aside.totals dl.describe dd { - flex : 0 0 calc(100% - 25rem); - text-align : right; -} - From c6e344fb80770b51e98b20e669c847832eda1e2b Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 2 Dec 2025 14:44:12 +0100 Subject: [PATCH 33/48] Sortie du bilan : utilisation comptes PC 2025 --- write_exit.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/write_exit.html b/write_exit.html index 340d5fa..168a776 100644 --- a/write_exit.html +++ b/write_exit.html @@ -270,8 +270,8 @@ Utilisation des « anciens » numéros de comptes because conflit avec les nouveaux numéros ; voir info.org *}} -{{:assign vnc_code="675"}} -{{:assign cession_code="775"}} +{{:assign vnc_code="652"}} +{{:assign cession_code="757"}} {{:assign var="liste_codes.6811" name="comp_account"}} {{:assign var="liste_codes.687" name="except_account"}} From b4096821e7a911b49ad9a1a76c3dfa59606fb5e1 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 2 Dec 2025 14:47:24 +0100 Subject: [PATCH 34/48] =?UTF-8?q?Mise-=C3=A0-jour=20num=C3=A9ro=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module.ini b/module.ini index 5027cdf..fdd92e7 100644 --- a/module.ini +++ b/module.ini @@ -1,5 +1,5 @@ name="Amortissements" -description="Immobilisations et amortissements\nversion 0.23" +description="Immobilisations et amortissements\nversion 0.24" author="Jean-Christophe Engel" author_url="https://gitea.zaclys.com/lesanges" home_button=false From b8ff2136452bfa27b374b8adf586221c57927790 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 2 Dec 2025 16:51:20 +0100 Subject: [PATCH 35/48] =?UTF-8?q?Compl=C3=A9ment=20filtrage=20des=20libell?= =?UTF-8?q?=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _archives.html | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/_archives.html b/_archives.html index 0eed040..717e710 100644 --- a/_archives.html +++ b/_archives.html @@ -8,13 +8,21 @@ {{* Immobilisation avec une écriture de sortie de bilan *}} {{:include file="_get_config.html" keep="module.config"}} -{{:assign condition="("}} +{{:assign accounts_condition="("}} {{#foreach from=$module.config.prefixes item="code"}} {{:assign code=$code|cat:"%"|quote_sql}} - {{:assign condition=$condition|cat:"account.code LIKE "|cat:$code|cat:" OR "}} + {{:assign accounts_condition=$accounts_condition|cat:"account.code LIKE "|cat:$code|cat:" OR "}} {{/foreach}} -{{:assign condition=$condition|cat:"0)"}} -{{:assign condition=$condition|cat:" AND acc2.code = account.code AND line.debit > 0 AND line.debit = line2.credit AND NOT (trans.status & 16)"}} +{{:assign accounts_condition=$accounts_condition|cat:"0)"}} +{{:assign condition=$accounts_condition|cat:" AND acc2.code = account.code AND line.debit > 0 AND line.debit = line2.credit AND NOT (trans.status & 16)"}} + +{{:assign filter_condition=" NOT ("}} +{{#foreach from=$module.config.filters item="filter"}} + {{:assign filter="%"|cat:$filter|cat:"%"|quote_sql}} + {{:assign filter_condition=$filter_condition|cat:" trans_label LIKE "|cat:$filter|cat:" OR "}} +{{/foreach}} +{{:assign filter_condition=$filter_condition|cat:"0)"}} +{{:assign condition=$condition|cat:" AND "|cat:$filter_condition}} {{#select trans.id as trans_id, From ec54c9044065ad096d53b71132d9c8e3b27f24ef Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 15 Dec 2025 15:59:18 +0100 Subject: [PATCH 36/48] Changement filtre brindille : key => value --- _check_account.html | 2 +- _get_codes.html | 6 +++++- add_asset.html | 4 ++-- save_amort.html | 4 ++-- transfer.html | 4 ++-- write_exit.html | 14 +++++++------- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/_check_account.html b/_check_account.html index 06e1108..ce6816e 100644 --- a/_check_account.html +++ b/_check_account.html @@ -19,7 +19,7 @@ {{/foreach}} {{:assign condition=$condition|cat:"0)"}} -{{:assign account_code=$account|keys|key:0}} +{{:assign account_code=$account|keys|value:0}} {{#sql select="code" tables="acc_accounts" diff --git a/_get_codes.html b/_get_codes.html index a780b40..0373085 100644 --- a/_get_codes.html +++ b/_get_codes.html @@ -2,9 +2,13 @@ {{* déterminer le numéro du compte passé en paramètre dans un tableau + la clé est parfois l'identifiant du compte, parfois son code... + d'où l'obligation d'extraire le code de la valeur qui a toujours + la forme : code — libellé *}} -{{:assign label=$account|values|key:0}} +{{:assign values=$account|values}} +{{:assign label=$values.0}} {{:assign pos=$label|strpos:" "}} {{:assign account_code=$label|substr:0:$pos}} {{:assign var="account_code.%s"|args:$account_code value=$label}} diff --git a/add_asset.html b/add_asset.html index 898042d..39c8b00 100644 --- a/add_asset.html +++ b/add_asset.html @@ -93,8 +93,8 @@ date=$_POST.date_achat label=$_POST.designation amount=$_POST.montant - debit=$debit_account|keys|key:0 - credit=$credit_account|keys|key:0 + debit=$debit_account|keys|value:0 + credit=$credit_account|keys|value:0 id_project=$_POST.id_project }} diff --git a/save_amort.html b/save_amort.html index 8fc110d..2872348 100644 --- a/save_amort.html +++ b/save_amort.html @@ -181,14 +181,14 @@ {{:assign var="lines." debit=$_POST.montant - account=$debit_account|keys|key:0 + account=$debit_account|keys|value:0 id_project=$_GET.project_id label=$_POST.designation }} {{:assign var="lines." credit=$_POST.montant - account=$credit_account|keys|key:0 + account=$credit_account|keys|value:0 id_project=$_GET.project_id label=$_POST.designation }} diff --git a/transfer.html b/transfer.html index c7f5dfc..6756386 100644 --- a/transfer.html +++ b/transfer.html @@ -54,7 +54,7 @@ account=$elem keep="account_code" }} - {{:assign debit_account=$account_code|keys|key:0}} + {{:assign debit_account=$account_code|keys|value:0}} {{:assign var="amount" from="_POST.credit_lines.%s"|args:$rang}} {{:assign var="label" from="_POST.line_labels.%s"|args:$rang}} {{:assign @@ -71,7 +71,7 @@ account=$_POST.debit_account keep="account_code" }} - {{:assign credit_account=$account_code|keys|key:0}} + {{:assign credit_account=$account_code|keys|value:0}} {{:assign var="amount" from="_POST.debit_lines.%s"|args:0}} {{:assign count=$_POST.line_labels|count}} {{:assign count="%d-1"|math:$count}} diff --git a/write_exit.html b/write_exit.html index 168a776..1e5d067 100644 --- a/write_exit.html +++ b/write_exit.html @@ -73,7 +73,7 @@ account=$account keep="account_code" }} - {{:assign amort_account_code=$account_code|keys|key:0}} + {{:assign amort_account_code=$account_code|keys|value:0}} {{if $valeur_nette > 0}} {{* immo non totalement amortie *}} @@ -84,7 +84,7 @@ account=$_POST.comp_account keep="account_code" }} - {{:assign comp_account_code=$account_code|keys|key:0}} + {{:assign comp_account_code=$account_code|keys|value:0}} {{:assign libelle="Amortissement complémentaire "|cat:$ligne_immo.label}} {{:assign @@ -110,7 +110,7 @@ account=$_POST.except_account keep="account_code" }} - {{:assign except_account_code=$account_code|keys|key:0}} + {{:assign except_account_code=$account_code|keys|value:0}} {{:assign libelle="Amortissement exceptionnel "|cat:$ligne_immo.label}} {{:assign var="lines." @@ -150,7 +150,7 @@ account=$_POST.immo_account keep="account_code" }} - {{:assign immo_account_code=$account_code|keys|key:0}} + {{:assign immo_account_code=$account_code|keys|value:0}} {{:assign libelle="Sortie du bilan de "|cat:$ligne_immo.label}} {{:assign var="lines." @@ -172,7 +172,7 @@ account=$_POST.vnc_account keep="account_code" }} - {{:assign vnc_account_code=$account_code|keys|key:0}} + {{:assign vnc_account_code=$account_code|keys|value:0}} {{:assign var="lines." account=$vnc_account_code @@ -203,13 +203,13 @@ account=$_POST.creance_account keep="account_code" }} - {{:assign creance_account=$account_code|keys|key:0}} + {{:assign creance_account=$account_code|keys|value:0}} {{:include file="_get_codes.html" account=$_POST.cession_account keep="account_code" }} - {{:assign cession_account=$account_code|keys|key:0}} + {{:assign cession_account=$account_code|keys|value:0}} {{:api method="POST" path="accounting/transaction" From 6fe88739c19725c5deb8abb5d241fe83329575b1 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 15 Dec 2025 19:21:17 +0100 Subject: [PATCH 37/48] Correction bug classement manuel immobilisation --- add_infos.html | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/add_infos.html b/add_infos.html index a147948..8001254 100644 --- a/add_infos.html +++ b/add_infos.html @@ -104,9 +104,9 @@ Classement
    (obligatoire)
    - {{:input type="radio-btn" name="classify" value="managed" label="Amortir" default=$default onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} - {{:input type="radio-btn" name="classify" value="amortized" label="Amortissement terminé" help="Cette immobilisation sera classée parmi les immobilisations amorties" default=$default onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} - {{:input type="radio-btn" name="classify" value="ignored" label="Ignorer l'écriture" help="Cette écriture n'apparaitra plus dans la liste des immobilisations" default=$default onclick="toggleInputs('div_inputs','f_classify_managed', 'f_classify_amortized')"}} + {{:input type="radio-btn" name="classify" value="managed" label="Amortir" default=$default}} + {{:input type="radio-btn" name="classify" value="amortized" label="Amortissement terminé" help="Cette immobilisation sera classée parmi les immobilisations amorties" default=$default}} + {{:input type="radio-btn" name="classify" value="ignored" label="Ignorer l'écriture" help="Cette écriture n'apparaitra plus dans la liste des immobilisations" default=$default}}
    @@ -132,11 +132,12 @@ +{{:admin_footer}} + {{* activer/désactiver les champs de saisie *}} -{{:admin_footer}} +function toggleInputs(event) { + toggleInputFields('div_inputs', 'f_classify_managed'); +} + +(function () { + const radios = document.querySelectorAll('input[name="classify"]'); + radios.forEach(radio => { + radio.addEventListener("change", toggleInputs); + }); +})(); + + From b50de139f8b8c7b3b82c4905964f4582e51cd26e Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 15 Dec 2025 19:22:25 +0100 Subject: [PATCH 38/48] Correction bug sortie bilan si date sortie dans aucun exercice ouvert --- balance_sheet_exit.html | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/balance_sheet_exit.html b/balance_sheet_exit.html index 3a56e4a..3d19e35 100644 --- a/balance_sheet_exit.html +++ b/balance_sheet_exit.html @@ -71,18 +71,13 @@ {{:assign valeur_nette="%f-%f"|math:$ligne_immo.montant:$amort_amount}} {{* -lister les exercices ouverts : - - dont la date de fin est postérieure à la date du dernier amortissment - - dont la date de début est antérieure ou égale à la date du jour + lister les exercices ouverts dont la date de fin est postérieure à la date du dernier amortissment *}} {{:assign default_exit_date=""}} {{#years closed=false order="start_date" where=":debut <= end_date" :debut=$date_debut}} {{if $start_date|strtotime <= $now && $now <= $end_date|strtotime}} {{:assign default_exit_date=$now|date_short}} {{/if}} - {{if $start_date|strtotime > $now}} - {{:break}} - {{/if}} {{:assign var="years." id=$id label=$label start_date=$start_date end_date=$end_date}} {{:assign debut=$start_date|date_short}} {{:assign fin=$end_date|date_short}} From bdef57545cc6f73f842810b4374632eee6cb55c6 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 16 Dec 2025 10:11:01 +0100 Subject: [PATCH 39/48] =?UTF-8?q?V=C3=A9rification=20date=20transfert=20im?= =?UTF-8?q?mo=20en=20cours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- transfer.html | 104 +++++++++++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 43 deletions(-) diff --git a/transfer.html b/transfer.html index 6756386..71f123e 100644 --- a/transfer.html +++ b/transfer.html @@ -17,8 +17,59 @@ {{:error message="Aucun exercice ouvert"}} {{/years}} +{{* déterminer les comptes d'immo en cours *}} +{{:include file="_get_config.html" keep="module.config.unfinished"}} +{{:assign condition="("}} +{{#foreach from=$module.config.unfinished item="elem"}} + {{:assign code=$elem.code|cat:"%"|quote_sql}} + {{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}} +{{/foreach}} +{{:assign condition=$condition|cat:"0)"}} + +{{* détails des écritures paramètres *}} +{{:assign trans=$_GET.trans|explode:","}} +{{:assign var="trans_list" value=$trans|map:quote_sql}} +{{:assign trans_list=$trans_list|implode:","}} +{{:assign trans_list="("|cat:$trans_list|cat:")"}} +{{:assign condition=$condition|cat:" AND trans.id IN "|cat:$trans_list}} +{{:assign condition=$condition|cat:" AND NOT (trans.status & 16)"}} + +{{#select + trans.id as trans_id, + trans.label AS trans_label, + trans.date AS trans_date, + SUM(line.debit) AS line_debit, + account.code AS account_code, + account.label AS account_label, + line.id_project as project_id + FROM acc_transactions AS trans + INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id + INNER JOIN acc_accounts AS account ON line.id_account = account.id + WHERE !condition + GROUP BY trans.id + ; + !condition=$condition +}} + {{:assign var="transactions.%s"|args:$trans_id + amount=$line_debit + date=$trans_date + code=$account_code + label=$account_label + project=$project_id + }} + {{if $max_date == null || $trans_date > $max_date}} + {{:assign max_date=$trans_date}} + {{/if}} +{{/select}} + {{* Traiter l'envoi du formulaire *}} {{#form on="transfer"}} + {{* vérifier que la date de mise en service est postérieure aux dates d'acquisition *}} + {{if $_POST.date_mes|parse_date < $max_date}} + {{:assign dacq=$max_date|date_short}} + {{:error message="La date de mise en service (%s) doit être postérieure à la date d'acquisition d'immobilisation la plus récente (%s) !"|args:$_POST.date_mes:$dacq}} + {{/if}} + {{* vérifier que la date de mise en service est située dans l'exercice sélectionné *}} {{:assign ts_date = $_POST.date_mes|parse_date|strtotime}} {{:assign ok=false}} @@ -120,7 +171,6 @@ {{:assign lines_count=$lines|count}} {{:assign lines_count="%d-1"|math:$lines_count}} {{:assign var="immo_id" from="result.lines.%s.id"|args:$lines_count}} - {{* enregistrer les infos de l'immobilisation *}} {{:save key=""|uuid @@ -137,7 +187,6 @@ {{:assign type_immo="other"}} {{/if}} {{:redirect force="index.html?ok=1&msg=immobilisation&type_immo=%s"|args:$type_immo}} - {{/form}} {{* barre de navigation *}} @@ -148,6 +197,15 @@ {{:form_errors}} {{* formulaire d'ajout d'immobilisation *}} +{{if $_GET.trans == null}} + {{:error message="Vous n'avez sélectionné aucune écriture !"}} +{{/if}} + +{{if $max_date|strtotime > $now}} + {{:assign default_date=$max_date}} +{{else}} + {{:assign default_date=$now|date_short}} +{{/if}} {{#select id,label FROM acc_projects WHERE archived = 0;}} {{:assign var="projects.%d"|args:$id value=$label}} @@ -162,53 +220,13 @@

    La date choisie n'est dans aucun exercice ouvert !

    -{{if $_GET.trans == null}} - {{:error message="Vous n'avez sélectionné aucune écriture !"}} -{{/if}} - -{{* déterminer les comptes d'immo en cours *}} -{{:include file="_get_config.html" keep="module.config.unfinished"}} -{{:assign condition="("}} -{{#foreach from=$module.config.unfinished item="elem"}} - {{:assign code=$elem.code|cat:"%"|quote_sql}} - {{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}} -{{/foreach}} -{{:assign condition=$condition|cat:"0)"}} - -{{* détails des écritures paramètres *}} -{{:assign trans=$_GET.trans|explode:","}} -{{:assign var="trans_list" value=$trans|map:quote_sql}} -{{:assign trans_list=$trans_list|implode:","}} -{{:assign trans_list="("|cat:$trans_list|cat:")"}} -{{:assign condition=$condition|cat:" AND trans.id IN "|cat:$trans_list}} -{{:assign condition=$condition|cat:" AND NOT (trans.status & 16)"}} - -{{#select - trans.id as trans_id, - trans.label AS trans_label, - trans.date AS trans_date, - SUM(line.debit) AS line_debit, - account.code AS account_code, - account.label AS account_label, - line.id_project as project_id - FROM acc_transactions AS trans - INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id - INNER JOIN acc_accounts AS account ON line.id_account = account.id - WHERE !condition - GROUP BY trans.id - ; - !condition=$condition -}} - {{:assign var="transactions.%s"|args:$trans_id amount=$line_debit date=$trans_date code=$account_code label=$account_label project=$project_id}} -{{/select}} -
    Données de l'immobilisation
    {{:input type="select" name="id_year" label="Exercice" default=$selected_year required=true default_empty="— Faire un choix —" options=$open_years}} - {{:input type="date" name="date_mes" label="Date de mise en service" required=true default=$now|date_short}} + {{:input type="date" name="date_mes" label="Date de mise en service" required=true default=$default_date}} {{:input type="text" name="designation" label="Libellé" required=true}}
    From 4ac6cbb1a6528f905216dfbb197653ccd963343c Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Tue, 16 Dec 2025 11:58:07 +0100 Subject: [PATCH 40/48] =?UTF-8?q?Immo=20en=20cours=20:=20ajout=20total=20g?= =?UTF-8?q?=C3=A9n=C3=A9ral=20+=20modif=20pr=C3=A9sentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _unfinished.html | 25 +++++++++++----------- scripts.js | 55 +++++++++++++++++++++++++++++++++--------------- style.css | 5 +++++ 3 files changed, 56 insertions(+), 29 deletions(-) diff --git a/_unfinished.html b/_unfinished.html index 3e41d55..60ac42b 100644 --- a/_unfinished.html +++ b/_unfinished.html @@ -16,9 +16,12 @@

    Montants sélectionnés -
      -
    •  
    • -
    + + + + + +

    @@ -181,15 +184,13 @@