fixed issue in update_voucher_outstanding
This commit is contained in:
parent
985d8a217f
commit
4b2f35ed79
@ -165,17 +165,15 @@ class DocType:
|
||||
def update_voucher_outstanding(self):
|
||||
# Clear outstanding
|
||||
self.clear_outstanding()
|
||||
sql("LOCK TABLE `tabGL Entry` WRITE")
|
||||
against_voucher = sql("select against_voucher, against_voucher_type from `tabGL Entry` where fiscal_year=%s and is_cancelled='No' and company=%s and ifnull(against_voucher, '') != '' and ifnull(against_voucher_type, '') != '' group by against_voucher, against_voucher_type", (self.doc.name, self.doc.company))
|
||||
against_voucher = sql("select against_voucher, against_voucher_type from `tabGL Entry` where fiscal_year=%s and ifnull(is_cancelled, 'No')='No' and company=%s and ifnull(against_voucher, '') != '' and ifnull(against_voucher_type, '') != '' group by against_voucher, against_voucher_type", (self.doc.name, self.doc.company))
|
||||
for d in against_voucher:
|
||||
# get voucher balance
|
||||
bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (d[0], d[1]))
|
||||
bal = sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled, 'No') = 'No'", (d[0], d[1]))
|
||||
bal = bal and flt(bal[0][0]) or 0.0
|
||||
if d[1] == 'Payable Voucher':
|
||||
bal = -bal
|
||||
# set voucher balance
|
||||
sql("update `tab%s` set outstanding_amount=%s where name='%s'"% (d[1], bal, d[0]))
|
||||
sql("UNLOCK TABLES")
|
||||
|
||||
# ====================================================================================
|
||||
# Generate periods
|
||||
|
Loading…
Reference in New Issue
Block a user