From 24707afd31a83927e34929383a28f88efaba6096 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Engel Date: Mon, 13 Jul 2026 10:25:11 +0200 Subject: [PATCH] =?UTF-8?q?R=C3=A9organisation=20sortie=20bilan=20(onglets?= =?UTF-8?q?)=20+=20contr=C3=B4le=20coh=C3=A9rence=20montant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _archives.html | 2 +- attach_amort.html | 2 +- attach_cession.html | 2 +- attach_credit.html | 2 +- attach_exit.html | 2 +- detach_amort.html | 2 +- detach_cession.html | 2 +- detach_credit.html | 2 +- detach_exit.html | 2 +- exit_step1.html | 46 +++------------ exit_step2.html | 59 +++----------------- exit_step3.html | 56 +++---------------- exit_step4.html | 67 +++++++++++++++------- link_immo.html | 21 +++++-- list_cessions.html | 118 +++++++++++++++++++++++++++++++++++++++ list_exit.html | 108 +++++++++++++++++++++++++++++++++++ other_amortizations.html | 7 +-- 17 files changed, 327 insertions(+), 173 deletions(-) create mode 100644 list_cessions.html create mode 100644 list_exit.html diff --git a/_archives.html b/_archives.html index a4356d6..b5d2cc6 100644 --- a/_archives.html +++ b/_archives.html @@ -153,7 +153,7 @@ {{$account_code}} {{$account_label}} - {{:linkbutton label="Modifier" href="exit_step1.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}} + {{:linkbutton label="Modifier" href="exit_step1.html?immo_doc_id=%s&from=exit"|args:$info_immo.id shape="edit"}} {{/select}} diff --git a/attach_amort.html b/attach_amort.html index 95767e2..c03821b 100644 --- a/attach_amort.html +++ b/attach_amort.html @@ -130,7 +130,7 @@ {{/if}} {{if $_GET.from == "exit"}} - {{:redirect force="exit_step2.html?immo_doc_id=%s&ok=1&msg=attach_amort"|args:$_GET.immo_doc_id}} + {{:redirect force="exit_step2.html?immo_doc_id=%s&from=exit&ok=1&msg=attach_amort"|args:$_GET.immo_doc_id}} {{else}} {{:redirect force="amortization.html?immo_doc_id=%s&type_immo=%s&ok=1&msg=attach_amort"|args:$_GET.immo_doc_id:$status}} {{/if}} diff --git a/attach_cession.html b/attach_cession.html index 8ffe851..bd78460 100644 --- a/attach_cession.html +++ b/attach_cession.html @@ -36,4 +36,4 @@ cession_line_id=$_GET.cession_line_id|intval }} -{{:redirect force="exit_step3.html?immo_doc_id=%s&ok=1&msg=attach_cession"|args:$_GET.immo_doc_id}} +{{:redirect force="exit_step3.html?immo_doc_id=%s&from=exit&ok=1&msg=attach_cession"|args:$_GET.immo_doc_id}} diff --git a/attach_credit.html b/attach_credit.html index e081434..1c15ebd 100644 --- a/attach_credit.html +++ b/attach_credit.html @@ -107,7 +107,7 @@ }} {{if $_GET.from == "exit"}} - {{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}} + {{:redirect force="exit_step1.html?immo_doc_id=%s&from=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id:$_GET.from}} {{else}} {{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}} {{/if}} diff --git a/attach_exit.html b/attach_exit.html index 2dda568..36cf6bf 100644 --- a/attach_exit.html +++ b/attach_exit.html @@ -36,4 +36,4 @@ exit_line_id=$_GET.exit_line_id|intval }} -{{:redirect to="exit_step4.html?immo_doc_id=%s&ok=1&msg=attach_exit"|args:$_GET.immo_doc_id}} +{{:redirect to="exit_step4.html?immo_doc_id=%s&from=exit&ok=1&msg=attach_exit"|args:$_GET.immo_doc_id}} diff --git a/detach_amort.html b/detach_amort.html index b058716..873c924 100644 --- a/detach_amort.html +++ b/detach_amort.html @@ -26,7 +26,7 @@ {{/if}} {{if $_GET.from == "exit"}} - {{:redirect force="exit_step2.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id}} + {{:redirect force="exit_step2.html?immo_doc_id=%s&from=exit&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id}} {{else}} {{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_amort"|args:$_GET.immo_doc_id:}} {{/if}} diff --git a/detach_cession.html b/detach_cession.html index eab7863..2733fcc 100644 --- a/detach_cession.html +++ b/detach_cession.html @@ -18,4 +18,4 @@ {{:delete id=$id}} {{/load}} -{{:redirect to="exit_step3.html?immo_doc_id=%s&ok=1&msg=detach_cession"|args:$_GET.immo_doc_id}} +{{:redirect to="exit_step3.html?immo_doc_id=%s&from=exit&ok=1&msg=detach_cession"|args:$_GET.immo_doc_id}} diff --git a/detach_credit.html b/detach_credit.html index 9665e85..9b7da0e 100644 --- a/detach_credit.html +++ b/detach_credit.html @@ -19,7 +19,7 @@ {{/load}} {{if $_GET.from == "exit"}} - {{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}} + {{:redirect force="exit_step1.html?immo_doc_id=%s&from=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id:$_GET.from}} {{else}} {{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=detach_avoir"|args:$_GET.immo_doc_id}} {{/if}} diff --git a/detach_exit.html b/detach_exit.html index 1a71701..094bd88 100644 --- a/detach_exit.html +++ b/detach_exit.html @@ -18,4 +18,4 @@ {{:delete id=$id}} {{/load}} -{{:redirect to="exit_step4.html?immo_doc_id=%s&ok=1&msg=detach_exit"|args:$_GET.immo_doc_id}} +{{:redirect to="exit_step4.html?immo_doc_id=%s&from=exit&ok=1&msg=detach_exit"|args:$_GET.immo_doc_id}} diff --git a/exit_step1.html b/exit_step1.html index 5744fb6..3ffa2cd 100644 --- a/exit_step1.html +++ b/exit_step1.html @@ -129,7 +129,6 @@ {{else}} {{:assign current="archived"}} {{/if}} -{{*:include file="_nav.html" current=$current subcurrent="exit"*}} {{if $_GET.ok}} {{if $_GET.msg|match:"attach_avoir"}} @@ -163,6 +162,15 @@ +{{if $credit_lines}} + +{{/if}} +

Écritures d'avoir attachées à l'immobilisation

{{if $linked_immos != null}} @@ -203,42 +211,6 @@

{{/if}} -{{if $credit_lines}} -

Autres écritures au crédit du compte d'immobilisation

-
- - - - - - - - - - - - - {{#foreach from=$credit_lines}} - {{:assign credit_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:$year}} - - - - - - - - - - {{/foreach}} - -
DateLibelléMontantN° compteCompte
#{{$trans_id}}{{$date|date_short}}{{$trans_label}} - {{if $line_label != null && $line_label != $trans_label}} — {{$line_label}}{{/if}} - {{$amount|money_html|raw}}{{$account_code}}{{$account_label}} - {{:linkbutton label="Attacher" href="attach_credit.html?immo_doc_id=%s&credit_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$credit_line_id shape="plus" target="_dialog"}} -
-{{/if}} -

{{:button type="submit" name="proceed" label="Poursuivre" shape="right" class="main"}} diff --git a/exit_step2.html b/exit_step2.html index 6c451fc..acf7cc0 100644 --- a/exit_step2.html +++ b/exit_step2.html @@ -95,7 +95,6 @@ {{else}} {{:assign current="archived"}} {{/if}} -{{*:include file="_nav.html" current=$current subcurrent="exit"*}} {{if $_GET.ok}} {{if $_GET.msg|match:"attach_amort"}} @@ -129,6 +128,15 @@ +{{if $free_amort_lines}} +

+{{/if}} +

Écritures d'amortissement attachées à l'immobilisation

{{if $linked_amort != null}} @@ -181,55 +189,6 @@

{{/if}} - -{{if $free_amort_lines}} -

Autres écritures d'amortissements

-
- - - - - - - - - - - - - - {{#foreach from=$free_amort_lines item="line"}} - {{:assign amort_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.amort_trans_id}} - {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}} - - - - - - - - - - {{/foreach}} - -
DateLibelléMontantN° compteCompte
#{{$line.amort_trans_id}}{{$line.date|date_short}} - {{if $line.line_label != null}} - {{$line.line_label}} - {{if $line.trans_label != $line.line_label}} - — {{$line.trans_label}} - {{/if}} - {{else}} - {{$line.trans_label}} - {{/if}} -{{* - {{$line.trans_label}} - {{if $line.line_label != null && $line.line_label != $line.trans_label}} — {{$line.line_label}}{{/if}} -*}} - {{"%f"|math:$line.amort_amount|money_html:false|raw}}{{$line.account_code}}{{$line.account_label}} - {{:linkbutton label="Attacher" href="attach_amort.html?immo_doc_id=%s&amort_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$line.amort_line_id shape="plus" target="_dialog"}} -
-{{/if}} -

{{:button type="submit" name="backward" label="Revenir à l'étape précédente" shape="left" class="main"}} diff --git a/exit_step3.html b/exit_step3.html index f55e5b5..365d817 100644 --- a/exit_step3.html +++ b/exit_step3.html @@ -92,7 +92,6 @@ {{:assign var="free_cessions." value=$line}} {{/select}} {{/select}} -{{*:debug linked_cessions=$linked_cessions free_cessions=$free_cessions total_cession=$total_cession*}} {{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} {{if $_GET.from == "exit"}} @@ -100,7 +99,6 @@ {{else}} {{:assign current="archived"}} {{/if}} -{{*:include file="_nav.html" current=$current subcurrent="exit"*}} {{if $_GET.ok}} {{if $_GET.msg|match:"attach_cession"}} @@ -138,6 +136,15 @@ +{{if $linked_cessions == null && $free_cessions != null}} +

+{{/if}} +

Écriture de cession attachée à l'immobilisation

{{if $linked_cessions != null}} @@ -190,51 +197,6 @@

{{/if}} - -{{if $free_cessions}} -

Autres écritures de cession

-
- - - - - - - - - - - - - - {{#foreach from=$free_cessions item="line"}} - {{:assign cession_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}} - {{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}} - - - - - - - - - - {{/foreach}} - -
DateLibelléMontantN° compteCompte
#{{$line.trans_id}}{{$line.date|date_short}} - {{if $line.line_label != null}} - {{$line.line_label}} - {{if $line.trans_label != $line.line_label}} - — {{$line.trans_label}} - {{/if}} - {{else}} - {{$line.trans_label}} - {{/if}} - {{"%f"|math:$line.amount|money_html:false|raw}}{{$line.account_code}}{{$line.account_label}} - {{:linkbutton label="Attacher" href="attach_cession.html?immo_doc_id=%s&cession_line_id=%s&from=exit"|args:$_GET.immo_doc_id:$line.line_id shape="plus"}} -
-{{/if}} -

{{:button type="submit" name="backward" label="Revenir à l'étape précédente" shape="left" class="main"}} diff --git a/exit_step4.html b/exit_step4.html index ed7be7a..ba6344a 100644 --- a/exit_step4.html +++ b/exit_step4.html @@ -12,23 +12,6 @@ {{:error message=$message}} {{/if}} -{{#form on="backward"}} - {{:redirect to="exit_step3.html?immo_doc_id=%s&from=%s"|args:$_GET.immo_doc_id:$_GET.from}} -{{/form}} - -{{#form on="validate"}} - {{* mettre à jour l'état de l'immobilisation *}} - {{:save - key=$info_immo.key - status="archived" - }} - {{:redirect to="index.html?type_immo=archived"}} -{{/form}} - -{{#form on="finish"}} - {{:redirect to="index.html?type_immo=other"}} -{{/form}} - {{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}} {{if $label_immo|strpos:$ligne_immo.line_label === false}} {{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}} @@ -60,6 +43,7 @@ {{else}} {{:assign montant_cession=$amount}} {{/if}} + {{:assign cession_doc_id=$id}} {{/load}} {{* chercher une écriture de sortie de bilan associée *}} @@ -117,6 +101,13 @@ {{:assign erreur=1}} {{:assign message="Le montant des amortissement dans l'écriture de sortie (%s) est différent du total des amortissements associés à l'immobilisation (%s)."|args:$exit_amort_display:$total_amort_display}} {{/if}} + + {{if $exit_line.amount != $solde}} + {{:assign erreur=2}} + {{:assign exit_line_amount=$exit_line.amount|money_currency:false|replace:" ":" "}} + {{:assign solde_immo=$solde|money_currency:false|replace:" ":" "}} + {{:assign message="Le montant de de l'immobilisation dans l'écriture de sortie (%s) est différent du montant à amortir (%s)."|args:$exit_line_amount:$solde_immo}} + {{/if}} {{/if}} {{* @@ -214,13 +205,32 @@ {{/if}} {{/select}} +{{#form on="backward"}} + {{:redirect to="exit_step3.html?immo_doc_id=%s&from=%s"|args:$_GET.immo_doc_id:$_GET.from}} +{{/form}} + +{{#form on="validate"}} + {{* mettre à jour l'état de l'immobilisation *}} + {{:save + key=$info_immo.key + status="archived" + }} + {{:redirect to="index.html?type_immo=archived"}} +{{/form}} + +{{#form on="cancel"}} + {{* supprimer les docs de cession et de sortie *}} + {{if $cession_doc_id != null}}{{:delete id=$cession_doc_id}}{{/if}} + {{if $exit_info != null}}{{:delete id=$exit_info.id}}{{/if}} + {{:redirect to="index.html?type_immo=other"}} +{{/form}} + {{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}} {{if $_GET.from == "exit"}} {{:assign current="other"}} {{else}} {{:assign current="archived"}} {{/if}} -{{*:include file="_nav.html" current=$current subcurrent="exit"*}} {{if $_GET.ok}} {{if $_GET.msg|match:"attach_exit"}} @@ -259,7 +269,13 @@ {{if $erreur}} -

{{$message}}
Vérifiez si vous avez correctement attaché les écritures d'amortissement.

+

{{$message}}
+ {{if $erreur == 1}} + Vérifiez si vous avez correctement attaché les écritures d'amortissement. + {{elseif $erreur == 2}} + Vérifiez si vous avez correctement attaché les éventuelles écritures d'avoir. + {{/if}} +

@@ -286,6 +302,15 @@
Détails de l'écriture de sortie de bilan
{{/if}} +{{if $exit_lines}} + +{{/if}} +

Écriture de sortie de bilan attachée à l'immobilisation

{{if $exit_line != null}} {{:assign exit_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$exit_line.trans_id}} @@ -328,6 +353,7 @@ {{/if}} {{if $exit_lines}} +{{*

Écritures non rattachées

@@ -362,6 +388,7 @@ {{/foreach}}
+*}} {{elseif $exit_line == null}}

Aucune écriture de sortie de bilan avec un montant de {{$solde|money_currency_html:false|raw}} au crédit du @@ -385,7 +412,7 @@ {{if $exit_line && ! $erreur}} {{:button type="submit" name="validate" label="Terminer" shape="check" class="main"}} {{else}} - {{:button type="submit" name="finish" label="Annuler" shape="delete" class="main"}} + {{:button type="submit" name="cancel" label="Annuler" shape="delete" class="main"}} {{/if}}

diff --git a/link_immo.html b/link_immo.html index 73e071b..2a049dc 100644 --- a/link_immo.html +++ b/link_immo.html @@ -12,7 +12,9 @@ {{/if}} {{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}} -{{:assign date_debut=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}} +{{:assign date_immo=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}} +{{:assign montant_immo=$info_immo.amount|or:$ligne_immo.amount}} + {{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}} {{if $label_immo|strpos:$ligne_immo.line_label ===false }} {{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}} @@ -21,6 +23,10 @@ {{:assign var="ligne_immo.amount" value=$info_immo.amount}} {{/if}} +{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}} +{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_immos, total_credits"}} +{{:assign solde="%d-%d"|math:$montant_immo:$total_credits}} + {{* lister les écritures au crédit du compte de l'immobilisation *}} @@ -59,8 +65,11 @@ :account_code = $account_code !table = $module.table :date_immo = $date_immo - assign="other_immos." + assign="credit_line" }} + {{if $credit_line.credit_amount < $solde}} + {{:assign var="other_immos." value=$credit_line}} + {{/if}} {{/select}} {{:admin_header title="Écritures au crédit du compte d'immobilisation" custom_css="./style.css" current="module_amortization"}} @@ -78,12 +87,12 @@