fix: Add view ledger button for cancelled docs (#22432)

* fix: Add view ledger button for cancelled docs

* fix: Add moddified to date in Stock Ledger
diff --git a/erpnext/loan_management/loan_common.js b/erpnext/loan_management/loan_common.js
index 3a47a88..d9dd415 100644
--- a/erpnext/loan_management/loan_common.js
+++ b/erpnext/loan_management/loan_common.js
@@ -9,12 +9,15 @@
 		}
 
 		if (['Loan Disbursement', 'Loan Repayment', 'Loan Interest Accrual'].includes(frm.doc.doctype)
-			&& frm.doc.docstatus == 1) {
+			&& frm.doc.docstatus > 0) {
 
 			frm.add_custom_button(__("Accounting Ledger"), function() {
 				frappe.route_options = {
 					voucher_no: frm.doc.name,
-					company: frm.doc.company
+					company: frm.doc.company,
+					from_date: frm.doc.posting_date,
+					to_date: moment(frm.doc.modified).format('YYYY-MM-DD'),
+					show_cancelled_entries: frm.doc.docstatus === 2
 				};
 
 				frappe.set_route("query-report", "General Ledger");