Ajout projet et proprification
This commit is contained in:
parent
f35ca35538
commit
5e081c4f23
3 changed files with 45 additions and 91 deletions
|
|
@ -13,27 +13,28 @@
|
|||
{{#select
|
||||
line.id as line_id,
|
||||
line.id_account as account_id,
|
||||
line.id_project as project_id,
|
||||
trans.id as trans_id,
|
||||
line.debit as montant,
|
||||
trans.label as label,
|
||||
trans.date as date_achat,
|
||||
y.id as year_id,
|
||||
y.end_date as date_fin
|
||||
y.end_date as date_fin,
|
||||
project.label as project_label
|
||||
from acc_transactions_lines as line
|
||||
inner join acc_transactions as trans on line.id_transaction = trans.id
|
||||
inner join acc_years as y on trans.id_year = y.id
|
||||
left join acc_projects AS project ON line.id_project = project.id
|
||||
where line.id = :line_id;
|
||||
:line_id = $_GET.line|intval
|
||||
assign=ligne_immo
|
||||
}}
|
||||
<h3>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_achat|date_short}}</h3>
|
||||
<h2>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_achat|date_short}} sur {{$info_immo.duration}} ans</h2>
|
||||
{{else}}
|
||||
{{:assign message="Immobilisation %s non trouvée"|args:$_GET.line}}
|
||||
{{:error message=$message}}
|
||||
{{/select}}
|
||||
|
||||
{{*:debug ligne_immo=$ligne_immo*}}
|
||||
|
||||
{{* lister les écritures d'amortissement *}}
|
||||
{{#select
|
||||
line.id as l_immo,
|
||||
|
|
@ -45,6 +46,8 @@
|
|||
line2.id_transaction as trans_id,
|
||||
line2.id_project as projet,
|
||||
line2.id_account as account_id,
|
||||
line2.id_project as project_id,
|
||||
project.label as project_label,
|
||||
trans.date as date_immo,
|
||||
acc.code as account_code,
|
||||
acc.label as nom_compte,
|
||||
|
|
@ -54,6 +57,7 @@
|
|||
inner JOIN acc_transactions_lines as line2 on links.id_transaction = line2.id_transaction
|
||||
inner join acc_accounts as acc on line2.id_account = acc.id
|
||||
inner join acc_transactions as trans on line2.id_transaction = trans.id
|
||||
left join acc_projects AS project ON line.id_project = project.id
|
||||
where line.id = :line_id and line2.debit <> 0
|
||||
order by trans.date;
|
||||
:line_id = $info_immo.line|intval
|
||||
|
|
@ -61,16 +65,11 @@
|
|||
}}
|
||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
||||
{{/select}}
|
||||
{{*:debug lines=$lines*}}
|
||||
{{*:debug line=$lines.0*}}
|
||||
{{*:debug line=$lines.1*}}
|
||||
|
||||
{{* calculer les amortissements *}}
|
||||
{{* montant de l'annuité normale *}}
|
||||
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
||||
{{:assign annuite="%f/%f"|math:$montant:$info_immo.duration|intval}}
|
||||
{{*:debug montant=$montant *}}
|
||||
{{*:debug annuite=$annuite *}}
|
||||
|
||||
{{* liste des exercices *}}
|
||||
{{#years}}
|
||||
|
|
@ -79,24 +78,18 @@
|
|||
{{:assign var="all_years.%d.closed"|args:$id value=$closed}}
|
||||
{{/years}}
|
||||
|
||||
{{*
|
||||
{{:debug all_years=$all_years}}
|
||||
{{:assign current_year=8}}
|
||||
{{:assign var="date_immo" from="all_years.%s.end_date"|args:$current_year}}
|
||||
{{:debug date_immo=$date_immo}}
|
||||
*}}
|
||||
|
||||
{{* première annuité *}}
|
||||
{{:assign date_achat=$ligne_immo.date_achat|date_short}}
|
||||
{{:assign date_fin=$ligne_immo.date_fin|date_short}}
|
||||
{{:include file="_calcul_dates.html" date_debut=$date_achat date_fin=$date_fin keep="nbjours"}}
|
||||
{{:assign annuite_1="%f/360*%d"|math:$annuite:$nbjours|intval}}
|
||||
{{*:debug annuite1=$annuite_1 *}}
|
||||
|
||||
{{:assign date_immo=$date_fin}}
|
||||
{{:assign annuite_courante=$annuite_1}}
|
||||
{{:assign solde=$montant}}
|
||||
{{:assign current_year=$ligne_immo.year_id}}
|
||||
{{:assign project_id=$ligne_immo.project_id}}
|
||||
{{:assign project_label=$ligne_immo.project_label}}
|
||||
|
||||
<section class="amortissement">
|
||||
<h2 class="ruler">Liste des amortissements</h2>
|
||||
|
|
@ -108,16 +101,15 @@
|
|||
<th>Montant</th>
|
||||
<th>Solde</th>
|
||||
<th>Libellé</th>
|
||||
<th>ligne amort</th>
|
||||
<th>N° compte</th>
|
||||
<th>Compte</th>
|
||||
<th>Nom compte</th>
|
||||
<th>Projet</th>
|
||||
<th class="actions"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#foreach count="%d+1"|math:$info_immo.duration|intval key="num"}}
|
||||
{{:assign var="line" from="lines.%s"|args:$num}}
|
||||
{{*:debug line=$line*}}
|
||||
|
||||
{{if $line != null}}
|
||||
{{* données de l'écriture *}}
|
||||
|
|
@ -129,13 +121,15 @@
|
|||
<td class="money">{{"%f"|math:$line.montant|money}}</td>
|
||||
<td class="money">{{"%f"|math:$solde|money}}</td>
|
||||
<td>{{$line.libelle}}</td>
|
||||
<td>{{$line.l_amort}}</td>
|
||||
<td>{{$line.account_code}}</td>
|
||||
<td>{{$line.nom_compte}}</td>
|
||||
<td>{{$line.project_label}}</td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{{:assign libelle=$line.libelle}}
|
||||
{{:assign ammort_account=$line.ammort_account}}
|
||||
{{:assign project_id=$line.project_id}}
|
||||
{{:assign project_label=$line.project_label}}
|
||||
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
||||
{{:assign current_year="%d+1"|math:$current_year}}
|
||||
{{:assign date_immo=$line.date_immo}}
|
||||
|
|
@ -167,14 +161,16 @@
|
|||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>{{$project_label}}</td>
|
||||
<td class="actions">
|
||||
{{if $all_years|keys|has:$current_year}}
|
||||
{{:linkbutton
|
||||
label="Enregistrer"
|
||||
href="save_amort.html?amount=%d&account=%s&year=%s&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$libelle
|
||||
href="save_amort.html?amount=%d&account=%s&year=%s&trans_id=%d&line_id=%s&project_id=%d&label=%s"|args:$annuite_courante:$ligne_immo.account_id:$current_year:$ligne_immo.trans_id:$_GET.line:$project_id:$libelle
|
||||
shape="right"
|
||||
}}
|
||||
{{else}}
|
||||
{{:linkbutton label="Enregistrer" href="" shape="alert"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue