194 lines
6.9 KiB
HTML
194 lines
6.9 KiB
HTML
{{* -*- brindille -*- *}}
|
|
|
|
{{*
|
|
Lister les écritures d'amortissement associées à une immobilisation
|
|
@param immo_doc_id : id du doc associé à l'immo
|
|
@param type_immo : managed, amortized, archived, others
|
|
*}}
|
|
|
|
{{* données de l'immobilisation *}}
|
|
{{:include file="_get_immo_data.html" immo_doc_id=$_GET.immo_doc_id keep="info_immo, ligne_immo, message"}}
|
|
{{if $message != null}}
|
|
{{:error message=$message}}
|
|
{{/if}}
|
|
|
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}
|
|
{{:assign date_debut=$info_immo.date_mes|or:$info_immo.date_achat|or:$ligne_immo.date_achat}}
|
|
{{:assign label_immo=$info_immo.label|or:$ligne_immo.trans_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}}
|
|
{{if $info_immo.amount != null}}
|
|
{{:assign var="ligne_immo.amount" value=$info_immo.amount}}
|
|
{{/if}}
|
|
|
|
{{if $info_immo.status == 'ignored'}}
|
|
{{:error message="Cette immobilisation ne doit pas être amortie"}}
|
|
{{/if}}
|
|
|
|
{{* déduire le montant des écritures liées à l'immo courante au crédit du même compte *}}
|
|
{{:include file="_get_credit_lines.html" immo_doc_id=$_GET.immo_doc_id keep="total_credits"}}
|
|
{{:assign solde="%d-%d"|math:$ligne_immo.amount:$total_credits}}
|
|
|
|
{{if $info_immo.status == "amortized"}}
|
|
{{:assign amort_amount=$solde}}
|
|
{{:assign valeur_residuelle=0}}
|
|
{{else}}
|
|
{{:assign valeur_residuelle=$solde}}
|
|
{{/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"}}
|
|
{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$total_amort}}
|
|
|
|
{{if $valeur_residuelle > 0}}
|
|
{{* lister les amortissements non rattachés à une immo *}}
|
|
{{:include file="./_get_free_amort.html" filter_condition="1" keep="free_amort_lines"}}
|
|
{{/if}}
|
|
|
|
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortization"}}
|
|
|
|
{{* barre de navigation *}}
|
|
{{if $_GET.type_immo == "amortized" || $valeur_residuelle== 0 }}
|
|
{{:assign subcurrent="amortized"}}
|
|
{{elseif $_GET.type_immo == "archived"}}
|
|
{{:assign subcurrent="archived"}}
|
|
{{elseif $_GET.type_immo == null || $_GET.type_immo == "managed"}}
|
|
{{:assign subcurrent="managed"}}
|
|
{{else}}
|
|
{{:assign subcurrent="other"}}
|
|
{{/if}}
|
|
|
|
{{:include
|
|
file="_nav.html"
|
|
current="index"
|
|
subcurrent="%s"|args:$subcurrent
|
|
subsubcurrent="amortization"
|
|
type_immo=$_GET.type_immo
|
|
autres_amort=$free_amort_lines
|
|
}}
|
|
|
|
{{if $_GET.ok}}
|
|
{{if $_GET.msg|match:"attach"}}
|
|
{{:assign msg="Attachement amortissement %s effectué"|args:$_GET.trans_id}}
|
|
{{elseif $_GET.msg|match:"detach"}}
|
|
{{:assign msg="Détachement amortissement %s affectué"|args:$_GET.trans_id}}
|
|
{{elseif $_GET.msg|match:"amortissement"}}
|
|
{{:assign msg="Amortissement enregistré"}}
|
|
{{/if}}
|
|
<p class="block confirm">{{$msg}}</p>
|
|
{{elseif $_GET.err}}
|
|
{{if $_GET.msg|match:"attach"}}
|
|
{{:assign msg="Échec attachement amortissement"}}
|
|
{{elseif $_GET.msg|match:"amortissement"}}
|
|
{{:assign msg="Échec enregistrement amortissement"}}
|
|
{{/if}}
|
|
<p class="block error">{{$msg}}</p>
|
|
{{/if}}
|
|
|
|
<form method="post" action="">
|
|
<fieldset>
|
|
<legend>Sortir l'immobilisation du bilan ?</legend>
|
|
<p class="submit">
|
|
{{:linkbutton
|
|
label="Sortir du bilan"
|
|
href="balance_sheet_exit.html?immo_doc_id=%s&type_immo=%s"|args:$_GET.immo_doc_id:$_GET.type_immo
|
|
shape="export"
|
|
class="main"
|
|
}}
|
|
</p>
|
|
<p class="help">
|
|
Il sera possible de choisir la date de sortie et d'indiquer
|
|
le montant de la cession le cas échéant.
|
|
</p>
|
|
</fieldset>
|
|
</form>
|
|
|
|
<div class="informations">
|
|
<dl class="describe">
|
|
<dt>Immobilisation</dt>
|
|
<dd><span class="num"><a href="{{$trans_url}}">#{{$ligne_immo.trans_id}}</a></span> {{$label_immo}}</dd>
|
|
<dt>Compte d'immobilisation</dt>
|
|
<dd>{{$ligne_immo.account_code}} — {{$ligne_immo.account_label}}</dd>
|
|
<dt>Début d'amortissement</dt>
|
|
<dd>{{$date_debut|date_short}}</dd>
|
|
{{if $info_immo.duration != null}}
|
|
<dt>Durée</dt>
|
|
<dd>{{$info_immo.duration}} ans</dd>
|
|
{{/if}}
|
|
<dt>Montant de l'immobilisation</dt>
|
|
<dd class="money strong">{{"%f"|math:$ligne_immo.amount|money_currency_html:false|raw}}</dd>
|
|
{{if $total_credits > 0}}
|
|
<dt>Montant des avoirs</dt>
|
|
<dd class="money">{{"%f"|math:$total_credits|money_currency_html:false|raw}}</dd>
|
|
<dt>Montant à amortir</dt>
|
|
<dd class="money strong">{{"%f"|math:$solde|money_currency_html:false|raw}}</dd>
|
|
{{/if}}
|
|
{{if $valeur_residuelle > 0}}
|
|
<dt>Montant des amortissements</dt>
|
|
<dd>{{"%d-%d"|math:$solde:$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
|
<dt>Valeur nette résiduelle</dt>
|
|
<dd>{{$valeur_residuelle|money_currency_html:false|raw}}</dd>
|
|
{{/if}}
|
|
{{if $info_immo.duration != null && $valeur_residuelle > 0}}
|
|
<dt>Annuité estimée</dt>
|
|
<dd>{{"min(%d, %f/%d)"|math:$valeur_residuelle:$solde:$info_immo.duration|money_currency_html:false|raw}}</dd>
|
|
{{/if}}
|
|
</dl>
|
|
</div>
|
|
|
|
<h3 class="ruler">Amortissements enregistrés</h3>
|
|
{{if $linked_amort != null}}
|
|
<section class="amortissement">
|
|
<table class="list">
|
|
<thead>
|
|
<tr>
|
|
<th class="num">N°</th>
|
|
<th>Date</th>
|
|
<th>Libellé</th>
|
|
<th class="nombre">Montant</th>
|
|
<th class="nombre">Valeur nette</th>
|
|
<th>N° compte</th>
|
|
<th>Compte</th>
|
|
<th class="actions"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{#foreach from=$linked_amort|ksort item="line"}}
|
|
{{* données de l'écriture *}}
|
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.trans_id}}
|
|
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.year}}
|
|
{{:assign solde="%f-%d"|math:$solde:$line.amount}}
|
|
<tr>
|
|
<td class="num"><a href="{{$trans_url}}">#{{$line.trans_id}}</a></td>
|
|
<td>{{$line.date|date_short}}</td>
|
|
<td>
|
|
{{$line.trans_label}}
|
|
{{if $line.line_label != null && $line.line_label != $line.trans_label}}
|
|
— {{$line.line_label}}
|
|
{{/if}}
|
|
</td>
|
|
<td class="money">{{"%f"|math:$line.amount|money_html:false|raw}}</td>
|
|
<td class="money">{{"%f"|math:$solde|money_html:false|raw}}</td>
|
|
<td><a href="{{$compte_url}}">{{$line.account_code}}</a></td>
|
|
<td>{{$line.account_label}}</td>
|
|
<td>
|
|
{{:linkbutton label="Détacher" href="detach_amort.html?immo_doc_id=%s&amort_line_id=%s"|args:$_GET.immo_doc_id:$line.line_id shape="minus"}}
|
|
</td>
|
|
</tr>
|
|
{{/foreach}}
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
{{else}}
|
|
<p class="block alert">Aucun amortissement enregistré pour cette immobilisation</p>
|
|
{{/if}}
|
|
|
|
{{if $free_amort_lines}}
|
|
<p class="block alert">
|
|
Il y a des écritures d'amortissement qui ne sont pas rattachées à une immobilisation ! <br />
|
|
Utilisez le bouton « Rattacher un amortissement » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
|
</p>
|
|
{{/if}}
|
|
{{:form_errors}}
|
|
{{:admin_footer}}
|