redo D_quit logic (tax and when we can sell shares)

This commit is contained in:
2025-10-17 21:20:22 +11:00
parent 5ce614ed28
commit bf66e9fa7c

59
calc.py
View File

@@ -6,13 +6,11 @@ from defines import END_YEAR
LEASE = 0 LEASE = 0
# Dates that don't change # Dates that don't change
car_balloon_date = datetime(2026, 11, 15)
new_fin_year_25 = datetime(2025, 7, 1)
new_fin_year_26 = datetime(2026, 7, 1)
end_date = datetime(END_YEAR, 4, 15)
school_fees_date = datetime(2025, 12, 5)
mich_present_date = datetime(2026,10,15)
first_pay_date = datetime(2025,1,8) first_pay_date = datetime(2025,1,8)
school_fees_date = datetime(2025, 12, 5)
car_balloon_date = datetime(2026, 11, 15)
mich_present_date = datetime(2026,10,15)
end_date = datetime(END_YEAR, 4, 15)
def bill_amount_today(finance, day, bill_data, bt_id_name, total ): def bill_amount_today(finance, day, bill_data, bt_id_name, total ):
amt=0 amt=0
@@ -84,22 +82,18 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
payout = 83115.84 payout = 83115.84
print( f"leave payout gross={payout}" ) print( f"leave payout gross={payout}" )
# as the leave is just on top of my existing earnings and if in 2024 fin year, just take tax at 37% for the extra leave amount
# hardcoded 6 represents the 12 weeks or 6 fornights of pay owed to me when I give notice or they sack me
D_leave_after_tax = payout * (1-0.37)
# However, if I quit in the next fin year - tax for 2025 will be: $4,288 plus 30c for each $1 over $45,000 # However, if I quit in the next fin year - tax for 2025 will be: $4,288 plus 30c for each $1 over $45,000
# (assuming the 7830.42 * ~90/bus_days_in_fortnight = ~ $64k - > 45k and < $135k bracket is 30%) # (assuming the 7830.42 * ~90/bus_days_in_fortnight = ~ $64k - > 45k and < $135k bracket is 30%)
# Given, I probably can't stop Deakin doing PAYG deductions, I won't get # Given, I probably can't stop Deakin doing PAYG deductions, I won't get
# the tax back until the end of the financial year, so work out the # the tax back until the end of the financial year, so work out the
# amount of tax I will get back info: tax_diff_D_leave # amount of tax I will get back info: tax_diff_D_leave
tax_on_leave = (payout - 45000)*.37 + 4288 tax_on_leave = (payout - 45000)*.37 + 4288
D_leave_after_tax_new_fin_year = payout - tax_on_leave D_leave_after_tax = payout - tax_on_leave
# just use redunancy calc... # just use redunancy calc...
D_leave_after_tax_new_fin_year = 56518.77 D_leave_after_tax = 56518.77
tax_diff_D_leave = payout - D_leave_after_tax_new_fin_year tax_diff_D_leave = payout - D_leave_after_tax
print( f"tax_diff_D_leave: {tax_diff_D_leave}") print( f"tax_diff_D_leave: {tax_diff_D_leave}")
@@ -107,7 +101,6 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
# convenience vars to make it easier to read conditional leave tax/payment logic below # convenience vars to make it easier to read conditional leave tax/payment logic below
D_has_quit = False D_has_quit = False
D_quit_year = 0
claim_tax_on_leave = False claim_tax_on_leave = False
# Constants for interest calculations # Constants for interest calculations
@@ -131,6 +124,8 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
# Calculate daily living expenses # Calculate daily living expenses
daily_living_expenses = Living_Expenses / 365 daily_living_expenses = Living_Expenses / 365
print( f"daily LE starts at={daily_living_expenses}" )
print( f"fortnightly LE starts at={daily_living_expenses*14}" )
# Start the calculation # Start the calculation
current_savings = Savings current_savings = Savings
@@ -181,31 +176,17 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
current_savings -= Car_loan_via_pay current_savings -= Car_loan_via_pay
print( f"{current_date}: making car loan pay as pre-tax lease: ${Car_loan_via_pay}" ) print( f"{current_date}: making car loan pay as pre-tax lease: ${Car_loan_via_pay}" )
# no more pay and if leave after tax > 0 this is the day I quit
if D_Num_fortnights_pay == 0 and D_leave_after_tax > 0: if D_Num_fortnights_pay == 0 and D_leave_after_tax > 0:
D_has_quit = True D_has_quit = True
D_quit_date = current_date D_quit_date = current_date
D_quit_year = current_date.year # going to pay tax on payout, so claim it back next year
# okay, if we leave before Jun 30th 2024, then I pay full tax, otherwise I get 'extra', but have to await end of next fin year claim_tax_on_leave = True
if current_date > new_fin_year_25: print(f"{current_date}: D has resigned in new year- get paid out my 12 weeks + remaining leave and lose some to tax - ${D_leave_after_tax}" )
claim_tax_on_leave = True current_savings += D_leave_after_tax
print(f"{current_date}: D has resigned in new year- get paid out my 12 weeks + remaining leave and lose some to tax - ${D_leave_after_tax_new_fin_year}" ) add_annotation(finance, current_date, current_savings, D_leave_after_tax, "D quit" )
current_savings += D_leave_after_tax_new_fin_year
add_annotation(finance, current_date, current_savings, D_leave_after_tax_new_fin_year, "D quit" )
else:
claim_tax_on_leave = False
print(f"{current_date}: D has resigned - get paid out my 12 weeks + remaining leave and lose some to tax - ${D_leave_after_tax}" )
current_savings += D_leave_after_tax
add_annotation(finance, current_date, current_savings, D_leave_after_tax, "D quit" )
D_leave_after_tax = 0 D_leave_after_tax = 0
# its end of 'next' fin year, if tax_diff > 0, then ddp quit after new tax year and gets back the overpaid tax
if current_date > new_fin_year_26 and claim_tax_on_leave:
current_savings += tax_diff_D_leave
print( f"I quit last fin year, so now its 1st July {current_date.year}, get tax back of {tax_diff_D_leave}" )
add_annotation(finance, current_date, current_savings, tax_diff_D_leave, "D quit - tax back" )
# can only claim the tax back once :)
claim_tax_on_leave=False
if fortnight_income: if fortnight_income:
print(f"{current_date}: salary paid by Deakin - adding: {fortnight_income}" ) print(f"{current_date}: salary paid by Deakin - adding: {fortnight_income}" )
current_savings += fortnight_income current_savings += fortnight_income
@@ -213,6 +194,14 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
savings_per_fortnight.append((current_date.strftime("%Y-%m-%d"), round(current_savings, 2))) savings_per_fortnight.append((current_date.strftime("%Y-%m-%d"), round(current_savings, 2)))
# its end of fin year, if claim_tax_on_leave > 0 then get tax back
if current_date.month == 7 and current_date.day == 1 and claim_tax_on_leave:
current_savings += tax_diff_D_leave
print( f"I quit last fin year, so now its 1st July {current_date.year}, get tax back of {tax_diff_D_leave}" )
add_annotation(finance, current_date, current_savings, tax_diff_D_leave, "D quit - tax back" )
# can only claim the tax back once :)
claim_tax_on_leave=False
# if I have quit, then car lease payments are made on the 15th of the month for full Car_loan # if I have quit, then car lease payments are made on the 15th of the month for full Car_loan
if D_has_quit and current_date.day == 15: if D_has_quit and current_date.day == 15:
if Ioniq6_future == LEASE and current_date <= car_balloon_date: if Ioniq6_future == LEASE and current_date <= car_balloon_date:
@@ -269,7 +258,7 @@ def calculate_savings_depletion(finance, bill_data, bill_type):
# if selling shares, and its 1st of July... # if selling shares, and its 1st of July...
# BUT not if D quits before end of financial year - as I won't be able to sell CBA shares for no cap gains # BUT not if D quits before end of financial year - as I won't be able to sell CBA shares for no cap gains
# so wait until the following year # so wait until the following year
if current_date.month == 7 and current_date.day == 1 and D_has_quit and Sell_shares>0 and (current_date.year > D_quit_year or current_date.year == D_quit_year and claim_tax_on_leave == False): if current_date.month == 7 and current_date.day == 1 and D_has_quit and Sell_shares>0 and (D_quit_date.month<7 or D_quit_date.year < current_date.year ):
# 2024 Govt. value # 2024 Govt. value
tax_threshold = 18200 tax_threshold = 18200
# cap-gains is 50% of profit (lazy profit calc here, just assume its all profit) # cap-gains is 50% of profit (lazy profit calc here, just assume its all profit)