removed M_* variables that are no longer relevant, cleaned up interface to have columns more ordered, updated default values in DB to be more as accurate as I can make them for now
This commit is contained in:
19
db.py
19
db.py
@@ -12,9 +12,7 @@ def init_db():
|
||||
cur.execute('''CREATE TABLE IF NOT EXISTS finance (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
D_Salary INTEGER,
|
||||
M_salary INTEGER,
|
||||
D_Num_fortnights_pay INTEGER,
|
||||
M_Num_fortnights_pay INTEGER,
|
||||
School_Fees INTEGER,
|
||||
Car_loan_via_pay INTEGER,
|
||||
Car_loan INTEGER,
|
||||
@@ -23,7 +21,6 @@ def init_db():
|
||||
Savings INTEGER,
|
||||
Interest_Rate REAL,
|
||||
Inflation REAL,
|
||||
M_payout INTEGER,
|
||||
Mich_present INTEGER,
|
||||
Overseas_trip INTEGER,
|
||||
Mark_reno INTEGER,
|
||||
@@ -35,20 +32,16 @@ def init_db():
|
||||
CBA_price REAL,
|
||||
Overseas_trip_date STRING,
|
||||
Mark_reno_date STRING,
|
||||
M_payout_date STRING,
|
||||
Sell_shares INTEGER
|
||||
)''')
|
||||
|
||||
# Check if table is empty, if so insert default values
|
||||
cur.execute('SELECT COUNT(*) FROM finance')
|
||||
if cur.fetchone()[0] == 0:
|
||||
cur.execute('''INSERT INTO finance (D_Salary, M_salary, D_Num_fortnights_pay, M_Num_fortnights_pay,
|
||||
School_Fees, Car_loan_via_pay, Car_loan, Car_balloon, Living_Expenses, Savings, Interest_Rate,
|
||||
Inflation, M_payout, Mich_present, Overseas_trip, Mark_reno, D_leave_owed_in_days, D_TLS_shares,
|
||||
M_TLS_shares, D_CBA_shares, TLS_price, CBA_price, Overseas_trip_date, Mark_reno_date,
|
||||
M_payout_date, Sell_shares)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(4762.29, 1962.56, 7, 1, 22000, 620, 1001.12, 45824.68, 65000, 297000, 5.0, 3.9, 96000,10000,28000,10000,90.6,1000,750,1095,4.03,156.21,'2025-06-01','2025-09-01', '2025-01-20', 6))
|
||||
cur.execute('''INSERT INTO finance (D_Salary, D_Num_fortnights_pay, School_Fees, Car_loan_via_pay, Car_loan, Car_balloon, Living_Expenses, Savings, Interest_Rate,
|
||||
Inflation, Mich_present, Overseas_trip, Mark_reno, D_leave_owed_in_days, D_TLS_shares, M_TLS_shares, D_CBA_shares, TLS_price, CBA_price, Overseas_trip_date, Mark_reno_date, Sell_shares)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''',
|
||||
(4762.29, 6, 22000, 620, 1001.12, 45824.68, 78000, 412000, 5.0, 3.9, 10000, 32000, 10000, 90.6, 1000, 750, 1095, 3.99, 160.61, '2025-06-01', '2025-09-01', 5))
|
||||
# NOTE: 1001.12 car-pay -- is 1017.99 (actual rate) - 16.87 (car park)
|
||||
# NOTE: o/s trip. ~ $4kpp flights x3, then ~$3k / week in barcelona accom, $100pp/pd for food ($2k), + spending money
|
||||
conn.commit()
|
||||
@@ -68,9 +61,7 @@ def update_finance(data):
|
||||
cur = conn.cursor()
|
||||
cur.execute('''UPDATE finance SET
|
||||
D_Salary = ?,
|
||||
M_salary = ?,
|
||||
D_Num_fortnights_pay = ?,
|
||||
M_Num_fortnights_pay = ?,
|
||||
School_Fees = ?,
|
||||
Car_loan_via_pay = ?,
|
||||
Car_loan = ?,
|
||||
@@ -79,7 +70,6 @@ def update_finance(data):
|
||||
Savings = ?,
|
||||
Interest_Rate = ?,
|
||||
Inflation = ?,
|
||||
M_payout = ?,
|
||||
Mich_present = ?,
|
||||
Overseas_trip = ?,
|
||||
Mark_reno = ?,
|
||||
@@ -91,7 +81,6 @@ def update_finance(data):
|
||||
CBA_price = ?,
|
||||
Overseas_trip_date = ?,
|
||||
Mark_reno_date = ?,
|
||||
M_payout_date = ?,
|
||||
Sell_shares = ?
|
||||
WHERE id = 1''', data)
|
||||
conn.commit()
|
||||
|
||||
Reference in New Issue
Block a user