@@ -178,8 +173,8 @@
| {{$line.date|date_short}} |
{{$line.label}} |
{{"%f"|math:$line.amount|money_currency_html:false|raw}} |
-
- {{if ! $created_amort}}
+ |
+ {{if $total_amort == 0}}
{{:linkbutton label="Détacher" href="detach_credit.html?immo_doc_id=%s&credit_line_id=%s"|args:$_GET.immo_doc_id:$line.credit_line_id shape="minus"}}
{{/if}}
|
@@ -199,14 +194,12 @@
shape="link"
target="_dialog"}}
{{/if}}
- {{if $valeur_residuelle > 0}}
- {{:linkbutton
- label="Enregistrer un amortissement"
- title="Enregistrer un nouvel amortissement"
- href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
- shape="plus"
+ {{:linkbutton
+ label="Enregistrer un amortissement"
+ title="Enregistrer un nouvel amortissement"
+ href="save_amort.html?immo_doc_id=%s"|args:$_GET.immo_doc_id target="_dialog"
+ shape="plus"
}}
- {{/if}}
{{if $linked_amort != null}}
@@ -243,7 +236,7 @@
{{"%f"|math:$solde|money_html:false|raw}} |
{{$line.account_code}} |
{{$line.account_label}} |
-
+ |
{{if ! $created_amort}}
{{:linkbutton label="Détacher" href="detach_amort.html?immo_doc_id=%s&amort_line_id=%s"|args:$_GET.immo_doc_id:$line.line_id shape="minus"}}
{{/if}}
diff --git a/attach_amort.html b/attach_amort.html
index c03821b..5c2951c 100644
--- a/attach_amort.html
+++ b/attach_amort.html
@@ -14,7 +14,7 @@
{{/if}}
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
-{{if $label_immo|strpos:$ligne_immo.line_label === false}}
+{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
{{/if}}
{{:assign montant_immo=$info_immo.amount|or:$ligne_immo.amount}}
@@ -93,12 +93,6 @@
{{:error message="Le montant de l'amortissement (%s) dépasse la valeur résiduelle de l'immobilisation (%s)"|args:$ma:$vnc}}
{{/if}}
- {{*
- supprimer les documents qui pointent sur une ligne d'amortissement absente
- cas de la suppression manuelle d'un amortissement
- *}}
- {{:include file="_remove_orphan_docs.tpl"}}
-
{{* Lier l'écriture d'amortissement à l'écriture d'immobilisation *}}
{{:include file="_common_attach.html" immo_doc_id=$_GET.immo_doc_id trans_id=$amort_line.trans_id}}
@@ -120,8 +114,8 @@
}}
{{/load}}
- {{* immo soldée ? *}}
- {{if $total_amort == $montant_immo && $_GET.from != "exit"}}
+ {{* À VÉRIFIER immo soldée ? *}}
+ {{if $total_amort == $montant_immo}}
{{:assign status="amortized"}}
{{:save
key=$info_immo.key
@@ -130,7 +124,7 @@
{{/if}}
{{if $_GET.from == "exit"}}
- {{:redirect force="exit_step2.html?immo_doc_id=%s&from=exit&ok=1&msg=attach_amort"|args:$_GET.immo_doc_id}}
+ {{:redirect force="exit_step2.html?immo_doc_id=%s&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}}
@@ -140,7 +134,7 @@
{{* barre de navigation *}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="managed" subcurrent="attach_amort"}}
+ {{:include file="_nav.html" current="config" subcurrent="init" subsubcurrent="parameter"}}
{{/if}}
{{:form_errors}}
diff --git a/attach_cession.html b/attach_cession.html
index bd78460..8ffe851 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&from=exit&ok=1&msg=attach_cession"|args:$_GET.immo_doc_id}}
+{{:redirect force="exit_step3.html?immo_doc_id=%s&ok=1&msg=attach_cession"|args:$_GET.immo_doc_id}}
diff --git a/attach_credit.html b/attach_credit.html
index 59cc802..6e8d22a 100644
--- a/attach_credit.html
+++ b/attach_credit.html
@@ -14,22 +14,13 @@
{{/if}}
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
-{{if $label_immo|strpos:$ligne_immo.line_label === false }}
+{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
{{/if}}
-{{if $info_immo.amount != null}}
- {{: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="total_credits"}}
-{{:assign valeur_residuelle="%d-%d"|math:$ligne_immo.amount:$total_credits}}
-
-{{* lister les amortissements liés à l'immobilisation *}}
-{{:include file="./_get_amort_lines.html" immo_doc_id=$_GET.immo_doc_id keep="linked_amort, total_amort, created_amort"}}
-{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$total_amort}}
-
+{{:assign solde_immo="%d-%d"|math:$ligne_immo.amount:$total_credits}}
{{* chercher l'écriture au crédit du compte d'immobilisation *}}
{{#select
@@ -71,50 +62,62 @@
{{/if}}
{{else}}
{{:assign montant_credit=$_POST.montant|money_int}}
- {{/if}}
-
- {{* vérifier que le montant saisi est inférieur à la valeur nette de l'écriture d'immobilisation *}}
- {{if $montant_credit > $valeur_residuelle}}
- {{:assign solde_nb="%f"|math:$valeur_residuelle|money_currency:false}}
- {{:error message="Le montant de l'avoir ne peut être supérieur à la valeur nette de l'immobilisation (%s)"|args:$solde_nb}}
- {{/if}}
-
- {{* vérifier que le montant saisi est inférieur au reste de l'écriture de crédit *}}
- {{if $montant_credit > $reste}}
- {{:assign reste_nb="%f"|math:$reste|money_currency:false}}
- {{:error message="Le montant de l'avoir ne peut être supérieur au reste (%s)"|args:$reste_nb}}
- {{/if}}
- {{if $montant_credit == $credit_line.amount}}
- {{:assign saved_credit=null}}
- {{else}}
- {{:assign saved_credit=$montant_credit}}
+ {{* vérifier que le montant saisi est inférieur au solde de l'écriture d'immobilisation *}}
+ {{if $montant_credit > $solde_immo}}
+ {{:assign solde_nb="%f"|math:$solde_immo|money_currency:false}}
+ {{:error message="Le montant de l'avoir ne peut être supérieur au montant de l'immobilisation (%s)"|args:$solde_nb}}
+ {{/if}}
+ {{* vérifier que le montant saisi est inférieur au reste de l'écriture de crédit *}}
+ {{if $montant_credit > $reste}}
+ {{:assign reste_nb="%f"|math:$reste|money_currency:false}}
+ {{:error message="Le montant de l'avoir ne peut être supérieur au reste (%s)"|args:$reste_nb}}
+ {{/if}}
+ {{if $montant_credit == $credit_line.amount}}
+ {{:assign saved_credit=null}}
+ {{else}}
+ {{:assign saved_credit=$montant_credit}}
+ {{/if}}
{{/if}}
{{* Lier l'écriture de crédit à l'écriture d'immobilisation *}}
{{:include file="_common_attach.html" immo_doc_id=$_GET.immo_doc_id trans_id=$credit_line.trans_id}}
- {{* enregistrer la liaison des lignes d'immo *}}
- {{:save
- key=""|uuid
- type="credit_link"
- immo_doc_id=$_GET.immo_doc_id|intval
- credit_line_id=$_GET.credit_line_id|intval
- amount=$saved_credit
- }}
+{{*
+ TODO ? vérifier le succès avant d'enregistrer le doc ?
+*}}
- {{if $_GET.from == "exit"}}
- {{: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}}
+{{* enregistrer la liaison des lignes d'immo *}}
+{{:save
+ key=""|uuid
+ type="credit_link"
+ immo_doc_id=$_GET.immo_doc_id|intval
+ credit_line_id=$_GET.credit_line_id|intval
+ amount=$saved_credit
+}}
+
+ {{*
+{{if $montant_credit == $solde_immo}}
+ {{:save
+ id=$_GET.immo_doc_id
+ status="archived"
+ }}
+{{/if}}
+*}}
+
+{{if $_GET.from == "exit"}}
+ {{:redirect force="exit_step1.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
+{{else}}
+ {{:redirect force="amortization.html?immo_doc_id=%s&ok=1&msg=attach_avoir"|args:$_GET.immo_doc_id}}
+{{/if}}
{{/form}}
{{:admin_header title="Écritures au crédit du compte d'immobilisation" custom_css="./style.css" current="module_amortization"}}
{{if ! $dialog}}
{{:include
file="_nav.html"
- current="managed"
- subcurrent="attach_credit"
+ current="config"
+ subcurrent="other"
+ subsubcurrent="immo"
type_immo="other"
}}
{{/if}}
diff --git a/attach_exit.html b/attach_exit.html
index 36cf6bf..2dda568 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&from=exit&ok=1&msg=attach_exit"|args:$_GET.immo_doc_id}}
+{{:redirect to="exit_step4.html?immo_doc_id=%s&ok=1&msg=attach_exit"|args:$_GET.immo_doc_id}}
diff --git a/balance_sheet_exit.html b/balance_sheet_exit.html
index da92038..2b4cf6b 100644
--- a/balance_sheet_exit.html
+++ b/balance_sheet_exit.html
@@ -12,7 +12,7 @@
{{/if}}
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
-{{if $label_immo|strpos:$ligne_immo.line_label === false}}
+{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
{{/if}}
@@ -71,7 +71,7 @@
{{:assign var="open_years.%d"|args:$id value=$label|cat:" (du "|cat:$debut|cat:" au "|cat:$fin|cat:")"}}
{{else}}
{{:assign debut=$date_debut|date_short}}
- {{:error message="Aucun exercice ouvert pour enregistrer la sortie de bilan à partir du %s"|args:$debut}}
+ {{:error message="Aucun exercice ouvert pour enregistrer un amortissement à partir du %s"|args:$debut}}
{{/years}}
{{if $years|count == 1}}
{{:assign default_year=$years.0.id}}
@@ -135,7 +135,7 @@
{{:admin_header title="Sortie de bilan" custom_css="./style.css" current="module_amortization"}}
{{if ! $dialog}}
- {{:include file="_nav.html" current="%s"|args:$_GET.type_immo subcurrent="balance_exit"}}
+ {{:include file="_nav.html" current="index" subcurrent="%s"|args:$_GET.type_immo subsubcurrent="balance_exit"}}
{{/if}}
{{:form_errors}}
diff --git a/compute_exit_data.html b/compute_exit_data.html
index f45a6fe..7caf90b 100644
--- a/compute_exit_data.html
+++ b/compute_exit_data.html
@@ -9,9 +9,7 @@
@param date_debut : date de début de la période d'amortissement complémentaire
@param exit_date : date de sortie de l'immobilisation
*}}
-
-{{* TODO boutons de navigation avant-arrière*}}
-
+{{* TODO *}}
{{* données de l'immobilisation *}}
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id|intval keep="info_immo, ligne_immo, message"}}
{{if $message != null}}
@@ -19,7 +17,7 @@
{{/if}}
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_label}}
-{{if $label_immo|strpos:$ligne_immo.line_label === false}}
+{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
{{/if}}
@@ -60,12 +58,7 @@
{{* barre de navigation *}}
{{if ! $dialog}}
- {{if $valeur_nette > 0}}
- {{:assign type_immo="managed"}}
- {{else}}
- {{:assign type_immo="amortized"}}
- {{/if}}
- {{:include file="_nav.html" current="%s"|args:$type_immo subcurrent="balance_exit"}}
+ {{:include file="_nav.html" current="index" subcurrent="balance_exit"}}
{{/if}}
{{:form_errors}}
diff --git a/config.html b/config.html
index a8c91c9..50f295b 100644
--- a/config.html
+++ b/config.html
@@ -46,7 +46,6 @@
{{/form}}
{{:admin_header title="Configuration" custom_css="./style.css" current="module_amortization"}}
-
{{:include file="_nav.html" current="config"}}
{{if $_GET.ok == 1}}
Configuration enregistrée.
@@ -129,7 +128,6 @@
{{/if}}
|