amortization : simplifications et amélioration présentation
This commit is contained in:
parent
0f1f3ed56d
commit
1637f6eafd
1 changed files with 32 additions and 23 deletions
|
@ -57,9 +57,9 @@
|
|||
{{/select}}
|
||||
{{:assign date_debut=$ligne_immo.date}}
|
||||
|
||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||
{{:assign var="duree" from="info_immo.duration"|args:$_GET.immo_id}}
|
||||
{{:assign date_debut=$info_immo.date}}
|
||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||
{{:assign duree=$duration}}
|
||||
{{:assign date_debut=$date}}
|
||||
{{/load}}
|
||||
|
||||
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||
|
@ -67,9 +67,9 @@
|
|||
l_amort.credit as amort_amount,
|
||||
l_amort.label as amort_label,
|
||||
l_amort.id as amort_line,
|
||||
CASE links.id_related = t_immo.id
|
||||
WHEN true THEN links.id_transaction
|
||||
WHEN false THEN links.id_related
|
||||
CASE WHEN links.id_related = t_immo.id
|
||||
THEN links.id_transaction
|
||||
ELSE links.id_related
|
||||
END as amort_trans_id,
|
||||
trans.date as amort_date,
|
||||
trans.label as trans_label,
|
||||
|
@ -80,25 +80,19 @@
|
|||
FROM acc_transactions_lines as l_immo
|
||||
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
|
||||
INNER JOIN acc_transactions_links as links
|
||||
ON (
|
||||
t_immo.id = links.id_transaction
|
||||
ON (t_immo.id = links.id_transaction
|
||||
OR
|
||||
t_immo.id = links.id_related
|
||||
)
|
||||
t_immo.id = links.id_related)
|
||||
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
||||
INNER join acc_transactions as trans on l_amort.id_transaction = trans.id
|
||||
INNER join acc_accounts as account on l_amort.id_account = account.id
|
||||
WHERE
|
||||
l_immo.id = :line_id
|
||||
AND
|
||||
l_amort.credit <> 0
|
||||
AND
|
||||
account.code LIKE '28%'
|
||||
AND account.code LIKE '28%'
|
||||
ORDER BY trans.date;
|
||||
:line_id = $_GET.immo_id|intval
|
||||
assign=linked_lines.
|
||||
}}
|
||||
{{:assign var="amort_years." value=$amort_year}}
|
||||
{{if $date_debut == null}}
|
||||
{{:assign date_debut=$amort_date}}
|
||||
{{/if}}
|
||||
|
@ -170,7 +164,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="plus"}}
|
||||
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line:$ligne_immo.immo_id shape="minus"}}
|
||||
</td>
|
||||
</tr>
|
||||
{{:assign annuite_courante=$annuite}}
|
||||
|
@ -187,6 +181,20 @@
|
|||
{{:assign project_label=$ligne_immo.project_label}}
|
||||
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
|
||||
{{:assign annuite_courante="min(%f,%f)"|math:$annuite_courante:$solde}}
|
||||
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
||||
|
||||
{{* infos des comptes d'immo et d'amortissement *}}
|
||||
{{#sql select="code, id_chart" tables="acc_accounts" where="id = :id" :id=$ligne_immo.account_id assign="immo_account"}}
|
||||
{{/sql}}
|
||||
{{:include
|
||||
file="./_get_amort_code.html"
|
||||
code_immo=$immo_account.code
|
||||
keep="code_amort"
|
||||
}}
|
||||
{{#sql select="id,label" tables="acc_accounts" where="code = :code AND id_chart = :id_chart"
|
||||
:code=$code_amort :id_chart=$immo_account.id_chart assign="amort_account"}}
|
||||
{{/sql}}
|
||||
|
||||
<section class="amortissement">
|
||||
<h3 class="center-block ruler">Amortissements à enregistrer</h3>
|
||||
<table class="list">
|
||||
|
@ -197,6 +205,8 @@
|
|||
<th class="nombre">Montant</th>
|
||||
<th class="nombre">Solde</th>
|
||||
<th>Libellé</th>
|
||||
<th>N° compte</th>
|
||||
<th>Compte</th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -204,7 +214,9 @@
|
|||
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
||||
{{:assign solde_prec=$solde}}
|
||||
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
||||
{{#select id FROM acc_years WHERE :amort_date >= start_date AND :amort_date <= end_date AND status == 0; :amort_date=$date_amort|parse_date}}
|
||||
{{#select id FROM acc_years
|
||||
WHERE :amort_date >= start_date AND :amort_date <= end_date AND status == 0 LIMIT 1;
|
||||
:amort_date=$date_amort|parse_date}}
|
||||
{{:assign enregistrer=1}}
|
||||
{{:assign current_year=$id}}
|
||||
{{else}}
|
||||
|
@ -215,12 +227,9 @@
|
|||
<td>{{$date_amort|date_short}}</td>
|
||||
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
||||
<td class="money">{{$solde|money:false}}</td>
|
||||
<td>
|
||||
{{if $libelle == null}}
|
||||
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
||||
{{/if}}
|
||||
{{$libelle}}
|
||||
</td>
|
||||
<td>{{$libelle}}</td>
|
||||
<td>{{$code_amort}}</td>
|
||||
<td>{{$amort_account.label}}</td>
|
||||
<td class="actions">
|
||||
{{if $enregistrer == 1}}
|
||||
{{:linkbutton
|
||||
|
|
Loading…
Add table
Reference in a new issue