austax: Add tax offset accounts
This commit is contained in:
parent
815b4843e2
commit
c798bd2207
@ -272,6 +272,23 @@ function reporting.CalculateIncomeTax.execute(args, context, kinds_for_account,
|
|||||||
}})
|
}})
|
||||||
table.insert(report.entries, 'Spacer')
|
table.insert(report.entries, 'Spacer')
|
||||||
|
|
||||||
|
-- Add tax offset entries
|
||||||
|
local total_offset = 0
|
||||||
|
|
||||||
|
do
|
||||||
|
local entries = entries_for_kind('austax.offset', true, balances, kinds_for_account)
|
||||||
|
if #entries ~= 0 then
|
||||||
|
local section: libdrcr.Section = {
|
||||||
|
text = 'Tax offsets',
|
||||||
|
id = nil,
|
||||||
|
visible = true,
|
||||||
|
entries = entries,
|
||||||
|
}
|
||||||
|
table.insert(report.entries, { Section = section })
|
||||||
|
total_offset += entries_subtotal(entries)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Low income tax offset row
|
-- Low income tax offset row
|
||||||
local offset_lito = calc.lito(net_taxable, tax_total, context)
|
local offset_lito = calc.lito(net_taxable, tax_total, context)
|
||||||
if offset_lito ~= 0 then
|
if offset_lito ~= 0 then
|
||||||
@ -284,14 +301,14 @@ function reporting.CalculateIncomeTax.execute(args, context, kinds_for_account,
|
|||||||
heading = false,
|
heading = false,
|
||||||
bordered = false,
|
bordered = false,
|
||||||
}})
|
}})
|
||||||
|
total_offset += offset_lito
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Total tax offsets row
|
-- Total tax offsets row
|
||||||
local offset_total = offset_lito
|
if total_offset ~= 0 then
|
||||||
if offset_total ~= 0 then
|
|
||||||
table.insert(report.entries, { Row = {
|
table.insert(report.entries, { Row = {
|
||||||
text = 'Total tax offsets',
|
text = 'Total tax offsets',
|
||||||
quantity = {offset_total},
|
quantity = {total_offset},
|
||||||
id = nil,
|
id = nil,
|
||||||
visible = true,
|
visible = true,
|
||||||
link = nil,
|
link = nil,
|
||||||
@ -347,8 +364,9 @@ function reporting.CalculateIncomeTax.execute(args, context, kinds_for_account,
|
|||||||
|
|
||||||
-- Add PAYGW entries
|
-- Add PAYGW entries
|
||||||
local total_paygw = 0
|
local total_paygw = 0
|
||||||
local entries = entries_for_kind('austax.paygw', false, balances, kinds_for_account)
|
|
||||||
|
|
||||||
|
do
|
||||||
|
local entries = entries_for_kind('austax.paygw', false, balances, kinds_for_account)
|
||||||
if #entries ~= 0 then
|
if #entries ~= 0 then
|
||||||
local section: libdrcr.Section = {
|
local section: libdrcr.Section = {
|
||||||
text = 'PAYG withheld amounts',
|
text = 'PAYG withheld amounts',
|
||||||
@ -359,6 +377,7 @@ function reporting.CalculateIncomeTax.execute(args, context, kinds_for_account,
|
|||||||
table.insert(report.entries, { Section = section })
|
table.insert(report.entries, { Section = section })
|
||||||
total_paygw = math.floor(entries_subtotal(entries) / 100) * 100
|
total_paygw = math.floor(entries_subtotal(entries) / 100) * 100
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Total PAYGW row
|
-- Total PAYGW row
|
||||||
if total_paygw ~= 0 then
|
if total_paygw ~= 0 then
|
||||||
@ -375,7 +394,7 @@ function reporting.CalculateIncomeTax.execute(args, context, kinds_for_account,
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- ATO liability row
|
-- ATO liability row
|
||||||
local ato_payable = tax_total - offset_total - total_paygw + study_loan_repayment
|
local ato_payable = tax_total - total_offset - total_paygw + study_loan_repayment
|
||||||
table.insert(report.entries, { Row = {
|
table.insert(report.entries, { Row = {
|
||||||
text = 'ATO liability payable (refundable)',
|
text = 'ATO liability payable (refundable)',
|
||||||
quantity = {ato_payable},
|
quantity = {ato_payable},
|
||||||
@ -392,8 +411,8 @@ function reporting.CalculateIncomeTax.execute(args, context, kinds_for_account,
|
|||||||
-- Estimated tax payable
|
-- Estimated tax payable
|
||||||
if charge_tax_monthly then
|
if charge_tax_monthly then
|
||||||
-- Charge income tax expense in parts, one per month
|
-- Charge income tax expense in parts, one per month
|
||||||
local monthly_tax = math.floor((tax_total - offset_total) / 12)
|
local monthly_tax = math.floor((tax_total - total_offset) / 12)
|
||||||
local last_month_tax = (tax_total - offset_total) - 11 * monthly_tax -- To account for rounding errors
|
local last_month_tax = (tax_total - total_offset) - 11 * monthly_tax -- To account for rounding errors
|
||||||
|
|
||||||
-- Some ad hoc calendar code
|
-- Some ad hoc calendar code
|
||||||
local eofy_year, eofy_month, _ = libdrcr.parse_date(context.eofy_date)
|
local eofy_year, eofy_month, _ = libdrcr.parse_date(context.eofy_date)
|
||||||
@ -458,18 +477,18 @@ function reporting.CalculateIncomeTax.execute(args, context, kinds_for_account,
|
|||||||
transaction_id = nil,
|
transaction_id = nil,
|
||||||
description = nil,
|
description = nil,
|
||||||
account = INCOME_TAX,
|
account = INCOME_TAX,
|
||||||
quantity = (tax_total - offset_total),
|
quantity = (tax_total - total_offset),
|
||||||
commodity = context.reporting_commodity,
|
commodity = context.reporting_commodity,
|
||||||
quantity_ascost = (tax_total - offset_total),
|
quantity_ascost = (tax_total - total_offset),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id = nil,
|
id = nil,
|
||||||
transaction_id = nil,
|
transaction_id = nil,
|
||||||
description = nil,
|
description = nil,
|
||||||
account = INCOME_TAX_CONTROL,
|
account = INCOME_TAX_CONTROL,
|
||||||
quantity = -(tax_total - offset_total),
|
quantity = -(tax_total - total_offset),
|
||||||
commodity = context.reporting_commodity,
|
commodity = context.reporting_commodity,
|
||||||
quantity_ascost = -(tax_total - offset_total),
|
quantity_ascost = -(tax_total - total_offset),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user