austax: Consider reportable fringe benefits amount in calculation of HELP mandatory repayment

This commit is contained in:
RunasSudo 2023-05-28 14:06:09 +10:00
parent d67b2f4298
commit 5e4e8b206a
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 32 additions and 8 deletions

View File

@ -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)

View File

@ -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(),
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),
id='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(

View File

@ -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
}