Dont add opening entries in account balance debit, credit column

This commit is contained in:
Nabin Hait
2011-09-27 11:14:54 +05:30
parent c752d075e6
commit a77cea2b90

View File

@@ -146,8 +146,8 @@ class DocType:
# build dict # build dict
p = { p = {
'debit': flt(debit) 'debit': self.doc.is_opening=='No' and flt(debit) or 0
,'credit':flt(credit) ,'credit':self.doc.is_opening=='No' and flt(credit) or 0
,'opening': self.doc.is_opening=='Yes' and amt or 0 ,'opening': self.doc.is_opening=='Yes' and amt or 0
# end date condition only if it is not opening # end date condition only if it is not opening
,'end_date_condition':(self.doc.is_opening!='Yes' and ("and ab.end_date >= '"+self.doc.posting_date+"'") or '') ,'end_date_condition':(self.doc.is_opening!='Yes' and ("and ab.end_date >= '"+self.doc.posting_date+"'") or '')
@@ -185,6 +185,7 @@ class DocType:
bal = flt(sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled,'No') = 'No'", (self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0) bal = flt(sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled,'No') = 'No'", (self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
tds = 0 tds = 0
if self.doc.against_voucher_type=='Payable Voucher': if self.doc.against_voucher_type=='Payable Voucher':
# amount to debit # amount to debit
bal = -bal bal = -bal
@@ -199,7 +200,7 @@ class DocType:
raise Exception raise Exception
# Update outstanding amt on against voucher # Update outstanding amt on against voucher
sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (self.doc.against_voucher_type, bal, self.doc.against_voucher)) sql("update `tab%s` set outstanding_amount=%s where name='%s'"% (self.doc.against_voucher_type,bal,self.doc.against_voucher))
# Total outstanding can not be greater than credit limit for any time for any customer # Total outstanding can not be greater than credit limit for any time for any customer