[fix] Taxes in itemised purchase register (#10494)

diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index 8f9948e..0e5d128 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -18,7 +18,7 @@
 	aii_account_map = get_aii_accounts()
 	if item_list:
 		itemised_tax, tax_columns = get_tax_accounts(item_list, columns,
-			tax_doctype="Purchase Taxes and Charges")
+			doctype="Purchase Invoice", tax_doctype="Purchase Taxes and Charges")
 
 	columns.append({
 		"fieldname": "currency",
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index 30c545f..dfcade2 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -139,7 +139,7 @@
 
 	return so_dn_map
 
-def get_tax_accounts(item_list, columns, tax_doctype="Sales Taxes and Charges"):
+def get_tax_accounts(item_list, columns, doctype="Sales Invoice", tax_doctype="Sales Taxes and Charges"):
 	import json
 	item_row_map = {}
 	tax_columns = []
@@ -155,11 +155,12 @@
 			charge_type, base_tax_amount_after_discount_amount
 		from `tab%s`
 		where
-			parenttype = 'Sales Invoice' and docstatus = 1
+			parenttype = %s and docstatus = 1
 			and (description is not null and description != '')
 			and parent in (%s)
 		order by description
-	""" % (tax_doctype, ', '.join(['%s']*len(invoice_item_row))), tuple(invoice_item_row.keys()))
+	""" % (tax_doctype, '%s', ', '.join(['%s']*len(invoice_item_row))),
+		tuple([doctype] + invoice_item_row.keys()))
 
 	for parent, description, item_wise_tax_detail, charge_type, tax_amount in tax_details:
 		if description not in tax_columns and tax_amount: