Prise en compte amortissement multi-lignes
This commit is contained in:
parent
8cf313502e
commit
fb9cb32a44
6 changed files with 152 additions and 69 deletions
|
|
@ -61,7 +61,7 @@
|
|||
{{#select
|
||||
l_amort.credit as amort_amount,
|
||||
l_amort.label as amort_label,
|
||||
l_amort.id as amort_line,
|
||||
l_amort.id as amort_line_id,
|
||||
CASE WHEN links.id_related = t_immo.id
|
||||
THEN links.id_transaction
|
||||
ELSE links.id_related
|
||||
|
|
@ -84,8 +84,20 @@
|
|||
AND account.code LIKE '28%'
|
||||
ORDER BY trans.date;
|
||||
:line_id = $_GET.immo_id|intval
|
||||
assign=linked_lines.
|
||||
assign="amort_line"
|
||||
}}
|
||||
|
||||
{{#load type="link"
|
||||
where="$$.immo_line_id = :immo_line_id AND $$.amort_trans_id = :amort_trans_id"
|
||||
assign="line"
|
||||
:immo_line_id=$_GET.immo_id|intval :amort_trans_id=$amort_line.amort_trans_id
|
||||
}}
|
||||
{{if $line.amort_line_id == $amort_line.amort_line_id}}
|
||||
{{:assign var="linked_amort." value=$amort_line}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{:assign var="linked_amort." value=$amort_line}}
|
||||
{{/load}}
|
||||
{{if $date_debut == null}}
|
||||
{{:assign date_debut=$amort_date}}
|
||||
{{/if}}
|
||||
|
|
@ -96,7 +108,7 @@
|
|||
{{:assign valeur_residuelle=0}}
|
||||
{{else}}
|
||||
{{:assign valeur_residuelle=$ligne_immo.montant}}
|
||||
{{#foreach from=$linked_lines}}
|
||||
{{#foreach from=$linked_amort}}
|
||||
{{:assign valeur_residuelle="%d-%d"|math:$valeur_residuelle:$amort_amount}}
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
|
|
@ -220,7 +232,7 @@
|
|||
</div>
|
||||
|
||||
<h3 class="ruler">Amortissements enregistrés</h3>
|
||||
{{if $linked_lines != null}}
|
||||
{{if $linked_amort != null}}
|
||||
<section class="amortissement">
|
||||
<table class="list">
|
||||
<thead>
|
||||
|
|
@ -236,7 +248,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach from=$linked_lines item="line"}}
|
||||
{{#foreach from=$linked_amort item="line"}}
|
||||
{{* données de l'écriture *}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.amort_trans_id}}
|
||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$line.account_id:$line.amort_year}}
|
||||
|
|
@ -256,7 +268,7 @@
|
|||
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
||||
<td>{{$line.account_label}}</td>
|
||||
<td>
|
||||
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line:$ligne_immo.immo_id shape="minus"}}
|
||||
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line_id:$ligne_immo.immo_id shape="minus"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/foreach}}
|
||||
|
|
@ -273,7 +285,7 @@
|
|||
|
||||
{{if $autres_amortissements}}
|
||||
<p class="block alert">
|
||||
Il existe des écritures d'amortissement qui ne sont pas rattachés à une immobilisation ! <br />
|
||||
Il existe des écritures d'amortissement qui ne sont pas rattachées à une immobilisation ! <br />
|
||||
Utilisez le bouton « Rattacher une écriture » pour les afficher ; vous pourrez choisir d'en attacher certaines à cette immobilisation.
|
||||
</p>
|
||||
{{/if}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue