|
|
@ -194,6 +194,9 @@ class Analytics(object): |
|
|
|
def get_rows(self): |
|
|
|
self.data = [] |
|
|
|
self.get_periodic_data() |
|
|
|
total_row = { |
|
|
|
"entity": "Total", |
|
|
|
} |
|
|
|
|
|
|
|
for entity, period_data in iteritems(self.entity_periodic_data): |
|
|
|
row = { |
|
|
@ -207,6 +210,9 @@ class Analytics(object): |
|
|
|
row[scrub(period)] = amount |
|
|
|
total += amount |
|
|
|
|
|
|
|
if not total_row.get(scrub(period)): total_row[scrub(period)] = 0 |
|
|
|
total_row[scrub(period)] += amount |
|
|
|
|
|
|
|
row["total"] = total |
|
|
|
|
|
|
|
if self.filters.tree_type == "Item": |
|
|
@ -214,9 +220,14 @@ class Analytics(object): |
|
|
|
|
|
|
|
self.data.append(row) |
|
|
|
|
|
|
|
self.data.append(total_row) |
|
|
|
|
|
|
|
def get_rows_by_group(self): |
|
|
|
self.get_periodic_data() |
|
|
|
out = [] |
|
|
|
total_row = { |
|
|
|
"entity": "Total", |
|
|
|
} |
|
|
|
|
|
|
|
for d in reversed(self.group_entries): |
|
|
|
row = { |
|
|
@ -232,8 +243,14 @@ class Analytics(object): |
|
|
|
self.entity_periodic_data.setdefault(d.parent, frappe._dict()).setdefault(period, 0.0) |
|
|
|
self.entity_periodic_data[d.parent][period] += amount |
|
|
|
total += amount |
|
|
|
|
|
|
|
if not total_row.get(scrub(period)): total_row[scrub(period)] = 0 |
|
|
|
total_row[scrub(period)] += amount |
|
|
|
|
|
|
|
row["total"] = total |
|
|
|
out = [row] + out |
|
|
|
|
|
|
|
out.append(total_row) |
|
|
|
self.data = out |
|
|
|
|
|
|
|
def get_periodic_data(self): |
|
|
|