diff --git a/archives.html b/archives.html index a56d15a..9160b73 100644 --- a/archives.html +++ b/archives.html @@ -5,6 +5,7 @@

Immobilisations archivées

+ {{:assign nb_immo=0}} @@ -26,7 +27,7 @@ {{:assign lines=$lines|implode:","}} {{:assign lines="("|cat:$lines|cat:")"}} {{:assign condition="line.id IN %s"|args:$lines}} -{{*:debug condition=$condition*}} + {{#select trans.id as trans_id, trans.label as trans_label, @@ -49,6 +50,7 @@ }} {{: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 nb_immo="%d+1"|math:$nb_immo}} @@ -63,4 +65,7 @@ {{/select}}
#{{$trans_id}} {{$trans_date|date_short}}
+ {{if $nb_immo == 0}} +

Aucune immobilisation

+ {{/if}}
diff --git a/immobilisations.html b/immobilisations.html index aa69248..6f1c86c 100644 --- a/immobilisations.html +++ b/immobilisations.html @@ -8,6 +8,7 @@ {{elseif $amort == "fini"}}

Immobilisations amorties

{{/if}} + {{:assign nb_immo=0}} @@ -138,6 +139,7 @@ }} {{:continue}} {{/if}} + {{:assign nb_immo="%d+1"|math:$nb_immo}} @@ -179,4 +181,7 @@ {{/select}}
#{{$trans_id}} {{$trans_date|date_short}}
+ {{if $nb_immo == 0}} +

Aucune immobilisation

+ {{/if}} diff --git a/immobilisations_non.html b/immobilisations_non.html index 2b31c84..39fbd96 100644 --- a/immobilisations_non.html +++ b/immobilisations_non.html @@ -20,12 +20,13 @@ - {{#load type="immo" where="$$.noamort = true"}} + {{#load type="immo" where="$$.status = 'ignored'"}} {{:assign var="lines." value="'%s'"|args:$line}} {{/load}} {{:assign lines=$lines|implode:","}} {{:assign lines="("|cat:$lines|cat:")"}} {{:assign condition="line.id IN %s"|args:$lines}} +{{:debug condition=$condition}} {{#select trans.id as trans_id, trans.label as trans_label, diff --git a/save_amort.html b/save_amort.html index 241834f..1c9df59 100644 --- a/save_amort.html +++ b/save_amort.html @@ -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 @@ {{* -------------------------------------------------------------------------------- *}}
diff --git a/scripts.js b/scripts.js index 9d56f87..232df76 100644 --- a/scripts.js +++ b/scripts.js @@ -1,9 +1,9 @@ // activer/désactiver les champs passés en paramètres function toggleInputs(idcb, idfields) { - const noamort = document.getElementById(idcb); + const elem = document.getElementById(idcb); for (let id of idfields) { const field = document.getElementById(id); - if (noamort.checked) { + if (elem.checked) { field.removeAttribute("disabled"); } else { @@ -13,10 +13,10 @@ function toggleInputs(idcb, idfields) { } function toggleVisibility(idcheck, fields) { - const amortcb = document.getElementById(idcheck); + const elem = document.getElementById(idcheck); for (let id of fields) { const field = document.getElementById(id); - if (amortcb.checked) { + if (elem.checked) { field.setAttribute('class', ''); } else { field.setAttribute('class', 'hidden');