Sfoglia il codice sorgente

sales analytics based on sales order/delivery note/sales invoice

version-14
Nabin Hait 12 anni fa
parent
commit
df5c9817b6
2 ha cambiato i file con 13 aggiunte e 8 eliminazioni
  1. +5
    -2
      public/js/wn/views/grid_report.js
  2. +8
    -6
      webnotes/widgets/report_dump.py

+ 5
- 2
public/js/wn/views/grid_report.js Vedi File

@@ -580,6 +580,7 @@ wn.views.GridReport = Class.extend({
return date==v.year_start_date ? true : null;
}).length;
});
}
// set label as last date of period
@@ -715,11 +716,13 @@ wn.views.TreeGridReport = wn.views.GridReportWithPlot.extend({
if(!tmap[v.parent]) tmap[v.parent] = [];
tmap[v.parent].push(v);
});
this.tl = [];
if (!this.tl) this.tl = {};
if (!this.tl[parent_doctype]) this.tl[parent_doctype] = [];
$.each(wn.report_dump.data[parent_doctype], function(i, parent) {
if(tmap[parent.name]) {
$.each(tmap[parent.name], function(i, d) {
me.tl.push($.extend(copy_dict(parent), d));
me.tl[parent_doctype].push($.extend(copy_dict(parent), d));
});
}
});


+ 8
- 6
webnotes/widgets/report_dump.py Vedi File

@@ -34,6 +34,8 @@ def get_data():
start = datetime.datetime.now()
for d in doctypes:
args = data_map[d]
dt = d.find("[") != -1 and d[:d.find("[")] or d
conditions = order_by = ""
if args.get("force_index"):
conditions = " force index (%s) " % args["force_index"]
@@ -41,17 +43,17 @@ def get_data():
conditions += " where " + " and ".join(args["conditions"])
if args.get("order_by"):
order_by = " order by " + args["order_by"]
table = args.get("from") or ("`tab%s`" % d)
table = args.get("from") or ("`tab%s`" % dt)
out[d] = {}
out[dt] = {}
start = datetime.datetime.now()
out[d]["data"] = [list(t) for t in webnotes.conn.sql("""select %s from %s %s %s""" \
out[dt]["data"] = [list(t) for t in webnotes.conn.sql("""select %s from %s %s %s""" \
% (",".join(args["columns"]), table, conditions, order_by))]
out[d]["time"] = str(datetime.datetime.now() - start)
out[d]["columns"] = map(lambda c: c.split(" as ")[-1], args["columns"])
out[dt]["time"] = str(datetime.datetime.now() - start)
out[dt]["columns"] = map(lambda c: c.split(" as ")[-1], args["columns"])
if args.get("links"):
out[d]["links"] = args["links"]
out[dt]["links"] = args["links"]
for d in out:
unused_links = []


Caricamento…
Annulla
Salva