KJE.parameters.set("MSG_SALES_TAX_RATE","GST + PST or HST (%)");KJE.parameters.set("MSG_LABEL8","Market value of equipment");KJE.parameters.set("MSG_DROPPER_TITLE","Equipment information:");KJE.parameters.set("MSG_DROPPER_CLOSETITLE","Equipment price of KJE2 with a KJE1 down payment.");KJE.BuyvsLeaseCalc=function(){this.MSG_ERROR1=KJE.parameters.get("MSG_ERROR1","Your loan term must be equal to or greater than the lease term.");this.MSG_ERROR2=KJE.parameters.get("MSG_ERROR2","Your down payment must be less than or equal to the total purchase price.");this.DS_NET=KJE.FloatArray(2);this.cats=KJE.parameters.get("ARRAY_GRAPH_CATS",["Net Cost to Buy","Net Cost to Lease"]);this.sSchedule=new KJE.Repeating()};KJE.BuyvsLeaseCalc.prototype.clear=function(){this.TERM=0;this.SECURITY_DEPOSIT=0;this.OTHER_FEES_LEASE=0;this.CAR_PRICE=0;this.INTEREST_RATE=0;this.DOWN_PAYMENT=0;this.OTHER_FEES_BUY=0;this.SALES_TAX_RATE=0;this.RATE_OF_DEPRECIATION=0;this.INVESTMENT_ROR=0;this.LOAN_TERM=0;this.LEASE_INTEREST=0;this.RESIDUAL_PERCENT=0};KJE.BuyvsLeaseCalc.prototype.calculate=function(A){var d=KJE;var I=this.TERM;var g=this.SECURITY_DEPOSIT;var v=this.OTHER_FEES_LEASE;var u=this.CAR_PRICE;var c=this.INTEREST_RATE;var s=this.DOWN_PAYMENT;var e=this.OTHER_FEES_BUY;var b=this.SALES_TAX_RATE;var a=this.RATE_OF_DEPRECIATION;var y=this.INVESTMENT_ROR;var H=this.LOAN_TERM;var J=this.LEASE_INTEREST;var k=this.RESIDUAL_PERCENT;var B=I/12;if(H==0){H=I}if(I>H){throw (this.MSG_ERROR1)}var L=s+v;var o=(u*(k/100));var G=o*(J/1200);G+=KJE.PMT(J/1200,I,u-s-o);G*=(1+(b/100));var t=G*I;var r=L+t;var F=KJE.FV_AMT(y/100,B,g+L)-g-L;var z=F+r;var h=z/I;var w=u*(b/100);var C=u+w+e;if(s>C){throw (this.MSG_ERROR2)}var l=C-s;var x=u;for(var E=1;E<=B;E++){x=x*(1-a/100)}var i=KJE.PMT(c/1200,H,l);var m=0;var D=i*I;var K=KJE.FV_AMT(y/100,B,s+e)-s-e;var p=l;var f=KJE.ROR_MONTH(y/100);for(var E=1;E<=I;E++){p-=(i-((p*c)/1200));m=(i-G+m)*(f+1)}m-=(i-G)*I;K+=m;var j=D+s+K-x+p;var q=j/I;this.LOST_PAYMENT_INTEREST=m;this.TOTAL_UPFRONT_COSTS=L;this.TOTAL_LEASE_PAYMENTS=t;this.TOTAL_PAID_FOR_LEASE=r;this.LOST_INTEREST_ON_LEASE=F;this.NET_COST_OF_LEASE=z;this.AVERAGE_COST_PER_MONTH_LEASE=h;this.MARKET_VALUE_AT_END_OF_LOAN=x;this.SALES_TAX=w;this.TOTAL_PURCHASE_PRICE=C;this.LOAN_AMOUNT=l;this.LOAN_PAYMENT=i;this.TOTAL_PAYMENTS=D;this.LOST_INTEREST_ON_BUY=K;this.NET_COST_OF_PURCHASE=j;this.AVERAGE_COST_PER_MONTH_BUY=q;this.ENDING_LOAN_BALANCE=p;this.MONTHLY_PAYMENT=G;this.RESIDUAL_AMT=o;this.DS_NET[0]=j;this.DS_NET[1]=z};KJE.BuyvsLeaseCalc.prototype.formatReport=function(b){var c=KJE;var a=this.iDecimal;var d=b;d=KJE.replace("LEASE_INTEREST",c.percent(this.LEASE_INTEREST/100,2),d);d=KJE.replace("RESIDUAL_PERCENT",c.percent(this.RESIDUAL_PERCENT/100),d);d=KJE.replace("RESIDUAL_AMT",c.dollars(this.RESIDUAL_AMT,2),d);d=KJE.replace("ENDING_LOAN_BALANCE",c.dollars(this.ENDING_LOAN_BALANCE,2),d);d=KJE.replace("LOAN_TERM",c.number(this.LOAN_TERM),d);d=KJE.replace("LOST_INTEREST_ON_LEASE",c.dollars(this.LOST_INTEREST_ON_LEASE,2),d);d=KJE.replace("TERM",c.number(this.TERM),d);d=KJE.replace("MONTHLY_PAYMENT",c.dollars(this.MONTHLY_PAYMENT,2),d);d=KJE.replace("SECURITY_DEPOSIT",c.dollars(this.SECURITY_DEPOSIT,2),d);d=KJE.replace("OTHER_FEES_LEASE",c.dollars(this.OTHER_FEES_LEASE,2),d);d=KJE.replace("TOTAL_UPFRONT_COSTS",c.dollars(this.TOTAL_UPFRONT_COSTS,2),d);d=KJE.replace("TOTAL_LEASE_PAYMENTS",c.dollars(this.TOTAL_LEASE_PAYMENTS,2),d);d=KJE.replace("TOTAL_PAID_FOR_LEASE",c.dollars(this.TOTAL_PAID_FOR_LEASE,2),d);d=KJE.replace("NET_COST_OF_LEASE",c.dollars(this.NET_COST_OF_LEASE,2),d);d=KJE.replace("AVERAGE_COST_PER_MONTH_LEASE",c.dollars(this.AVERAGE_COST_PER_MONTH_LEASE,2),d);d=KJE.replace("CAR_PRICE",c.dollars(this.CAR_PRICE,2),d);d=KJE.replace("INTEREST_RATE",c.percent(this.INTEREST_RATE/100,2),d);d=KJE.replace("DOWN_PAYMENT",c.dollars(this.DOWN_PAYMENT,2),d);d=KJE.replace("OTHER_FEES_BUY",c.dollars(this.OTHER_FEES_BUY,2),d);d=KJE.replace("SALES_TAX_RATE",c.percent(this.SALES_TAX_RATE/100,2),d);d=KJE.replace("RATE_OF_DEPRECIATION",c.percent(this.RATE_OF_DEPRECIATION/100),d);d=KJE.replace("MARKET_VALUE_AT_END_OF_LOAN",c.dollars(this.MARKET_VALUE_AT_END_OF_LOAN,2),d);d=KJE.replace("SALES_TAX",c.dollars(this.SALES_TAX,2),d);d=KJE.replace("TOTAL_PURCHASE_PRICE",c.dollars(this.TOTAL_PURCHASE_PRICE,2),d);d=KJE.replace("LOAN_AMOUNT",c.dollars(this.LOAN_AMOUNT,2),d);d=KJE.replace("LOAN_PAYMENT",c.dollars(this.LOAN_PAYMENT,2),d);d=KJE.replace("TOTAL_PAYMENTS",c.dollars(this.TOTAL_PAYMENTS,2),d);d=KJE.replace("TOTAL_DOWN_PLUS_PAYMENTS",c.dollars(c.round(this.TOTAL_PAYMENTS,2)+this.DOWN_PAYMENT,2),d);d=KJE.replace("TOTAL_DOWN_LOST_INTEREST_PLUS_PAYMENTS",c.dollars(c.round(this.TOTAL_PAYMENTS,2)+this.DOWN_PAYMENT+c.round(this.LOST_INTEREST_ON_BUY,2),2),d);d=KJE.replace("LOST_INTEREST_ON_BUY",c.dollars(this.LOST_INTEREST_ON_BUY,2),d);d=KJE.replace("NET_COST_OF_PURCHASE",c.dollars(this.NET_COST_OF_PURCHASE,2),d);d=KJE.replace("AVERAGE_COST_PER_MONTH_BUY",c.dollars(this.AVERAGE_COST_PER_MONTH_BUY,2),d);d=KJE.replace("INVESTMENT_ROR",c.percent(this.INVESTMENT_ROR/100,2),d);d=KJE.replace("LOST_PAYMENT_INTEREST",c.dollars(this.LOST_PAYMENT_INTEREST),d);d=KJE.replace("LEASE_TOT_DOWN_PLUS_PAYMENTS",c.dollars(c.round(this.TOTAL_LEASE_PAYMENTS,2)+this.TOTAL_UPFRONT_COSTS,2),d);d=KJE.replace("LEASE_TOT_DOWN_LOST_INTEREST_PLUS_PAYMENTS",c.dollars(c.round(this.TOTAL_LEASE_PAYMENTS,2)+this.TOTAL_UPFRONT_COSTS+c.round(this.LOST_INTEREST_ON_LEASE,2),2),d);d=d.replace("**REPEATING GROUP**",this.sSchedule.getRepeat());this.sSchedule.clearRepeat();return d};KJE.CalcName="Equipment Buy vs. Lease Calculator (Canadian)";KJE.CalcType="CABizBuyvsLease";KJE.CalculatorTitle="Buy or Lease?";KJE.parseInputs=function(a){return a};KJE.initialize=function(){KJE.CalcControl=new KJE.BuyvsLeaseCalc();KJE.GuiControl=new KJE.BuyvsLease(KJE.CalcControl)};KJE.BuyvsLease=function(n){var f=KJE;var c=KJE.gLegend;var i=KJE.inputs.items;KJE.PercentSlider("LEASE_INTEREST","Interest rate",0,20,2);KJE.PercentSlider("RESIDUAL_PERCENT","Residual percent",0,95,0);KJE.NumberSlider("TERM","Lease term in months",12,360,0);KJE.NumberSlider("LOAN_TERM","Loan term in months",12,360,0);KJE.DollarSlider("SECURITY_DEPOSIT","Security deposit",0,100000);KJE.DollarSlider("OTHER_FEES_LEASE","Other fees",0,50000);KJE.DollarSlider("CAR_PRICE","Purchase price",1000,10000000,n.iDecimal,0,KJE.parameters.get("AUTO_SALE_PRICE_SLM",2));KJE.PercentSlider("INTEREST_RATE","Interest rate",0,20,2);KJE.DollarSlider("DOWN_PAYMENT","Down payment",0,1000000);KJE.DollarSlider("OTHER_FEES_BUY","Other fees",0,100000);KJE.PercentSlider("SALES_TAX_RATE","Sales tax rate",0,30,2);KJE.PercentSlider("RATE_OF_DEPRECIATION","Annual depreciation",0,25,0);KJE.InvestRateSlider("INVESTMENT_ROR","Investment rate of return");KJE.Label("NET_COST_OF_LEASE","Net cost of lease",null,null,"KJEBold");KJE.Label("NET_COST_OF_PURCHASE","Net cost of buying",null,null,"KJEBold");var j=KJE.gNewGraph(KJE.gCATEGORIES,"GRAPH1",true,false,KJE.colorList[1],KJE.parameters.get("MSG_GRAPH_TITLE","Net Cost of Buying vs. Leasing"));j._legend.setVisible(false);j._legend._iOrientation=(c.TOP_RIGHT);j._showItemLabel=true;j._bPopDetail=true;var b=KJE.parameters.get("MSG_DROPPER_TITLE","Vehicle information:");var e=KJE.parameters.get("MSG_DROPPER_CLOSETITLE","Vehicle price of KJE2 with a KJE1 down payment.");var g=function(){return b+KJE.subText(KJE.getKJEReplaced(e,i.DOWN_PAYMENT.getFormatted(),i.CAR_PRICE.getFormatted(),i.SALES_TAX_RATE.getFormatted()),"KJECenter")};KJE.addDropper(new KJE.Dropper("INPUTS",true,b,g),KJE.colorList[0]);var o=KJE.parameters.get("MSG_DROPPER2_TITLE","Buy option:");var h=KJE.parameters.get("MSG_DROPPER2_CLOSETITLE","Payment KJE1");var m=function(){return o+"|"+KJE.subText(KJE.getKJEReplaced(h,f.dollars(n.LOAN_PAYMENT,2)),"KJERightBold")};KJE.addDropper(new KJE.Dropper("INPUTS2",false,m,m),KJE.colorList[0]);var a=KJE.parameters.get("MSG_DROPPER3_TITLE","Lease option:");var d=KJE.parameters.get("MSG_DROPPER3_CLOSETITLE","Payment KJE1");var k=function(){return a+"|"+KJE.subText(KJE.getKJEReplaced(d,f.dollars(n.MONTHLY_PAYMENT,2)),"KJERightBold")};KJE.addDropper(new KJE.Dropper("INPUTS3",false,k,k),KJE.colorList[0])};KJE.BuyvsLease.prototype.setValues=function(b){var a=KJE.inputs.items;b.TERM=a.TERM.getValue();b.SECURITY_DEPOSIT=a.SECURITY_DEPOSIT.getValue();b.OTHER_FEES_LEASE=a.OTHER_FEES_LEASE.getValue();b.CAR_PRICE=a.CAR_PRICE.getValue();b.INTEREST_RATE=a.INTEREST_RATE.getValue();b.DOWN_PAYMENT=a.DOWN_PAYMENT.getValue();b.OTHER_FEES_BUY=a.OTHER_FEES_BUY.getValue();b.SALES_TAX_RATE=a.SALES_TAX_RATE.getValue();b.RATE_OF_DEPRECIATION=a.RATE_OF_DEPRECIATION.getValue();b.INVESTMENT_ROR=a.INVESTMENT_ROR.getValue();b.LOAN_TERM=a.LOAN_TERM.getValue();b.LEASE_INTEREST=a.LEASE_INTEREST.getValue();b.RESIDUAL_PERCENT=a.RESIDUAL_PERCENT.getValue()};KJE.BuyvsLease.prototype.refresh=function(e){var d=KJE;var c=KJE.gLegend;var b=KJE.inputs.items;var a=KJE.gGraphs[0];a.removeAll();a.setGraphCategories(e.cats);a.add(new KJE.gGraphDataSeries(e.DS_NET,"Test",a.getColor(1)));a.paint();b.NET_COST_OF_LEASE.setText(d.dollars(e.NET_COST_OF_LEASE,2));b.NET_COST_OF_PURCHASE.setText(d.dollars(e.NET_COST_OF_PURCHASE,2))};KJE.InputScreenText="
**ROR_DEFINITION**
The lost interest on your purchase includes any interest you would have earned at your investment rate of return on the buy option's down payment and other fees. If the monthly payment for leasing is less than the monthly payment for buying, this also includes any lost interest due to the higher monthly payments. If leasing is more expensive than buying, your interest costs for buying are reduced by the amount of interest you would earn on the difference.
The lost interest on your lease includes any interest you would have earned at your investment rate of return on the lease option's down payment, security deposit and other fees. Please see the definition for 'Net cost of buying' for an explanation on how we account for any interest you might earn by having a lower monthly lease payment.
Buy | Lease | ||
---|---|---|---|
Price | CAR_PRICE | Price | CAR_PRICE |
Interest rate | INTEREST_RATE | Interest rate | LEASE_INTEREST |
Down payment | DOWN_PAYMENT | Down payment | DOWN_PAYMENT |
Other fees buy | OTHER_FEES_BUY | Other fees lease | OTHER_FEES_LEASE |
Rate of depreciation | RATE_OF_DEPRECIATION | Residual percent | RESIDUAL_PERCENT |
GST + PST or HST (%) | SALES_TAX | Security deposit | SECURITY_DEPOSIT |
Loan amount | LOAN_AMOUNT | ||
Loan payment | LOAN_PAYMENT | Lease payment | MONTHLY_PAYMENT |
Net cost of buying | Net cost of leasing | ||
---|---|---|---|
Total loan payments | + TOTAL_PAYMENTS | Total lease payments | + TOTAL_LEASE_PAYMENTS |
Lost interest on buy option | + LOST_INTEREST_ON_BUY | Lost interest on up front costs | + LOST_INTEREST_ON_LEASE |
Down payment | + DOWN_PAYMENT | Up front costs | + TOTAL_UPFRONT_COSTS |
Ending loan balance | + ENDING_LOAN_BALANCE | ||
Market value after TERM months* | - MARKET_VALUE_AT_END_OF_LOAN | ||
Net cost of purchase | = NET_COST_OF_PURCHASE | Net cost of lease | = NET_COST_OF_LEASE |