diff --git a/_archives.html b/_archives.html
index ce92aff..a4356d6 100644
--- a/_archives.html
+++ b/_archives.html
@@ -153,7 +153,7 @@
{{$account_code}} |
{{$account_label}} |
- {{:linkbutton label="Modifier" href="exit_step4.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}}
+ {{:linkbutton label="Modifier" href="exit_step1.html?immo_doc_id=%s"|args:$info_immo.id shape="edit"}}
|
{{/select}}
diff --git a/exit_step1.html b/exit_step1.html
index 0fc2fb1..0b85eb9 100644
--- a/exit_step1.html
+++ b/exit_step1.html
@@ -32,6 +32,7 @@
- line.credit < ligne_immo.amount => peut-être un avoir
- line.credit = ligne_immo.amount - avoirs => écriture de sortie du bilan
*}}
+{{:assign account_code=$ligne_immo.account_code|cat:"%"}}
{{#select
trans.id as trans_id,
trans.label as trans_label,
@@ -40,15 +41,15 @@
line.id as credit_line_id,
line.label as line_label,
line.credit as amount,
- acc.id as account_id,
- acc.code as account_code,
- acc.label as account_label
+ account.id as account_id,
+ account.code as account_code,
+ account.label as account_label
FROM acc_transactions AS trans
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
+ INNER JOIN acc_accounts AS account ON line.id_account = account.id
LEFT JOIN module_data_amortization AS mda ON json_extract(mda.document, '$.amort_line_id') = line.id
WHERE
- acc.code = :acc_code
+ account.code LIKE :account_code
AND line.credit > 0
AND credit_line_id NOT IN (
SELECT json_extract(credit_link.document, '$.credit_line_id') AS line_id FROM !table as credit_link
@@ -58,7 +59,7 @@
WHERE json_extract(exit_link.document, '$.type') == "exit_link"
)
;
- :acc_code=$ligne_immo.account_code
+ :account_code=$account_code
!table =$module.table
assign="credit_line"
}}
@@ -75,7 +76,6 @@
}}
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
-{{* TODO écritures d'amort pas entièrement affectées *}}
{{#select
line.id as amort_line_id,
line.credit as amort_amount,
@@ -105,7 +105,7 @@
{{:assign keep_amort=true}}
{{#load type="amort_link"
where="$$.amort_line_id = :amort_line_id"
- :amort_line_id=$amort_line.amort_line_id|intval
+ :amort_line_id=$amort_line.amort_line_id
assign="amort_link"
}}
{{if $amort_link.amount == null || $amort_link.amount == 0}}
@@ -123,6 +123,7 @@
{{/select}}
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
+{{:include file="_nav.html" current="archived" subcurrent="exit"}}
{{if $_GET.ok}}
{{if $_GET.msg|match:"attach_avoir"}}
diff --git a/exit_step2.html b/exit_step2.html
index 8199426..ee740ff 100644
--- a/exit_step2.html
+++ b/exit_step2.html
@@ -43,7 +43,6 @@
}}
{{* chercher des écritures d'amortissement correspondant au compte d'une immo sans doc associé *}}
-{{* TODO écritures d'amort pas entièrement affectées *}}
{{#select
line.id as amort_line_id,
line.credit as amort_amount,
@@ -91,6 +90,7 @@
{{/select}}
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
+{{:include file="_nav.html" current="archived" subcurrent="exit"}}
{{if $_GET.ok}}
{{if $_GET.msg|match:"attach_amort"}}
diff --git a/exit_step3.html b/exit_step3.html
index 5d8ff0d..458357c 100644
--- a/exit_step3.html
+++ b/exit_step3.html
@@ -1,6 +1,5 @@
{{* -*- brindille -*- *}}
-{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
{{*
Associer une écriture de cession à une immo créée et sortie du
bilan avant la mise en service du module
@@ -59,6 +58,21 @@
assign="line"
}}
{{* voir si l'écriture de cession est déjà liée à une immo *}}
+ {{* TODO VOIR SI TUTILE
+ {{#load type="cession_link"
+ where="$$.cession_line_id = :cession_line_id"
+ :cession_line_id = $line.line_id
+ assign="cession_link"
+ }}
+{{:debug line=$line cession_link=$cession_link}}
+ {{:assign total_cession="%d+%d"|math:$total_cession:$line.amount}}
+ {{:assign var="line.linked_id" value=$linked_id}}
+ {{:assign var="linked_cessions." value=$line}}
+ {{else}}
+ {{:assign var="free_cessions." value=$line}}
+ {{/load}}
+*}}
+
{{#select
CASE WHEN links.id_related = :trans_id
THEN links.id_transaction
@@ -80,6 +94,9 @@
{{/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"}}
+{{:include file="_nav.html" current="archived" subcurrent="exit"}}
+
{{if $_GET.ok}}
{{if $_GET.msg|match:"attach_cession"}}
{{:assign msg="Écriture de cession attachée"}}
diff --git a/exit_step4.html b/exit_step4.html
index ccb6d7f..8a2b51e 100644
--- a/exit_step4.html
+++ b/exit_step4.html
@@ -164,6 +164,7 @@
{{/select}}
{{:admin_header title="Immobilisation sortie du bilan" custom_css="./style.css" current="module_amortization"}}
+{{:include file="_nav.html" current="archived" subcurrent="exit"}}
{{if $_GET.ok}}
{{if $_GET.msg|match:"attach_exit"}}
diff --git a/link_immo.html b/link_immo.html
index ddee4dd..557b0e8 100644
--- a/link_immo.html
+++ b/link_immo.html
@@ -18,6 +18,7 @@
{{*
lister les écritures au crédit du compte de l'immobilisation
*}}
+{{:assign account_code=$ligne_immo.account_code|cat:"%"}}
{{#select
line.id as credit_line_id,
line.id_transaction as credit_trans_id,
@@ -34,12 +35,15 @@
INNER JOIN acc_transactions AS trans ON trans.id = line.id_transaction
INNER JOIN acc_accounts AS account ON account.id = line.id_account
INNER JOIN acc_years AS y ON y.id = trans.id_year
- WHERE account.code = :account_code AND credit > 0
+ WHERE account.code LIKE :account_code AND credit > 0
AND credit_line_id NOT IN (
SELECT json_extract(link.document, '$.credit_line_id') AS credit_line_id FROM !table as link
- WHERE json_extract(link.document, '$.type') == "credit_link")
+ WHERE json_extract(link.document, '$.type') == "credit_link"
+ UNION
+ SELECT json_extract(exit_link.document, '$.exit_line_id') AS line_id FROM !table as exit_link
+ WHERE json_extract(exit_link.document, '$.type') == "exit_link")
ORDER BY trans.date, trans.label;
- :account_code = $ligne_immo.account_code
+ :account_code = $account_code
!table =$module.table
assign="other_immos."
}}
@@ -60,7 +64,7 @@