@@ -80,12 +80,13 @@ CREATE TABLE estimate ( | |||
'Condominium Lo-rise', | |||
'Condominium Hi-rise'), | |||
pud BOOLEAN, /* Property under development */ | |||
term INT, /* In months */ | |||
term INT, /* In years */ | |||
interest INT, /* Per year, precise to 2 decimals */ | |||
hoi INT, /* Hazard insurance annual payments */ | |||
mi_name VARCHAR(50), /* Mortgage insurance title shown in menu */ | |||
mi_amount INT, /* Mortgage insurance amount */ | |||
lender VARCHAR(30), | |||
name VARCHAR(30), | |||
PRIMARY KEY (`id`), | |||
FOREIGN KEY (loan_type_id) REFERENCES loan_type(id) | |||
ON UPDATE RESTRICT, | |||
@@ -101,7 +102,8 @@ CREATE TABLE fee ( | |||
id INT AUTO_INCREMENT NOT NULL, | |||
estimate_id INT, | |||
amount INT NOT NULL, | |||
type ENUM('Goverment', 'Title', 'Other'), | |||
perc SMALLINT, /* Percentage of sale price instead of amount */ | |||
type ENUM('Goverment', 'Title', 'Required', 'Lender', 'Other'), | |||
notes VARCHAR(255), | |||
name VARCHAR(30), | |||
/* Group heading shown in report */ | |||
@@ -129,3 +129,114 @@ INSERT IGNORE INTO fee_template ( | |||
true, | |||
"Processing fee" | |||
); | |||
INSERT IGNORE INTO loan_type ( | |||
user_id, | |||
branch_id, | |||
name | |||
) VALUES | |||
( | |||
NULL, | |||
NULL, | |||
"Conventional" | |||
), | |||
( | |||
NULL, | |||
NULL, | |||
"FHA" | |||
), | |||
( | |||
NULL, | |||
NULL, | |||
"VA" | |||
), | |||
( | |||
NULL, | |||
NULL, | |||
"USDA" | |||
), | |||
( | |||
NULL, | |||
(SELECT id FROM branch LIMIT 1), | |||
"Test" | |||
); | |||
INSERT IGNORE INTO borrower ( | |||
credit_score, | |||
monthly_income, | |||
num | |||
) VALUES | |||
( | |||
740, | |||
500000, | |||
1 | |||
); | |||
INSERT IGNORE INTO estimate ( | |||
user_id, | |||
borrower_id, | |||
comparison_id, | |||
transaction, | |||
loan_type_id, | |||
loan_amount, | |||
price, | |||
property, | |||
pud, | |||
term, | |||
interest, | |||
hoi, | |||
mi_name, | |||
mi_amount, | |||
lender | |||
) VALUES | |||
( | |||
(SELECT id FROM user WHERE email="test@example.com" LIMIT 1), | |||
(SELECT id FROM borrower ORDER BY id DESC LIMIT 1), | |||
NULL, | |||
'Purchase', | |||
(SELECT id FROM loan_type WHERE name="Conventional"), | |||
3300000, | |||
100000000, | |||
0, | |||
false, | |||
30, | |||
375, | |||
10000, | |||
"custom mi", | |||
234000, | |||
"For client 1" | |||
), | |||
( | |||
(SELECT id FROM user WHERE email="manager@example.com" LIMIT 1), | |||
(SELECT id FROM borrower ORDER BY id DESC LIMIT 1), | |||
NULL, | |||
'Purchase', | |||
(SELECT id FROM loan_type WHERE name="FHA"), | |||
2510000, | |||
25000000, | |||
0, | |||
false, | |||
30, | |||
300, | |||
10000, | |||
"maybe MGIC", | |||
234000, | |||
"For client 2" | |||
), | |||
( | |||
(SELECT id FROM user WHERE email="test@example.com" LIMIT 1), | |||
(SELECT id FROM borrower ORDER BY id DESC LIMIT 1), | |||
NULL, | |||
'Refinance', | |||
(SELECT id FROM loan_type WHERE name="USDA"), | |||
8000000, | |||
50000000, | |||
3, | |||
false, | |||
10, | |||
125, | |||
15000, | |||
"custom mi", | |||
234000, | |||
"Random name" | |||
); |