142 lines
4.7 KiB
HTML
142 lines
4.7 KiB
HTML
{{* -*- brindille -*- *}}
|
|
|
|
{{*
|
|
Lister les écritures au crédit du compte de l'immobilisation
|
|
paramètre et proposer de les attacher à l'immo paramètre
|
|
@param immo_doc_id : document associé à l'immo
|
|
*}}
|
|
|
|
{{#load id=$_GET.immo_doc_id|intval assign="info_immo"}}
|
|
{{else}}
|
|
{{:error message="Informations de l'immobilisation non trouvées"}}
|
|
{{/load}}
|
|
|
|
{{* récupérer les infos de l'immobilisation *}}
|
|
{{#select
|
|
trans.id as immo_trans_id,
|
|
trans.label as label,
|
|
trans.date as date_achat,
|
|
line.id as immo_line_id,
|
|
line.label as line_label,
|
|
line.debit as montant,
|
|
account.code as account_code
|
|
FROM acc_transactions_lines AS line
|
|
INNER JOIN acc_transactions AS trans ON line.id_transaction = trans.id
|
|
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
|
WHERE line.id = :line_id;
|
|
:line_id = $info_immo.line
|
|
assign="ligne_immo"
|
|
}}
|
|
{{else}}
|
|
{{:error message="Immobilisation « %s » non trouvée"|args:$info_immo.line}}
|
|
{{/select}}
|
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.immo_trans_id}}
|
|
{{:assign label_immo=$ligne_immo.label}}
|
|
{{if $ligne_immo.line_label != null && $ligne_immo.line_label != $label_immo}}
|
|
{{:assign label_immo=$label_immo|cat:" — "|cat:$ligne_immo.line_label}}
|
|
{{/if}}
|
|
|
|
{{*
|
|
lister les écritures au crédit du compte de l'immobilisation
|
|
variante : utiliser une jointure ; pas forcément plus efficace
|
|
*}}
|
|
{{#select
|
|
line.id as credit_line_id,
|
|
line.id_transaction as credit_trans_id,
|
|
line.credit as credit_amount,
|
|
line.label as line_label,
|
|
trans.id as immo_trans_id,
|
|
trans.date as trans_date,
|
|
trans.label as trans_label,
|
|
trans.id_year as credit_year,
|
|
account.id as account_id,
|
|
account.code as account_code,
|
|
account.label as account_label
|
|
FROM acc_transactions_lines AS line
|
|
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
|
|
AND credit_trans_id NOT IN (
|
|
SELECT
|
|
CASE WHEN id_transaction = credit_trans_id THEN id_transaction
|
|
ELSE id_related
|
|
END AS other_id
|
|
FROM acc_transactions_links WHERE other_id = credit_trans_id)
|
|
ORDER BY trans.date, trans.label;
|
|
:account_code = $ligne_immo.account_code
|
|
assign="other_immos."
|
|
}}
|
|
{{/select}}
|
|
|
|
{{:admin_header title="Écritures au crédit du compte d'immobilisation" custom_css="./style.css" current="module_amortization"}}
|
|
|
|
{{* barre de navigation *}}
|
|
{{if ! $dialog}}
|
|
{{:include
|
|
file="_nav.html"
|
|
current="config"
|
|
subcurrent="other"
|
|
subsubcurrent="immo"
|
|
type_immo="other"
|
|
}}
|
|
{{/if}}
|
|
|
|
<section class="immobilisation">
|
|
<fieldset>
|
|
<legend>
|
|
Écritures au crédit du compte d'immobilisation « {{$ligne_immo.account_code}} »
|
|
</legend>
|
|
|
|
<div class="informations">
|
|
<dl class="describe">
|
|
<dt>Immobilisation</dt>
|
|
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.immo_trans_id}}</a></span> {{$label_immo}}</dd>
|
|
<dt>Montant</dt>
|
|
<dd class="money strong">{{"%f"|math:$ligne_immo.montant|money_currency_html:false|raw}}</dd>
|
|
<dt>Date de l'écriture d'immobilisation</dt>
|
|
<dd>{{$ligne_immo.date_achat|date_short}}</dd>
|
|
</dl>
|
|
</div>
|
|
</fieldset>
|
|
|
|
{{if $other_immos != null}}
|
|
<table class="list">
|
|
<thead>
|
|
<tr>
|
|
<th>N°</th>
|
|
<th>Date</th>
|
|
<th class="nombre">Montant</th>
|
|
<th>Libellé</th>
|
|
<th>N° compte</th>
|
|
<th>Compte</th>
|
|
<th class="actions"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{#foreach from=$other_immos item="line"}}
|
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.credit_trans_id}}
|
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.credit_year}}
|
|
<tr>
|
|
<td class="num"><a href="{{$trans_url}}">#{{$line.credit_trans_id}}</a></td>
|
|
<td>{{$line.trans_date|date_short}}</td>
|
|
<td class="money">{{"%f"|math:$line.credit_amount|money_html:false|raw}}</td>
|
|
<td>{{$line.trans_label}}
|
|
{{if $line.line_label != null && $line.line_label != $line.trans_label}} - {{$line.line_label}}{{/if}}
|
|
</td>
|
|
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
|
<td>{{$line.account_label}}</td>
|
|
<td>
|
|
{{:linkbutton label="Attacher" href="attach_immo.html?credit_line_id=%d&immo_doc_id=%s"|args:$line.credit_line_id:$_GET.immo_doc_id shape="plus"}}
|
|
</td>
|
|
</tr>
|
|
{{/foreach}}
|
|
</tbody>
|
|
</table>
|
|
<p class="help">Sélectionner une écriture d'avoir ou autre réduction du montant de l'acquisition pour l'associer à l'immobilisation</p>
|
|
{{else}}
|
|
<p class="block alert">Aucune écriture au crédit du compte « {{$ligne_immo.account_code}} »</p>
|
|
{{/if}}
|
|
</section>
|
|
{{:form_errors}}
|
|
{{:admin_footer}}
|