Added the default page of the cash summary, ledger, ledger summary, journal, trial balance, income statement, balance sheet in the accounting application.

This commit is contained in:
依瑪貓 2020-07-21 07:40:38 +08:00
parent 6c58b04617
commit 7657d5f823
2 changed files with 100 additions and 7 deletions

View File

@ -45,31 +45,31 @@ urlpatterns = [
path("cash/<str:subject_code>/<str:period_spec>", path("cash/<str:subject_code>/<str:period_spec>",
views.cash, name="cash"), views.cash, name="cash"),
path("cash-summary", path("cash-summary",
mia_core_views.todo, name="cash-summary.home"), views.cash_summary_home, name="cash-summary.home"),
path("cash-summary/<str:subject_code>", path("cash-summary/<str:subject_code>",
views.cash_summary, name="cash-summary"), views.cash_summary, name="cash-summary"),
path("ledger", path("ledger",
mia_core_views.todo, name="ledger.home"), views.ledger_home, name="ledger.home"),
path("ledger/<str:subject_code>/<str:period_spec>", path("ledger/<str:subject_code>/<str:period_spec>",
views.ledger, name="ledger"), views.ledger, name="ledger"),
path("ledger-summary", path("ledger-summary",
mia_core_views.todo, name="ledger-summary.home"), views.ledger_summary_home, name="ledger-summary.home"),
path("ledger-summary/<str:subject_code>", path("ledger-summary/<str:subject_code>",
views.ledger_summary, name="ledger-summary"), views.ledger_summary, name="ledger-summary"),
path("journal", path("journal",
mia_core_views.todo, name="journal.home"), views.journal_home, name="journal.home"),
path("journal/<str:period_spec>", path("journal/<str:period_spec>",
views.journal, name="journal"), views.journal, name="journal"),
path("trial-balance", path("trial-balance",
mia_core_views.todo, name="trial-balance.home"), views.trial_balance_home, name="trial-balance.home"),
path("trial-balance/<str:period_spec>", path("trial-balance/<str:period_spec>",
views.trial_balance, name="trial-balance"), views.trial_balance, name="trial-balance"),
path("income-statement", path("income-statement",
mia_core_views.todo, name="income-statement.home"), views.income_statement_home, name="income-statement.home"),
path("income-statement/<str:period_spec>", path("income-statement/<str:period_spec>",
views.income_statement, name="income-statement"), views.income_statement, name="income-statement"),
path("balance-sheet", path("balance-sheet",
mia_core_views.todo, name="balance-sheet.home"), views.balance_sheet_home, name="balance-sheet.home"),
path("balance-sheet/<str:period_spec>", path("balance-sheet/<str:period_spec>",
views.balance_sheet, name="balance-sheet"), views.balance_sheet, name="balance-sheet"),
path("search", path("search",

View File

@ -232,6 +232,19 @@ def cash(request, subject_code, period_spec):
}) })
@require_GET
@digest_login_required
def cash_summary_home(request):
"""The cash summary home page.
Returns:
HttpResponseRedirect: The redirection to the default subject.
"""
subject_code = settings.ACCOUNTING["DEFAULT_CASH_SUBJECT"]
return HttpResponseRedirect(
reverse("accounting:cash-summary", args=(subject_code)))
def cash_summary(request, subject_code): def cash_summary(request, subject_code):
"""The cash account summary report.""" """The cash account summary report."""
# The subject # The subject
@ -330,6 +343,21 @@ def _ledger_subjects():
ORDER BY s.code""")) ORDER BY s.code"""))
@require_GET
@digest_login_required
def ledger_home(request):
"""The ledger home page.
Returns:
HttpResponseRedirect: The redirection to the default subject
and month.
"""
subject_code = settings.ACCOUNTING["DEFAULT_LEDGER_SUBJECT"]
period_spec = dateformat.format(timezone.localdate(), "Y-m")
return HttpResponseRedirect(
reverse("accounting:ledger", args=(subject_code, period_spec)))
@require_GET @require_GET
@digest_login_required @digest_login_required
def ledger(request, subject_code, period_spec): def ledger(request, subject_code, period_spec):
@ -388,6 +416,19 @@ def ledger(request, subject_code, period_spec):
}) })
@require_GET
@digest_login_required
def ledger_summary_home(request):
"""The ledger summary home page.
Returns:
HttpResponseRedirect: The redirection to the default subject.
"""
subject_code = settings.ACCOUNTING["DEFAULT_LEDGER_SUBJECT"]
return HttpResponseRedirect(
reverse("accounting:ledger-summary", args=(subject_code)))
def ledger_summary(request, subject_code): def ledger_summary(request, subject_code):
"""The ledger summary report.""" """The ledger summary report."""
# The subject # The subject
@ -435,6 +476,19 @@ def ledger_summary(request, subject_code):
}) })
@require_GET
@digest_login_required
def journal_home(request):
"""The journal home page.
Returns:
HttpResponseRedirect: The redirection to the default month.
"""
period_spec = dateformat.format(timezone.localdate(), "Y-m")
return HttpResponseRedirect(
reverse("accounting:journal", args=(period_spec)))
@require_GET @require_GET
@digest_login_required @digest_login_required
def journal(request, period_spec): def journal(request, period_spec):
@ -496,6 +550,19 @@ def journal(request, period_spec):
}) })
@require_GET
@digest_login_required
def trial_balance_home(request):
"""The trial balance home page.
Returns:
HttpResponseRedirect: The redirection to the default month.
"""
period_spec = dateformat.format(timezone.localdate(), "Y-m")
return HttpResponseRedirect(
reverse("accounting:trial-balance", args=(period_spec)))
@require_GET @require_GET
@digest_login_required @digest_login_required
def trial_balance(request, period_spec): def trial_balance(request, period_spec):
@ -577,6 +644,19 @@ def trial_balance(request, period_spec):
}) })
@require_GET
@digest_login_required
def income_statement_home(request):
"""The income statement home page.
Returns:
HttpResponseRedirect: The redirection to the default month.
"""
period_spec = dateformat.format(timezone.localdate(), "Y-m")
return HttpResponseRedirect(
reverse("accounting:income-statement", args=(period_spec)))
@require_GET @require_GET
@digest_login_required @digest_login_required
def income_statement(request, period_spec): def income_statement(request, period_spec):
@ -637,6 +717,19 @@ def income_statement(request, period_spec):
}) })
@require_GET
@digest_login_required
def balance_sheet_home(request):
"""The balance sheet home page.
Returns:
HttpResponseRedirect: The redirection to the default month.
"""
period_spec = dateformat.format(timezone.localdate(), "Y-m")
return HttpResponseRedirect(
reverse("accounting:balance-sheet", args=(period_spec)))
@require_GET @require_GET
@digest_login_required @digest_login_required
def balance_sheet(request, period_spec): def balance_sheet(request, period_spec):