find wrong vouchers
diff --git a/patches/october_2012/find_wrong_voucher.py b/patches/october_2012/find_wrong_voucher.py
index ca612f3..189f2b6 100644
--- a/patches/october_2012/find_wrong_voucher.py
+++ b/patches/october_2012/find_wrong_voucher.py
@@ -2,7 +2,7 @@
import webnotes
from webnotes.utils import flt
vouchers = webnotes.conn.sql("""
- select parent, parenttype, modified, sum(tax_amount) as tax from `tabPurchase Taxes and Charges`
+ select parent, parenttype, modified, sum(if(add_deduct_tax='Add', tax_amount, -tax_amount)) as tax from `tabPurchase Taxes and Charges`
where modified >= '2012-07-12'
and category in ('Total', 'Valuation and Total')
and parenttype != 'Purchase Taxes and Charges Master'