msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
due_date=sql("select due_date from `tabReceivable Voucher` where name = '%s'"%r[col_idx['Against Voucher']])
due_date=due_dateandcstr(due_date[0][0])or''
# get booking amt
opening_amt=sql("select debit from `tabGL Entry` where account = '%s' and voucher_no = '%s' and is_cancelled = 'No'"%(r[col_idx['Account']],r[col_idx['Voucher No']]))
cond="and against_voucher = '%s' and against_voucher is not null"%r[col_idx['Against Voucher']]
# if entry against JV & and not adjusted within period
elifr[col_idx['Against Voucher Type']]=='Receivable Voucher'andsql("select name from `tabReceivable Voucher` where name = '%s' and (posting_date < '%s' or posting_date > '%s') and docstatus = 1"%(r[col_idx['Against Voucher']],from_date,to_date)):
cond=" and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'"%(r[col_idx['Voucher No']],r[col_idx['Against Voucher']])
# if entry against JV and unadjusted
elifnotr[col_idx['Against Voucher']]:
cond=" and ((voucher_no = '%s' and ifnull(against_voucher, '') = '') or (ifnull(against_voucher, '') = '%s' and voucher_type = 'Journal Voucher'))"%(r[col_idx['Voucher No']],r[col_idx['Voucher No']])
ifcond:
outstanding_amt=flt(sql("select ifnull(sum(debit),0) - ifnull(sum(credit),0) from `tabGL Entry` where account = '%s' and ifnull(is_cancelled, 'No') = 'No' and posting_date <= '%s'%s"%(r[col_idx['Account']],to_date,cond))[0][0]or0)
msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")