refactor: rewrite `Incorrect Stock Value Report` queries in `QB`
diff --git a/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py b/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
index 23e3c8a..df01b14 100644
--- a/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
+++ b/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
@@ -4,6 +4,8 @@
 
 import frappe
 from frappe import _
+from frappe.query_builder import Field
+from frappe.query_builder.functions import Min, Timestamp
 from frappe.utils import add_days, getdate, today
 
 import erpnext
@@ -28,7 +30,7 @@
 def get_unsync_date(filters):
 	date = filters.from_date
 	if not date:
-		date = frappe.db.sql(""" SELECT min(posting_date) from `tabStock Ledger Entry`""")
+		date = (frappe.qb.from_("Stock Ledger Entry").select(Min(Field("posting_date")))).run()
 		date = date[0][0]
 
 	if not date:
@@ -54,22 +56,27 @@
 	result = []
 
 	voucher_wise_dict = {}
-	data = frappe.db.sql(
-		"""
-			SELECT
-				name, posting_date, posting_time, voucher_type, voucher_no,
-				stock_value_difference, stock_value, warehouse, item_code
-			FROM
-				`tabStock Ledger Entry`
-			WHERE
-				posting_date
-				= %s and company = %s
-				and is_cancelled = 0
-			ORDER BY timestamp(posting_date, posting_time) asc, creation asc
-		""",
-		(from_date, report_filters.company),
-		as_dict=1,
-	)
+	sle = frappe.qb.DocType("Stock Ledger Entry")
+	data = (
+		frappe.qb.from_(sle)
+		.select(
+			sle.name,
+			sle.posting_date,
+			sle.posting_time,
+			sle.voucher_type,
+			sle.voucher_no,
+			sle.stock_value_difference,
+			sle.stock_value,
+			sle.warehouse,
+			sle.item_code,
+		)
+		.where(
+			(sle.posting_date == from_date)
+			& (sle.company == report_filters.company)
+			& (sle.is_cancelled == 0)
+		)
+		.orderby(Timestamp(sle.posting_date, sle.posting_time), sle.creation)
+	).run(as_dict=True)
 
 	for d in data:
 		voucher_wise_dict.setdefault((d.item_code, d.warehouse), []).append(d)