diff --git a/_calcul_dates.html b/_calcul_dates.html index e4dd864..ef868de 100644 --- a/_calcul_dates.html +++ b/_calcul_dates.html @@ -9,4 +9,4 @@ {{:assign ts_debut=$date_debut|strtotime}} {{:assign ts_fin=$date_fin|strtotime}} -{{:assign nbjours="1+abs(%d-%d)/(60*60*24)"|math:$ts_fin:$ts_debut}} +{{:assign nbjours="round(1+abs(%d-%d)/(60*60*24), 0)"|math:$ts_fin:$ts_debut}} diff --git a/save_amort.html b/save_amort.html index 2a991e0..43cc871 100644 --- a/save_amort.html +++ b/save_amort.html @@ -41,6 +41,11 @@ {{:assign amort_label=$line_label|or:$trans_label}} {{/foreach}} +{{* date de début du 1er exercice dans paheko *}} +{{#years order="start_date" limit=1}} + {{:assign first_date=$start_date}} +{{/years}} + {{if $total_amort == 0}} {{* 1er amortissement *}} {{* déterminer le compte d'amortissement en fonction du compte d'immobilisation *}} @@ -55,8 +60,10 @@ {{:assign var=libelle value="Amortissement %s"|args:$ligne_immo.trans_label}} {{else}} {{* amortissements suivants *}} - {{:assign date_debut=$date_debut|strtotime}} - {{:assign date_debut="%d+(60*60*24)"|math:$date_debut|date:"Y-m-d"}} + {{if $date_debut != $first_date}} + {{:assign date_debut=$date_debut|strtotime}} + {{:assign date_debut="%d+(60*60*24)"|math:$date_debut|date:"Y-m-d"}} + {{/if}} {{/if}} {{* @@ -244,9 +251,6 @@ {{:input type="text" name="designation" label="Libellé" required=true default=$amort_label size="50"}} {{if $total_amort == 0 || $nbjours < 365 || $nbjours > 366}} {{:assign msg="Montant calculé au prorata du nombre de jours d'amortissement dans l'exercice"}} - {{if $nbjours != null}} - {{:assign msg=$msg|cat:" (%s)"|args:$nbjours}} - {{/if}} {{/if}} {{:input type="money" name="montant" label="Montant" required=true default=$montant_amort help=$msg}} {{:input