find wrong vouchers

This commit is contained in:
Nabin Hait 2012-10-03 14:41:36 +05:30
parent bd037ab540
commit 3af321fa59

View File

@ -1,9 +1,15 @@
def execute():
import webnotes
vouchers = webnotes.conn.sql("""
select parent, parenttype, modified from `tabPurchase Taxes and Charges`
select parent, parenttype, modified, sum(tax_amount) as tax from `tabPurchase Taxes and Charges`
where modified >= '2012-07-12'
and category = 'Valuation' and tax_amount != 0
and category in ('Total', 'Valuation and Total')
and parenttype != 'Purchase Taxes and Charges Master'
group by parenttype, parent
""")
print vouchers
for d in vouchers:
total_tax = webnotes.conn.sql("""select tax_amount from `tab%s` where name = %s""" %
(d[1], '%s'), d[0])
if flt(total_tax[0][0]) != flt(d[3]):
print d