merge
diff --git a/patches/december_2012/repost_ordered_qty.py b/patches/december_2012/repost_ordered_qty.py
new file mode 100644
index 0000000..c798b6c
--- /dev/null
+++ b/patches/december_2012/repost_ordered_qty.py
@@ -0,0 +1,17 @@
+def execute():
+	import webnotes
+	from webnotes.utils import flt
+	bins = webnotes.conn.sql("select item_code, warehouse, name, ordered_qty from `tabBin`")
+	for d in bins:
+		ordered_qty = webnotes.conn.sql("""
+			select sum(ifnull(po_item.qty, 0) - ifnull(po_item.received_qty, 0)) 
+			from `tabPurchase Order Item` po_item, `tabPurchase Order` po
+			where po_item.parent = po.name and po.docstatus = 1 and po.status != 'Stopped' 
+			and po_item.item_code = %s and po_item.warehouse = %s
+		""", (d[0], d[1]))
+
+		if flt(d[3]) != flt(ordered_qty[0][0]):
+			print d[3], ordered_qty[0][0]
+			
+			webnotes.conn.sql("""update `tabBin` set ordered_qty = %s where name = %s""",
+			 	(ordered_qty and ordered_qty[0][0] or 0, d[2]))
\ No newline at end of file
diff --git a/patches/december_2012/repost_projected_qty.py b/patches/december_2012/repost_projected_qty.py
new file mode 100644
index 0000000..4e4f522
--- /dev/null
+++ b/patches/december_2012/repost_projected_qty.py
@@ -0,0 +1,5 @@
+def execute():
+	import webnotes
+	webnotes.conn.sql("""update `tabBin` 
+		set projected_qty = ifnull(actual_qty, 0) + ifnull(indented_qty, 0) + 
+			ifnull(ordered_qty, 0) + ifnull(planned_qty, 0) - ifnull(reserved_qty, 0)""")
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index d21014c..88a7773 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -713,4 +713,12 @@
 		'patch_module': 'patches.december_2012',
 		'patch_file': 'expense_leave_reload',
 	},
+	{
+		'patch_module': 'patches.december_2012',
+		'patch_file': 'repost_ordered_qty',
+	},
+	{
+		'patch_module': 'patches.december_2012',
+		'patch_file': 'repost_projected_qty',
+	},
 ]
\ No newline at end of file