multi sort for stock ledger search criteria
diff --git a/erpnext/patches/august_2012/reload_stock_ledger.py b/erpnext/patches/august_2012/reload_stock_ledger.py
deleted file mode 100644
index d0ec9ee..0000000
--- a/erpnext/patches/august_2012/reload_stock_ledger.py
+++ /dev/null
@@ -1,4 +0,0 @@
-def execute():
-	import webnotes
-	from webnotes.modules import reload_doc
-	reload_doc('stock', 'Report', 'Stock Ledger')
\ No newline at end of file
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index e4eff96..3acd97d 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -534,10 +534,6 @@
 		'patch_file': 'remove_cash_flow_statement',
 	},
 	{
-		'patch_module': 'patches.august_2012',
-		'patch_file': 'reload_stock_ledger',
-	},
-	{
 		'patch_module': 'patches.september_2012',
 		'patch_file': 'stock_report_permissions_for_accounts',
 	},
@@ -545,4 +541,8 @@
 		'patch_module': 'patches.september_2012',
 		'patch_file': 'communication_delete_permission',
 	},
+	{
+		'patch_module': 'patches.september_2012',
+		'patch_file': 'reload_criteria_stock_ledger',
+	},
 ]
diff --git a/erpnext/patches/september_2012/reload_criteria_stock_ledger.py b/erpnext/patches/september_2012/reload_criteria_stock_ledger.py
new file mode 100644
index 0000000..4e2e71a
--- /dev/null
+++ b/erpnext/patches/september_2012/reload_criteria_stock_ledger.py
@@ -0,0 +1,7 @@
+def execute():
+	import webnotes
+	from webnotes.modules import reload_doc
+	reload_doc('stock', 'Search Criteria', 'Stock Ledger')
+
+	from webnotes.model import delete_doc
+	delete_doc("Report", "Stock Ledger")
\ No newline at end of file
diff --git a/erpnext/stock/Report/Stock Ledger/Stock Ledger.txt b/erpnext/stock/Report/Stock Ledger/Stock Ledger.txt
deleted file mode 100644
index d0c5184..0000000
--- a/erpnext/stock/Report/Stock Ledger/Stock Ledger.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Report, Stock Ledger
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2012-09-06 18:47:05',
-		'docstatus': 0,
-		'modified': '2012-09-06 18:48:22',
-		'modified_by': u'Administrator',
-		'owner': u'Administrator'
-	},
-
-	# These values are common for all Report
-	{
-		'doctype': 'Report',
-		'json': u'{"filters":[["Stock Ledger Entry","is_cancelled","=","No"]],"columns":[["item_code","Stock Ledger Entry"],["warehouse","Stock Ledger Entry"],["posting_date","Stock Ledger Entry"],["posting_time","Stock Ledger Entry"],["actual_qty","Stock Ledger Entry"],["bin_aqat","Stock Ledger Entry"],["voucher_type","Stock Ledger Entry"],["voucher_no","Stock Ledger Entry"]],"sort_by":"Stock Ledger Entry.posting_date","sort_order":"desc","sort_by_next":"Stock Ledger Entry.posting_time","sort_order_next":"desc"}',
-		'name': '__common__',
-		'ref_doctype': u'Stock Ledger Entry'
-	},
-
-	# Report, Stock Ledger
-	{
-		'doctype': 'Report',
-		'name': u'Stock Ledger'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/stock/search_criteria/stock_ledger/stock_ledger.txt b/erpnext/stock/search_criteria/stock_ledger/stock_ledger.txt
index cee810b..5f9cb8c 100644
--- a/erpnext/stock/search_criteria/stock_ledger/stock_ledger.txt
+++ b/erpnext/stock/search_criteria/stock_ledger/stock_ledger.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-04-16 11:42:44',
+		'creation': '2012-09-13 15:18:44',
 		'docstatus': 0,
-		'modified': '2012-04-16 16:00:35',
+		'modified': '2012-09-13 15:19:44',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -23,7 +23,7 @@
 		'module': u'Stock',
 		'name': '__common__',
 		'page_len': 50,
-		'sort_by': u'`tabStock Ledger Entry`.`item_code`',
+		'sort_by': u'`tabStock Ledger Entry`.`posting_date` DESC, `tabStock Ledger Entry`.`posting_time` DESC, `tabStock Ledger Entry`.`name` DESC',
 		'sort_order': u'DESC',
 		'standard': u'Yes'
 	},
diff --git a/public/js/all-app.js b/public/js/all-app.js
index f52272c..18eeac0 100644
--- a/public/js/all-app.js
+++ b/public/js/all-app.js
@@ -400,7 +400,7 @@
  *	lib/js/core.js
  */
 if(!console){var console={log:function(txt){}}}
-window._version_number="031a31bad930de7f9e8157242afbcba4729d91ff9f957c0c897cafd6";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
+window._version_number="1e94c62f61174cfb7f98c2bdd377674ef06b81eff2e4d1c2dff88107";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
 
 /*
  *	lib/js/legacy/globals.js
diff --git a/public/js/all-web.js b/public/js/all-web.js
index 2c0b0ae..b2ba636 100644
--- a/public/js/all-web.js
+++ b/public/js/all-web.js
@@ -287,7 +287,7 @@
  *	lib/js/core.js
  */
 if(!console){var console={log:function(txt){}}}
-window._version_number="031a31bad930de7f9e8157242afbcba4729d91ff9f957c0c897cafd6";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
+window._version_number="1e94c62f61174cfb7f98c2bdd377674ef06b81eff2e4d1c2dff88107";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
 
 /*
  *	lib/js/legacy/globals.js
diff --git a/public/js/report-legacy.js b/public/js/report-legacy.js
index 5a3b93f..925386e 100644
--- a/public/js/report-legacy.js
+++ b/public/js/report-legacy.js
@@ -171,10 +171,10 @@
 _r.DataTable.prototype.set_sort_option_disabled=function(label,disabled){var s=this.sort_sel;if(disabled){for(var i=0;i<s.options.length;i++){if(s.options[i]&&s.options[i].text==label){this.disabled_options[label]=s.options[i];s.remove(i);}}}else{if(this.disabled_options[label]){try{s.add(this.disabled_options[label],s.options[s.options.length-1]);}catch(e){try{s.add(this.disabled_options[label],s.options.length-1);}catch(e){}}
 this.disabled_options[label]=null;}}}
 _r.DataTable.prototype.add_sort_option=function(label,val){var s=this.sort_sel;s.options[s.options.length]=new Option(label,val,false,s.options.length==0?true:false);}
-_r.DataTable.prototype.update_query=function(no_limit){if((_r.rb_con.cur_rb&&_r.rb_con.cur_rb.get_query)||(this.search_criteria&&this.search_criteria.custom_query)){}else{if(!sel_val(this.sort_sel)){this.sort_sel.selectedIndex=0;}
+_r.DataTable.prototype.update_query=function(no_limit){if((_r.rb_con.cur_rb&&_r.rb_con.cur_rb.get_query)||(this.search_criteria&&this.search_criteria.custom_query)){}else{var sort_by=null,sort_order="";if(sel_val(this.sort_sel)){sort_by=sel_val(this.sort_sel);sort_order=this.sort_order;}else if(_r.rb_con.cur_rb.sc.sort_by){sort_by=_r.rb_con.cur_rb.sc.sort_by;sort_order="";}else{this.sort_sel.selectedIndex=0;sort_by=sel_val(this.sort_sel);sort_order=this.sort_order;}
 this.query+=NEWLINE
-+' ORDER BY '+sel_val(this.sort_sel)
-+' '+this.sort_order;}
++' ORDER BY '+sort_by
++' '+sort_order;}
 if(no_limit||this.no_limit){if(this.show_query)alert(this.query);return;}
 this.query+=' LIMIT '+(this.start_rec-1)+','+this.page_len;if(this.show_query)
 alert(this.query);}