Rushabh Mehta | e67d1fb | 2013-08-05 14:59:54 +0530 | [diff] [blame] | 1 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. |
| 2 | # License: GNU General Public License v3. See license.txt |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 3 | |
| 4 | from __future__ import unicode_literals |
| 5 | import webnotes |
Nabin Hait | b8ebbca | 2013-06-20 13:03:10 +0530 | [diff] [blame] | 6 | from webnotes.utils import add_days, add_months, cstr, getdate |
| 7 | from webnotes import _ |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 8 | |
Saurabh | 1848b71 | 2013-06-14 15:03:45 +0530 | [diff] [blame] | 9 | def get_columns(filters, trans): |
Nabin Hait | b8ebbca | 2013-06-20 13:03:10 +0530 | [diff] [blame] | 10 | validate_filters(filters) |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 11 | |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 12 | # get conditions for based_on filter cond |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 13 | based_on_details = based_wise_colums_query(filters.get("based_on"), trans) |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 14 | # get conditions for periodic filter cond |
| 15 | period_cols, period_select = period_wise_colums_query(filters, trans) |
| 16 | # get conditions for grouping filter cond |
| 17 | group_by_cols = group_wise_column(filters.get("group_by")) |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 18 | |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 19 | columns = based_on_details["based_on_cols"] + period_cols + ["Total(Qty):Float:120", "Total(Amt):Currency:120"] |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 20 | if group_by_cols: |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 21 | columns = based_on_details["based_on_cols"] + group_by_cols + period_cols + \ |
| 22 | ["Total(Qty):Float:120", "Total(Amt):Currency:120"] |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 23 | |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 24 | conditions = {"based_on_select": based_on_details["based_on_select"], "period_wise_select": period_select, |
Saurabh | 36cb3ca | 2013-06-21 16:25:28 +0530 | [diff] [blame] | 25 | "columns": columns, "group_by": based_on_details["based_on_group_by"], "grbc": group_by_cols, "trans": trans, |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 26 | "addl_tables": based_on_details["addl_tables"]} |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 27 | |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 28 | return conditions |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 29 | |
Nabin Hait | b8ebbca | 2013-06-20 13:03:10 +0530 | [diff] [blame] | 30 | def validate_filters(filters): |
| 31 | for f in ["Fiscal Year", "Based On", "Period", "Company"]: |
| 32 | if not filters.get(f.lower().replace(" ", "_")): |
| 33 | webnotes.msgprint(f + _(" is mandatory"), raise_exception=1) |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 34 | |
Nabin Hait | b8ebbca | 2013-06-20 13:03:10 +0530 | [diff] [blame] | 35 | if filters.get("based_on") == filters.get("group_by"): |
| 36 | webnotes.msgprint("'Based On' and 'Group By' can not be same", raise_exception=1) |
| 37 | |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 38 | def get_data(filters, conditions): |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 39 | data = [] |
| 40 | inc, cond= '','' |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 41 | query_details = conditions["based_on_select"] + conditions["period_wise_select"] |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 42 | |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 43 | if conditions["based_on_select"] in ["t1.project_name,", "t2.project_name,"]: |
| 44 | cond = 'and '+ conditions["based_on_select"][:-1] +' IS Not NULL' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 45 | |
| 46 | if filters.get("group_by"): |
| 47 | sel_col = '' |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 48 | ind = conditions["columns"].index(conditions["grbc"][0]) |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 49 | |
| 50 | if filters.get("group_by") == 'Item': |
| 51 | sel_col = 't2.item_code' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 52 | elif filters.get("group_by") == 'Customer': |
| 53 | sel_col = 't1.customer' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 54 | elif filters.get("group_by") == 'Supplier': |
| 55 | sel_col = 't1.supplier' |
| 56 | |
| 57 | if filters.get('based_on') in ['Item','Customer','Supplier']: |
| 58 | inc = 2 |
| 59 | else : |
| 60 | inc = 1 |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 61 | data1 = webnotes.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s |
Saurabh | 36cb3ca | 2013-06-21 16:25:28 +0530 | [diff] [blame] | 62 | where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s and |
| 63 | t1.docstatus = 1 %s |
Saurabh | 5b6d03e | 2013-06-19 12:34:22 +0530 | [diff] [blame] | 64 | group by %s |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 65 | """ % (query_details, conditions["trans"], conditions["trans"], conditions["addl_tables"], "%s", |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 66 | "%s", cond, conditions["group_by"]), (filters.get("company"), |
| 67 | filters["fiscal_year"]),as_list=1) |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 68 | |
| 69 | for d in range(len(data1)): |
| 70 | #to add blanck column |
| 71 | dt = data1[d] |
| 72 | dt.insert(ind,'') |
| 73 | data.append(dt) |
| 74 | |
| 75 | #to get distinct value of col specified by group_by in filter |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 76 | row = webnotes.conn.sql("""select DISTINCT(%s) from `tab%s` t1, `tab%s Item` t2 %s |
Saurabh | 5b6d03e | 2013-06-19 12:34:22 +0530 | [diff] [blame] | 77 | where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s |
| 78 | and t1.docstatus = 1 and %s = %s |
Nabin Hait | 4555d3b | 2013-06-21 16:27:34 +0530 | [diff] [blame] | 79 | """ % |
| 80 | (sel_col, conditions["trans"], conditions["trans"], conditions["addl_tables"], |
| 81 | "%s", "%s", conditions["group_by"], "%s"), |
| 82 | (filters.get("company"), filters.get("fiscal_year"), data1[d][0]), as_list=1) |
Saurabh | 1848b71 | 2013-06-14 15:03:45 +0530 | [diff] [blame] | 83 | |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 84 | for i in range(len(row)): |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 85 | des = ['' for q in range(len(conditions["columns"]))] |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 86 | |
Saurabh | af5df66 | 2013-06-20 15:00:53 +0530 | [diff] [blame] | 87 | #get data for group_by filter |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 88 | row1 = webnotes.conn.sql(""" select %s , %s from `tab%s` t1, `tab%s Item` t2 %s |
Saurabh | 5b6d03e | 2013-06-19 12:34:22 +0530 | [diff] [blame] | 89 | where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s |
| 90 | and t1.docstatus = 1 and %s = %s and %s = %s |
Nabin Hait | 4555d3b | 2013-06-21 16:27:34 +0530 | [diff] [blame] | 91 | """ % |
| 92 | (sel_col, conditions["period_wise_select"], conditions["trans"], |
| 93 | conditions["trans"], conditions["addl_tables"], "%s", "%s", sel_col, |
| 94 | "%s", conditions["group_by"], "%s"), |
| 95 | (filters.get("company"), filters.get("fiscal_year"), row[i][0], |
| 96 | data1[d][0]), as_list=1) |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 97 | |
| 98 | des[ind] = row[i] |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 99 | for j in range(1,len(conditions["columns"])-inc): |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 100 | des[j+inc] = row1[0][j] |
Nabin Hait | b8ebbca | 2013-06-20 13:03:10 +0530 | [diff] [blame] | 101 | |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 102 | data.append(des) |
| 103 | else: |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 104 | data = webnotes.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s |
Saurabh | 36cb3ca | 2013-06-21 16:25:28 +0530 | [diff] [blame] | 105 | where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s and |
| 106 | t1.docstatus = 1 %s |
Saurabh | 5b6d03e | 2013-06-19 12:34:22 +0530 | [diff] [blame] | 107 | group by %s |
Nabin Hait | 4555d3b | 2013-06-21 16:27:34 +0530 | [diff] [blame] | 108 | """ % |
| 109 | (query_details, conditions["trans"], conditions["trans"], conditions["addl_tables"], |
| 110 | "%s", "%s", cond,conditions["group_by"]), |
| 111 | (filters.get("company"), filters.get("fiscal_year")), as_list=1) |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 112 | |
| 113 | return data |
| 114 | |
Nabin Hait | b8ebbca | 2013-06-20 13:03:10 +0530 | [diff] [blame] | 115 | def get_mon(dt): |
| 116 | return getdate(dt).strftime("%b") |
Saurabh | d4f2199 | 2013-06-19 14:44:44 +0530 | [diff] [blame] | 117 | |
Saurabh | 1848b71 | 2013-06-14 15:03:45 +0530 | [diff] [blame] | 118 | def period_wise_colums_query(filters, trans): |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 119 | query_details = '' |
Saurabh | 1848b71 | 2013-06-14 15:03:45 +0530 | [diff] [blame] | 120 | pwc = [] |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 121 | bet_dates = get_period_date_ranges(filters.get("period"), filters.get("fiscal_year")) |
Saurabh | 1848b71 | 2013-06-14 15:03:45 +0530 | [diff] [blame] | 122 | |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 123 | if trans in ['Purchase Receipt', 'Delivery Note', 'Purchase Invoice', 'Sales Invoice']: |
| 124 | trans_date = 'posting_date' |
| 125 | else: |
| 126 | trans_date = 'transaction_date' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 127 | |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 128 | if filters.get("period") != 'Yearly': |
| 129 | for dt in bet_dates: |
| 130 | get_period_wise_columns(dt, filters.get("period"), pwc) |
| 131 | query_details = get_period_wise_query(dt, trans_date, query_details) |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 132 | else: |
Nabin Hait | 4555d3b | 2013-06-21 16:27:34 +0530 | [diff] [blame] | 133 | pwc = [filters.get("fiscal_year") + " (Qty):Float:120", |
| 134 | filters.get("fiscal_year") + " (Amt):Currency:120"] |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 135 | query_details = " SUM(t2.qty), SUM(t1.grand_total)," |
| 136 | |
Saurabh | 1848b71 | 2013-06-14 15:03:45 +0530 | [diff] [blame] | 137 | query_details += 'SUM(t2.qty), SUM(t1.grand_total)' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 138 | return pwc, query_details |
| 139 | |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 140 | def get_period_wise_columns(bet_dates, period, pwc): |
| 141 | if period == 'Monthly': |
| 142 | pwc += [get_mon(bet_dates[0]) + " (Qty):Float:120", |
| 143 | get_mon(bet_dates[0]) + " (Amt):Currency:120"] |
| 144 | else: |
| 145 | pwc += [get_mon(bet_dates[0]) + "-" + get_mon(bet_dates[1]) + " (Qty):Float:120", |
| 146 | get_mon(bet_dates[0]) + "-" + get_mon(bet_dates[1]) + " (Amt):Currency:120"] |
| 147 | |
| 148 | def get_period_wise_query(bet_dates, trans_date, query_details): |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 149 | query_details += """SUM(IF(t1.%(trans_date)s BETWEEN '%(sd)s' AND '%(ed)s', t2.qty, NULL)), |
| 150 | SUM(IF(t1.%(trans_date)s BETWEEN '%(sd)s' AND '%(ed)s', t1.grand_total, NULL)), |
Nabin Hait | 4555d3b | 2013-06-21 16:27:34 +0530 | [diff] [blame] | 151 | """ % {"trans_date": trans_date, "sd": bet_dates[0],"ed": bet_dates[1]} |
Nabin Hait | b8ebbca | 2013-06-20 13:03:10 +0530 | [diff] [blame] | 152 | return query_details |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 153 | |
Saurabh | f8f68c5 | 2013-06-20 18:52:31 +0530 | [diff] [blame] | 154 | def get_period_date_ranges(period, fiscal_year): |
| 155 | from dateutil.relativedelta import relativedelta |
| 156 | |
| 157 | year_start_date = webnotes.conn.get_value("Fiscal Year", fiscal_year, "year_start_date") |
| 158 | increment = { |
| 159 | "Monthly": 1, |
| 160 | "Quarterly": 3, |
| 161 | "Half-Yearly": 6, |
| 162 | "Yearly": 12 |
| 163 | }.get(period) |
| 164 | |
| 165 | period_date_ranges = [] |
| 166 | for i in xrange(1, 13, increment): |
| 167 | period_end_date = year_start_date + relativedelta(months=increment, days=-1) |
| 168 | period_date_ranges.append([year_start_date, period_end_date]) |
| 169 | year_start_date = period_end_date + relativedelta(days=1) |
| 170 | |
| 171 | return period_date_ranges |
| 172 | |
| 173 | def get_period_month_ranges(period, fiscal_year): |
| 174 | from dateutil.relativedelta import relativedelta |
| 175 | period_month_ranges = [] |
| 176 | |
| 177 | for start_date, end_date in get_period_date_ranges(period, fiscal_year): |
| 178 | months_in_this_period = [] |
| 179 | while start_date <= end_date: |
| 180 | months_in_this_period.append(start_date.strftime("%B")) |
| 181 | start_date += relativedelta(months=1) |
| 182 | period_month_ranges.append(months_in_this_period) |
| 183 | |
| 184 | return period_month_ranges |
| 185 | |
| 186 | def based_wise_colums_query(based_on, trans): |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 187 | based_on_details = {} |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 188 | |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 189 | # based_on_cols, based_on_select, based_on_group_by, addl_tables |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 190 | if based_on == "Item": |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 191 | based_on_details["based_on_cols"] = ["Item:Link/Item:120", "Item Name:Data:120"] |
| 192 | based_on_details["based_on_select"] = "t2.item_code, t2.item_name," |
| 193 | based_on_details["based_on_group_by"] = 't2.item_code' |
| 194 | based_on_details["addl_tables"] = '' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 195 | |
| 196 | elif based_on == "Item Group": |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 197 | based_on_details["based_on_cols"] = ["Item Group:Link/Item Group:120"] |
| 198 | based_on_details["based_on_select"] = "t2.item_group," |
| 199 | based_on_details["based_on_group_by"] = 't2.item_group' |
| 200 | based_on_details["addl_tables"] = '' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 201 | |
| 202 | elif based_on == "Customer": |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 203 | based_on_details["based_on_cols"] = ["Customer:Link/Customer:120", "Territory:Link/Territory:120"] |
| 204 | based_on_details["based_on_select"] = "t1.customer_name, t1.territory, " |
| 205 | based_on_details["based_on_group_by"] = 't1.customer_name' |
| 206 | based_on_details["addl_tables"] = '' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 207 | |
| 208 | elif based_on == "Customer Group": |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 209 | based_on_details["based_on_cols"] = ["Customer Group:Link/Customer Group"] |
| 210 | based_on_details["based_on_select"] = "t1.customer_group," |
| 211 | based_on_details["based_on_group_by"] = 't1.customer_group' |
| 212 | based_on_details["addl_tables"] = '' |
| 213 | |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 214 | elif based_on == 'Supplier': |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 215 | based_on_details["based_on_cols"] = ["Supplier:Link/Supplier:120", "Supplier Type:Link/Supplier Type:140"] |
| 216 | based_on_details["based_on_select"] = "t1.supplier, t3.supplier_type," |
| 217 | based_on_details["based_on_group_by"] = 't1.supplier' |
| 218 | based_on_details["addl_tables"] = ',`tabSupplier` t3' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 219 | |
| 220 | elif based_on == 'Supplier Type': |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 221 | based_on_details["based_on_cols"] = ["Supplier Type:Link/Supplier Type:140"] |
| 222 | based_on_details["based_on_select"] = "t3.supplier_type," |
| 223 | based_on_details["based_on_group_by"] = 't3.supplier_type' |
| 224 | based_on_details["addl_tables"] =',`tabSupplier` t3' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 225 | |
| 226 | elif based_on == "Territory": |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 227 | based_on_details["based_on_cols"] = ["Territory:Link/Territory:120"] |
| 228 | based_on_details["based_on_select"] = "t1.territory," |
| 229 | based_on_details["based_on_group_by"] = 't1.territory' |
| 230 | based_on_details["addl_tables"] = '' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 231 | |
| 232 | elif based_on == "Project": |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 233 | if trans in ['Sales Invoice', 'Delivery Note', 'Sales Order']: |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 234 | based_on_details["based_on_cols"] = ["Project:Link/Project:120"] |
| 235 | based_on_details["based_on_select"] = "t1.project_name," |
| 236 | based_on_details["based_on_group_by"] = 't1.project_name' |
| 237 | based_on_details["addl_tables"] = '' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 238 | elif trans in ['Purchase Order', 'Purchase Invoice', 'Purchase Receipt']: |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 239 | based_on_details["based_on_cols"] = ["Project:Link/Project:120"] |
| 240 | based_on_details["based_on_select"] = "t2.project_name," |
| 241 | based_on_details["based_on_group_by"] = 't2.project_name' |
| 242 | based_on_details["addl_tables"] = '' |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 243 | else: |
Nabin Hait | b8ebbca | 2013-06-20 13:03:10 +0530 | [diff] [blame] | 244 | webnotes.msgprint("Project-wise data is not available for Quotation", raise_exception=1) |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 245 | |
Saurabh | 2b02f14 | 2013-06-21 10:46:26 +0530 | [diff] [blame] | 246 | return based_on_details |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 247 | |
Saurabh | 1848b71 | 2013-06-14 15:03:45 +0530 | [diff] [blame] | 248 | def group_wise_column(group_by): |
Saurabh | 0326f54 | 2013-06-13 19:17:56 +0530 | [diff] [blame] | 249 | if group_by: |
| 250 | return [group_by+":Link/"+group_by+":120"] |
| 251 | else: |
| 252 | return [] |