added functionality to modify odometer value when adding new odometer records.

This commit is contained in:
DESKTOP-GENO133\IvanPlex
2024-03-15 12:49:02 -06:00
parent 618107e515
commit 82b0fba99a
9 changed files with 31 additions and 2 deletions

View File

@@ -490,4 +490,15 @@ function getRecordsDeltaStats(recordIds) {
,
icon: "info"
});
}
function GetAdjustedOdometer(id, odometerInput) {
//if editing an existing record or vehicle does not have odometer adjustment or input is NaN then just return the original input.
if (id > 0 || !GetVehicleId().hasOdometerAdjustment || isNaN(odometerInput)) {
return odometerInput;
}
//apply odometer adjustments first.
var adjustedOdometer = parseInt(odometerInput) + parseInt(GetVehicleId().odometerDifference);
//apply odometer multiplier.
adjustedOdometer *= globalParseFloat(GetVehicleId().odometerMultiplier);
return adjustedOdometer.toFixed(0);
}