diff --git a/austax/reports.py b/austax/reports.py index b7051eb..79352c0 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, medicare_levy_threshold, repayment_rates, fbt_grossup +from .tax_tables import base_tax, medicare_levy_threshold, medicare_levy_surcharge_single, repayment_rates, fbt_grossup def base_income_tax(year, taxable_income): """Get the amount of base income tax""" @@ -59,6 +59,13 @@ def medicare_levy(year, taxable_income): # Normal Medicare levy return Amount(int(taxable_income.quantity * 0.02), '$') +def medicare_levy_surcharge(year, taxable_income, rfb_grossedup): + mls_income = taxable_income + rfb_grossedup + + for i, (upper_limit, rate) in enumerate(medicare_levy_surcharge_single[year]): + if upper_limit is None or mls_income.quantity <= upper_limit * (10**AMOUNT_DPS): + return Amount(rate * mls_income.quantity, '$') + def study_loan_repayment(year, taxable_income, rfb_grossedup): """Get the amount of mandatory study loan repayment""" @@ -165,6 +172,21 @@ def tax_summary_report(): bordered=True ), Spacer(), + Section( + entries=[ + Calculated( + 'Taxable value of reportable fringe benefits', + lambda _: -sum((e.amount for e in entries_for_kind(account_configurations, accounts, 'austax.rfb')), Amount(0, '$')), + id='rfb_taxable' + ), + Calculated( + 'Grossed-up value', + lambda _: Amount(report.by_id('rfb_taxable').amount.quantity * fbt_grossup[eofy_date().year], '$'), + id='rfb_grossedup' + ) + ], + visible=False # Precompute RFB amount as this is required for MLS + ), Section( entries=[ Calculated( @@ -175,6 +197,10 @@ def tax_summary_report(): 'Medicare levy', lambda _: medicare_levy(eofy_date().year, report.by_id('taxable').amount) ), + Calculated( + 'Medicare levy surcharge', + lambda _: medicare_levy_surcharge(eofy_date().year, report.by_id('taxable').amount, report.by_id('rfb_grossedup').amount) + ), Subtotal('Total income tax', id='total_tax', bordered=True) ] ), @@ -191,13 +217,11 @@ def tax_summary_report(): entries=[ Calculated( 'Taxable value of reportable fringe benefits', - lambda _: -sum((e.amount for e in entries_for_kind(account_configurations, accounts, 'austax.rfb')), Amount(0, '$')), - id='rfb_taxable' + lambda _: report.by_id('rfb_taxable').amount ), Calculated( 'Grossed-up value', - lambda _: Amount(report.by_id('rfb_taxable').amount.quantity * fbt_grossup[eofy_date().year], '$'), - id='rfb_grossedup' + lambda _: report.by_id('rfb_grossedup').amount ), Calculated( 'Mandatory study loan repayment', diff --git a/austax/tax_tables.py b/austax/tax_tables.py index 83c6a00..2bc6b33 100644 --- a/austax/tax_tables.py +++ b/austax/tax_tables.py @@ -91,6 +91,19 @@ medicare_levy_threshold = { 2022: (23365, 29207) } +# Medicare levy surcharge rates (singles) +# https://www.ato.gov.au/individuals-and-families/medicare-and-private-health-insurance/medicare-levy-surcharge/medicare-levy-surcharge-income-thresholds-and-rates +# Maps each financial year to list of (upper limit (INclusive), MLS rate) +# FIXME: Only supports singles +medicare_levy_surcharge_single = { + 2024: [ + (93000, 0), + (108000, 0.01), + (144000, 0.0125), + (None, 0.015) + ] +} + # FBT type 1 gross-up factor # https://www.ato.gov.au/rates/fbt/#GrossupratesforFBT fbt_grossup = {