Correction incohérence calcul montant amortissement
This commit is contained in:
parent
579ae55434
commit
d54887a18d
2 changed files with 3 additions and 3 deletions
|
|
@ -229,7 +229,7 @@
|
||||||
{{:assign var=date_amort value=$years.0.end_date}}
|
{{:assign var=date_amort value=$years.0.end_date}}
|
||||||
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
{{:include file="_calcul_dates.html" date_debut=$date_debut date_fin=$date_amort keep="nbjours"}}
|
||||||
{{* montant de l'amortissement *}}
|
{{* montant de l'amortissement *}}
|
||||||
{{:assign montant_amort="%f/%f/365*%d"|math:$ligne_immo.amount:$info_immo.duration:$nbjours|intval}}
|
{{:assign montant_amort="round(%f/%f/365*%d,2)"|math:$ligne_immo.amount:$info_immo.duration:$nbjours|intval}}
|
||||||
{{:assign montant_amort="min(%f, %d-%d)"|math:$montant_amort:$ligne_immo.amount:$total_amort}}
|
{{:assign montant_amort="min(%f, %d-%d)"|math:$montant_amort:$ligne_immo.amount:$total_amort}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ function getNumber(text) {
|
||||||
// @param date de fin
|
// @param date de fin
|
||||||
// @result montant de l'amortissement
|
// @result montant de l'amortissement
|
||||||
function computeAmort(montant_immo, duree_immo, somme_amort, date_debut, date_fin) {
|
function computeAmort(montant_immo, duree_immo, somme_amort, date_debut, date_fin) {
|
||||||
const nbjours = 1 + (date_fin - date_debut) / (60*60*24);
|
const nbjours = Math.round(1 + Math.abs((date_fin - date_debut)) / (60*60*24));
|
||||||
return Math.round(Math.min(montant_immo / duree_immo / 365 * nbjours, montant_immo - somme_amort));
|
return Math.round(Math.min(montant_immo / duree_immo / 365 * nbjours, montant_immo - somme_amort));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,7 +131,7 @@ function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_mo
|
||||||
const somme_amort = Number(document.getElementById(id_amort).value);
|
const somme_amort = Number(document.getElementById(id_amort).value);
|
||||||
const montant_amort = computeAmort(montant_immo, duree_immo, somme_amort, date_debut, date_fin);
|
const montant_amort = computeAmort(montant_immo, duree_immo, somme_amort, date_debut, date_fin);
|
||||||
case_montant.value = montant_amort/100;
|
case_montant.value = montant_amort/100;
|
||||||
case_montant.innerText = montant_amort;
|
case_montant.innerText = montant_amort/100;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSelectorYear(button_names, f_years_selector)
|
function setSelectorYear(button_names, f_years_selector)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue