fix: tcs chargable amount
diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
index 36ed6de..f2c4973 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
@@ -53,6 +53,10 @@
 		frappe.throw(_('Please set associated account in Tax Withholding Category {0} against Company {1}')
 			.format(tax_withholding_category, ref_doc.company))
 
+	if party_type == 'Customer' and not tax_details.cumulative_threshold:
+		frappe.throw(_('Tax Withholding Category {} against Company {} for Customer {} should have Cumulative Threshold value.')
+			.format(tax_withholding_category, ref_doc.company, party))
+
 	tax_amount = get_tax_amount(
 		party_type, parties,
 		ref_doc, tax_details,
@@ -145,7 +149,7 @@
 			tax_amount = grand_total * tax_details.rate / 100 if grand_total > 0 else 0
 		else:
 			#  if no tcs has been charged in FY,
-			# then (prev invoices + advances) value crossing the threshold are chargeable
+			# then chargeable value is "prev invoices + advances" value which cross the threshold
 			tax_amount = get_tcs_amount(
 				parties, ref_doc, tax_details,
 				fiscal_year_details, vouchers, advance_vouchers
@@ -253,13 +257,13 @@
 		'voucher_type': 'Sales Invoice',
 	}, 'sum(credit)') or 0.0
 
-	current_invoice_total = get_invoice_total_without_tcs(ref_doc, tax_details)
-	chargeable_amt = current_invoice_total + invoiced_amt + advance_amt - credit_note_amt
-
-	threshold = tax_details.get('threshold', 0)
 	cumulative_threshold = tax_details.get('cumulative_threshold', 0)
 
-	if ((threshold and chargeable_amt >= threshold) or (cumulative_threshold and chargeable_amt >= cumulative_threshold)):
+	current_invoice_total = get_invoice_total_without_tcs(ref_doc, tax_details)
+	total_invoiced_amt = current_invoice_total + invoiced_amt + advance_amt - credit_note_amt
+
+	if ((cumulative_threshold and total_invoiced_amt >= cumulative_threshold)):
+		chargeable_amt = total_invoiced_amt - cumulative_threshold
 		tcs_amount = chargeable_amt * tax_details.rate / 100 if chargeable_amt > 0 else 0
 
 	return tcs_amount
diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
index c8bd083..1d8fa45 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
@@ -140,13 +140,13 @@
 
 		# create another invoice whose total when added to previously created invoice,
 		# surpasses cumulative threshhold
-		si = create_sales_invoice(customer = "Test TCS Customer")
+		si = create_sales_invoice(customer = "Test TCS Customer", rate=12000)
 		si.submit()
 
 		# assert tax collection on total invoice amount created until now
 		tcs_charged = sum([d.base_tax_amount for d in si.taxes if d.account_head == 'TCS - _TC'])
-		self.assertEqual(tcs_charged, 3000)
-		self.assertEqual(si.grand_total, 13000)
+		self.assertEqual(tcs_charged, 200)
+		self.assertEqual(si.grand_total, 12200)
 		invoices.append(si)
 
 		# TCS is already collected once, so going forward system will collect TCS on every invoice