Calculator Upgrade

I love these change ideas. I am moderately adept at using financial software, and still found the current calculator could use some simplifying…especially eliminating the need for a negative number.

I’m close to finishing #1. For some damn reason Im off by a dollar or 2 when it calculates monthly. Pretty annoying. There are a lot of conditional statements in the calculations that make it challenging.

What language are you coding in?

Calculator is coded in JavaScript. It’s mostly an issue when the due at signing is less than taxes and fees, and you are rolling in the remainder of fees into the monthly.

As an aside, I am a server side java developer.

Aside from the possible slick data feed for state/county/city tax while retaining proper methodology for monthly vs upfront etc…, the only thing I really find myself wanting in the current calc is all fees and upfront items to just default to upfront, and have a check-box to allow simple capping/rolling to payment. I think that would provide much clarity to those not familiar with the inside calculations to leasing, and avoid the negative down payment “trick”. Then you can just add whatever down payment you like, to achieve desired total DAS or specify a desired DAS to roll up to as well. Other than that, a few blank lines to add misc amounts for extras like various coverage plans or remaining payments from old lease would be helpful, with the same option to stay upfront or check-box for capping/rolling to payment.

1 Like

I’ve worked with MEAN before, let me know if I can help any, I’ll definitely try!

So I think its the math here that is killing me, mostly when calculating " Tax is levied upfront on the total lease payment".

The base calculation for netCapCost in the existing code is:
netCapCost = salesPrice - incUntaxed -incTaxed - dp + acqFeeV;

In the case of using a negative number in the down payment field it is a double negative in the above calc. which becomes a positive, so in essence you are adding in that value to the capCost. This calculates the monthly correctly but there is always some ± $10 discrepancy with the actual calculated tax.

I have no clue who wrote or maintains the code for the calculator but I made a “least intrusive” change to get the down payment to calculate while rolling the rest of the taxes and fees in.

In some case the monthly is off by a dollar, but the tax is never calculating right. I guess its close enough that it does not mess up the monthly.

Basically tax on total lease cost is a pia because you need to calculate the monthly then re-calculate the netCapCost after you find how much tax get paid for the lease payments.

This is the simple change:

function calcAll() {
calcNCC();
calcMonPmt();
calcDriveOffTax();
calcDriveOff();

if ($("#zero_driveoff").is(':checked')) {
  calcZeroDriveOff();
} else { //roll in fees and apply down payment (MY CHANGE HERE)
  fees = dealerFee + regFee;

  //re-calculate  tax on total lease cost
  if (totalLeaseTaxRad.is(':checked')) {
    driveoff_taxbase = driveoff_taxbase / (1 - tax);
    driveoff_tax = driveoff_taxbase * tax;
  }

  var ncc_rollin = driveoff_tax + fees + monPmtTax;

  driveoff = dp;
  netCapCost = salesPrice - incUntaxed - incTaxed - dp + acqFeeV + ncc_rollin;
  calcMonPmt();
}
calcTotalLeaseCost(); //For diaplay purposes

}

Basically run the calculation (which finds the initial tax) “driveoff_taxbase = monPmt*mo + dp + incTaxed + dealerFee + acqFeeV;”

Then run it again with the update capCost that includes taxes and fees, then re run the calc for monthly payment.

Does anyone have the complete mathematical formula for Tax is levied upfront on the total lease payment?

I tried to just calculate this by hand but i could not get the correct tax and monthly.

There is definitely a bug in general calculating tax, in the existing code. Especially when checking Zero Drive off when there is already a value in the down payment field.

I don’t but I wanted to say I appreciate your efforts on this.

Do any of the mods know whether demo mileage is taxed the calculator??

1 Like

Miles are never taxed. Dollars are taxed.

All else being equal: Adding demo miles lowers your RV, which increases your payments, and those higher payments are taxed.

1 Like

Yeah that’s theoretically correct, but the calc doesn’t do this.

May be a bug:

Example from calc code -

resV = resPmsrp - 0.2(demoMileage-3000);
adjResP = resV/msrp;

adjResP is only used for display purposes and never included in the actual calculation.

Not sure if that is intentional or not.

Is that for Mercedes? Does the bug exist for all brands that have demo calcs?

Looks like it only does it for mini/bmw and Mercedes. It is also conditional on demo milage amount.

For MB, its > 3000 < 10000 for it to adj res.

For BMW there are a few more milage conditions.

But again, it never does anything with the final revised res number aside from display.

@admins looks like @jonnyd91 found a bug in the calculator

adjResP is for display purposes only, but resV (adjusted RV in dollars) is used for calculations. I didn’t calculate a deal by hand to confirm it’s accuracy, but playing with the demo miles, the calculated monthly payments seem to be adjusting accordingly.

Yep, missed that. Maybe what @aronchi is seeing is that it only recalculates the residual for certain milage ranges.

e.g. for MB it is (demoMileage>3000 && demoMileage<10000)
for BMW there are a few different ranges it calculates.

I don’t know the logic or intent behind that, this is just me eyeballing the code.

I agree, i just don’t think the sales tax on the mileage is running. Demo miles are taxes

Do you have a basic hand calculation on that?

It looks like after the RV is re-calculated the calculator calls calculateAll again and reprocessed the entire calculation with the updated RV.

Does anyone know if our calcs include taxing msds?