Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py
index c64d64e..93bef5d 100644
--- a/erpnext/accounts/doctype/gl_control/gl_control.py
+++ b/erpnext/accounts/doctype/gl_control/gl_control.py
@@ -177,7 +177,7 @@
 	#----------------------------------------------------------------------------
 	def make_single_entry(self,parent,d,le_map,cancel, merge_entries):
 		if self.get_val(le_map['account'], d, parent) and (self.get_val(le_map['debit'], d, parent) or self.get_val(le_map['credit'], d, parent)):
-			flist = ['account','cost_center','against','debit','credit','remarks','voucher_type','voucher_no','transaction_date','posting_date','fiscal_year','against_voucher','against_voucher_type','company','is_opening', 'aging_date']
+			flist = ['account','cost_center','against','debit','credit','remarks','voucher_type','voucher_no','posting_date','fiscal_year','against_voucher','against_voucher_type','company','is_opening', 'aging_date']
 
 			# Check budget before gl entry
 			#check budget only if account is expense account
@@ -536,7 +536,6 @@
 
 	# update new rv 
 
-	new_rv.doc.voucher_date = new_rv.doc.next_date
 	new_rv.doc.posting_date = new_rv.doc.next_date
 	new_rv.doc.aging_date = new_rv.doc.next_date
 	new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
index d09adc2..acbd72c 100644
--- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
+++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.py
@@ -533,7 +533,7 @@
 		self.values.append({
 			'item_code'					 : d.item_code,
 			'warehouse'					 : wh,
-			'transaction_date'		: self.doc.voucher_date,
+			'transaction_date'			: getdate(self.doc.modified).strftime('%Y-%m-%d'),
 			'posting_date'				: self.doc.posting_date,
 			'posting_time'				: self.doc.posting_time,
 			'voucher_type'				: 'Receivable Voucher',
diff --git a/erpnext/accounts/search_criteria/collection_report/collection_report.py b/erpnext/accounts/search_criteria/collection_report/collection_report.py
index fe0cb57..c0f6e61 100644
--- a/erpnext/accounts/search_criteria/collection_report/collection_report.py
+++ b/erpnext/accounts/search_criteria/collection_report/collection_report.py
@@ -66,7 +66,7 @@
 
 for r in res:
   if r[col_idx['Against Receivable']]:
-    dt=sql("select voucher_date, Aging_date from `tabReceivable Voucher` where name='%s'"%r[col_idx['Against Receivable']])
+    dt=sql("select date(modified), Aging_date from `tabReceivable Voucher` where name='%s'"%r[col_idx['Against Receivable']])
     r.append('')
     r.append(dt and cstr(dt[0][0]) or '')
     r.append(dt and cstr(dt[0][1]) or '')
@@ -103,4 +103,4 @@
   r.append(val_l2)
   r.append(val_l3)
   r.append(val_l4)
-  r.append(val_l5_above)
\ No newline at end of file
+  r.append(val_l5_above)
diff --git a/erpnext/accounts/search_criteria/payment_report/payment_report.py b/erpnext/accounts/search_criteria/payment_report/payment_report.py
index 8252103..cc025ba 100644
--- a/erpnext/accounts/search_criteria/payment_report/payment_report.py
+++ b/erpnext/accounts/search_criteria/payment_report/payment_report.py
@@ -66,7 +66,7 @@
 
 for r in res:
   if r[col_idx['Against Payable']]:
-    dt=sql("select voucher_date, aging_date from `tabPayable Voucher` where name='%s'"%r[col_idx['Against Payable']])
+    dt=sql("select date(modified), aging_date from `tabPayable Voucher` where name='%s'"%r[col_idx['Against Payable']])
     r.append('')
     r.append(dt and cstr(dt[0][0]) or '')
     r.append(dt and cstr(dt[0][1]) or '')
@@ -102,4 +102,4 @@
   r.append(val_l2)
   r.append(val_l3)
   r.append(val_l4)
-  r.append(val_l5_above)
\ No newline at end of file
+  r.append(val_l5_above)
diff --git a/erpnext/patches/jan_mar_2012/clear_session_cache.py b/erpnext/patches/jan_mar_2012/clear_session_cache.py
index 2071ae5..5ba2104 100644
--- a/erpnext/patches/jan_mar_2012/clear_session_cache.py
+++ b/erpnext/patches/jan_mar_2012/clear_session_cache.py
@@ -16,6 +16,4 @@
 
 def execute():
 	import webnotes
-	webnotes.conn.sql("""
-		delete from __SessionCache
-	""")
+	webnotes.clear_cache()
diff --git a/erpnext/patches/jan_mar_2012/label_cleanup.py b/erpnext/patches/jan_mar_2012/label_cleanup.py
index 93536fa..b40f36f 100644
--- a/erpnext/patches/jan_mar_2012/label_cleanup.py
+++ b/erpnext/patches/jan_mar_2012/label_cleanup.py
@@ -33,10 +33,10 @@
 	}
 
 	for d in del_flds:
-		webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = %s", (del_flds[d], d))
+		webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = '%s'"% (del_flds[d], d))
 
 	for d in del_labels:
-		webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = %s", (del_labels[d], d))
+		webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = '%s'"% (del_labels[d], d))
 
 	delete_doc('DocType', 'Update Delivery Date Detail')
 
diff --git a/erpnext/selling/search_criteria/variance_report/variance_report.py b/erpnext/selling/search_criteria/variance_report/variance_report.py
index e4ebf33..6948eac 100644
--- a/erpnext/selling/search_criteria/variance_report/variance_report.py
+++ b/erpnext/selling/search_criteria/variance_report/variance_report.py
@@ -60,7 +60,7 @@
 
 if under == 'Receivable Voucher':
   under_detail = 'RV'
-  dt = 'voucher_date'
+  dt = 'posting_date'
 else:
   under_detail = under
   dt = "transaction_date"
@@ -516,4 +516,4 @@
     tot_target = 0
 
   elif tl == 1:
-    out.append(r)
\ No newline at end of file
+    out.append(r)