Correction erreur calcul montant + réorganisation affichage

This commit is contained in:
Jean-Christophe Engel 2024-03-19 16:05:39 +01:00
parent b91c1087ae
commit 061a27d40d

View File

@ -172,10 +172,11 @@
</section>
{{/if}}
{{if $solde > 0}}
{{:assign project_id=$ligne_immo.project_id}}
{{:assign project_label=$ligne_immo.project_label}}
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
<section class="amortissement">
<h3 class="ruler">Amortissements à enregistrer</h3>
<table class="list">
@ -233,23 +234,9 @@
</tbody>
</table>
</section>
{{/if}}
<section class="amortissement">
<h3 class="ruler">Autres amortissements non rattachés</h3>
<table class="list">
<thead>
<tr>
<th></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>
{{* Autres amortissements non rattachés *}}
{{#select
li.id as l_id,
li.id_transaction as t_id,
@ -266,7 +253,8 @@
inner join acc_transactions as trans on trans.id = li.id_transaction
inner join acc_years as y on y.id = trans.id_year
where acc.code like "28%"
order by trans.date, trans.label
order by trans.date, trans.label;
assign=autre_amort
}}
{{:assign linked="false"}}
{{#select
@ -274,37 +262,58 @@
id_related
from acc_transactions_links
where id_transaction = :id_amort or id_related = :id_amort;
:id_amort=$t_id}}
{{:assign linked="true"}}
:id_amort=$t_id
}}
{{:assign var=autre_amort.linked value="true"}}
{{else}}
{{:assign var="autres_amortissements." value=$autre_amort}}
{{/select}}
{{/select}}
{{if $linked != "true"}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$t_id}}
{{if $autres_amortissements != null}}
<section class="amortissement">
<h3 class="ruler">Autres amortissements non rattachés</h3>
<table class="list">
<thead>
<tr>
<td class="num"><a href={{$trans_url}}>#{{$t_id}}</a></td>
<td>{{$t_date|date_short}}</td>
<td class="money">{{"%f"|math:$montant|money}}</td>
<td>{{if $l_label == null}}
{{$t_label}}
<th></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=$autres_amortissements item="line"}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_id}}
<tr>
<td class="num"><a href={{$trans_url}}>#{{$line.t_id}}</a></td>
<td>{{$line.t_date|date_short}}</td>
<td class="money">{{"%f"|math:$line.montant|money}}</td>
<td>{{if $line.l_label == null}}
{{$line.t_label}}
{{else}}
{{$l_label}}
{{$line.l_label}}
{{/if}}
</td>
<td>{{$a_code}}</td>
<td>{{$a_label}}</td>
<td>{{$line.a_code}}</td>
<td>{{$line.a_label}}</td>
<td>
{{if $linked != "true"}}
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$l_id:$ligne_immo.immo_id shape="plus"}}
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}}
{{else}}
{{:linkbutton label="Attacher" href="" shape="lock" class="disabled"}}
{{/if}}
</td>
</tr>
{{/if}}
{{/select}}
{{/foreach}}
</tbody>
</table>
</section>
{{/if}}
{{:form_errors}}
{{:admin_footer}}