[fixes] outstanding for jv

This commit is contained in:
Nabin Hait 2013-06-07 17:06:39 +05:30
parent bc97cbfedb
commit 4bb0eee411

View File

@ -160,13 +160,13 @@ class DocType:
def update_outstanding_amt(self): def update_outstanding_amt(self):
# get final outstanding amt # get final outstanding amt
bal = flt(sql("""select sum(debit) - sum(credit) from `tabGL Entry` bal = flt(sql("""select sum(debit) - sum(credit) from `tabGL Entry`
where against_voucher=%s and against_voucher_type=%s where against_voucher=%s and against_voucher_type=%s and account = %s
and ifnull(is_cancelled,'No') = 'No'""", and ifnull(is_cancelled,'No') = 'No'""", (self.doc.against_voucher,
(self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0) self.doc.against_voucher_type, self.doc.account))[0][0] or 0.0)
if self.doc.against_voucher_type == 'Purchase Invoice': if self.doc.against_voucher_type == 'Purchase Invoice':
bal = -bal bal = -bal
elif self.doc.against_voucher_type == "Journal Voucher": elif self.doc.against_voucher_type == "Journal Voucher":
against_voucher_amount = flt(webnotes.conn.sql("""select sum(debit) - sum(credit) against_voucher_amount = flt(webnotes.conn.sql("""select sum(debit) - sum(credit)
from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s