diff --git a/.gitignore b/.gitignore index 29cec9a..b704964 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__/ .python/ +finance.db diff --git a/__pycache__/calc.cpython-312.pyc b/__pycache__/calc.cpython-312.pyc deleted file mode 100644 index fb0643d..0000000 Binary files a/__pycache__/calc.cpython-312.pyc and /dev/null differ diff --git a/__pycache__/csv.cpython-312.pyc b/__pycache__/csv.cpython-312.pyc deleted file mode 100644 index 26ed5e3..0000000 Binary files a/__pycache__/csv.cpython-312.pyc and /dev/null differ diff --git a/__pycache__/db.cpython-312.pyc b/__pycache__/db.cpython-312.pyc deleted file mode 100644 index 55d60e4..0000000 Binary files a/__pycache__/db.cpython-312.pyc and /dev/null differ diff --git a/__pycache__/main.cpython-312.pyc b/__pycache__/main.cpython-312.pyc deleted file mode 100644 index 99d4e05..0000000 Binary files a/__pycache__/main.cpython-312.pyc and /dev/null differ diff --git a/calc.py b/calc.py index 828830a..a53b581 100644 --- a/calc.py +++ b/calc.py @@ -4,9 +4,7 @@ from datetime import datetime, timedelta def calculate_savings_depletion(finance): # Extract all the financial data from the database D_Salary = finance['D_Salary'] - M_salary = finance['M_salary'] D_Num_fortnights_pay = finance['D_Num_fortnights_pay'] - M_Num_fortnights_pay = finance['M_Num_fortnights_pay'] School_Fees = finance['School_Fees'] Car_loan_via_pay = finance['Car_loan_via_pay'] Car_loan = finance['Car_loan'] @@ -15,7 +13,6 @@ def calculate_savings_depletion(finance): Savings = finance['Savings'] Interest_Rate = finance['Interest_Rate'] Inflation = finance['Inflation'] - M_payout = finance['M_payout'] Mich_present = finance['Mich_present'] Overseas_trip = finance['Overseas_trip'] Mark_reno = finance['Mark_reno'] @@ -59,7 +56,6 @@ def calculate_savings_depletion(finance): # significant dates - but who knows when? :) overseas_trip_date = datetime.strptime( finance['Overseas_trip_date'], "%Y-%m-%d") mark_reno_date = datetime.strptime( finance['Mark_reno_date'], "%Y-%m-%d") - M_payout_date = datetime.strptime( finance['M_payout_date'], "%Y-%m-%d") # to force deakin pay cycles to match reality, we work from the 8th of Jan as our "day-zero" so we are paid on the 8/1/25, 22/1/25, etc. days_count = ( current_date - datetime(2025,1,1) ).days @@ -84,9 +80,6 @@ def calculate_savings_depletion(finance): if D_Num_fortnights_pay > 0: fortnight_income += D_Salary D_Num_fortnights_pay -= 1 - if M_Num_fortnights_pay > 0: - fortnight_income += M_salary - M_Num_fortnights_pay -= 1 if D_Num_fortnights_pay == 0 and D_leave_after_tax > 0: print(f"D has resigned {current_date}: get paid out my 9 weeks leave and lose 45% to tax - ${D_leave_after_tax}" ) @@ -116,10 +109,6 @@ def calculate_savings_depletion(finance): daily_living_expenses = Living_Expenses / 365 #print(f"Living Exp inceased {current_date}: ${Living_Expenses}") - if current_date.date() == M_payout_date.date(): - current_savings += M_payout - print(f"payout={current_date} + {M_payout}") - if current_date.date() == school_fees_date.date(): current_savings -= School_Fees print(f"school fees={current_date} - {School_Fees}") diff --git a/db.py b/db.py index 8044471..e4e332a 100644 --- a/db.py +++ b/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() diff --git a/finance.db b/finance.db index b97d5ee..66a0ca2 100644 Binary files a/finance.db and b/finance.db differ diff --git a/main.py b/main.py index 234decf..df8c642 100644 --- a/main.py +++ b/main.py @@ -33,9 +33,7 @@ def update(): finance_data = ( request.form['D_Salary'], - request.form['M_salary'], request.form['D_Num_fortnights_pay'], - request.form['M_Num_fortnights_pay'], request.form['School_Fees'], request.form['Car_loan_via_pay'], request.form['Car_loan'], @@ -44,7 +42,6 @@ def update(): request.form['Savings'], request.form['Interest_Rate'], request.form['Inflation'], - request.form['M_payout'], request.form['Mich_present'], request.form['Overseas_trip'], request.form['Mark_reno'], @@ -56,7 +53,6 @@ def update(): request.form['CBA_price'], request.form['Overseas_trip_date'], request.form['Mark_reno_date'], - request.form['M_payout_date'], request.form['Sell_shares'], ) diff --git a/templates/index.html b/templates/index.html index ef4ce1c..b991616 100644 --- a/templates/index.html +++ b/templates/index.html @@ -19,8 +19,8 @@
- - + +
@@ -29,10 +29,10 @@
-
+
- - + +
@@ -52,8 +52,8 @@
- - + +
@@ -62,10 +62,10 @@
-
+
- - + +
@@ -79,8 +79,8 @@
- - + +
@@ -89,33 +89,14 @@
-
-
- - -
-
-
+
-
-
- - - -
-
-
-
- - -
-
@@ -124,11 +105,11 @@
- - + +
-
+
@@ -148,24 +129,12 @@
-
+
-
-
- - -
-
-
-
- - -
-
@@ -186,6 +155,18 @@
+
+
+ + +
+
+
+
+ + +
+