austax: Implement Medicare levy reduction

This commit is contained in:
RunasSudo 2023-09-18 22:07:02 +10:00
parent 2130bb70c7
commit 4f2085c35f
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 20 additions and 5 deletions

View File

@ -20,7 +20,7 @@ from drcr.models import AccountConfiguration, Amount, Metadata, Transaction, Tri
from drcr.reports import Calculated, Report, Section, Spacer, Subtotal, entries_for_kind
from drcr.webapp import eofy_date, sofy_date
from .tax_tables import base_tax, repayment_rates, fbt_grossup
from .tax_tables import base_tax, medicare_levy_threshold, repayment_rates, fbt_grossup
def base_income_tax(year, taxable_income):
"""Get the amount of base income tax"""
@ -42,10 +42,17 @@ def lito(taxable_income):
return Amount(0, '$')
def medicare_levy(taxable_income):
if taxable_income.quantity < 2920700:
raise NotImplementedError('Medicare levy reduction is not implemented')
def medicare_levy(year, taxable_income):
lower_threshold, upper_threshold = medicare_levy_threshold[year]
if taxable_income.quantity < lower_threshold * 100:
return Amount(0, '$')
if taxable_income.quantity < upper_threshold * 100:
# Medicare levy is 10% of the amount above the lower threshold
return Amount((taxable_income - lower_threshold * 100) * 0.1, '$')
# Normal Medicare levy
return Amount(int(taxable_income.quantity * 0.02), '$')
def study_loan_repayment(year, taxable_income, rfb_grossedup):
@ -153,7 +160,7 @@ def tax_summary_report():
),
Calculated(
'Medicare levy',
lambda _: medicare_levy(report.by_id('taxable').amount)
lambda _: medicare_levy(eofy_date().year, report.by_id('taxable').amount)
),
Subtotal('Total income tax', id='total_tax', bordered=True)
]

View File

@ -82,6 +82,14 @@ repayment_rates = {
]
}
# Medicare levy thresholds
# https://www.ato.gov.au/Individuals/Medicare-and-private-health-insurance/Medicare-levy/Medicare-levy-reduction/Medicare-levy-reduction-for-low-income-earners/
# Maps each financial year to list of (lower threshold, upper threshold)
medicare_levy_threshold = {
2023: (24276, 30345),
2022: (23365, 29207)
}
# FBT type 1 gross-up factor
# https://www.ato.gov.au/rates/fbt/#GrossupratesforFBT
fbt_grossup = {