fix: Trial Balance report considering cancelled entries
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index 922722f..4947248 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -126,23 +126,22 @@
 	def make_gl_entries(self, get_opening_entries=False):
 		gl_entries = self.get_gl_entries()
 		closing_entries = self.get_grouped_gl_entries(get_opening_entries=get_opening_entries)
-		if gl_entries:
-			if len(gl_entries) > 5000:
-				frappe.enqueue(
-					process_gl_entries,
-					gl_entries=gl_entries,
-					closing_entries=closing_entries,
-					voucher_name=self.name,
-					company=self.company,
-					closing_date=self.posting_date,
-					queue="long",
-				)
-				frappe.msgprint(
-					_("The GL Entries will be processed in the background, it can take a few minutes."),
-					alert=True,
-				)
-			else:
-				process_gl_entries(gl_entries, closing_entries, self.name, self.company, self.posting_date)
+		if len(gl_entries) > 5000:
+			frappe.enqueue(
+				process_gl_entries,
+				gl_entries=gl_entries,
+				closing_entries=closing_entries,
+				voucher_name=self.name,
+				company=self.company,
+				closing_date=self.posting_date,
+				queue="long",
+			)
+			frappe.msgprint(
+				_("The GL Entries will be processed in the background, it can take a few minutes."),
+				alert=True,
+			)
+		else:
+			process_gl_entries(gl_entries, closing_entries, self.name, self.company, self.posting_date)
 
 	def get_grouped_gl_entries(self, get_opening_entries=False):
 		closing_entries = []
@@ -330,17 +329,15 @@
 	from erpnext.accounts.general_ledger import make_gl_entries
 
 	try:
-		make_gl_entries(gl_entries, merge_entries=False)
+		if gl_entries:
+			make_gl_entries(gl_entries, merge_entries=False)
+
 		make_closing_entries(gl_entries + closing_entries, voucher_name, company, closing_date)
-		frappe.db.set_value(
-			"Period Closing Voucher", gl_entries[0].get("voucher_no"), "gle_processing_status", "Completed"
-		)
+		frappe.db.set_value("Period Closing Voucher", voucher_name, "gle_processing_status", "Completed")
 	except Exception as e:
 		frappe.db.rollback()
 		frappe.log_error(e)
-		frappe.db.set_value(
-			"Period Closing Voucher", gl_entries[0].get("voucher_no"), "gle_processing_status", "Failed"
-		)
+		frappe.db.set_value("Period Closing Voucher", voucher_name, "gle_processing_status", "Failed")
 
 
 def make_reverse_gl_entries(voucher_type, voucher_no):
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index 39917f9..599c8a3 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -231,6 +231,9 @@
 				(closing_balance.posting_date < filters.from_date) | (closing_balance.is_opening == "Yes")
 			)
 
+	if doctype == "GL Entry":
+		opening_balance = opening_balance.where(closing_balance.is_cancelled == 0)
+
 	if (
 		not filters.show_unclosed_fy_pl_balances
 		and report_type == "Profit and Loss"