[fix] missing gl entries warnings
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 3f25e02..aa84929 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -276,12 +276,18 @@
 def compare_existing_and_expected_gle(existing_gle, expected_gle):
 	matched = True
 	for entry in expected_gle:
+		account_existed = False
 		for e in existing_gle:
-			if entry.account==e.account and entry.against_account==e.against_account \
-				and (not entry.cost_center or not e.cost_center or entry.cost_center==e.cost_center) \
-				and (entry.debit != e.debit or entry.credit != e.credit):
-					matched = False
-					break
+			if entry.account == e.account:
+				account_existed = True
+			if entry.account == e.account and entry.against_account == e.against_account \
+					and (not entry.cost_center or not e.cost_center or entry.cost_center == e.cost_center) \
+					and (entry.debit != e.debit or entry.credit != e.credit):
+				matched = False
+				break
+		if not account_existed:
+			matched = False
+			break
 	return matched
 
 def get_future_stock_vouchers(posting_date, posting_time, for_warehouses=None, for_items=None):
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index e35f3d2..bf0782f 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -36,6 +36,7 @@
 			self.pro_doc = frappe.get_doc('Production Order', self.production_order)
 
 		self.validate_posting_time()
+		self.validate_posting_date()
 		self.validate_purpose()
 		self.validate_item()
 		self.set_transfer_qty()
@@ -65,6 +66,38 @@
 		self.update_production_order()
 		self.make_gl_entries_on_cancel()
 
+	def validate_posting_date(self):
+		allow_negative_stock = cint(frappe.db.get_value("Stock Settings", None, "allow_negative_stock"))
+		items, warehouses = self.get_items_and_warehouses()
+		previous_stock_vouchers = self.get_previous_stock_vouchers(self.posting_date, self.posting_time, warehouses,
+		                                                           items)
+
+		if allow_negative_stock and previous_stock_vouchers:
+			for voucher_type, voucher_no in previous_stock_vouchers:
+				frappe.msgprint(
+					_("The posting date is after {0}: {1}, this will cause missing data in the General Ledger").format(
+						voucher_type, voucher_no))
+
+	def get_previous_stock_vouchers(self, posting_date, posting_time, for_warehouses=None, for_items=None):
+		previous_stock_vouchers = []
+
+		values = []
+		condition = ""
+
+		if for_items:
+			condition += " and item_code in ({})".format(", ".join(["%s"] * len(for_items)))
+			values += for_items
+
+		for d in frappe.db.sql("""select distinct sle.voucher_type, sle.voucher_no
+			from `tabStock Ledger Entry` sle
+			where timestamp(sle.posting_date, sle.posting_time) <= timestamp(%s, %s) {condition}
+			and warehouse = "Finished Goods - IAG"
+			order by timestamp(sle.posting_date, sle.posting_time) asc, name asc""".format(condition=condition),
+		                       tuple([posting_date, posting_time] + values), as_dict=True):
+			previous_stock_vouchers.append([d.voucher_type, d.voucher_no])
+
+		return previous_stock_vouchers
+
 	def validate_purpose(self):
 		valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer", "Material Transfer for Manufacture",
 			"Manufacture", "Repack", "Subcontract"]