diff --git a/components/new/new.vue b/components/new/new.vue
index 5b0273c..702385f 100644
--- a/components/new/new.vue
+++ b/components/new/new.vue
@@ -5,7 +5,7 @@
- sel = indx"
>
@@ -46,14 +46,14 @@ class="bi bi-plus" viewBox="0 0 16 16"> loan.hoi = Math.round(hoi*100)"
@update:interest="(i) => loan.interest = i"
- @update:interestDays="(d) => loans[sel].interestDays = d"
- @update:hazardEscrow="(h) => loans[sel].hazardEscrow = h"
+ @update:interestDays="(d) => estimate.loans[sel].interestDays = d"
+ @update:hazardEscrow="(h) => estimate.loans[sel].hazardEscrow = h"
@update:hazard="(h) => loan.hazard = Math.round(h * 100)"
- @update:taxEscrow="(t) => loans[sel].taxEscrow = t"
+ @update:taxEscrow="(t) => estimate.loans[sel].taxEscrow = t"
@update:tax="(t) => loan.tax = Math.round(t*100)"
@update:manualMI="perc => loan.mi.rate = perc"
@toggle:manualMIMonthly=
- "() => loans[sel].mi.monthly = !loans[sel].mi.monthly"
+ "() => estimate.loans[sel].mi.monthly = !estimate.loans[sel].mi.monthly"
@continue="generate"
/>
1) {
+ if (this.estimate.loans.length > 1) {
let x = this.sel
this.sel = 0
- this.loans.splice(x, 1)
+ this.estimate.loans.splice(x, 1)
}
}
@@ -176,7 +176,7 @@ function setAmount(e) {
function setDti(e) {
let dti = strip(e)
- let loan = this.loans[this.sel]
+ let loan = this.estimate.loans[this.sel]
if (!loan.price) return
if (dti > 100) dti = 100
@@ -188,7 +188,7 @@ function setDti(e) {
function setHousingDti(e) {
let housingDti = strip(e)
- let loan = this.loans[this.sel]
+ let loan = this.estimate.loans[this.sel]
if (!loan.price) return
if (housingDti > 100) housingDti = 100
@@ -238,7 +238,6 @@ export default {
data() {
return {
estimate: estimate,
- loans: estimate.loans,
sel: 0,
errors: [],
hash: window.location.hash
diff --git a/components/new/summary.vue b/components/new/summary.vue
index 0e26aea..cd00dee 100644
--- a/components/new/summary.vue
+++ b/components/new/summary.vue
@@ -22,7 +22,7 @@ Credits: ${{format(loan.result.totalCredits)}}
diff --git a/skouter.go b/skouter.go
index 3e0400f..8f0ec03 100644
--- a/skouter.go
+++ b/skouter.go
@@ -270,7 +270,7 @@ func cachePdf(name string) Page {
// For calculating down payments
diff := func(a, b int) string {
- return strconv.FormatFloat(float64(b - a)/100, 'f', 2, 32)
+ return humanize.Commaf(float64(b - a)/100)
}
sortFees := func(ftype string, fees []Fee) []Fee {
@@ -341,6 +341,8 @@ func (estimate *Estimate) makeResults() []Result {
if loan.Mi.Monthly {
result.TotalMonthly = result.TotalMonthly +
int(loan.Mi.Rate/100/12*float32(loan.Amount))
+ } else {
+ loan.Mi.Upfront = int(loan.Mi.Rate/100*float32(loan.Amount))
}
for i := range loan.Fees {
diff --git a/views/report/comparison.tpl b/views/report/comparison.tpl
index 676d9c0..0777e03 100644
--- a/views/report/comparison.tpl
+++ b/views/report/comparison.tpl
@@ -30,11 +30,11 @@
Loan amount |
{{range .Estimate.Loans}}${{dollars .Amount}} | {{end}}
Down payment |
-{{range .Estimate.Loans}}${{diff .Amount $.Estimate.Price}} | {{end}}
+{{range .Estimate.Loans}}${{diff .Amount $.Estimate.Price }} | {{end}}
Closing costs |
{{range .Estimate.Loans}}${{dollars .Result.TotalFees}} | {{end}}
MI Premium |
- {{range .Estimate.Loans}}${{.Mi.Upfront}} | {{end}}
+ {{range .Estimate.Loans}}${{dollars .Mi.Upfront}} | {{end}}
Credits |
{{range .Estimate.Loans}}${{dollars .Result.TotalCredits}} | {{end}}
Cash to close |