merge
diff --git a/accounts/page/trial_balance/trial_balance.js b/accounts/page/trial_balance/trial_balance.js
index dc87d58..c64075f 100644
--- a/accounts/page/trial_balance/trial_balance.js
+++ b/accounts/page/trial_balance/trial_balance.js
@@ -37,37 +37,6 @@
 			});
 		},
 		
-		export: function() {
-			var msgbox = msgprint('<p>Select To Download:</p>\
-				<p><input type="checkbox" name="with_groups" checked> Account Groups</p>\
-				<p><input type="checkbox" name="with_ledgers" checked> Account Ledgers</p>\
-				<p><button class="btn btn-info">Download</button>');
-
-			var me = this;
-
-			$(msgbox.body).find("button").click(function() {
-				var with_groups = $(msgbox.body).find("[name='with_groups']").is(":checked");
-				var with_ledgers = $(msgbox.body).find("[name='with_ledgers']").is(":checked");
-
-				var data = wn.slickgrid_tools.get_view_data(me.columns, me.dataView, 
-					function(row, item) {
-						if(with_groups) {
-							// pad row
-							for(var i=0; i<item.indent; i++) row[0] = "   " + row[0];
-						}
-						if(with_groups && item.group_or_ledger == "Group") return true;
-						if(with_ledgers && item.group_or_ledger == "Ledger") return true;
-					
-						return false;
-				});
-				
-				wn.tools.downloadify(data, ["Report Manager", "System Manager"], me);
-				return false;
-			})
-
-			return false;
-		},
-		
 		prepare_balances: function() {
 			// store value of with closing entry
 			this.with_period_closing_entry = this.wrapper
diff --git a/patches/december_2012/clear_web_cache.py b/patches/december_2012/clear_web_cache.py
index da71492..b92f4bd 100644
--- a/patches/december_2012/clear_web_cache.py
+++ b/patches/december_2012/clear_web_cache.py
@@ -1,5 +1,10 @@
 import webnotes
 def execute():
+	webnotes.reload_doc("website", "doctype", "web_page")
+	webnotes.reload_doc("website", "doctype", "blog")
+	webnotes.reload_doc("stock", "doctype", "item")
+	webnotes.reload_doc("setup", "doctype", "item_group")
+	
 	# build wn-web.js and wn-web.css
 	from website.helpers.make_web_include_files import make
 	make()
diff --git a/public/js/stock_analytics.js b/public/js/stock_analytics.js
index 53641ce..124b02a 100644
--- a/public/js/stock_analytics.js
+++ b/public/js/stock_analytics.js
@@ -62,8 +62,7 @@
 		this.columns = std_columns.concat(this.columns);
 	},
 	filters: [
-		{fieldtype:"Select", label: "Value or Qty", options:["Value (Weighted Average)", 
-			"Value (FIFO)", "Quantity"],
+		{fieldtype:"Select", label: "Value or Qty", options:["Value", "Quantity"],
 			filter: function(val, item, opts, me) {
 				return me.apply_zero_filter(val, item, opts, me);
 			}},
@@ -145,7 +144,10 @@
 				
 				if(me.value_or_qty!="Quantity") {
 					var wh = me.get_item_warehouse(sl.warehouse, sl.item_code);
-					var is_fifo = this.value_or_qty== "Value (FIFO)";
+					var valuation_method = item.valuation_method ? 
+						item.valuation_method : sys_defaults.valuation_method;
+					var is_fifo = valuation_method == "FIFO";
+					
 					var diff = me.get_value_diff(wh, sl, is_fifo);
 				} else {
 					var diff = sl.qty;
diff --git a/selling/doctype/opportunity/opportunity.txt b/selling/doctype/opportunity/opportunity.txt
index 496897e..1547ad7 100644
--- a/selling/doctype/opportunity/opportunity.txt
+++ b/selling/doctype/opportunity/opportunity.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:19", 
   "docstatus": 0, 
-  "modified": "2013-01-22 14:56:40", 
+  "modified": "2013-01-22 15:23:24", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -52,7 +52,7 @@
   "no_copy": 1, 
   "oldfieldname": "naming_series", 
   "oldfieldtype": "Select", 
-  "options": "ENQUIRY\nENQ", 
+  "options": "OPPT", 
   "reqd": 1
  }, 
  {
diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py
index 145bcb4..6c1300b 100644
--- a/selling/doctype/quotation/quotation.py
+++ b/selling/doctype/quotation/quotation.py
@@ -239,10 +239,6 @@
 	# =========================================================================
 	def on_submit(self):
 		self.check_item_table()
-		if not self.doc.amended_from:
-			webnotes.conn.set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been sent')
-		else:
-			webnotes.conn.set(self.doc, 'message', 'Quotation has been amended. New Quotation no:'+self.doc.name)
 		
 		# Check for Approving Authority
 		get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
@@ -257,24 +253,11 @@
 # ON CANCEL
 # ==========================================================================
 	def on_cancel(self):
-		webnotes.conn.set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been cancelled')
-		
 		#update enquiry status
 		self.update_enquiry('cancel')
 		
 		webnotes.conn.set(self.doc,'status','Cancelled')
-		
-	
-# SEND SMS
-# =============================================================================
-	def send_sms(self):
-		if not self.doc.customer_mobile_no:
-			msgprint("Please enter customer mobile no")
-		elif not self.doc.message:
-			msgprint("Please enter the message you want to send")
-		else:
-			msgprint(get_obj("SMS Control", "SMS Control").send_sms([self.doc.contact_mobile,], self.doc.message))
-	
+			
 # Print other charges
 # ===========================================================================
 	def print_other_charges(self,docname):
diff --git a/stock/page/stock_balance/stock_balance.js b/stock/page/stock_balance/stock_balance.js
index 90c7943..536d435 100644
--- a/stock/page/stock_balance/stock_balance.js
+++ b/stock/page/stock_balance/stock_balance.js
@@ -42,14 +42,25 @@
 		this.columns = [
 			{id: "name", name: "Item", field: "name", width: 300,
 				formatter: this.tree_formatter},
-			{id: "opening", name: "Opening", field: "opening", width: 100, 
+				
+			{id: "opening_qty", name: "Opening Qty", field: "opening_qty", width: 100, 
 				formatter: this.currency_formatter},
-			{id: "inflow", name: "In", field: "inflow", width: 100, 
+			{id: "inflow_qty", name: "In Qty", field: "inflow_qty", width: 100, 
 				formatter: this.currency_formatter},
-			{id: "outflow", name: "Out", field: "outflow", width: 100, 
+			{id: "outflow_qty", name: "Out Qty", field: "outflow_qty", width: 100, 
 				formatter: this.currency_formatter},
-			{id: "closing", name: "Closing", field: "closing", width: 100, 
+			{id: "closing_qty", name: "Closing Qty", field: "closing_qty", width: 100, 
 				formatter: this.currency_formatter},
+				
+			{id: "opening_value", name: "Opening Value", field: "opening_value", width: 100, 
+				formatter: this.currency_formatter},
+			{id: "inflow_value", name: "In Value", field: "inflow_value", width: 100, 
+				formatter: this.currency_formatter},
+			{id: "outflow_value", name: "Out Value", field: "outflow_value", width: 100, 
+				formatter: this.currency_formatter},
+			{id: "closing_value", name: "Closing Value", field: "closing_value", width: 100, 
+				formatter: this.currency_formatter},
+				
 			{id: "brand", name: "Brand", field: "brand", width: 100},
 			{id: "item_name", name: "Item Name", field: "item_name", width: 100},
 			{id: "description", name: "Description", field: "description", width: 200, 
@@ -58,17 +69,14 @@
 	},
 	
 	filters: [
-		{fieldtype:"Select", label: "Value or Qty", options:["Value (Weighted Average)", 
-			"Value (FIFO)", "Quantity"],
-			filter: function(val, item, opts, me) {
-				return me.apply_zero_filter(val, item, opts, me);
-			}},
 		{fieldtype:"Select", label: "Brand", link:"Brand", 
 			default_value: "Select Brand...", filter: function(val, item, opts) {
 				return val == opts.default_value || item.brand == val || item._show;
 			}, link_formatter: {filter_input: "brand"}},
 		{fieldtype:"Select", label: "Warehouse", link:"Warehouse", 
-			default_value: "Select Warehouse..."},
+			default_value: "Select Warehouse...", filter: function(val, item, opts, me) {
+				return me.apply_zero_filter(val, item, opts, me);
+			}},
 		{fieldtype:"Date", label: "From Date"},
 		{fieldtype:"Label", label: "To"},
 		{fieldtype:"Date", label: "To Date"},
@@ -100,31 +108,37 @@
 			
 			if(me.is_default("warehouse") ? true : me.warehouse == sl.warehouse) {
 				var item = me.item_by_name[sl.item_code];
-				
-				if(me.value_or_qty!="Quantity") {
-					var wh = me.get_item_warehouse(sl.warehouse, sl.item_code);
-					var is_fifo = this.value_or_qty== "Value (FIFO)";
-					var diff = me.get_value_diff(wh, sl, is_fifo);
-				} else {
-					var diff = sl.qty;
-				}
+				var wh = me.get_item_warehouse(sl.warehouse, sl.item_code);
+				var valuation_method = item.valuation_method ? 
+					item.valuation_method : sys_defaults.valuation_method;
+				var is_fifo = valuation_method == "FIFO";
+
+				var qty_diff = sl.qty;
+				var value_diff = me.get_value_diff(wh, sl, is_fifo);
 
 				if(posting_datetime < from_date) {
-					item.opening += diff;
+					item.opening_qty += qty_diff;
+					item.opening_value += value_diff;
 				} else if(posting_datetime <= to_date) {
 					var ignore_inflow_outflow = this.is_default("warehouse")
 						&& sl.voucher_type=="Stock Entry" 
 						&& this.stock_entry_map[sl.voucher_no].purpose=="Material Transfer";
 					
 					if(!ignore_inflow_outflow) {
-						if(diff < 0) {
-							item.outflow += Math.abs(diff);
+						if(qty_diff < 0) {
+							item.outflow_qty += Math.abs(qty_diff);
 						} else {
-							item.inflow += diff;
+							item.inflow_qty += qty_diff;
+						}
+						if(value_diff < 0) {
+							item.outflow_value += Math.abs(value_diff);
+						} else {
+							item.inflow_value += value_diff;
 						}
 					}
 					
-					item.closing += diff;
+					item.closing_qty += qty_diff;
+					item.closing_value += value_diff;
 				} else {
 					break;
 				}
@@ -134,7 +148,8 @@
 		// opening + diff = closing
 		// adding opening, since diff already added to closing		
 		$.each(me.item_by_name, function(key, item) {
-			item.closing += item.opening;
+			item.closing_qty += item.opening_qty;
+			item.closing_value += item.opening_value;
 		});
 	},