fix: removed before from accounts_controlle.pyr and fetch the gl from frontend
diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html
index 06f77b0..73d8f9b 100644
--- a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html
+++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html
@@ -7,6 +7,7 @@
 
 </style>
 <div class="page-break">
+    {% set gl = frappe.get_list(doctype="GL Entry",  fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %}
     {%- if not doc.get("print_heading") and not doc.get("select_print_heading")
         and doc.set("select_print_heading", _("Payment Entry")) -%}{%- endif -%}
     {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
@@ -33,7 +34,7 @@
             <tr>
                     <td class="top-bottom" colspan="5"><strong>Debit</strong></td>
             </tr>
-            {% for entries in doc.gl_entries %}
+            {% for entries in gl %}
             {% if entries.credit == 0.0 %}
             <tr>
                 <td class="right top-bottom">{{ entries.account }}</td>
@@ -48,12 +49,12 @@
             {% endfor %}
             <tr>
                     <td class="right" colspan="3" ><strong>Total (debit) </strong></td>
-                    <td class="left" >{{ doc.gl_entries | sum(attribute='debit') }}</td>
+                    <td class="left" >{{ gl | sum(attribute='debit') }}</td>
             </tr>
             <tr>
                     <td class="top-bottom" colspan="5"><strong>Credit</strong></td>
             </tr>
-            {% for entries in doc.gl_entries %}
+            {% for entries in gl %}
             {% if entries.debit == 0.0 %}
             <tr>
                 <td class="right top-bottom">{{ entries.account }}</td>
@@ -68,7 +69,7 @@
             {% endfor %}
             <tr>
                     <td class="right" colspan="3"><strong>Total (credit) </strong></td>
-                    <td class="left" >{{ doc.gl_entries | sum(attribute='credit') }}</td>
+                    <td class="left" >{{ gl | sum(attribute='credit') }}</td>
             </tr>
         </table>
     <div>
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html
index 566d444..1a016e9 100644
--- a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html
+++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html
@@ -5,6 +5,7 @@
     .table-bordered td.left{border-left: none !important;}
 </style>
 <div class="page-break">
+    {% set gl = frappe.get_list(doctype="GL Entry",  fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %}
     {%- if not doc.get("print_heading") and not doc.get("select_print_heading")
         and doc.set("select_print_heading", _("Journal Entry")) -%}{%- endif -%}
     {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
@@ -31,7 +32,7 @@
             <tr>
                 <td class="top-bottom" colspan="5"><strong>Debit</strong></td>
             </tr>
-            {% for entries in doc.gl_entries %}
+            {% for entries in gl %}
             {% if entries.credit == 0.0 %}
             <tr>
                 <td class="right top-bottom">{{ entries.account }}</td>
@@ -43,12 +44,12 @@
             {% endfor %}
             <tr>
                     <td class="right" colspan="3" ><strong>Total (debit) </strong></td>
-                    <td class="left" >{{ doc.gl_entries | sum(attribute='debit') }}</td>
+                    <td class="left" >{{ gl | sum(attribute='debit') }}</td>
             </tr>
             <tr>
                     <td class="top-bottom" colspan="5"><strong>Credit</strong></td>
             </tr>
-            {% for entries in doc.gl_entries %}
+            {% for entries in gl %}
             {% if entries.debit == 0.0 %}
             <tr>
                 <td class="right top-bottom">{{ entries.account }}</td>
@@ -60,10 +61,10 @@
             {% endfor %}
             <tr>
                 <td class="right" colspan="3"><strong>Total (credit) </strong></td>
-                <td class="left" >{{ doc.gl_entries | sum(attribute='credit') }}</td>
+                <td class="left" >{{ gl | sum(attribute='credit') }}</td>
             </tr>
             <tr>
-                <td class="top-bottom" colspan="5"><b>Narration: </b>{{ doc.gl_entries[0].remarks }}</td>
+                <td class="top-bottom" colspan="5"><b>Narration: </b>{{ gl[0].remarks }}</td>
             </tr>
         </table>
     <div>
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html
index 342ce22..6c53a7a 100644
--- a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html
+++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html
@@ -1,5 +1,6 @@
 {%- from "templates/print_formats/standard_macros.html" import add_header -%}
 <div class="page-break">
+    {% set gl = frappe.get_list(doctype="GL Entry",  fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %}
     {%- if not doc.get("print_heading") and not doc.get("select_print_heading")
         and doc.set("select_print_heading", _("Purchase Invoice")) -%}{%- endif -%}
     {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
@@ -62,7 +63,7 @@
                 {% for tax in doc.taxes %}
                 {% if tax.tax_amount_after_discount_amount!= 0 %}
                     <tr><td><strong>{{ tax.account_head }}: </strong></td><td>{{ tax.tax_amount_after_discount_amount }}</td></tr>
-
+                {% endif %}
                 {% endfor %}
                 {% if doc.taxes_and_charges_added!= 0 %}
                 <tr><td><strong> Taxes and Charges Added: </strong></td><td>{{ doc.taxes_and_charges_added }}</td></tr>
@@ -85,7 +86,7 @@
                 <th>Debit Amount</th>
                 <th>Credit Amount</th>
             </tr>
-            {% for entries in doc.gl_entries %}
+            {% for entries in gl %}
             <tr>
                 <td>{{ loop.index }}</td>
                 <td>{{ entries.account }}</td>
diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html
index 4dc4b8a..1c3fb6a 100644
--- a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html
+++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html
@@ -1,5 +1,6 @@
 {%- from "templates/print_formats/standard_macros.html" import add_header -%}
 <div class="page-break">
+    {% set gl = frappe.get_list(doctype="GL Entry",  fields=["account", "party_type", "party", "debit", "credit", "remarks"], filters={"voucher_type": doc.doctype, "voucher_no": doc.name}) %}
     {%- if not doc.get("print_heading") and not doc.get("select_print_heading")
         and doc.set("select_print_heading", _("Sales Invoice")) -%}{%- endif -%}
     {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
@@ -75,7 +76,7 @@
                 <th>Debit Amount</th>
                 <th>Credit Amount</th>
             </tr>
-            {% for entries in doc.gl_entries %}
+            {% for entries in gl %}
             <tr>
                 <td>{{ loop.index }}</td>
                 <td>{{ entries.account }}</td>
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 7bb71ec..63ea259 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -119,12 +119,6 @@
 			self.validate_non_invoice_documents_schedule()
 
 	def before_print(self):
-		if self.doctype in ['Journal Entry', 'Payment Entry', 'Sales Invoice', 'Purchase Invoice']:
-			self.gl_entries = frappe.get_list("GL Entry", filters={
-				"voucher_type": self.doctype,
-				"voucher_no": self.name
-			}, fields=["account", "party_type", "party", "debit", "credit", "remarks"])
-
 		if self.doctype in ['Purchase Order', 'Sales Order', 'Sales Invoice', 'Purchase Invoice',
 							'Supplier Quotation', 'Purchase Receipt', 'Delivery Note', 'Quotation']:
 			if self.get("group_same_items"):