101 lines
3 KiB
HTML
101 lines
3 KiB
HTML
{{* -*- brindille -*- *}}
|
|
|
|
{{* Liste des immobilisations en cours de constitution *}}
|
|
|
|
<section class="immobilisation">
|
|
|
|
<p class="help">
|
|
Cette page liste les immobilisations en cours de constitution, donc non amortissables
|
|
</p>
|
|
|
|
<table class="list">
|
|
<thead>
|
|
<tr>
|
|
<th>N°</th>
|
|
<th>Date</th>
|
|
<th>Libellé</th>
|
|
<th class="nombre">Montant</th>
|
|
<th>N° compte</th>
|
|
<th>Compte</th>
|
|
<th class="actions"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
{{* lister les immobilisations en cours de constitution *}}
|
|
{{:include file="_get_config.html" keep="config.prefixes"}}
|
|
{{:assign condition="("}}
|
|
{{#foreach from=$config.prefixes item="code"}}
|
|
{{if $code|substr:0:2 == "23"}}
|
|
{{:assign code=$code|cat:"%"|quote_sql}}
|
|
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$code|cat:" OR "}}
|
|
{{/if}}
|
|
{{/foreach}}
|
|
{{:assign condition=$condition|cat:"0)"}}
|
|
{{:assign condition=$condition|cat:" AND debit > 0 AND NOT (trans.status & 16)"}}
|
|
{{:assign nb_immo=0}}
|
|
|
|
{{#select
|
|
trans.id as trans_id,
|
|
trans.label as trans_label,
|
|
trans.date as trans_date,
|
|
line.id as immo_id,
|
|
account.id as account_id,
|
|
account.code as account_code,
|
|
account.label as account_label,
|
|
sum(line.debit) AS debit,
|
|
trans.id_year as trans_id_year
|
|
FROM acc_transactions AS trans
|
|
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
|
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
|
WHERE !condition
|
|
GROUP BY trans.id
|
|
ORDER BY trans.date DESC;
|
|
!condition=$condition
|
|
}}
|
|
{{* 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}}
|
|
|
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
|
{{:assign nb_immo="%d+1"|math:$nb_immo}}
|
|
|
|
<tr>
|
|
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
|
<td>{{$trans_date|date_short}}</td>
|
|
<td>{{$trans_label}}</td>
|
|
<td class="money">{{"%f"|math:$debit|money:false}}</td>
|
|
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
|
<td>{{$account_label}}</td>
|
|
<td class="actions"></td>
|
|
</tr>
|
|
{{/select}}
|
|
</tbody>
|
|
</table>
|
|
{{if $nb_immo == 0}}
|
|
<p class="block alert">Aucune immobilisation</p>
|
|
{{/if}}
|
|
</section>
|