From 4f2085c35f0399d3196f71522a6db873694e7063 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Mon, 18 Sep 2023 22:07:02 +1000 Subject: [PATCH] austax: Implement Medicare levy reduction --- austax/reports.py | 17 ++++++++++++----- austax/tax_tables.py | 8 ++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/austax/reports.py b/austax/reports.py index a5a3ede..113092a 100644 --- a/austax/reports.py +++ b/austax/reports.py @@ -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) ] diff --git a/austax/tax_tables.py b/austax/tax_tables.py index ee9306d..8573f15 100644 --- a/austax/tax_tables.py +++ b/austax/tax_tables.py @@ -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 = {