restructuration et complément classification immobilisations
This commit is contained in:
parent
3ef33e15e3
commit
5fcf510b25
12
_nav.html
12
_nav.html
@ -1,4 +1,10 @@
|
|||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
|
{{if $current == 'index'}}
|
||||||
|
<aside>
|
||||||
|
{{:linkbutton label="Ajouter une immobilisation" shape="plus" href="add_asset.html" target="_dialog"}}
|
||||||
|
</aside>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li {{if $current == 'index'}} class="current"{{/if}}><a href="{{$module.url}}index.html">Immobilisations</a></li>
|
<li {{if $current == 'index'}} class="current"{{/if}}><a href="{{$module.url}}index.html">Immobilisations</a></li>
|
||||||
<li {{if $current == 'aide'}} class="current"{{/if}}><a href="{{$module.url}}aide.html">Aide</a></li>
|
<li {{if $current == 'aide'}} class="current"{{/if}}><a href="{{$module.url}}aide.html">Aide</a></li>
|
||||||
@ -6,9 +12,9 @@
|
|||||||
|
|
||||||
{{if $current == 'index'}}
|
{{if $current == 'index'}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
<li {{if $subcurrent == 'amort'}}class="current"{{/if}}><a href="index.html?amort=1">Amortissables</a></li>
|
<li {{if $subcurrent == 'amort'}}class="current"{{/if}}><a href="index.html?amort=amort">Amortissables</a></li>
|
||||||
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=2">Terminées</a></li>
|
<li {{if $subcurrent == 'fini'}}class="current"{{/if}}><a href="index.html?amort=fini">Terminées</a></li>
|
||||||
<li {{if $subcurrent == 'no_amort'}}class="current"{{/if}}><a href="index.html?amort=0">Non amortissables</a></li>
|
<li {{if $subcurrent == 'no_amort'}}class="current"{{/if}}><a href="index.html?amort=no_amort">Non amortissables</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{if $subsubcurrent == 'amortization'}}
|
{{if $subsubcurrent == 'amortization'}}
|
||||||
<ul class="sub">
|
<ul class="sub">
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
{{:admin_header title="Liste des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if $_GET.fini == null || $_GET.fini == 0}}
|
{{if $_GET.amort == null || $_GET.amort == "amort"}}
|
||||||
{{:assign subcurrent="amort"}}
|
{{:assign subcurrent="amort"}}
|
||||||
{{elseif $_GET.fini == 1}}
|
{{elseif $_GET.amort == "fini"}}
|
||||||
{{:assign subcurrent="fini"}}
|
{{:assign subcurrent="fini"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign subcurrent="no_amort"}}
|
{{:assign subcurrent="no_amort"}}
|
||||||
@ -31,13 +31,6 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* récupérer les infos de l'immobilisation *}}
|
{{* récupérer les infos de l'immobilisation *}}
|
||||||
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
|
||||||
{{else}}
|
|
||||||
{{:error message="Pas d'info concernant l'immobilisation %s"|args:$_GET.immo_id}}
|
|
||||||
{{/load}}
|
|
||||||
{{:assign var="duree" from="info_immo.duration"|args:$_GET.immo_id}}
|
|
||||||
{{:assign date_debut=$info_immo.date}}
|
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
line.id as immo_id,
|
line.id as immo_id,
|
||||||
line.id_account as account_id,
|
line.id_account as account_id,
|
||||||
@ -56,11 +49,15 @@
|
|||||||
:line_id = $_GET.immo_id|intval
|
:line_id = $_GET.immo_id|intval
|
||||||
assign=ligne_immo
|
assign=ligne_immo
|
||||||
}}
|
}}
|
||||||
<h2>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_debut|date_short}} sur {{$duree}} ans</h2>
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
|
{{#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}}
|
||||||
|
|
||||||
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||||
{{#select
|
{{#select
|
||||||
l_amort.credit as amort_amount,
|
l_amort.credit as amort_amount,
|
||||||
@ -97,25 +94,32 @@
|
|||||||
assign=linked_lines.
|
assign=linked_lines.
|
||||||
}}
|
}}
|
||||||
{{:assign var="amort_years." value=$amort_year}}
|
{{:assign var="amort_years." value=$amort_year}}
|
||||||
|
{{if $date_debut == null}}
|
||||||
|
{{:assign date_debut=$amort_date}}
|
||||||
|
{{/if}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{* montant de l'annuité théorique *}}
|
<h2>Amortissement de « {{$ligne_immo.label}} » d'un montant de {{"%f"|math:$ligne_immo.montant|money_currency}} en date du {{$date_debut|date_short}}{{if $duree != null}} sur {{$duree}} ans{{/if}}</h2>
|
||||||
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
|
||||||
{{:assign annuite="%f/%f"|math:$montant:$duree}}
|
|
||||||
{{* première annuité *}}
|
|
||||||
{{:assign date_amort=$ligne_immo.date_amort}}
|
|
||||||
{{if $date_amort|strtotime < $date_debut|strtotime}}
|
|
||||||
{{* changer d'exercice *}}
|
|
||||||
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
|
||||||
{{:assign date_amort=$date_amort|parse_date}}
|
|
||||||
{{/if}}
|
|
||||||
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
|
||||||
{{:assign annuite_1="%f/360*%d"|math:$annuite:$nbjours|intval}}
|
|
||||||
{{:assign annuite_courante=$annuite_1}}
|
|
||||||
{{:assign current_year=$ligne_immo.year_id}}
|
|
||||||
{{:assign solde=$ligne_immo.montant}}
|
|
||||||
{{:assign nbamort=0}}
|
|
||||||
|
|
||||||
|
{{if $duree != null}}
|
||||||
|
{{* montant de l'annuité théorique *}}
|
||||||
|
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
||||||
|
{{:assign annuite="%f/%f"|math:$montant:$duree}}
|
||||||
|
{{* première annuité *}}
|
||||||
|
{{:assign date_amort=$ligne_immo.date_amort}}
|
||||||
|
{{if $date_amort|strtotime < $date_debut|strtotime}}
|
||||||
|
{{* changer d'exercice *}}
|
||||||
|
{{:include file="_next_year.html" date=$date_amort keep="date_amort"}}
|
||||||
|
{{:assign date_amort=$date_amort|parse_date}}
|
||||||
|
{{/if}}
|
||||||
|
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
||||||
|
{{:assign annuite_1="%f/360*%d"|math:$annuite:$nbjours|intval}}
|
||||||
|
{{:assign annuite_courante=$annuite_1}}
|
||||||
|
{{:assign current_year=$ligne_immo.year_id}}
|
||||||
|
{{:assign nbamort=0}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{:assign solde=$ligne_immo.montant}}
|
||||||
{{if $linked_lines != null}}
|
{{if $linked_lines != null}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<h3 class="ruler">
|
<h3 class="ruler">
|
||||||
@ -172,7 +176,7 @@
|
|||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $solde > 0}}
|
{{if $duree != null && $solde > 0}}
|
||||||
{{:assign project_id=$ligne_immo.project_id}}
|
{{:assign project_id=$ligne_immo.project_id}}
|
||||||
{{: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}}
|
||||||
@ -231,89 +235,89 @@
|
|||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{if $_GET.fini == null || $_GET.fini != 1}}
|
{{if $_GET.amort == null || $_GET.amort != "fini"}}
|
||||||
|
|
||||||
{{* amortissement à exclure *}}
|
{{* amortissement à exclure *}}
|
||||||
{{:include
|
{{:include
|
||||||
file="_amort_exclus.html"
|
file="_amort_exclus.html"
|
||||||
keep="amort_exclus"
|
keep="amort_exclus"
|
||||||
}}
|
|
||||||
|
|
||||||
{{* 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
|
|
||||||
}}
|
|
||||||
{{#select
|
|
||||||
id_transaction,
|
|
||||||
id_related
|
|
||||||
from acc_transactions_links
|
|
||||||
where id_transaction = :id_amort or id_related = :id_amort;
|
|
||||||
:id_amort=$t_id
|
|
||||||
}}
|
}}
|
||||||
{{else}}
|
|
||||||
{{if $autre_amort.t_id|in:$amort_exclus}}
|
{{* 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%" AND credit > 0
|
||||||
|
order by trans.date, trans.label;
|
||||||
|
assign=autre_amort
|
||||||
|
}}
|
||||||
|
{{#select
|
||||||
|
id_transaction,
|
||||||
|
id_related
|
||||||
|
from acc_transactions_links
|
||||||
|
where id_transaction = :id_amort or id_related = :id_amort;
|
||||||
|
:id_amort=$t_id
|
||||||
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign var="autres_amortissements." value=$autre_amort}}
|
{{if $autre_amort.t_id|in:$amort_exclus}}
|
||||||
{{/if}}
|
{{else}}
|
||||||
|
{{:assign var="autres_amortissements." value=$autre_amort}}
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{/select}}
|
|
||||||
|
|
||||||
{{if $autres_amortissements != null}}
|
{{if $autres_amortissements != null}}
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<h3 class="ruler">Autres amortissements non rattachés</h3>
|
<h3 class="ruler">Autres amortissements non rattachés</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<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>
|
<tr>
|
||||||
<td class="num"><a href={{$trans_url}}>#{{$line.t_id}}</a></td>
|
<th>N°</th>
|
||||||
<td>{{$line.t_date|date_short}}</td>
|
<th>Date</th>
|
||||||
<td class="money">{{"%f"|math:$line.montant|money}}</td>
|
<th class="nombre">Montant</th>
|
||||||
<td>{{if $line.l_label == null}}
|
<th>Libellé</th>
|
||||||
{{$line.t_label}}
|
<th>N° compte</th>
|
||||||
{{else}}
|
<th>Compte</th>
|
||||||
{{$line.l_label}}
|
<th class="actions"></th>
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
<td>{{$line.a_code}}</td>
|
|
||||||
<td>{{$line.a_label}}</td>
|
|
||||||
<td>
|
|
||||||
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{{/foreach}}
|
</thead>
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
|
||||||
</section>
|
{{#foreach from=$autres_amortissements item="line"}}
|
||||||
{{/if}}
|
{{: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>{{$line.a_code}}</td>
|
||||||
|
<td>{{$line.a_label}}</td>
|
||||||
|
<td>
|
||||||
|
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/foreach}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
{{* Liste des immobilisations amortissable ou à définir *}}
|
{{* Liste des immobilisations amortissable ou à définir *}}
|
||||||
|
|
||||||
<section class="immobilisation">
|
<section class="immobilisation">
|
||||||
<h2 class="ruler">Immobilisations en cours</h2>
|
{{if $amort == "amort"}}
|
||||||
|
<h2 class="ruler">Immobilisations en cours</h2>
|
||||||
|
{{else}}
|
||||||
|
<h2 class="ruler">Immobilisations amorties</h2>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
@ -101,7 +105,9 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
{{* immo amortie ? *}}
|
{{* immo amortie ? *}}
|
||||||
{{if $amort_amount >= $debit}}
|
{{if $amort == "amort" && $amort_amount >= $debit ||
|
||||||
|
$amort == "fini" && $amort_amount < $debit
|
||||||
|
}}
|
||||||
{{:continue}}
|
{{:continue}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<tr>
|
<tr>
|
||||||
@ -114,7 +120,7 @@
|
|||||||
<td>{{$account_label}}</td>
|
<td>{{$account_label}}</td>
|
||||||
<td>{{$project_label}}</td>
|
<td>{{$project_label}}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{if $duration == null}}
|
{{if ! $exist_amort && $duration == null}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Ajouter infos"
|
label="Ajouter infos"
|
||||||
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
||||||
@ -132,7 +138,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{:linkbutton
|
{{:linkbutton
|
||||||
label="Amortissements"
|
label="Amortissements"
|
||||||
href="amortization.html?immo_id=%s"|args:$immo_id
|
href="amortization.html?immo_id=%s&amort=%s"|args:$immo_id:$amort
|
||||||
shape="table"
|
shape="table"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
@ -142,17 +148,3 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<form method="post" action="">
|
|
||||||
<fieldset>
|
|
||||||
<legend>Ajouter une immobilisation</legend>
|
|
||||||
<p class="submit">
|
|
||||||
{{:linkbutton
|
|
||||||
label="Ajouter une immobilisation"
|
|
||||||
shape="plus"
|
|
||||||
href="add_asset.html"
|
|
||||||
target="_dialog"
|
|
||||||
}}
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
@ -1,144 +0,0 @@
|
|||||||
{{* -*- brindille -*- *}}
|
|
||||||
|
|
||||||
{{* Liste des immobilisations totalement amorties *}}
|
|
||||||
|
|
||||||
<section class="immobilisation">
|
|
||||||
<h2 class="ruler">Immobilisations amorties</h2>
|
|
||||||
|
|
||||||
<table class="list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>N°</th>
|
|
||||||
<th>Date</th>
|
|
||||||
<th>Libellé</th>
|
|
||||||
<th class="nombre">Montant</th>
|
|
||||||
<th class="nombre">Durée</th>
|
|
||||||
<th>N° compte</th>
|
|
||||||
<th>Compte</th>
|
|
||||||
<th>Projet</th>
|
|
||||||
<th class="actions"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
{{* lister les immobilisations *}}
|
|
||||||
{{:read file="./defaut.json" assign="config_json"}}
|
|
||||||
{{:assign config_defaut=$config_json|json_decode}}
|
|
||||||
{{:assign var="prefix_array" value=$config_defaut.prefixes|keys}}
|
|
||||||
{{:assign quote="'"}}
|
|
||||||
{{:assign condition="("}}
|
|
||||||
{{#foreach from=$prefix_array item="code"}}
|
|
||||||
{{:assign condition=$condition|cat:" account.code LIKE "|cat:$quote|cat:$code|cat:"%"|cat:$quote|cat:" OR "}}
|
|
||||||
{{/foreach}}
|
|
||||||
{{:assign condition=$condition|cat:"0)"}}
|
|
||||||
{{:assign condition=$condition|cat:" AND debit > 0"}}
|
|
||||||
|
|
||||||
{{#select
|
|
||||||
trans.id as trans_id,
|
|
||||||
trans.label as trans_label,
|
|
||||||
trans.date as trans_date,
|
|
||||||
line.id as immo_id,
|
|
||||||
account.id as account_id,
|
|
||||||
account.code as account_code,
|
|
||||||
account.label as account_label,
|
|
||||||
line.debit AS debit,
|
|
||||||
project.label as project_label,
|
|
||||||
trans.id_year as trans_id_year
|
|
||||||
FROM acc_transactions AS trans
|
|
||||||
INNER JOIN acc_transactions_lines AS line ON line.id_transaction = trans.id
|
|
||||||
INNER JOIN acc_accounts AS account ON line.id_account = account.id
|
|
||||||
INNER JOIN acc_years AS years ON trans.id_year = years.id
|
|
||||||
LEFT JOIN acc_projects AS project ON line.id_project = project.id
|
|
||||||
WHERE !condition
|
|
||||||
ORDER BY trans.date DESC;
|
|
||||||
!condition=$condition
|
|
||||||
}}
|
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id}}
|
|
||||||
{{:assign compte_url="%s/acc/accounts/journal.php?id=%s&year=%s"|args:$admin_url:$account_id:$trans_id_year}}
|
|
||||||
{{:assign duration=null}}
|
|
||||||
{{* voir si l'immo est prise en charge *}}
|
|
||||||
{{#load type="immo" where="$$.line = :line_id" :line_id=$immo_id|intval}}
|
|
||||||
{{:assign duration=$duration}}
|
|
||||||
{{if $noamort}}
|
|
||||||
{{:assign amortissable="non"}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amortissable="oui"}}
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amortissable="nsp"}}
|
|
||||||
{{/load}}
|
|
||||||
{{if $amortissable == "non"}}
|
|
||||||
{{:continue}}
|
|
||||||
{{/if}}
|
|
||||||
{{* voir s'il existe des écritures d'amortissement associées *}}
|
|
||||||
{{#select
|
|
||||||
sum(l_amort.credit) as amort_amount,
|
|
||||||
CASE links.id_related = t_immo.id
|
|
||||||
WHEN true THEN links.id_transaction
|
|
||||||
WHEN false THEN links.id_related
|
|
||||||
END as amort_trans_id
|
|
||||||
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
|
|
||||||
OR
|
|
||||||
t_immo.id = links.id_related
|
|
||||||
)
|
|
||||||
INNER JOIN acc_transactions_lines as l_amort on amort_trans_id = l_amort.id_transaction
|
|
||||||
WHERE
|
|
||||||
l_immo.id = :line_id
|
|
||||||
AND
|
|
||||||
l_amort.credit <> 0;
|
|
||||||
:line_id = $immo_id|intval
|
|
||||||
}}
|
|
||||||
{{if $amort_amount == null}}
|
|
||||||
{{:assign exist_amort=false}}
|
|
||||||
{{:assign amort_amount=0}}
|
|
||||||
{{else}}
|
|
||||||
{{:assign amort_amount=$amort_amount}}
|
|
||||||
{{:assign exist_amort=true}}
|
|
||||||
{{/if}}
|
|
||||||
{{/select}}
|
|
||||||
{{* immo amortie ? *}}
|
|
||||||
{{if $amort_amount < $debit}}
|
|
||||||
{{:continue}}
|
|
||||||
{{/if}}
|
|
||||||
<tr>
|
|
||||||
<td class="num"><a href={{$trans_url}}>#{{$trans_id}}</a></td>
|
|
||||||
<td>{{$trans_date|date_short}}</td>
|
|
||||||
<td>{{$trans_label}}</td>
|
|
||||||
<td class="money">{{"%f"|math:$debit|money}}</td>
|
|
||||||
<td class="money">{{if $duration != null}}{{$duration}}{{/if}}</td>
|
|
||||||
<td><a href={{$compte_url}}>{{$account_code}}</a></td>
|
|
||||||
<td>{{$account_label}}</td>
|
|
||||||
<td>{{$project_label}}</td>
|
|
||||||
<td class="actions">
|
|
||||||
{{if $duration == null}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Ajouter infos"
|
|
||||||
href="add_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
|
||||||
shape="help"
|
|
||||||
target="_dialog"
|
|
||||||
}}
|
|
||||||
{{else}}
|
|
||||||
{{if ! $exist_amort}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Modifier infos"
|
|
||||||
href="modif_infos.html?immo_id=%s&amort=1"|args:$immo_id
|
|
||||||
shape="help"
|
|
||||||
target="_dialog"
|
|
||||||
}}
|
|
||||||
{{/if}}
|
|
||||||
{{:linkbutton
|
|
||||||
label="Amortissements"
|
|
||||||
href="amortization.html?immo_id=%s&fini=1"|args:$immo_id
|
|
||||||
shape="table"
|
|
||||||
}}
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{/select}}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
|
15
index.html
15
index.html
@ -2,12 +2,10 @@
|
|||||||
{{:admin_header title="Gestion des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
{{:admin_header title="Gestion des amortissements" custom_css="./style.css" current="module_amortissement"}}
|
||||||
|
|
||||||
{{* barre de navigation *}}
|
{{* barre de navigation *}}
|
||||||
{{if $_GET.amort == null || $_GET.amort == 1}}
|
{{if $_GET.amort == null}}
|
||||||
{{:assign amort="amort"}}
|
{{:assign amort="amort"}}
|
||||||
{{elseif $_GET.amort == 2}}
|
|
||||||
{{:assign amort="fini"}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign amort="no_amort"}}
|
{{:assign amort=$_GET.amort}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$amort}}
|
{{:include file="_nav.html" current="index" subcurrent="%s"|args:$amort}}
|
||||||
@ -37,11 +35,10 @@
|
|||||||
{{/select}}
|
{{/select}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
{{if $amort == "amort"}}
|
{{if $amort == "no_amort"}}
|
||||||
{{:include file="./immobilisations.html"}}
|
|
||||||
{{elseif $amort == "fini"}}
|
|
||||||
{{:include file="./immobilisations_achevees.html"}}
|
|
||||||
{{else}}
|
|
||||||
{{:include file="./immobilisations_non.html"}}
|
{{:include file="./immobilisations_non.html"}}
|
||||||
|
{{else}}
|
||||||
|
{{:include file="./immobilisations.html"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
Loading…
Reference in New Issue
Block a user