My form has 2 inputs, each calling the calculeSalaire()
function.
calculeSalaire()
{
this.fraisGestion = this.getFraisGestion();
this.tauxFraisGestion = this.getTauxFraisGestion();
this.salaireBrut = this.getSalaireBrut();
this.salaireNet = this.getSalaireNet();
this.chargesSalariales = this.getChargesSalariales();
this.chargesPatronales = this.getChargesPatronales();
this.totalPaye = this.getTotalPaye();
}
All these functions return a number
. I want to display only 2 decimal places for each of these values using the toFixed(2)
function.
The formatting works for all functions except one:
getSalaireBrut()
{
this.salaireBrut = (this.chiffreAffaire - this.fraisGestion -
this.fraisPro)/(1.10)/(1.447);
var salaireBruttxt = this.salaireBrut.toFixed(2);
return parseFloat(salaireBruttxt);
}
chiffreAffaire
is an Input
fraisPro
is an Input
fraisGestion
is calculated
I'm puzzled why it doesn't work for this function but works fine in the following function:
getChargesSalariales()
{
this.chargesSalariales = this.salaireBrut*(23/100);
var chargesSalarialtxt = this.chargesSalariales.toFixed(2);
return parseFloat(chargesSalarialtxt);
}
It's worth mentioning that I utilize the salaireBrut
value calculated by the previous non-working function.
Any insights on why this discrepancy occurs?