DrCr/drcr/tax/views.py

37 lines
1.3 KiB
Python

# DrCr: Web-based double-entry bookkeeping framework
# Copyright (C) 2022–2023 Lee Yingtong Li (RunasSudo)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from flask import render_template
from ..config import TAX_MAPPING
from ..models import Amount, TrialBalancer
from ..webapp import all_transactions, app
from .aus_tax import base_income_tax, calculate_tax
@app.route('/tax/summary')
def tax_summary():
# Get trial balance and validate COA
balancer = TrialBalancer()
balancer.apply_transactions(all_transactions())
return render_template(
'tax/summary.html',
accounts=balancer.accounts,
base_income_tax=base_income_tax, calculate_tax=calculate_tax,
running_total=Amount(0, '$'),
TAX_MAPPING=TAX_MAPPING
)