refonte attachement/détachement écritures amortissement

This commit is contained in:
Jean-Christophe Engel 2024-12-17 10:15:30 +01:00
parent 59e6abe581
commit 10f2128b1b
3 changed files with 56 additions and 49 deletions

View file

@ -26,8 +26,7 @@
{{* 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}}
{{:assign message="Pas d'info concernant l'immobilisation %s"|args:$_GET.immo_id}}
{{:error message=$message}}
{{: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}}
@ -52,8 +51,7 @@
}}
<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}}
{{:assign message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
{{:error message=$message}}
{{:error message="Immobilisation %s non trouvée"|args:$_GET.immo_id}}
{{/select}}
{{* chercher des écritures d'amortissement liées à l'immobilisation *}}
@ -70,8 +68,7 @@
trans.id_year as amort_year,
acc.id as account_id,
acc.code as account_code,
acc.label as account_name,
"vrai" as linked
acc.label as account_name
FROM
acc_transactions_lines as l_immo
INNER JOIN acc_transactions as t_immo on t_immo.id = l_immo.id_transaction
@ -154,11 +151,7 @@
<td><a href={{$compte_url}}>{{$line.account_code}}</a></td>
<td>{{$line.account_name}}</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.immo_id shape="plus"}}
{{else}}
{{*:linkbutton label="Détacher" href="" shape="lock" class="disabled"*}}
{{/if}}
{{:linkbutton label="Détacher" href="detach_amort.html?amort_id=%d&immo_id=%d"|args:$line.amort_line:$ligne_immo.immo_id shape="plus"}}
</td>
</tr>
{{:assign annuite_courante=$annuite}}
@ -221,8 +214,6 @@
shape="right"
target="_dialog"
}}
{{else}}
{{*:linkbutton label="Créer l'écriture" href="" shape="lock" class="disabled"*}}
{{/if}}
</td>
</tr>
@ -259,7 +250,6 @@
order by trans.date, trans.label;
assign=autre_amort
}}
{{:assign linked="false"}}
{{#select
id_transaction,
id_related
@ -267,7 +257,6 @@
where id_transaction = :id_amort or id_related = :id_amort;
:id_amort=$t_id
}}
{{:assign var=autre_amort.linked value="true"}}
{{else}}
{{:assign var="autres_amortissements." value=$autre_amort}}
{{/select}}
@ -305,11 +294,7 @@
<td>{{$line.a_code}}</td>
<td>{{$line.a_label}}</td>
<td>
{{if $linked != "true"}}
{{:linkbutton label="Attacher" href="attach_amort.html?amort_id=%d&immo_id=%d"|args:$line.l_id:$ligne_immo.immo_id shape="plus"}}
{{else}}
{{:linkbutton label="Attacher" href="" shape="lock" class="disabled"}}
{{/if}}
{{: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}}