Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-10-17 07:35:29 +02:00
commit 8a91e691ab
7 changed files with 139 additions and 135 deletions

View File

@ -22,7 +22,7 @@ report.customize_filters = function() {
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0; this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0; this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Purchase Invoice', report_default:'Aging Date'}); this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Purchase Invoice', report_default:'Aging Date'});
this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:30}); this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:30});
this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:45}); this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:45});
this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:60}); this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:60});

View File

@ -8,11 +8,11 @@
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check mandatory filters # Check mandatory filters
# ------------------------------------------------------------------ # ------------------------------------------------------------------
@ -40,25 +40,24 @@ for r in range(len(range_list)-1):
# Add columns # Add columns
# ------------------------------------------------------------------ # ------------------------------------------------------------------
data = [['Aging Date','Date','80px',''], data = [['Aging Date','Date','80px',''],
['Transaction Date','Date','80px',''], ['Account','Data','120px',''],
['Account','Data','120px',''], ['Against Voucher Type','Data','120px',''],
['Against Voucher Type','Data','120px',''], ['Against Voucher','Data','120px',''],
['Against Voucher','Data','120px',''], ['Voucher Type','Data','120px',''],
['Voucher Type','Data','120px',''], ['Voucher No','Data','120px',''],
['Voucher No','Data','120px',''], ['Remarks','Data','160px',''],
['Remarks','Data','160px',''], ['Supplier Type', 'Data', '80px', ''],
['Supplier Type', 'Data', '80px', ''], ['Due Date', 'Data', '80px', ''],
['Due Date', 'Data', '80px', ''], ['Bill No','Data','80px',''],
['Bill No','Data','80px',''], ['Bill Date','Data','80px',''],
['Bill Date','Data','80px',''], ['Opening Amt','Currency','120px',''],
['Opening Amt','Currency','120px',''], ['Outstanding Amt','Currency','120px',''],
['Outstanding Amt','Currency','120px',''], ['Age (Days)', 'Currency', '150px', ''],
['Age (Days)', 'Currency', '150px', ''], ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
['0-'+cstr(filter_values['range_1']),'Currency','100px',''], [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
[cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''], [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
[cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''], [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
[cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''], [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
[cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
for d in data: for d in data:
@ -97,12 +96,14 @@ for t in sql("select name, due_date, bill_no, bill_date from `tabPurchase Invoic
pv_outside_period = [d[0] for d in sql("select distinct name from `tabPurchase Invoice` where (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (from_date, to_date))] pv_outside_period = [d[0] for d in sql("select distinct name from `tabPurchase Invoice` where (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (from_date, to_date))]
from webnotes.utils import nowdate
out = [] out = []
total_booking_amt, total_outstanding_amt = 0,0 total_booking_amt, total_outstanding_amt = 0,0
for r in res: for r in res:
outstanding_amt, due_date, bill_no, bill_date, cond = 0, '','','', '' outstanding_amt, due_date, bill_no, bill_date, cond = 0, '','','', ''
booking_amt = r.pop(8) booking_amt = r.pop(7)
# supplier type # supplier type
r.append(supp_type_dict.get(r[col_idx['Account']], '')) r.append(supp_type_dict.get(r[col_idx['Account']], ''))
@ -141,6 +142,8 @@ for r in res:
# split into date ranges # split into date ranges
val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above= 0 val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above= 0
if r[col_idx[aging_based_on]]: if r[col_idx[aging_based_on]]:
if getdate(to_date) > getdate(nowdate()):
to_date = nowdate()
diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days
if diff < cint(filter_values['range_1']): if diff < cint(filter_values['range_1']):
val_l1 = outstanding_amt val_l1 = outstanding_amt

View File

@ -1,4 +1,4 @@
SELECT DISTINCT `tabGL Entry`.`Aging_date`,`tabGL Entry`.`transaction_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`, `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`, `tabGL Entry`.`remarks`, `tabGL Entry`.`credit` SELECT DISTINCT `tabGL Entry`.`Aging_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`, `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`, `tabGL Entry`.`remarks`, `tabGL Entry`.`credit`
FROM `tabGL Entry`,`tabAccount` FROM `tabGL Entry`,`tabAccount`
WHERE `tabGL Entry`.`posting_date`>= '%(posting_date)s' WHERE `tabGL Entry`.`posting_date`>= '%(posting_date)s'
AND `tabGL Entry`.`posting_date`<= '%(posting_date1)s' AND `tabGL Entry`.`posting_date`<= '%(posting_date1)s'

View File

@ -3,11 +3,11 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-04-03 12:49:50', u'creation': '2012-05-14 18:05:41',
'docstatus': 0, u'docstatus': 0,
'modified': '2012-04-03 12:49:50', u'modified': '2012-10-17 10:51:41',
'modified_by': u'Administrator', u'modified_by': u'Administrator',
'owner': u'Administrator' u'owner': u'Administrator'
}, },
# These values are common for all Search Criteria # These values are common for all Search Criteria
@ -15,10 +15,11 @@
'columns': u'GL Entry\x01Posting Date,GL Entry\x01Account,GL Entry\x01Against Voucher,GL Entry\x01Voucher No', 'columns': u'GL Entry\x01Posting Date,GL Entry\x01Account,GL Entry\x01Against Voucher,GL Entry\x01Voucher No',
'criteria_name': u'Accounts Payable', 'criteria_name': u'Accounts Payable',
'doc_type': u'GL Entry', 'doc_type': u'GL Entry',
'doctype': 'Search Criteria', u'doctype': u'Search Criteria',
'filters': u"{'GL Entry\x01Is Cancelled':'','GL Entry\x01Fiscal Year':'','GL Entry\x01Company':'','Purchase Invoice\x01Aging Based On':'Posting Date','GL Entry\x01Range 1':'30','GL Entry\x01Range 2':'45','GL Entry\x01Range 3':'60','GL Entry\x01Range 4':'90'}", 'filters': u'{"GL Entry\\u0001Voucher Type":[""],"GL Entry\\u0001Is Cancelled":[""],"GL Entry\\u0001Is Opening":[""],"GL Entry\\u0001Fiscal Year":[""],"Purchase Invoice\\u0001Aging Based On":["Aging Date"],"GL Entry\\u0001Range 1":"30","GL Entry\\u0001Range 2":"45","GL Entry\\u0001Range 3":"60","GL Entry\\u0001Range 4":"90"}',
'module': u'Accounts', 'module': u'Accounts',
'name': '__common__', u'name': u'__common__',
'page_len': 50,
'sort_by': u'`tabGL Entry`.`name`', 'sort_by': u'`tabGL Entry`.`name`',
'sort_order': u'DESC', 'sort_order': u'DESC',
'standard': u'Yes' 'standard': u'Yes'
@ -26,7 +27,7 @@
# Search Criteria, accounts_payable # Search Criteria, accounts_payable
{ {
'doctype': 'Search Criteria', u'doctype': u'Search Criteria',
'name': u'accounts_payable' u'name': u'accounts_payable'
} }
] ]

View File

@ -22,7 +22,7 @@ report.customize_filters = function() {
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0; this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0; this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Sales Invoice', report_default:'Aging Date'}); this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Sales Invoice', report_default:'Aging Date'});
this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'}); this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'}); this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'}); this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
@ -33,6 +33,4 @@ report.customize_filters = function() {
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company; this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
this.dt.set_no_limit(1); this.dt.set_no_limit(1);
} }
//this.mytabs.items['Select Columns'].hide()

View File

@ -8,142 +8,144 @@
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check mandatory filters # Check mandatory filters
#------------------------------ #------------------------------
from __future__ import unicode_literals from __future__ import unicode_literals
if not filter_values.get('posting_date') or not filter_values.get('posting_date1'): if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section") msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section")
raise Exception raise Exception
else: else:
from_date = filter_values.get('posting_date') from_date = filter_values.get('posting_date')
to_date = filter_values.get('posting_date1') to_date = filter_values.get('posting_date1')
if not filter_values['range_1'] or not filter_values['range_2'] or not filter_values['range_3'] or not filter_values['range_4']: if not filter_values['range_1'] or not filter_values['range_2'] or not filter_values['range_3'] or not filter_values['range_4']:
msgprint("Please select aging ranges in no of days in 'Set Filters' section") msgprint("Please select aging ranges in no of days in 'Set Filters' section")
raise Exception raise Exception
# validate Range # validate Range
range_list = ['range_1','range_2','range_3','range_4'] range_list = ['range_1','range_2','range_3','range_4']
for r in range(len(range_list)-1): for r in range(len(range_list)-1):
if not cint(filter_values[range_list[r]]) < cint(filter_values[range_list[r + 1]]): if not cint(filter_values[range_list[r]]) < cint(filter_values[range_list[r + 1]]):
msgprint("Range %s should be less than Range %s." % (cstr(r+1),cstr(r+2))) msgprint("Range %s should be less than Range %s." % (cstr(r+1),cstr(r+2)))
raise Exception raise Exception
# Add columns # Add columns
# ----------- # -----------
data = [['Transaction Date','Date','80px',''], data = [['Aging Date','Date','80px',''],
['Aging Date','Date','80px',''], ['Account','Data','120px',''],
['Account','Data','120px',''], ['Against Voucher Type','Data','120px',''],
['Against Voucher Type','Data','120px',''], ['Against Voucher','Data','120px',''],
['Against Voucher','Data','120px',''], ['Voucher Type','Data','120px',''],
['Voucher Type','Data','120px',''], ['Voucher No','Data','120px',''],
['Voucher No','Data','120px',''], ['Remarks','Data','160px',''],
['Remarks','Data','160px',''], ['Territory','Data','120px',''],
['Territory','Data','120px',''], ['Due Date', 'Date', '80px', ''],
['Due Date', 'Date', '80px', ''], ['Opening Amt','Currency','120px',''],
['Opening Amt','Currency','120px',''], ['Outstanding Amt','Currency','120px',''],
['Outstanding Amt','Currency','120px',''], ['Age (Days)', 'Data', '60px', ''],
['Age (Days)', 'Data', '60px', ''], ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
['0-'+cstr(filter_values['range_1']),'Currency','100px',''], [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
[cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''], [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
[cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''], [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
[cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''], [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
[cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
for d in data: for d in data:
colnames.append(d[0]) colnames.append(d[0])
coltypes.append(d[1]) coltypes.append(d[1])
colwidths.append(d[2]) colwidths.append(d[2])
coloptions.append(d[3]) coloptions.append(d[3])
col_idx[d[0]] = len(colnames)-1 col_idx[d[0]] = len(colnames)-1
# ageing based on # ageing based on
aging_based_on = filter_values.get('aging_based_on') and filter_values['aging_based_on'].split(NEWLINE)[-1] or 'Aging Date' aging_based_on = filter_values.get('aging_based_on') and filter_values['aging_based_on'].split(NEWLINE)[-1] or 'Aging Date'
if len(res) > 2000 and from_export == 0: if len(res) > 2000 and from_export == 0:
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") 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")
raise Exception raise Exception
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# main loop starts here # main loop starts here
# ------------------------------------------------------------------ # ------------------------------------------------------------------
from webnotes.utils import nowdate
out = [] out = []
total_opening_amt,total_outstanding_amt = 0,0 total_opening_amt,total_outstanding_amt = 0,0
for r in res: for r in res:
# get customer territory # get customer territory
terr = sql("select t1.territory from `tabCustomer` t1, `tabAccount` t2 where t1.name = t2.master_name and t2.name = '%s'" % r[col_idx['Account']]) terr = sql("select t1.territory from `tabCustomer` t1, `tabAccount` t2 where t1.name = t2.master_name and t2.name = '%s'" % r[col_idx['Account']])
r.append(terr and terr[0][0] or '') r.append(terr and terr[0][0] or '')
outstanding_amt, opening_amt, cond, due_date = 0,0, '', '' outstanding_amt, opening_amt, cond, due_date = 0,0, '', ''
# if entry against Sales Invoice # if entry against Sales Invoice
if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Sales Invoice': if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Sales Invoice':
# get due date # get due date
due_date = sql("select due_date from `tabSales Invoice` where name = '%s'" % r[col_idx['Against Voucher']]) due_date = sql("select due_date from `tabSales Invoice` where name = '%s'" % r[col_idx['Against Voucher']])
due_date = due_date and cstr(due_date[0][0]) or '' due_date = due_date and cstr(due_date[0][0]) or ''
# get booking amt # 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']])) 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']]))
opening_amt = opening_amt and flt(opening_amt[0][0]) or 0 opening_amt = opening_amt and flt(opening_amt[0][0]) or 0
cond = "and against_voucher = '%s' and against_voucher is not null" % r[col_idx['Against Voucher']] 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 # if entry against JV & and not adjusted within period
elif r[col_idx['Against Voucher Type']] == 'Sales Invoice' and sql("select name from `tabSales Invoice` where name = '%s' and (posting_date < '%s' or posting_date > '%s') and docstatus = 1" % (r[col_idx['Against Voucher']], from_date, to_date)): elif r[col_idx['Against Voucher Type']] == 'Sales Invoice' and sql("select name from `tabSales Invoice` 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']]) 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 # if entry against JV and unadjusted
elif not r[col_idx['Against Voucher']]: elif not r[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']]) 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']])
if cond: if cond:
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] or 0) 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] or 0)
# add to total outstanding # add to total outstanding
total_outstanding_amt += flt(outstanding_amt) total_outstanding_amt += flt(outstanding_amt)
# add to total booking amount # add to total booking amount
if outstanding_amt and r[col_idx['Voucher Type']] == 'Sales Invoice' and r[col_idx['Against Voucher']]: if outstanding_amt and r[col_idx['Voucher Type']] == 'Sales Invoice' and r[col_idx['Against Voucher']]:
total_opening_amt += flt(opening_amt) total_opening_amt += flt(opening_amt)
r += [due_date, opening_amt, outstanding_amt] r += [due_date, opening_amt, outstanding_amt]
#Ageing Outstanding #Ageing Outstanding
val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = 0 val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = 0
diff = 0 diff = 0
if r[col_idx[aging_based_on]]: if r[col_idx[aging_based_on]]:
diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days if getdate(to_date) > getdate(nowdate()):
if diff < cint(filter_values['range_1']): to_date = nowdate()
val_l1 = outstanding_amt diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days
if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']): if diff < cint(filter_values['range_1']):
val_l2 = outstanding_amt val_l1 = outstanding_amt
if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']): if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
val_l3 = outstanding_amt val_l2 = outstanding_amt
if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']): if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
val_l4 = outstanding_amt val_l3 = outstanding_amt
if diff >= cint(filter_values['range_4']): if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
val_l5_above = outstanding_amt val_l4 = outstanding_amt
if diff >= cint(filter_values['range_4']):
r += [diff, val_l1, val_l2, val_l3, val_l4, val_l5_above] val_l5_above = outstanding_amt
r += [diff, val_l1, val_l2, val_l3, val_l4, val_l5_above]
# Only show that entry which has outstanding # Only show that entry which has outstanding
if abs(flt(outstanding_amt)) > 0.001: if abs(flt(outstanding_amt)) > 0.001:
out.append(r) out.append(r)
if len(out) > 300 and from_export == 0: if len(out) > 300 and from_export == 0:
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") 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")
raise Exception raise Exception
# Append Extra rows to RES # Append Extra rows to RES
if len(out) > 0: if len(out) > 0:
t_row = ['' for i in range(len(colnames))] t_row = ['' for i in range(len(colnames))]
t_row[col_idx['Voucher No']] = 'Total' t_row[col_idx['Voucher No']] = 'Total'
t_row[col_idx['Opening Amt']] = total_opening_amt t_row[col_idx['Opening Amt']] = total_opening_amt
t_row[col_idx['Outstanding Amt']] = total_outstanding_amt t_row[col_idx['Outstanding Amt']] = total_outstanding_amt
out.append(t_row) out.append(t_row)

View File

@ -1,4 +1,4 @@
SELECT `tabGL Entry`.`transaction_date`,`tabGL Entry`.`aging_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`, `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`, `tabGL Entry`.remarks SELECT `tabGL Entry`.`aging_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`, `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`, `tabGL Entry`.remarks
FROM `tabGL Entry`,`tabAccount` FROM `tabGL Entry`,`tabAccount`
WHERE `tabGL Entry`.`posting_date`>= '%(posting_date)s' WHERE `tabGL Entry`.`posting_date`>= '%(posting_date)s'
AND `tabGL Entry`.`posting_date`<= '%(posting_date1)s' AND `tabGL Entry`.`posting_date`<= '%(posting_date1)s'