From 5e4e8b206a929c03b289bcff667da7ba83a8e676 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sun, 28 May 2023 14:06:09 +1000 Subject: [PATCH] austax: Consider reportable fringe benefits amount in calculation of HELP mandatory repayment --- austax/__init__.py | 1 + austax/reports.py | 33 +++++++++++++++++++++++++-------- austax/tax_tables.py | 6 ++++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/austax/__init__.py b/austax/__init__.py index c38eab1..b42ecf7 100644 --- a/austax/__init__.py +++ b/austax/__init__.py @@ -36,6 +36,7 @@ def plugin_init(): drcr.plugins.account_kinds.append(('austax.d5', 'Other work-related expenses (D5)')) drcr.plugins.account_kinds.append(('austax.paygw', 'PAYG withheld amounts')) drcr.plugins.account_kinds.append(('austax.cgtasset', 'CGT asset')) + drcr.plugins.account_kinds.append(('austax.rfb', 'Reportable fringe benefit')) drcr.plugins.transaction_providers.append(make_tax_transactions) diff --git a/austax/reports.py b/austax/reports.py index e07da93..450d869 100644 --- a/austax/reports.py +++ b/austax/reports.py @@ -19,7 +19,7 @@ from drcr.database import db from drcr.models import AccountConfiguration, Amount, Transaction, TrialBalancer from drcr.reports import Calculated, Report, Section, Spacer, Subtotal, entries_for_kind -from .tax_tables import base_tax, repayment_rates +from .tax_tables import base_tax, repayment_rates, fbt_grossup from datetime import datetime @@ -49,12 +49,14 @@ def medicare_levy(taxable_income): return Amount(int(taxable_income.quantity * 0.02), '$') -def study_loan_repayment(year, taxable_income): +def study_loan_repayment(year, taxable_income, rfb_grossedup): """Get the amount of mandatory study loan repayment""" + repayment_income = taxable_income + rfb_grossedup + for upper_limit, rate in repayment_rates[year]: - if upper_limit is None or taxable_income.quantity <= upper_limit * (10**AMOUNT_DPS): - return Amount(rate * taxable_income.quantity, '$') + if upper_limit is None or repayment_income.quantity <= upper_limit * (10**AMOUNT_DPS): + return Amount(rate * repayment_income.quantity, '$') def tax_summary_report(): # Get trial balance @@ -143,10 +145,25 @@ def tax_summary_report(): entries=entries_for_kind(account_configurations, accounts, 'austax.paygw') + [Subtotal('Total withheld amounts', id='paygw')] ), Spacer(), - Calculated( - 'Mandatory study loan repayment', - lambda _: study_loan_repayment(eofy_date().year, report.by_id('taxable').amount), - id='loan_repayment' + 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' + ), + Calculated( + 'Mandatory study loan repayment', + lambda _: study_loan_repayment(eofy_date().year, report.by_id('taxable').amount, report.by_id('rfb_grossedup').amount), + id='loan_repayment', + heading=True + ) + ] ), Spacer(), Calculated( diff --git a/austax/tax_tables.py b/austax/tax_tables.py index 501aa6e..2a922c9 100644 --- a/austax/tax_tables.py +++ b/austax/tax_tables.py @@ -53,3 +53,9 @@ repayment_rates = { (None, 0.1) ] } + +# FBT type 2 gross-up factor +# https://www.ato.gov.au/rates/fbt/#GrossupratesforFBT +fbt_grossup = { + 2023: 1.8868 +}