Skip to content

Commit

Permalink
refactor: simplify column names
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Dec 29, 2023
1 parent 482116e commit 2d01a6a
Showing 1 changed file with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,8 @@ def get_data(company: str, fy_start, month_start, month_end):
frappe.qb.from_(gl_entry)
.select(
gl_entry.account,
gl_entry.account_currency,
Sum(gl_entry.debit_in_account_currency).as_(
"debit_until_evaluation_period"
),
Sum(gl_entry.credit_in_account_currency).as_(
"credit_until_evaluation_period"
),
Sum(gl_entry.debit_in_account_currency).as_("debit"),
Sum(gl_entry.credit_in_account_currency).as_("credit"),
)
.where(
(gl_entry.company == company)
Expand All @@ -92,7 +87,7 @@ def get_data(company: str, fy_start, month_start, month_end):
& (gl_entry.posting_date < month_start)
& (gl_entry.voucher_type != "Period Closing Voucher")
)
.groupby(gl_entry.account, gl_entry.account_currency)
.groupby(gl_entry.account)
)

sum_in_month = (
Expand All @@ -102,8 +97,8 @@ def get_data(company: str, fy_start, month_start, month_end):
.select(
gl_entry.account,
gl_entry.account_currency,
Sum(gl_entry.debit_in_account_currency).as_("debit_in_evaluation_period"),
Sum(gl_entry.credit_in_account_currency).as_("credit_in_evaluation_period"),
Sum(gl_entry.debit_in_account_currency).as_("debit"),
Sum(gl_entry.credit_in_account_currency).as_("credit"),
)
.where(
(gl_entry.company == company)
Expand All @@ -123,10 +118,10 @@ def get_data(company: str, fy_start, month_start, month_end):
.select(
sum_in_month.account,
sum_in_month.account_currency,
sum_until_month.debit_until_evaluation_period,
sum_until_month.credit_until_evaluation_period,
sum_in_month.debit_in_evaluation_period,
sum_in_month.credit_in_evaluation_period,
sum_until_month.debit,
sum_until_month.credit,
sum_in_month.debit,
sum_in_month.credit,
)
)

Expand Down

0 comments on commit 2d01a6a

Please sign in to comment.