Correction erreur calcul montant + réorganisation affichage
This commit is contained in:
parent
b91c1087ae
commit
061a27d40d
@ -172,139 +172,148 @@
|
|||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:assign project_id=$ligne_immo.project_id}}
|
{{if $solde > 0}}
|
||||||
{{:assign project_label=$ligne_immo.project_label}}
|
{{:assign project_id=$ligne_immo.project_id}}
|
||||||
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
|
{{:assign project_label=$ligne_immo.project_label}}
|
||||||
|
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
|
||||||
<section class="amortissement">
|
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
||||||
<h3 class="ruler">Amortissements à enregistrer</h3>
|
<section class="amortissement">
|
||||||
<table class="list">
|
<h3 class="ruler">Amortissements à enregistrer</h3>
|
||||||
<thead>
|
<table class="list">
|
||||||
<tr>
|
<thead>
|
||||||
<th>N°</th>
|
|
||||||
<th>Date</th>
|
|
||||||
<th class="nombre">Montant</th>
|
|
||||||
<th class="nombre">Solde</th>
|
|
||||||
<th>Libellé</th>
|
|
||||||
<th class="actions"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
|
||||||
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
|
||||||
{{#select id from acc_years where :amort_date >= start_date and :amort_date <= end_date and closed = 0; :amort_date=$date_amort|parse_date}}
|
|
||||||
{{:assign enregistrer=1}}
|
|
||||||
{{:assign current_year=$id}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign enregistrer=0}}
|
|
||||||
{{/select}}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="num">{{"%d+1"|math:$num}}</td>
|
<th>N°</th>
|
||||||
<td>{{$date_amort}}</td>
|
<th>Date</th>
|
||||||
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
<th class="nombre">Montant</th>
|
||||||
<td class="money">{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}}</td>
|
<th class="nombre">Solde</th>
|
||||||
<td>
|
<th>Libellé</th>
|
||||||
{{if $libelle == null}}
|
<th class="actions"></th>
|
||||||
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
|
||||||
{{/if}}
|
|
||||||
{{$libelle}}
|
|
||||||
</td>
|
|
||||||
<td class="actions">
|
|
||||||
{{if $enregistrer == 1}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Enregistrer"
|
|
||||||
href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&immo_id=%s&project_id=%d&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.immo_id:$project_id:$libelle
|
|
||||||
shape="right"
|
|
||||||
target="_dialog"
|
|
||||||
}}
|
|
||||||
{{else}}
|
|
||||||
{{:linkbutton label="Enregistrer" href="" shape="lock" class="disabled"}}
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{{:assign jour=$date_amort|date:"d"}}
|
</thead>
|
||||||
{{:assign mois=$date_amort|date:"m"}}
|
<tbody>
|
||||||
{{:assign annee=$date_amort|date:"Y"}}
|
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
||||||
{{:assign annee="%d+1"|math:$annee}}
|
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
||||||
{{:assign date_amort="%s/%s/%s"|args:$jour:$mois:$annee|parse_date|date_short}}
|
{{#select id from acc_years where :amort_date >= start_date and :amort_date <= end_date and closed = 0; :amort_date=$date_amort|parse_date}}
|
||||||
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
{{:assign enregistrer=1}}
|
||||||
{{if $solde == 0}}{{:break}}{{/if}}
|
{{:assign current_year=$id}}
|
||||||
{{/foreach}}
|
{{else}}
|
||||||
</tbody>
|
{{:assign enregistrer=0}}
|
||||||
</table>
|
{{/select}}
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="amortissement">
|
|
||||||
<h3 class="ruler">Autres amortissements non rattachés</h3>
|
|
||||||
<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>
|
|
||||||
|
|
||||||
{{#select
|
|
||||||
li.id as l_id,
|
|
||||||
li.id_transaction as t_id,
|
|
||||||
li.credit as montant,
|
|
||||||
li.reference,
|
|
||||||
li.label as l_label,
|
|
||||||
trans.date as t_date,
|
|
||||||
trans.label as t_label,
|
|
||||||
acc.code as a_code,
|
|
||||||
acc.label as a_label,
|
|
||||||
y.label as y_label
|
|
||||||
from acc_transactions_lines as li
|
|
||||||
inner join acc_accounts as acc on acc.id = li.id_account
|
|
||||||
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
|
|
||||||
}}
|
|
||||||
{{: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>
|
<tr>
|
||||||
<td class="num"><a href={{$trans_url}}>#{{$t_id}}</a></td>
|
<td class="num">{{"%d+1"|math:$num}}</td>
|
||||||
<td>{{$t_date|date_short}}</td>
|
<td>{{$date_amort}}</td>
|
||||||
<td class="money">{{"%f"|math:$montant|money}}</td>
|
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
||||||
<td>{{if $l_label == null}}
|
<td class="money">{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}}</td>
|
||||||
{{$t_label}}
|
<td>
|
||||||
|
{{if $libelle == null}}
|
||||||
|
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
||||||
|
{{/if}}
|
||||||
|
{{$libelle}}
|
||||||
|
</td>
|
||||||
|
<td class="actions">
|
||||||
|
{{if $enregistrer == 1}}
|
||||||
|
{{:linkbutton
|
||||||
|
label="Enregistrer"
|
||||||
|
href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&immo_id=%s&project_id=%d&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.immo_id:$project_id:$libelle
|
||||||
|
shape="right"
|
||||||
|
target="_dialog"
|
||||||
|
}}
|
||||||
|
{{else}}
|
||||||
|
{{:linkbutton label="Enregistrer" href="" shape="lock" class="disabled"}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{:assign jour=$date_amort|date:"d"}}
|
||||||
|
{{:assign mois=$date_amort|date:"m"}}
|
||||||
|
{{:assign annee=$date_amort|date:"Y"}}
|
||||||
|
{{:assign annee="%d+1"|math:$annee}}
|
||||||
|
{{:assign date_amort="%s/%s/%s"|args:$jour:$mois:$annee|parse_date|date_short}}
|
||||||
|
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
||||||
|
{{if $solde == 0}}{{:break}}{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{* Autres amortissements non rattachés *}}
|
||||||
|
{{#select
|
||||||
|
li.id as l_id,
|
||||||
|
li.id_transaction as t_id,
|
||||||
|
li.credit as montant,
|
||||||
|
li.reference,
|
||||||
|
li.label as l_label,
|
||||||
|
trans.date as t_date,
|
||||||
|
trans.label as t_label,
|
||||||
|
acc.code as a_code,
|
||||||
|
acc.label as a_label,
|
||||||
|
y.label as y_label
|
||||||
|
from acc_transactions_lines as li
|
||||||
|
inner join acc_accounts as acc on acc.id = li.id_account
|
||||||
|
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;
|
||||||
|
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 var=autre_amort.linked value="true"}}
|
||||||
|
{{else}}
|
||||||
|
{{: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>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=$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}}
|
{{else}}
|
||||||
{{$l_label}}
|
{{$line.l_label}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td>{{$a_code}}</td>
|
<td>{{$line.a_code}}</td>
|
||||||
<td>{{$a_label}}</td>
|
<td>{{$line.a_label}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{if $linked != "true"}}
|
{{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}}
|
{{else}}
|
||||||
{{:linkbutton label="Attacher" href="" shape="lock" class="disabled"}}
|
{{:linkbutton label="Attacher" href="" shape="lock" class="disabled"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/foreach}}
|
||||||
{{/select}}
|
</tbody>
|
||||||
</tbody>
|
</table>
|
||||||
</table>
|
</section>
|
||||||
</section>
|
{{/if}}
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
Loading…
Reference in New Issue
Block a user