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
1 changed files with 129 additions and 120 deletions

View File

@ -172,11 +172,12 @@
</section>
{{/if}}
{{:assign project_id=$ligne_immo.project_id}}
{{:assign project_label=$ligne_immo.project_label}}
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
<section class="amortissement">
{{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">
<thead>
@ -232,25 +233,11 @@
{{/foreach}}
</tbody>
</table>
</section>
</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>
{{#select
{{* Autres amortissements non rattachés *}}
{{#select
li.id as l_id,
li.id_transaction as t_id,
li.credit as montant,
@ -266,45 +253,67 @@
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
id_transaction,
id_related
from acc_transactions_links
where id_transaction = :id_amort or id_related = :id_amort;
:id_amort=$t_id}}
{{:assign linked="true"}}
{{/select}}
{{if $linked != "true"}}
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$t_id}}
<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}}
:id_amort=$t_id
}}
{{:assign var=autre_amort.linked value="true"}}
{{else}}
{{$l_label}}
{{:assign var="autres_amortissements." value=$autre_amort}}
{{/select}}
{{/select}}
{{if $autres_amortissements != null}}
<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>
{{#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}}
{{$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>
</section>
{{/if}}
{{:form_errors}}
{{:admin_footer}}