diff --git a/add_infos.html b/add_infos.html
index 718f8a1..65eddda 100644
--- a/add_infos.html
+++ b/add_infos.html
@@ -27,11 +27,13 @@
{{/select}}
{{* chercher les liaisons de l'écriture d'immobilisation *}}
+{{:assign total_credits=0}}
{{#select
CASE links.id_related = :immo_trans_id
WHEN true THEN links.id_transaction
WHEN false THEN links.id_related
END as linked_id,
+ line.credit,
acc.code
FROM acc_transactions_links as links
INNER JOIN acc_transactions_lines AS line on line.id_transaction = linked_id
@@ -41,6 +43,7 @@
;
:immo_trans_id = $ligne_immo.immo_trans_id
}}
+ {{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
{{:assign var="linked_transactions.%d."|args:$code value=$linked_id}}
{{/select}}
{{:assign var="immo_transactions" from="linked_transactions.%d"|args:$ligne_immo.code}}
@@ -173,8 +176,14 @@
- Immobilisation
- #{{$ligne_immo.immo_trans_id}} {{$ligne_immo.label}}{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $ligne_immo.label}} — {{$ligne_immo.line_label}}{{/if}}
- - Montant
+ - Montant de l'immobilisation
- {{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}
+ {{if $total_credits > 0}}
+ - Montant des avoirs
+ - {{"%f"|math:$total_credits|money_currency_html:false|raw}}
+ - Montant à amortir
+ - {{"%d-%d"|math:$ligne_immo.montant:$total_credits|money_currency_html:false|raw}}
+ {{/if}}
- Date de l'écriture d'immobilisation
- {{$ligne_immo.date_achat|date_short}}
diff --git a/amortization.html b/amortization.html
index 12df9fa..3875a05 100644
--- a/amortization.html
+++ b/amortization.html
@@ -59,8 +59,8 @@
}}
{{:assign total_credits="%d+%d"|math:$total_credits:$credit}}
{{/select}}
-{{:assign var="ligne_immo.montant" value="%d-%d"|math:$ligne_immo.montant:$total_credits}}
-{{:assign solde=$ligne_immo.montant}}
+{{:assign montant_amortissable="%d-%d"|math:$ligne_immo.montant:$total_credits}}
+{{:assign solde=$montant_amortissable}}
{{* lister les lignes des écritures d'amortissement liées à l'immobilisation *}}
{{#select
@@ -105,10 +105,10 @@
{{/select}}
{{if $status == "amortized"}}
- {{:assign amort_amount=$ligne_immo.montant}}
+ {{:assign amort_amount=$montant_amortissable}}
{{:assign valeur_residuelle=0}}
{{else}}
- {{:assign valeur_residuelle=$ligne_immo.montant}}
+ {{:assign valeur_residuelle=$montant_amortissable}}
{{#foreach from=$linked_amort}}
{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$amort_amount}}
{{/foreach}}
@@ -239,8 +239,14 @@
- Immobilisation
- #{{$ligne_immo.immo_trans_id}} {{$ligne_immo.label}}{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $ligne_immo.label}} — {{$ligne_immo.line_label}}{{/if}}
- - Montant
+ - Montant de l'immobilisation
- {{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}
+ {{if $total_credits > 0}}
+ - Montant des avoirs
+ - {{"%f"|math:$total_credits|money_currency_html:false|raw}}
+ - Montant à amortir
+ - {{"%f"|math:$montant_amortissable|money_currency_html:false|raw}}
+ {{/if}}
- Début d'amortissement
- {{$date_debut|date_short}}
{{if $duree != null}}
@@ -249,13 +255,13 @@
{{/if}}
{{if $valeur_residuelle > 0}}
- Montant des amortissements
- - {{"%d-%d"|math:$ligne_immo.montant:$valeur_residuelle|money_currency_html:false|raw}}
+ - {{"%d-%d"|math:$montant_amortissable:$valeur_residuelle|money_currency_html:false|raw}}
- Valeur nette comptable
- {{$valeur_residuelle|money_currency_html:false|raw}}
{{/if}}
{{if $duree != null && $valeur_residuelle > 0}}
- Annuité estimée
- - {{"min(%d, %f/%d)"|math:$valeur_residuelle:$ligne_immo.montant:$duree|money_currency_html:false|raw}}
+ - {{"min(%d, %f/%d)"|math:$valeur_residuelle:$montant_amortissable:$duree|money_currency_html:false|raw}}
{{/if}}