Pie chart for ageing analysis in accounts receivale/payable
This commit is contained in:
parent
8ed2f87480
commit
28bdff5a55
@ -16,7 +16,10 @@ class ReceivablePayableReport(object):
|
|||||||
|
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1])
|
party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1])
|
||||||
return self.get_columns(party_naming_by, args), self.get_data(party_naming_by, args)
|
columns = self.get_columns(party_naming_by, args)
|
||||||
|
data = self.get_data(party_naming_by, args)
|
||||||
|
graph_data = self.get_graph_data(columns, data)
|
||||||
|
return columns, data, None, graph_data
|
||||||
|
|
||||||
def get_columns(self, party_naming_by, args):
|
def get_columns(self, party_naming_by, args):
|
||||||
columns = [_("Posting Date") + ":Date:80", _(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
|
columns = [_("Posting Date") + ":Date:80", _(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
|
||||||
@ -40,6 +43,8 @@ class ReceivablePayableReport(object):
|
|||||||
|
|
||||||
columns += [_("Age (Days)") + ":Int:80"]
|
columns += [_("Age (Days)") + ":Int:80"]
|
||||||
|
|
||||||
|
self.ageing_col_idx_start = len(columns)
|
||||||
|
|
||||||
if not "range1" in self.filters:
|
if not "range1" in self.filters:
|
||||||
self.filters["range1"] = "30"
|
self.filters["range1"] = "30"
|
||||||
if not "range2" in self.filters:
|
if not "range2" in self.filters:
|
||||||
@ -251,6 +256,23 @@ class ReceivablePayableReport(object):
|
|||||||
.get(against_voucher_type, {})\
|
.get(against_voucher_type, {})\
|
||||||
.get(against_voucher, [])
|
.get(against_voucher, [])
|
||||||
|
|
||||||
|
def get_graph_data(self, columns, data):
|
||||||
|
ageing_columns = columns[self.ageing_col_idx_start : self.ageing_col_idx_start+4]
|
||||||
|
|
||||||
|
range_totals = [[d.get("label")] for d in ageing_columns]
|
||||||
|
|
||||||
|
for d in data:
|
||||||
|
for i in xrange(4):
|
||||||
|
range_totals[i].append(d[self.ageing_col_idx_start + i])
|
||||||
|
|
||||||
|
return {
|
||||||
|
"data": {
|
||||||
|
'columns': range_totals,
|
||||||
|
'type': 'pie'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
args = {
|
args = {
|
||||||
"party_type": "Customer",
|
"party_type": "Customer",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user