Améliorations cosmétiques

This commit is contained in:
Jean-Christophe Engel 2025-05-16 15:20:22 +02:00
parent 3fc96927a5
commit 0c4f39b21a
5 changed files with 26 additions and 16 deletions

View file

@ -1,9 +1,8 @@
{{* -*- brindille -*- *}}
{{*
créer une écriture d'amortissement
paramètres
- immo_id : id de la ligne d'immobilisation
Créer une écriture d'amortissement
@param immo_id : id de la ligne d'immobilisation
*}}
{{* Infos de l'immobilisation *}}
@ -49,6 +48,7 @@
ELSE links.id_related
END as amort_trans_id,
MAX(trans.date) as amort_date,
COUNT(trans.id) as amort_number,
trans.label as trans_label,
trans.id_year as amort_year,
account.id as account_id,
@ -70,9 +70,8 @@
}}
{{/select}}
{{if $amort_line.amort_amount == null}}
{{if $amort_line.amort_number == 0}}
{{* 1er amortissement *}}
{{:assign premier_amort=true}}
{{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}}
{{#select code, label from acc_accounts where id = :id; :id=$ligne_immo.account_id assign=amort_account}}
{{/select}}
@ -85,7 +84,6 @@
{{:assign var=libelle value="Amortissement %s"|args:$ligne_immo.label}}
{{else}}
{{* amortissements suivants *}}
{{:assign premier_amort=false}}
{{:assign date_debut=$amort_line.amort_date|strtotime}}
{{:assign date_debut="%d+(60*60*24)"|math:$date_debut|date:"Y-m-d"}}
{{:assign var=code_amort value=$amort_line.account_code}}
@ -98,8 +96,9 @@
ou la date du dernier amortissement
*}}
{{:assign msg_years=""}}
{{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date" :debut=$date_debut assign=years.}}
{{if $premier_amort}}
{{#years closed=false order="start_date" where="start_date <= :debut AND :debut <= end_date"
:debut=$date_debut assign=years.}}
{{if $amort_line.amort_number == 0}}
{{:assign ts_debut=$date_debut|strtotime}}
{{else}}
{{:assign ts_debut=$start_date|strtotime}}
@ -129,7 +128,7 @@
{{/if}}
{{/foreach}}
{{if ! $ok}}
{{:error message="La date choisie n'est dans aucun exercice compatible !!\nExercices compatibles : %s"|args:$msg_years}}
{{:error message="La date choisie n'est dans aucun exercice compatible !\nExercices compatibles : %s"|args:$msg_years}}
{{/if}}
{{* déterminer le numéro des comptes au cas où la clé serait un identifiant *}}
{{:include
@ -233,7 +232,7 @@
{{* -------------------------------------------------------------------------------- *}}
<div id="f_erreur" class="hidden">
<p class="block error">La date saisie n'est pas dans l'exercice choisi</p>
<p class="block error">La date saisie n'est pas dans l'exercice choisi !</p>
</div>
<form method="post" action="">