diff --git a/src/accounting/report/reports/balance_sheet.py b/src/accounting/report/reports/balance_sheet.py index 8286292..85b0437 100644 --- a/src/accounting/report/reports/balance_sheet.py +++ b/src/accounting/report/reports/balance_sheet.py @@ -28,12 +28,12 @@ from accounting import db from accounting.locale import gettext from accounting.models import Currency, BaseAccount, Account, Transaction, \ JournalEntry -from accounting.report.option_link import OptionLink -from accounting.report.page_params import PageParams from accounting.report.period import Period -from accounting.report.period_choosers import BalanceSheetPeriodChooser -from accounting.report.report_chooser import ReportChooser -from accounting.report.report_type import ReportType +from .utils.option_link import OptionLink +from .utils.page_params import PageParams +from .utils.period_choosers import BalanceSheetPeriodChooser +from .utils.report_chooser import ReportChooser +from .utils.report_type import ReportType class BalanceSheetAccount: diff --git a/src/accounting/report/reports/income_expenses.py b/src/accounting/report/reports/income_expenses.py index 2763e5e..36ee67a 100644 --- a/src/accounting/report/reports/income_expenses.py +++ b/src/accounting/report/reports/income_expenses.py @@ -28,13 +28,13 @@ from flask import url_for, render_template, Response from accounting import db from accounting.locale import gettext from accounting.models import Currency, Account, Transaction, JournalEntry -from accounting.report.option_link import OptionLink -from accounting.report.page_params import PageParams from accounting.report.period import Period -from accounting.report.period_choosers import IncomeExpensesPeriodChooser -from accounting.report.report_chooser import ReportChooser -from accounting.report.report_type import ReportType from accounting.utils.pagination import Pagination +from .utils.option_link import OptionLink +from .utils.page_params import PageParams +from .utils.period_choosers import IncomeExpensesPeriodChooser +from .utils.report_chooser import ReportChooser +from .utils.report_type import ReportType class Entry: diff --git a/src/accounting/report/reports/income_statement.py b/src/accounting/report/reports/income_statement.py index 4ce61af..3d9551c 100644 --- a/src/accounting/report/reports/income_statement.py +++ b/src/accounting/report/reports/income_statement.py @@ -28,12 +28,12 @@ from accounting import db from accounting.locale import gettext from accounting.models import Currency, BaseAccount, Account, Transaction, \ JournalEntry -from accounting.report.option_link import OptionLink -from accounting.report.page_params import PageParams from accounting.report.period import Period -from accounting.report.period_choosers import IncomeStatementPeriodChooser -from accounting.report.report_chooser import ReportChooser -from accounting.report.report_type import ReportType +from .utils.option_link import OptionLink +from .utils.page_params import PageParams +from .utils.period_choosers import IncomeStatementPeriodChooser +from .utils.report_chooser import ReportChooser +from .utils.report_type import ReportType class IncomeStatementAccount: diff --git a/src/accounting/report/reports/journal.py b/src/accounting/report/reports/journal.py index b6ac9bf..a5f347c 100644 --- a/src/accounting/report/reports/journal.py +++ b/src/accounting/report/reports/journal.py @@ -28,12 +28,12 @@ from flask import render_template, Response from accounting import db from accounting.locale import gettext from accounting.models import Currency, Account, Transaction, JournalEntry -from accounting.report.page_params import PageParams from accounting.report.period import Period -from accounting.report.period_choosers import JournalPeriodChooser -from accounting.report.report_chooser import ReportChooser -from accounting.report.report_type import ReportType from accounting.utils.pagination import Pagination +from .utils.page_params import PageParams +from .utils.period_choosers import JournalPeriodChooser +from .utils.report_chooser import ReportChooser +from .utils.report_type import ReportType class Entry: diff --git a/src/accounting/report/reports/ledger.py b/src/accounting/report/reports/ledger.py index aa522fe..199af70 100644 --- a/src/accounting/report/reports/ledger.py +++ b/src/accounting/report/reports/ledger.py @@ -28,13 +28,13 @@ from flask import url_for, render_template, Response from accounting import db from accounting.locale import gettext from accounting.models import Currency, Account, Transaction, JournalEntry -from accounting.report.option_link import OptionLink -from accounting.report.page_params import PageParams from accounting.report.period import Period -from accounting.report.period_choosers import LedgerPeriodChooser -from accounting.report.report_chooser import ReportChooser -from accounting.report.report_type import ReportType from accounting.utils.pagination import Pagination +from .utils.option_link import OptionLink +from .utils.page_params import PageParams +from .utils.period_choosers import LedgerPeriodChooser +from .utils.report_chooser import ReportChooser +from .utils.report_type import ReportType class Entry: diff --git a/src/accounting/report/reports/trial_balance.py b/src/accounting/report/reports/trial_balance.py index e6b4b4c..1f97b40 100644 --- a/src/accounting/report/reports/trial_balance.py +++ b/src/accounting/report/reports/trial_balance.py @@ -27,12 +27,12 @@ from flask import url_for, Response, render_template from accounting import db from accounting.locale import gettext from accounting.models import Currency, Account, Transaction, JournalEntry -from accounting.report.option_link import OptionLink -from accounting.report.page_params import PageParams from accounting.report.period import Period -from accounting.report.period_choosers import TrialBalancePeriodChooser -from accounting.report.report_chooser import ReportChooser -from accounting.report.report_type import ReportType +from .utils.option_link import OptionLink +from .utils.page_params import PageParams +from .utils.period_choosers import TrialBalancePeriodChooser +from .utils.report_chooser import ReportChooser +from .utils.report_type import ReportType class TrialBalanceAccount: diff --git a/src/accounting/report/reports/utils/__init__.py b/src/accounting/report/reports/utils/__init__.py new file mode 100644 index 0000000..32409a5 --- /dev/null +++ b/src/accounting/report/reports/utils/__init__.py @@ -0,0 +1,19 @@ +# The Mia! Accounting Flask Project. +# Author: imacat@mail.imacat.idv.tw (imacat), 2023/3/7 + +# Copyright (c) 2023 imacat. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""The utilities to generate reports. + +""" diff --git a/src/accounting/report/option_link.py b/src/accounting/report/reports/utils/option_link.py similarity index 100% rename from src/accounting/report/option_link.py rename to src/accounting/report/reports/utils/option_link.py diff --git a/src/accounting/report/page_params.py b/src/accounting/report/reports/utils/page_params.py similarity index 97% rename from src/accounting/report/page_params.py rename to src/accounting/report/reports/utils/page_params.py index 733c7b8..baf7044 100644 --- a/src/accounting/report/page_params.py +++ b/src/accounting/report/reports/utils/page_params.py @@ -17,15 +17,15 @@ """The page parameters of a report. """ +import typing as t from abc import ABC, abstractmethod from urllib.parse import urlparse, ParseResult, parse_qsl, urlencode, \ urlunparse from flask import request -import typing as t -from accounting.report.report_chooser import ReportChooser from accounting.utils.txn_types import TransactionType +from .report_chooser import ReportChooser class PageParams(ABC): diff --git a/src/accounting/report/period_choosers.py b/src/accounting/report/reports/utils/period_choosers.py similarity index 98% rename from src/accounting/report/period_choosers.py rename to src/accounting/report/reports/utils/period_choosers.py index c0e49eb..1d0b34f 100644 --- a/src/accounting/report/period_choosers.py +++ b/src/accounting/report/reports/utils/period_choosers.py @@ -27,8 +27,9 @@ from datetime import date from flask import url_for from accounting.models import Currency, Account, Transaction -from .period import YearPeriod, Period, ThisMonth, LastMonth, SinceLastMonth, \ - ThisYear, LastYear, Today, Yesterday, TemplatePeriod +from accounting.report.period import YearPeriod, Period, ThisMonth, \ + LastMonth, SinceLastMonth, ThisYear, LastYear, Today, Yesterday, \ + TemplatePeriod class PeriodChooser(ABC): diff --git a/src/accounting/report/report_chooser.py b/src/accounting/report/reports/utils/report_chooser.py similarity index 99% rename from src/accounting/report/report_chooser.py rename to src/accounting/report/reports/utils/report_chooser.py index d0d5850..6609dd1 100644 --- a/src/accounting/report/report_chooser.py +++ b/src/accounting/report/reports/utils/report_chooser.py @@ -29,9 +29,9 @@ from flask_babel import LazyString from accounting import db from accounting.locale import gettext from accounting.models import Currency, Account +from accounting.report.period import Period from accounting.template_globals import default_currency_code from .option_link import OptionLink -from .period import Period from .report_type import ReportType diff --git a/src/accounting/report/report_type.py b/src/accounting/report/reports/utils/report_type.py similarity index 100% rename from src/accounting/report/report_type.py rename to src/accounting/report/reports/utils/report_type.py