austax: Do not generate transactions with zero amounts
This commit is contained in:
parent
805cf4b319
commit
65d6a9bf05
@ -446,33 +446,35 @@ function reporting.CalculateIncomeTax.execute(args, context, kinds_for_account,
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Charge monthly tax
|
-- Charge monthly tax
|
||||||
table.insert(transactions, {
|
if this_month_tax ~= 0 then
|
||||||
id = nil,
|
table.insert(transactions, {
|
||||||
dt = libdrcr.date_to_dt(libdrcr.format_date(this_year, month, this_day)),
|
id = nil,
|
||||||
description = 'Estimated income tax',
|
dt = libdrcr.date_to_dt(libdrcr.format_date(this_year, month, this_day)),
|
||||||
postings = {
|
description = 'Estimated income tax',
|
||||||
{
|
postings = {
|
||||||
id = nil,
|
{
|
||||||
transaction_id = nil,
|
id = nil,
|
||||||
description = nil,
|
transaction_id = nil,
|
||||||
account = INCOME_TAX,
|
description = nil,
|
||||||
quantity = this_month_tax,
|
account = INCOME_TAX,
|
||||||
commodity = context.reporting_commodity,
|
quantity = this_month_tax,
|
||||||
quantity_ascost = this_month_tax,
|
commodity = context.reporting_commodity,
|
||||||
|
quantity_ascost = this_month_tax,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = nil,
|
||||||
|
transaction_id = nil,
|
||||||
|
description = nil,
|
||||||
|
account = INCOME_TAX_CONTROL,
|
||||||
|
quantity = -this_month_tax,
|
||||||
|
commodity = context.reporting_commodity,
|
||||||
|
quantity_ascost = -this_month_tax,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
})
|
||||||
id = nil,
|
end
|
||||||
transaction_id = nil,
|
|
||||||
description = nil,
|
|
||||||
account = INCOME_TAX_CONTROL,
|
|
||||||
quantity = -this_month_tax,
|
|
||||||
commodity = context.reporting_commodity,
|
|
||||||
quantity_ascost = -this_month_tax,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
else
|
elseif (tax_total - total_offset) ~= 0 then
|
||||||
-- Charge income tax expense in one transaction at EOFY
|
-- Charge income tax expense in one transaction at EOFY
|
||||||
table.insert(transactions, {
|
table.insert(transactions, {
|
||||||
id = nil,
|
id = nil,
|
||||||
@ -502,31 +504,33 @@ function reporting.CalculateIncomeTax.execute(args, context, kinds_for_account,
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Mandatory study loan repayment
|
-- Mandatory study loan repayment
|
||||||
table.insert(transactions, {
|
if study_loan_repayment ~= 0 then
|
||||||
id = nil,
|
table.insert(transactions, {
|
||||||
dt = libdrcr.date_to_dt(context.eofy_date),
|
id = nil,
|
||||||
description = 'Mandatory study loan repayment payable',
|
dt = libdrcr.date_to_dt(context.eofy_date),
|
||||||
postings = {
|
description = 'Mandatory study loan repayment payable',
|
||||||
{
|
postings = {
|
||||||
id = nil,
|
{
|
||||||
transaction_id = nil,
|
id = nil,
|
||||||
description = nil,
|
transaction_id = nil,
|
||||||
account = HELP,
|
description = nil,
|
||||||
quantity = study_loan_repayment,
|
account = HELP,
|
||||||
commodity = context.reporting_commodity,
|
quantity = study_loan_repayment,
|
||||||
quantity_ascost = study_loan_repayment,
|
commodity = context.reporting_commodity,
|
||||||
|
quantity_ascost = study_loan_repayment,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = nil,
|
||||||
|
transaction_id = nil,
|
||||||
|
description = nil,
|
||||||
|
account = INCOME_TAX_CONTROL,
|
||||||
|
quantity = -study_loan_repayment,
|
||||||
|
commodity = context.reporting_commodity,
|
||||||
|
quantity_ascost = -study_loan_repayment,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
})
|
||||||
id = nil,
|
end
|
||||||
transaction_id = nil,
|
|
||||||
description = nil,
|
|
||||||
account = INCOME_TAX_CONTROL,
|
|
||||||
quantity = -study_loan_repayment,
|
|
||||||
commodity = context.reporting_commodity,
|
|
||||||
quantity_ascost = -study_loan_repayment,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Transfer PAYGW balances to Income Tax Control
|
-- Transfer PAYGW balances to Income Tax Control
|
||||||
for account, kinds in pairs(kinds_for_account) do
|
for account, kinds in pairs(kinds_for_account) do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user