diff --git a/_get_amort_lines.html b/_get_amort_lines.html
index a985fa2..dd115e8 100644
--- a/_get_amort_lines.html
+++ b/_get_amort_lines.html
@@ -5,6 +5,7 @@
@param immo_doc_id : id du doc associé à l'immobilisation
@result linked_amort : lignes d'amortissement liées à la ligne d'immobilisation
@result total_amort : montant total des amortissements de l'immobilisation
+ @result created_amort : vrai s'il y a au moins un amortissement créé par le module dans la liste
*}}
{{:assign total_amort=0}}
@@ -33,6 +34,10 @@
assign="amort_line"
}}
{{:assign var="amort_line.amount" value=$amort_info.amount|or:$amort_line.amount}}
+ {{if $amort_info.created}}
+ {{:assign var="amort_line.created" value=true}}
+ {{:assign var="created_amort" value=true}}
+ {{/if}}
{{:assign var="linked_amort.%s_%d"|args:$amort_line.date:$amort_info.id value=$amort_line}}
{{:assign total_amort="%d+%d"|math:$total_amort:$amort_line.amount}}
{{/select}}
diff --git a/_get_free_amort.html b/_get_free_amort.html
index a3373a4..1e9809e 100644
--- a/_get_free_amort.html
+++ b/_get_free_amort.html
@@ -18,7 +18,7 @@
FROM acc_transactions_lines AS line
INNER JOIN acc_accounts AS account ON account.id = line.id_account
INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
- WHERE account.code LIKE "28%" AND credit > 0 AND (NOT trans.status & 16) AND !filter_condition
+ WHERE credit > 0 AND (NOT trans.status & 16) AND !filter_condition
ORDER BY trans.date, trans.label;
!filter_condition=$filter_condition
assign="amort_line"
diff --git a/amortization.html b/amortization.html
index 2613641..f80b761 100644
--- a/amortization.html
+++ b/amortization.html
@@ -38,12 +38,14 @@
{{/if}}
{{* 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"}}
+{{: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}}
{{if $valeur_residuelle > 0}}
{{* lister les amortissements non attachés à une immo *}}
- {{:include file="./_get_free_amort.html" filter_condition="1" keep="free_amort_lines"}}
+ {{:assign account_filter="28%"|quote_sql}}
+ {{:assign filter_condition="account.code LIKE "|cat:$account_filter}}
+ {{:include file="./_get_free_amort.html" filter_condition=$filter_condition keep="free_amort_lines"}}
{{/if}}
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortization"}}
@@ -110,11 +112,11 @@