Browse Source

Fix error caused by negative percentages in fees

master
Immanuel Onyeka 1 year ago
parent
commit
366647310f
5 changed files with 20 additions and 10 deletions
  1. +11
    -2
      components/app.vue
  2. +2
    -1
      components/estimates.vue
  3. +2
    -2
      migrations/0_29092022_setup_tables.sql
  4. +4
    -4
      migrations/seed.sql
  5. +1
    -1
      skouter.go

+ 11
- 2
components/app.vue View File

@@ -11,8 +11,17 @@
</div> </div>


<home :user="user" v-else-if="active == 1" /> <home :user="user" v-else-if="active == 1" />
<new-estimate :user="user" :fees="fees" :token="token" v-else-if="active == 2" />
<estimates :user="user" :fees="fees" v-else-if="active == 3" :token="token" />
<new-estimate
:user="user"
:fees="fees"
:token="token"
v-else-if="active == 2" />
<estimates
:user="user"
:fees="fees"
v-else-if="active == 3"
:token="token"
@addFeeTemp="(f) => fees.push(f)" />
<settings :user="user" v-else-if="active == 4" /> <settings :user="user" v-else-if="active == 4" />
<sign-out :user="user" v-else-if="active == 5" /> <sign-out :user="user" v-else-if="active == 5" />
</template> </template>


+ 2
- 1
components/estimates.vue View File

@@ -71,6 +71,7 @@ import FeeDialog from "./fee-dialog.vue"
import { format } from "../helpers.js" import { format } from "../helpers.js"


const props = defineProps(['user', 'fees', 'token']) const props = defineProps(['user', 'fees', 'token'])
const emit = defineEmits(['addFeeTemp'])
let edit = ref(null) let edit = ref(null)
let estimates = ref([]) let estimates = ref([])
let estimate = ref() let estimate = ref()
@@ -90,7 +91,7 @@ function newFee(fee, isDebit) {
}, },
}).then(resp => { }).then(resp => {
if (resp.ok && resp.status == 200) { if (resp.ok && resp.status == 200) {
return
resp.json().then(r => emit('addFeeTemp', r))
} else { } else {
// resp.text().then(t => this.errors = [t]) // resp.text().then(t => this.errors = [t])
// window.location.hash = 'new' // window.location.hash = 'new'


+ 2
- 2
migrations/0_29092022_setup_tables.sql View File

@@ -123,7 +123,7 @@ CREATE TABLE fee (
loan_id INT, loan_id INT,
amount INT NOT NULL, amount INT NOT NULL,
perc SMALLINT, /* Percentage of sale price instead of amount */ perc SMALLINT, /* Percentage of sale price instead of amount */
type ENUM('Goverment', 'Title', 'Required', 'Lender', 'Other'),
type ENUM('Government', 'Title', 'Required', 'Lender', 'Other'),
notes VARCHAR(255), notes VARCHAR(255),
name VARCHAR(30), name VARCHAR(30),
/* Group heading shown in report */ /* Group heading shown in report */
@@ -141,7 +141,7 @@ CREATE TABLE fee_template (
amount INT NOT NULL, amount INT NOT NULL,
perc SMALLINT NOT NULL, perc SMALLINT NOT NULL,
/* Percentage of sale price instead of amount */ /* Percentage of sale price instead of amount */
type ENUM('Goverment', 'Title', 'Required', 'Lender', 'Other'),
type ENUM('Government', 'Title', 'Required', 'Lender', 'Other'),
notes VARCHAR(255) NOT NULL, notes VARCHAR(255) NOT NULL,
name VARCHAR(30) NOT NULL, name VARCHAR(30) NOT NULL,
/* Group heading shown in report */ /* Group heading shown in report */


+ 4
- 4
migrations/seed.sql View File

@@ -233,7 +233,7 @@ INSERT INTO loan (
(SELECT id FROM loan_type WHERE name="Conventional"), (SELECT id FROM loan_type WHERE name="Conventional"),
3300000, 3300000,
30, 30,
375,
3.75,
88.00, 88.00,
5.00, 5.00,
0, 0,
@@ -244,7 +244,7 @@ INSERT INTO loan (
(SELECT id FROM loan_type WHERE name="FHA"), (SELECT id FROM loan_type WHERE name="FHA"),
2510000, 2510000,
30, 30,
300,
3,
90.00, 90.00,
6.70, 6.70,
0, 0,
@@ -254,7 +254,7 @@ INSERT INTO loan (
3, 3,
(SELECT id FROM loan_type WHERE name="FHA"), (SELECT id FROM loan_type WHERE name="FHA"),
2510000, 2510000,
30,
1.8,
300, 300,
90.00, 90.00,
6.70, 6.70,
@@ -265,7 +265,7 @@ INSERT INTO loan (
2, 2,
(SELECT id FROM loan_type WHERE name="USDA"), (SELECT id FROM loan_type WHERE name="USDA"),
8000000, 8000000,
10,
1.1,
125, 125,
95.00, 95.00,
4.90, 4.90,


+ 1
- 1
skouter.go View File

@@ -59,7 +59,7 @@ type FeeTemplate struct {
User int `json:"user"` User int `json:"user"`
Branch int `json:"branch"` Branch int `json:"branch"`
Amount int `json:"amount"` Amount int `json:"amount"`
Perc int `json:"perc"`
Perc float32 `json:"perc"`
Type string `json:"type"` Type string `json:"type"`
Notes string `json:"notes"` Notes string `json:"notes"`
Name string `json:"name"` Name string `json:"name"`


Loading…
Cancel
Save