Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dvorak0 committed Oct 8, 2021
1 parent bdeb896 commit cc48347
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion monthly_expenses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def build_report(self):
# Converting Result Rows to a Pandas Dataframe
df = pd.DataFrame(rows, columns=[k[0] for k in cols])
df['month_count'] = df['year']
month_count_html = df['year']
df = df.replace({'month_count': month_count})
df['amount (CNY)'] = df['amount (CNY)'] / df['month_count']
df = df.drop(columns=['month_count'])
Expand All @@ -130,5 +131,5 @@ def build_report(self):
cols = ["Account_L{}".format(k) for k in range(n_levels)]
df[cols] = df["Account"].str.split(':', n_levels - 1, expand=True)
df = df.fillna('').drop(columns="Account", level=0).set_index(cols)
return (df.groupby(["Account_L0", "Account_L1"]).sum().round(decimals=2)).to_html(),df.groupby(["Account_L0", "Account_L1"]).sum().sum().to_frame().to_html()
return (df.groupby(["Account_L0", "Account_L1"]).sum().round(decimals=2)).to_html(),df.groupby(["Account_L0", "Account_L1"]).sum().sum().to_frame().to_html(),pd.DataFrame(month_count.items(), columns=['Year', 'count']).to_html()

4 changes: 3 additions & 1 deletion monthly_expenses/templates/MonthlyExpenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ <h2>Monthly Expenses</h2>
<div class="row">
{% set report1 = extension.build_report() %}
{% set report2 = extension.build_report_life() %}
{% set a = extension.get_valid_month_number() %}
<div class="column">
{{report1[0] |safe}}
</div>
<div class="column">
{{report1[1] |safe}}
</div>
<div class="column">
{{report1[2] |safe}}
</div>
</div>
<div class="row">
<div class="column">
Expand Down

0 comments on commit cc48347

Please sign in to comment.