chore: Simplify query
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 f6289e7..e93fa8c 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -233,19 +233,15 @@
 		if group_by_account:
 			qb_dimension_fields.append("account")
 
-		account = frappe.qb.DocType("Account")
-		accounts_query = (
-			frappe.qb.from_(account)
-			.select(account.name)
-			.where((account.company == self.company) & (account.is_group == 0) & (account.docstatus < 2))
-		)
+		account_filters = {
+			"company": self.company,
+			"is_group": 0,
+		}
 
 		if report_type:
-			accounts_query = accounts_query.where(account.report_type == report_type)
+			account_filters.update({"report_type": report_type})
 
-		accounts = accounts_query.run(as_dict=True)
-
-		accounts = [d.name for d in accounts]
+		accounts = frappe.get_all("Account", filters=account_filters, pluck="name")
 
 		gl_entry = frappe.qb.DocType("GL Entry")
 		query = frappe.qb.from_(gl_entry).select(gl_entry.account, gl_entry.account_currency)