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}}
|
{{/select}}
|
||||||
{{:assign date_debut=$ligne_immo.date}}
|
{{:assign date_debut=$ligne_immo.date}}
|
||||||
|
|
||||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
{{#load type="immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||||
{{:assign var="duree" from="info_immo.duration"|args:$_GET.immo_id}}
|
{{:assign duree=$duration}}
|
||||||
{{:assign date_debut=$info_immo.date}}
|
{{:assign date_debut=$date}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||||
|
@ -67,9 +67,9 @@
|
||||||
l_amort.credit as amort_amount,
|
l_amort.credit as amort_amount,
|
||||||
l_amort.label as amort_label,
|
l_amort.label as amort_label,
|
||||||
l_amort.id as amort_line,
|
l_amort.id as amort_line,
|
||||||
CASE links.id_related = t_immo.id
|
CASE WHEN links.id_related = t_immo.id
|
||||||
WHEN true THEN links.id_transaction
|
THEN links.id_transaction
|
||||||
WHEN false THEN links.id_related
|
ELSE links.id_related
|
||||||
END as amort_trans_id,
|
END as amort_trans_id,
|
||||||
trans.date as amort_date,
|
trans.date as amort_date,
|
||||||
trans.label as trans_label,
|
trans.label as trans_label,
|
||||||
|
@ -80,25 +80,19 @@
|
||||||
FROM acc_transactions_lines as l_immo
|
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 as t_immo on t_immo.id = l_immo.id_transaction
|
||||||
INNER JOIN acc_transactions_links as links
|
INNER JOIN acc_transactions_links as links
|
||||||
ON (
|
ON (t_immo.id = links.id_transaction
|
||||||
t_immo.id = links.id_transaction
|
|
||||||
OR
|
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_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_transactions as trans on l_amort.id_transaction = trans.id
|
||||||
INNER join acc_accounts as account on l_amort.id_account = account.id
|
INNER join acc_accounts as account on l_amort.id_account = account.id
|
||||||
WHERE
|
WHERE
|
||||||
l_immo.id = :line_id
|
l_immo.id = :line_id
|
||||||
AND
|
AND account.code LIKE '28%'
|
||||||
l_amort.credit <> 0
|
|
||||||
AND
|
|
||||||
account.code LIKE '28%'
|
|
||||||
ORDER BY trans.date;
|
ORDER BY trans.date;
|
||||||
:line_id = $_GET.immo_id|intval
|
:line_id = $_GET.immo_id|intval
|
||||||
assign=linked_lines.
|
assign=linked_lines.
|
||||||
}}
|
}}
|
||||||
{{:assign var="amort_years." value=$amort_year}}
|
|
||||||
{{if $date_debut == null}}
|
{{if $date_debut == null}}
|
||||||
{{:assign date_debut=$amort_date}}
|
{{:assign date_debut=$amort_date}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -170,7 +164,7 @@
|
||||||
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
|
||||||
<td>{{$line.account_label}}</td>
|
<td>{{$line.account_label}}</td>
|
||||||
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{:assign annuite_courante=$annuite}}
|
{{:assign annuite_courante=$annuite}}
|
||||||
|
@ -187,6 +181,20 @@
|
||||||
{{:assign project_label=$ligne_immo.project_label}}
|
{{:assign project_label=$ligne_immo.project_label}}
|
||||||
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
|
{{:assign nbamort="%d-%d"|math:$duree:$nbamort}}
|
||||||
{{:assign annuite_courante="min(%f,%f)"|math:$annuite_courante:$solde}}
|
{{: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">
|
<section class="amortissement">
|
||||||
<h3 class="center-block ruler">Amortissements à enregistrer</h3>
|
<h3 class="center-block ruler">Amortissements à enregistrer</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
|
@ -197,6 +205,8 @@
|
||||||
<th class="nombre">Montant</th>
|
<th class="nombre">Montant</th>
|
||||||
<th class="nombre">Solde</th>
|
<th class="nombre">Solde</th>
|
||||||
<th>Libellé</th>
|
<th>Libellé</th>
|
||||||
|
<th>N° compte</th>
|
||||||
|
<th>Compte</th>
|
||||||
<th class="actions"></th>
|
<th class="actions"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -204,7 +214,9 @@
|
||||||
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
||||||
{{:assign solde_prec=$solde}}
|
{{:assign solde_prec=$solde}}
|
||||||
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
{{: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 enregistrer=1}}
|
||||||
{{:assign current_year=$id}}
|
{{:assign current_year=$id}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -215,12 +227,9 @@
|
||||||
<td>{{$date_amort|date_short}}</td>
|
<td>{{$date_amort|date_short}}</td>
|
||||||
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
||||||
<td class="money">{{$solde|money:false}}</td>
|
<td class="money">{{$solde|money:false}}</td>
|
||||||
<td>
|
<td>{{$libelle}}</td>
|
||||||
{{if $libelle == null}}
|
<td>{{$code_amort}}</td>
|
||||||
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
<td>{{$amort_account.label}}</td>
|
||||||
{{/if}}
|
|
||||||
{{$libelle}}
|
|
||||||
</td>
|
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if $enregistrer == 1}}
|
{{if $enregistrer == 1}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
|
|
Loading…
Add table
Reference in a new issue