Ajout attachement/détachement amortissement
This commit is contained in:
parent
8a4b605e99
commit
a30613e0ee
@ -6,9 +6,21 @@
|
|||||||
{{:include file="_nav.html" current="amortization"}}
|
{{:include file="_nav.html" current="amortization"}}
|
||||||
|
|
||||||
{{if $_GET.ok}}
|
{{if $_GET.ok}}
|
||||||
<p class="block confirm">Amortissement enregistré</p>
|
{{if $_GET.msg|match:"attach"}}
|
||||||
|
{{:assign msg="Attachement effectué"}}
|
||||||
|
{{elseif $_GET.msg|match:"detach"}}
|
||||||
|
{{:assign msg="Attachement supprimé"}}
|
||||||
|
{{elseif $_GET.msg|match:"amortissement"}}
|
||||||
|
{{:assign msg="Amortissement enregistré"}}
|
||||||
|
{{/if}}
|
||||||
|
<p class="block confirm">{{$msg}}</p>
|
||||||
{{elseif $_GET.err}}
|
{{elseif $_GET.err}}
|
||||||
<p class="block error">Échec enregistrement amortissement</p>
|
{{if $_GET.msg|match:"attach"}}
|
||||||
|
{{:assign msg="Échec attachement"}}
|
||||||
|
{{elseif $_GET.msg|match:"amortissement"}}
|
||||||
|
{{:assign msg="Échec enregistrement amortissement"}}
|
||||||
|
{{/if}}
|
||||||
|
<p class="block error">{{$msg}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{* récupérer les infos de l'immobilisation *}}
|
{{* récupérer les infos de l'immobilisation *}}
|
||||||
@ -18,12 +30,23 @@
|
|||||||
{{:error message=$message}}
|
{{:error message=$message}}
|
||||||
{{/load}}
|
{{/load}}
|
||||||
|
|
||||||
|
{{* liste de toutes les immobilisations gérées *}}
|
||||||
|
{{#load type="immo"}}
|
||||||
|
{{:assign
|
||||||
|
var="info_immos.%s"|args:$line
|
||||||
|
duration=$duration
|
||||||
|
amort=$amort
|
||||||
|
}}
|
||||||
|
{{:assign var="amort_associes" value=$amort|values}}
|
||||||
|
{{/load}}
|
||||||
|
{{:assign var="duree" from="info_immos.%s.duration"|args:$_GET.line_id}}
|
||||||
|
|
||||||
{{#select
|
{{#select
|
||||||
line.id as line_id,
|
line.id as line_id,
|
||||||
line.id_account as account_id,
|
line.id_account as account_id,
|
||||||
line.id_project as project_id,
|
line.id_project as project_id,
|
||||||
trans.id as trans_id,
|
|
||||||
line.debit as montant,
|
line.debit as montant,
|
||||||
|
trans.id as trans_id,
|
||||||
trans.label as label,
|
trans.label as label,
|
||||||
trans.date as date_achat,
|
trans.date as date_achat,
|
||||||
y.id as year_id,
|
y.id as year_id,
|
||||||
@ -37,54 +60,86 @@
|
|||||||
:line_id = $_GET.line_id|intval
|
:line_id = $_GET.line_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_achat|date_short}} sur {{$info_immo.duration}} ans</h2>
|
<h2>Amortissement de « {{$label}} » d'un montant de {{"%f"|math:$montant|money_currency}} en date du {{$date_achat|date_short}} sur {{$duree}} ans</h2>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{:assign message="Immobilisation %s non trouvée"|args:$_GET.line_id}}
|
{{:assign message="Immobilisation %s non trouvée"|args:$_GET.line_id}}
|
||||||
{{:error message=$message}}
|
{{:error message=$message}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{* lister les écritures d'amortissement *}}
|
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
|
||||||
{{#select
|
{{#select
|
||||||
line.id as l_immo,
|
l_immo.id,
|
||||||
line.id_account as amort_account,
|
l_immo.id_account,
|
||||||
line2.debit as montant,
|
l_amort.credit as amort_amount,
|
||||||
line2.label as libelle,
|
l_amort.label as amort_label,
|
||||||
links.id_transaction as t_amort,
|
l_amort.id as amort_line,
|
||||||
line2.id as l_amort,
|
l_amort.id_transaction as amort_trans_id,
|
||||||
line2.id_transaction as trans_id,
|
l_amort.id_project as projet,
|
||||||
line2.id_project as projet,
|
l_amort.id_account as account_id,
|
||||||
line2.id_account as account_id,
|
l_amort.id_project as project_id,
|
||||||
line2.id_project as project_id,
|
|
||||||
project.label as project_label,
|
project.label as project_label,
|
||||||
trans.date as date_immo,
|
trans.date as amort_date,
|
||||||
|
trans.label as trans_label,
|
||||||
|
trans.id_year as amort_year,
|
||||||
acc.code as account_code,
|
acc.code as account_code,
|
||||||
acc.label as nom_compte,
|
acc.label as account_name,
|
||||||
acc.id_chart as PC
|
acc.id_chart as PC,
|
||||||
from acc_transactions_lines as line
|
"vrai" as linked
|
||||||
inner JOIN acc_transactions_links as links on line.id_transaction = links.id_related
|
from acc_transactions_lines as l_immo
|
||||||
inner JOIN acc_transactions_lines as line2 on links.id_transaction = line2.id_transaction
|
inner JOIN acc_transactions_links as links on l_immo.id_transaction = links.id_related
|
||||||
inner join acc_accounts as acc on line2.id_account = acc.id
|
inner JOIN acc_transactions_lines as l_amort on links.id_transaction = l_amort.id_transaction
|
||||||
inner join acc_transactions as trans on line2.id_transaction = trans.id
|
inner join acc_accounts as acc on l_amort.id_account = acc.id
|
||||||
left join acc_projects AS project ON line.id_project = project.id
|
inner join acc_transactions as trans on l_amort.id_transaction = trans.id
|
||||||
where line.id = :line_id and line2.debit <> 0
|
inner join acc_projects AS project ON l_immo.id_project = project.id
|
||||||
|
where l_immo.id = :line_id and l_amort.credit <> 0
|
||||||
order by trans.date;
|
order by trans.date;
|
||||||
:line_id = $info_immo.line|intval
|
:line_id = $_GET.line_id|intval
|
||||||
assign=lines.
|
assign=linked_lines.
|
||||||
}}
|
}}
|
||||||
{{*:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$trans_id*}}
|
{{:assign var="amort_associes." value=$amort_line}}
|
||||||
|
{{:assign var="amort_years." value=$amort_year}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
|
|
||||||
{{* calculer les amortissements *}}
|
{{* chercher parmi les associations *}}
|
||||||
{{* montant de l'annuité normale *}}
|
{{:assign var="liste_amort" from="info_immos.%s.amort"|args:$_GET.line_id}}
|
||||||
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
{{#foreach from=$liste_amort item="id_amort"}}
|
||||||
{{:assign annuite="%f/%f"|math:$montant:$info_immo.duration|intval}}
|
{{#select
|
||||||
|
l_amort.id_transaction as amort_trans_id,
|
||||||
|
l_amort.credit as amort_amount,
|
||||||
|
l_amort.label as amort_label,
|
||||||
|
trans.date as amort_date,
|
||||||
|
trans.label as trans_label,
|
||||||
|
trans.id_year as amort_year,
|
||||||
|
acc.code as account_code,
|
||||||
|
acc.label as account_name,
|
||||||
|
project.label as project_label
|
||||||
|
from acc_transactions_lines as l_amort
|
||||||
|
inner join acc_transactions as trans on l_amort.id_transaction = trans.id
|
||||||
|
inner join acc_accounts as acc on l_amort.id_account = acc.id
|
||||||
|
inner join acc_projects AS project ON l_amort.id_project = project.id
|
||||||
|
where l_amort.id = :l_amort_id;
|
||||||
|
:l_amort_id = $id_amort
|
||||||
|
}}
|
||||||
|
{{:assign
|
||||||
|
var="linked_lines."
|
||||||
|
amort_line=$id_amort
|
||||||
|
amort_trans_id=$amort_trans_id
|
||||||
|
amort_amount=$amort_amount
|
||||||
|
amort_label=$amort_label
|
||||||
|
amort_date=$amort_date
|
||||||
|
amort_year=$amort_year
|
||||||
|
trans_label=$trans_label
|
||||||
|
account_code=$account_code
|
||||||
|
account_name=$account_name
|
||||||
|
project_label=$project_label
|
||||||
|
}}
|
||||||
|
{{:assign var="amort_years." value=$amort_year}}
|
||||||
|
{{/select}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
{{* liste des exercices *}}
|
{{* montant de l'annuité théorique *}}
|
||||||
{{#years}}
|
{{:assign montant="%f"|math:$ligne_immo.montant}}
|
||||||
{{:assign var="all_years.%d.label"|args:$id value=$label}}
|
{{:assign annuite="%f/%f"|math:$montant:$duree}}
|
||||||
{{:assign var="all_years.%d.end_date"|args:$id value=$end_date}}
|
|
||||||
{{:assign var="all_years.%d.closed"|args:$id value=$closed}}
|
|
||||||
{{/years}}
|
|
||||||
|
|
||||||
{{* première annuité *}}
|
{{* première annuité *}}
|
||||||
{{:assign date_achat=$ligne_immo.date_achat|date_short}}
|
{{:assign date_achat=$ligne_immo.date_achat|date_short}}
|
||||||
@ -92,15 +147,83 @@
|
|||||||
{{:include file="_calcul_dates.html" date_debut=$date_achat date_fin=$date_fin keep="nbjours"}}
|
{{: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}}
|
{{:assign annuite_1="%f/360*%d"|math:$annuite:$nbjours|intval}}
|
||||||
|
|
||||||
{{:assign date_immo=$date_fin}}
|
{{:assign date_amort=$date_fin}}
|
||||||
{{:assign annuite_courante=$annuite_1}}
|
{{:assign annuite_courante=$annuite_1}}
|
||||||
{{:assign solde=$montant}}
|
|
||||||
{{:assign current_year=$ligne_immo.year_id}}
|
{{:assign current_year=$ligne_immo.year_id}}
|
||||||
|
{{:assign solde=$ligne_immo.montant}}
|
||||||
|
{{:assign nbamort=0}}
|
||||||
|
|
||||||
|
{{if $linked_lines != null}}
|
||||||
|
<section class="amortissement">
|
||||||
|
<h3 class="ruler">
|
||||||
|
Amortissements attachés à « <a class="num"
|
||||||
|
href={{"%s/acc/transactions/details.php?id=%s"|args:$admin_url:$ligne_immo.trans_id}}>{{$ligne_immo.trans_id}}</a>
|
||||||
|
{{$ligne_immo.label}} »
|
||||||
|
({{"%f"|math:$ligne_immo.montant|money_currency}}, {{$ligne_immo.date_achat|date_short}})
|
||||||
|
</h3>
|
||||||
|
<table class="list">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>N°</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th style="text-align: right;">Montant</th>
|
||||||
|
<th style="text-align: right;">Solde</th>
|
||||||
|
<th>Libellé</th>
|
||||||
|
<th>N° compte</th>
|
||||||
|
<th>Compte</th>
|
||||||
|
<th>Projet</th>
|
||||||
|
<th class="actions"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#foreach from=$linked_lines item="line"}}
|
||||||
|
{{* données de l'écriture *}}
|
||||||
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.amort_trans_id}}
|
||||||
|
{{:assign solde="%f-%d"|math:$solde:$line.amort_amount}}
|
||||||
|
{{:assign date_amort=$line.amort_date}}
|
||||||
|
{{:assign current_year=$line.amort_year}}
|
||||||
|
<tr>
|
||||||
|
<td class="num"><a href={{$trans_url}}>#{{$line.amort_trans_id}}</a></td>
|
||||||
|
<td>{{$line.amort_date|date_short}}</td>
|
||||||
|
<td class="money">{{"%f"|math:$line.amort_amount|money}}</td>
|
||||||
|
<td class="money">{{"%f"|math:$solde|money}}</td>
|
||||||
|
<td>
|
||||||
|
{{if $line.amort_label == null}}
|
||||||
|
{{$line.trans_label}}
|
||||||
|
{{else}}
|
||||||
|
{{$line.amort_label}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
<td>{{$line.account_code}}</td>
|
||||||
|
<td>{{$line.account_name}}</td>
|
||||||
|
<td>{{$line.project_label}}</td>
|
||||||
|
<td>
|
||||||
|
{{if $line.linked == null}}
|
||||||
|
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line:$ligne_immo.line_id shape="plus"}}
|
||||||
|
{{else}}
|
||||||
|
{{:linkbutton label="Détacher" href="" shape="lock" class="disabled"}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{:assign annuite_courante=$annuite}}
|
||||||
|
{{: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 nbamort="%d+1"|math:$nbamort}}
|
||||||
|
{{/foreach}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{: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}}
|
||||||
|
|
||||||
<section class="amortissement">
|
<section class="amortissement">
|
||||||
<h2 class="ruler">Liste des amortissements</h2>
|
<h3 class="ruler">Amortissements à enregistrer</h3>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -116,78 +239,127 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#foreach count="%d+1"|math:$info_immo.duration|intval key="num"}}
|
{{#foreach count="%d+1"|math:$nbamort key="num"}}
|
||||||
{{:assign var="line" from="lines.%s"|args:$num}}
|
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
||||||
|
{{#select id from acc_years where end_date = :end_date and closed = 0; :end_date=$date_amort|parse_date}}
|
||||||
{{if $line != null}}
|
{{:assign enregistrer=1}}
|
||||||
{{* données de l'écriture *}}
|
|
||||||
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$line.t_amort}}
|
|
||||||
{{:assign solde="%f-%d"|math:$solde:$line.montant}}
|
|
||||||
<tr>
|
|
||||||
<td class="num"><a href={{$trans_url}}>#{{$line.t_amort}}</a></td>
|
|
||||||
<td>{{$line.date_immo|date_short}}</td>
|
|
||||||
<td class="money">{{"%f"|math:$line.montant|money}}</td>
|
|
||||||
<td class="money">{{"%f"|math:$solde|money}}</td>
|
|
||||||
<td>{{$line.libelle}}</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 amort_account=$line.amort_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}}
|
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
{{* pas d'écriture *}}
|
{{:assign enregistrer=0}}
|
||||||
|
{{/select}}
|
||||||
{{:assign solde="%f-%d"|math:$solde:$annuite_courante}}
|
<tr>
|
||||||
{{if $all_years|keys|has:$current_year}}
|
<td class="num">{{"%d+1"|math:$num}}</td>
|
||||||
{{:assign var="date_immo" from="all_years.%s.end_date"|args:$current_year}}
|
<td>{{$date_amort}}</td>
|
||||||
{{:assign date_immo=$date_immo|date_short}}
|
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
||||||
{{else}}
|
<td class="money">{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}}</td>
|
||||||
{{:assign jour=$date_immo|date:"d"}}
|
<td>
|
||||||
{{:assign mois=$date_immo|date:"m"}}
|
{{if $libelle == null}}
|
||||||
{{:assign annee=$date_immo|date:"Y"}}
|
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
||||||
{{:assign annee="%d+1"|math:$annee}}
|
{{/if}}
|
||||||
{{:assign date_immo="%s/%s/%s"|args:$jour:$mois:$annee|parse_date|date_short}}
|
{{$libelle}}
|
||||||
{{/if}}
|
</td>
|
||||||
<tr>
|
<td></td>
|
||||||
<td class="num">{{"%d+1"|math:$num}}</td>
|
<td></td>
|
||||||
<td>{{$date_immo}}</td>
|
<td></td>
|
||||||
<td class="money">{{"%f"|math:$annuite_courante|money}}</td>
|
<td class="actions">
|
||||||
<td class="money">{{if $solde == 0}}0,00{{else}}{{"%f"|math:$solde|money}}{{/if}}</td>
|
{{if $enregistrer == 1}}
|
||||||
<td>
|
{{:linkbutton
|
||||||
{{if $libelle == null}}
|
label="Enregistrer"
|
||||||
{{:assign libelle="Amortissement "|cat:$ligne_immo.label}}
|
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_id:$project_id:$libelle
|
||||||
{{/if}}
|
shape="right"
|
||||||
{{$libelle}}
|
}}
|
||||||
</td>
|
{{else}}
|
||||||
<td></td>
|
{{:linkbutton label="Enregistrer" href="" shape="lock" class="disabled"}}
|
||||||
<td></td>
|
{{/if}}
|
||||||
<td>{{$project_label}}</td>
|
</td>
|
||||||
<td class="actions">
|
</tr>
|
||||||
{{if $all_years|keys|has:$current_year}}
|
{{:assign jour=$date_amort|date:"d"}}
|
||||||
{{:linkbutton
|
{{:assign mois=$date_amort|date:"m"}}
|
||||||
label="Enregistrer"
|
{{:assign annee=$date_amort|date:"Y"}}
|
||||||
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_id:$project_id:$libelle
|
{{:assign annee="%d+1"|math:$annee}}
|
||||||
shape="right"
|
{{:assign date_amort="%s/%s/%s"|args:$jour:$mois:$annee|parse_date|date_short}}
|
||||||
}}
|
{{:assign current_year="%d+1"|math:$current_year}}
|
||||||
{{else}}
|
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
||||||
{{:linkbutton label="Enregistrer" href="" shape="lock" class="disabled"}}
|
{{if $solde == 0}}{{:break}}{{/if}}
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{{:assign current_year="%d+1"|math:$current_year}}
|
|
||||||
{{:assign annuite_courante="min(%f,%f)"|math:$annuite:$solde}}
|
|
||||||
{{/if}}
|
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</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 style="text-align: right;">Montant</th>
|
||||||
|
<th>Libellé</th>
|
||||||
|
<th>N° compte</th>
|
||||||
|
<th>Compte</th>
|
||||||
|
<th>Projet</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,
|
||||||
|
pro.label as p_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
|
||||||
|
inner join acc_projects as pro on li.id_project = pro.id
|
||||||
|
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;
|
||||||
|
:id_amort=$t_id}}
|
||||||
|
{{:assign linked="true"}}
|
||||||
|
{{/select}}
|
||||||
|
|
||||||
|
{{if ! $l_id|in:$amort_associes && $linked != "true"}}
|
||||||
|
{{:assign trans_url="%s/acc/transactions/details.php?id=%s"|args:$admin_url:$t_id}}
|
||||||
|
<tr>
|
||||||
|
<td class="num"><a href={{$trans_url}}>#{{$t_id}}</a></td>
|
||||||
|
<td>{{$t_date|date_short}}</td>
|
||||||
|
<td class="money">{{"%f"|math:$montant|money}}</td>
|
||||||
|
<td>{{if $l_label == null}}
|
||||||
|
{{$t_label}}
|
||||||
|
{{else}}
|
||||||
|
{{$l_label}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
<td>{{$a_code}}</td>
|
||||||
|
<td>{{$a_label}}</td>
|
||||||
|
<td>{{$p_label}}</td>
|
||||||
|
<td>
|
||||||
|
{{if $linked != "true"}}
|
||||||
|
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$l_id:$ligne_immo.line_id shape="plus"}}
|
||||||
|
{{else}}
|
||||||
|
{{:linkbutton label="Attacher" href="" shape="lock" class="disabled"}}
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/if}}
|
||||||
|
{{/select}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
|
||||||
{{:form_errors}}
|
{{:form_errors}}
|
||||||
{{:admin_footer}}
|
{{:admin_footer}}
|
||||||
|
33
attach_amort.html
Normal file
33
attach_amort.html
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Enregistrer l'association entre une écriture d'amortissement et
|
||||||
|
l'écriture d'immobilisation correspondante
|
||||||
|
Comme je ne sais pas créer une ligne dans acc_transactions_links
|
||||||
|
j'enregistre les associations dans un document json
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{* trouver l'entrée correspondant à l'immobilisation *}}
|
||||||
|
|
||||||
|
{{* TODO : améliorer le message d'erreur *}}
|
||||||
|
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign message="Pas d'info concernant l'immobilisation %s ; avez-vous renseigné la durée d'immobilisation ?"|args:$_GET.immo_id}}
|
||||||
|
{{:error message=$message}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
|
||||||
|
{{* Ajouter la nouvelle ligne d'amortissement aux lignes existantes *}}
|
||||||
|
|
||||||
|
{{:assign var="assoc." value=$_GET.amort_id|intval}}
|
||||||
|
|
||||||
|
{{* Enregistrer les infos *}}
|
||||||
|
{{:save
|
||||||
|
key=$info_immo.key
|
||||||
|
validate_schema="schema.json"
|
||||||
|
type="immo"
|
||||||
|
line=$info_immo.line
|
||||||
|
duration=$info_immo.duration
|
||||||
|
amort=$assoc
|
||||||
|
}}
|
||||||
|
{{:redirect to="amortization.html?line_id=%s&ok=1&msg=attach"|args:$_GET.immo_id}}
|
31
detach_amort.html
Normal file
31
detach_amort.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{{* -*- brindille -*- *}}
|
||||||
|
|
||||||
|
{{*
|
||||||
|
Supprimer l'association entre une écriture d'amortissement et
|
||||||
|
une écriture d'immobilisation
|
||||||
|
*}}
|
||||||
|
|
||||||
|
{{#load type="immo" assign="info_immo" where="$$.line = :line_id" :line_id=$_GET.immo_id|intval}}
|
||||||
|
{{else}}
|
||||||
|
{{:assign message="Pas d'info concernant l'immobilisation %s"|args:$_GET.immo_id}}
|
||||||
|
{{:error message=$message}}
|
||||||
|
{{/load}}
|
||||||
|
|
||||||
|
{{:assign var="liste_amort" val=$info_immo.amort}}
|
||||||
|
|
||||||
|
{{#foreach from=$info_immo.amort item="amort_id"}}
|
||||||
|
{{if $amort_id != $_GET.amort_id}}
|
||||||
|
{{:assign var="t_amort." value=$amort_id}}
|
||||||
|
{{/if}}
|
||||||
|
{{/foreach}}
|
||||||
|
|
||||||
|
{{* Enregistrer les infos *}}
|
||||||
|
{{:save
|
||||||
|
key=$info_immo.key
|
||||||
|
validate_schema="schema.json"
|
||||||
|
type="immo"
|
||||||
|
line=$info_immo.line
|
||||||
|
duration=$info_immo.duration
|
||||||
|
amort=$t_amort
|
||||||
|
}}
|
||||||
|
{{:redirect to="amortization.html?line_id=%s&ok=1&msg=detach"|args:$_GET.immo_id}}
|
Loading…
Reference in New Issue
Block a user