[Report][Quotation Trend Complete]

This commit is contained in:
Saurabh
2013-06-12 17:55:19 +05:30
parent bcbd9a4800
commit f9966f44cd
3 changed files with 93 additions and 43 deletions

View File

@@ -155,8 +155,10 @@ for r in res:
for d in range(len(colnames) - cr):
r.append(flt(main_det[0][d]))
out.append(r)
if group_by:
flag = 1
# check for root nodes
if based_on in ['Item Group','Customer Group','Territory']:
is_grp = sql("select is_group from `tab%s` where name = '%s'" % (based_on, cstr(r[col_idx[based_on]]).strip()))
is_grp = is_grp and cstr(is_grp[0][0]) or ''
@@ -165,11 +167,11 @@ for r in res:
if flag == 1:
det = [x[0] for x in sql("SELECT DISTINCT %s FROM %s where %s" % (sel_col, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))]
for des in range(len(det)):
t_row = ['' for i in range(len(colnames))]
t_row[col_idx[group_by]] = cstr(det[des])
gr_det = sql("SELECT %s FROM %s WHERE %s = '%s' and %s" % (query_val, add_tab, sel_col, cstr(det[des]), add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
webnotes.errprint(cstr(r[col_idx[based_on]]).strip())
for d in range(len(col_names)):
t_row[col_idx[col_names[d]]] = flt(gr_det[0][d])
out.append(t_row)