Sortie immobilisation du bilan
This commit is contained in:
parent
d669b5c95b
commit
ea8d805dba
8 changed files with 939 additions and 21 deletions
|
|
@ -28,10 +28,10 @@
|
|||
{{:read file="./defaut.json" assign="config_json"}}
|
||||
{{:assign config_defaut=$config_json|json_decode}}
|
||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
||||
{{:assign quote="'"}}
|
||||
{{:assign condition="("}}
|
||||
{{#foreach from=$prefix_array item="code"}}
|
||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$quote|cat:$code|cat:"%"|cat:$quote|cat:" OR "}}
|
||||
{{:assign code=$code|cat:"%"|quote_sql}}
|
||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
||||
{{/foreach}}
|
||||
{{:assign condition=$condition|cat:"0)"}}
|
||||
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
{{* voir si l'immo est prise en charge *}}
|
||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
||||
{{:assign duration=$duration}}
|
||||
{{if $noamort}}
|
||||
{{if $status == "ignored"}}
|
||||
{{:assign amortissable="non"}}
|
||||
{{else}}
|
||||
{{:assign amortissable="oui"}}
|
||||
|
|
@ -71,6 +71,32 @@
|
|||
{{if $amortissable == "non"}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{* voir s'il existe une écriture qui solde l'immobilisation *}}
|
||||
{{:assign ignore=false}}
|
||||
{{#select
|
||||
line.id AS line,
|
||||
line.id_transaction AS trans,
|
||||
line.debit,
|
||||
line.label,
|
||||
line2.id AS line2,
|
||||
line2.id_transaction AS trans2,
|
||||
line2.credit,
|
||||
line2.label
|
||||
FROM acc_transactions_lines AS line
|
||||
INNER JOIN acc_accounts AS acc ON acc.id = line.id_account
|
||||
INNER JOIN acc_transactions_lines AS line2 ON line2.id_account = acc.id
|
||||
WHERE
|
||||
line.id = :line_id
|
||||
AND line2.credit = line.debit;
|
||||
:line_id = $immo_id|intval
|
||||
}}
|
||||
{{:assign ignore=true}}
|
||||
{{/select}}
|
||||
{{if $ignore}}
|
||||
{{:continue}}
|
||||
{{/if}}
|
||||
|
||||
{{* voir s'il existe des écritures d'amortissement associées *}}
|
||||
{{#select
|
||||
sum(l_amort.credit) as amort_amount,
|
||||
|
|
@ -104,7 +130,8 @@
|
|||
{{:assign exist_amort=true}}
|
||||
{{/if}}
|
||||
{{/select}}
|
||||
{{* immo amortie ? *}}
|
||||
|
||||
{{* classement par onglet *}}
|
||||
{{if $amort == "encours" && $amort_amount >= $debit ||
|
||||
$amort == "fini" && $amort_amount < $debit ||
|
||||
$amortissable == "nsp" && ! $exist_amort
|
||||
|
|
@ -135,19 +162,13 @@
|
|||
target="_dialog"
|
||||
}}
|
||||
{{/if}}
|
||||
{{if $amort == "encours"}}
|
||||
{{if $amort == "encours" || $amort == "fini"}}
|
||||
{{:linkbutton
|
||||
label="Cession"
|
||||
href=""
|
||||
shape="money"
|
||||
}}
|
||||
{{elseif $amort == "fini"}}
|
||||
{{:linkbutton
|
||||
label="Rebut"
|
||||
href=""
|
||||
label="Sortir du bilan"
|
||||
href="balance_sheet_exit.html?immo_id=%s"|args:$immo_id
|
||||
shape="export"
|
||||
}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{:linkbutton
|
||||
label="Amortissements"
|
||||
href="amortization.html?immo_id=%s&amort=%s"|args:$immo_id:$amort
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue