Show general/stock ledger button links to new query reports
diff --git a/public/js/account_tree_grid.js b/public/js/account_tree_grid.js
index 44bef57..1cd9aa6 100644
--- a/public/js/account_tree_grid.js
+++ b/public/js/account_tree_grid.js
@@ -26,9 +26,10 @@
 				show: true, 
 				parent_field: "parent_account", 
 				formatter: function(item) {
-					return repl('<a href="#general-ledger/account=%(enc_value)s">%(value)s</a>', {
+					return repl("<a \
+						onclick='wn.cur_grid_report.show_general_ledger(\"%(value)s\")'>\
+						%(value)s</a>", {
 							value: item.name,
-							enc_value: encodeURIComponent(item.name)
 						});
 				}
 			},
@@ -211,4 +212,14 @@
 			return;
 		}
 	},
+	
+	show_general_ledger: function(account) {
+		wn.route_options = {
+			account: account,
+			company: this.company,
+			from_date: this.from_date,
+			to_date: this.to_date
+		};
+		wn.set_route("query-report", "General Ledger");
+	}
 });
\ No newline at end of file
diff --git a/public/js/controllers/stock_controller.js b/public/js/controllers/stock_controller.js
index ee5c497..d2fb904 100644
--- a/public/js/controllers/stock_controller.js
+++ b/public/js/controllers/stock_controller.js
@@ -11,9 +11,10 @@
 				wn.route_options = {
 					voucher_no: me.frm.doc.name,
 					from_date: me.frm.doc.posting_date,
-					to_date: me.frm.doc.posting_date
+					to_date: me.frm.doc.posting_date,
+					company: me.frm.doc.company
 				};
-				wn.set_route('stock-ledger');
+				wn.set_route("query-report", "Stock Ledger");
 			}, "icon-bar-chart");
 		}
 		
@@ -24,11 +25,12 @@
 		if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) { 
 			cur_frm.appframe.add_button(wn._('Accounting Ledger'), function() {
 				wn.route_options = {
-					"voucher_no": me.frm.doc.name,
-					"from_date": me.frm.doc.posting_date,
-					"to_date": me.frm.doc.posting_date,
+					voucher_no: me.frm.doc.name,
+					from_date: me.frm.doc.posting_date,
+					to_date: me.frm.doc.posting_date,
+					company: me.frm.doc.company
 				};
-				wn.set_route("general-ledger");
+				wn.set_route("query-report", "General Ledger");
 			}, "icon-table");
 		}
 	},
diff --git a/public/js/stock_analytics.js b/public/js/stock_analytics.js
index 832cac5..8b68d39 100644
--- a/public/js/stock_analytics.js
+++ b/public/js/stock_analytics.js
@@ -17,10 +17,10 @@
 				parent_field: "parent_item_group", 
 				formatter: function(item) {
 					if(!item.is_group) {
-						return repl('<a href="#stock-ledger/item_code=%(enc_value)s">%(value)s</a>',
-							{
+						return repl("<a \
+							onclick='wn.cur_grid_report.show_stock_ledger(\"%(value)s\")'>\
+							%(value)s</a>", {
 								value: item.name,
-								enc_value: encodeURIComponent(item.name)
 							});
 					} else {
 						return item.name;
@@ -183,5 +183,13 @@
 	},
 	get_plot_points: function(item, col, idx) {
 		return [[dateutil.user_to_obj(col.name).getTime(), item[col.field]]]
+	},
+	show_stock_ledger: function(item_code) {
+		wn.route_options = {
+			item_code: item_code,
+			from_date: this.from_date,
+			to_date: this.to_date
+		};
+		wn.set_route("query-report", "Stock Ledger");
 	}
 });
\ No newline at end of file