[report] deleted old reports based on search_criteria
This commit is contained in:
parent
8b96ba1da6
commit
82366d3bb8
@ -170,11 +170,6 @@ wn.module_page["Accounts"] = [
|
||||
"label":wn._("Financial Analytics"),
|
||||
page: "financial-analytics"
|
||||
},
|
||||
{
|
||||
"label":wn._("Trend Analyzer"),
|
||||
route: "Report/Profile/Trend Analyzer",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Gross Profit"),
|
||||
route: "query-report/Gross Profit",
|
||||
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,37 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 1;
|
||||
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.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_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_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:90});
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
|
||||
|
||||
this.dt.set_no_limit(1);
|
||||
}
|
||||
|
||||
this.mytabs.items['Select Columns'].hide()
|
@ -1,183 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Check mandatory filters
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
from __future__ import unicode_literals
|
||||
if not filter_values.get('posting_date1'):
|
||||
msgprint("Please select To Posting Date ")
|
||||
raise Exception
|
||||
else:
|
||||
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']:
|
||||
msgprint("Please select aging ranges in no of days in 'More Filters' ")
|
||||
raise Exception
|
||||
|
||||
# validate Range
|
||||
range_list = ['range_1','range_2','range_3','range_4']
|
||||
for r in range(len(range_list)-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)))
|
||||
raise Exception
|
||||
|
||||
|
||||
# Add columns
|
||||
# ------------------------------------------------------------------
|
||||
data = [['Aging Date','Date','80px',''],
|
||||
['Account','Data','120px',''],
|
||||
['Against Voucher Type','Data','120px',''],
|
||||
['Against Voucher','Data','120px',''],
|
||||
['Voucher Type','Data','120px',''],
|
||||
['Voucher No','Data','120px',''],
|
||||
['Remarks','Data','160px',''],
|
||||
['Supplier Type', 'Data', '80px', ''],
|
||||
['Due Date', 'Data', '80px', ''],
|
||||
['Bill No','Data','80px',''],
|
||||
['Bill Date','Data','80px',''],
|
||||
['Opening Amt','Currency','120px',''],
|
||||
['Outstanding Amt','Currency','120px',''],
|
||||
['Age (Days)', 'Currency', '150px', ''],
|
||||
['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_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
|
||||
[cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
|
||||
[cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
|
||||
|
||||
|
||||
for d in data:
|
||||
colnames.append(d[0])
|
||||
coltypes.append(d[1])
|
||||
colwidths.append(d[2])
|
||||
coloptions.append(d[3])
|
||||
col_idx[d[0]] = len(colnames)-1
|
||||
|
||||
# ageing based on
|
||||
# ------------------------------------------------------------------
|
||||
aging_based_on = 'Aging Date'
|
||||
if filter_values.has_key('aging_based_on') and filter_values['aging_based_on']:
|
||||
aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
|
||||
|
||||
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""", raise_exception=1)
|
||||
|
||||
# get supplier type
|
||||
supp_type_dict = {}
|
||||
for each in sql("""select t2.name, t1.supplier_type from tabSupplier t1, tabAccount t2
|
||||
where t1.name = t2.account_name group by t2.name"""):
|
||||
supp_type_dict[each[0]] = each[1]
|
||||
|
||||
# get due_date, bill_no, bill_date from PV
|
||||
pv_dict = {}
|
||||
for t in sql("""select name, due_date, bill_no, bill_date
|
||||
from `tabPurchase Invoice` group by name"""):
|
||||
pv_dict[t[0]] = [cstr(t[1]), t[2], cstr(t[3])]
|
||||
|
||||
# pv after to-date
|
||||
pv_after_to_date = [d[0] for d in sql("""select distinct name from `tabPurchase Invoice`
|
||||
where posting_date > %s and docstatus = 1""", (to_date,))]
|
||||
|
||||
|
||||
from webnotes.utils import nowdate
|
||||
|
||||
out = []
|
||||
total_booking_amt, total_outstanding_amt = 0,0
|
||||
|
||||
for r in res:
|
||||
outstanding_amt, due_date, bill_no, bill_date, cond = 0, '','','', ''
|
||||
booking_amt = r.pop(7)
|
||||
|
||||
# supplier type
|
||||
r.append(supp_type_dict.get(r[col_idx['Account']], ''))
|
||||
|
||||
if r[col_idx['Voucher Type']] == 'Purchase Invoice':
|
||||
r += pv_dict.get(r[col_idx['Voucher No']], ['', '', ''])
|
||||
else:
|
||||
r += ['', '', '']
|
||||
|
||||
# if entry against Purchase Invoice
|
||||
if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Purchase Invoice':
|
||||
cond = " and ifnull(against_voucher, '') = '%s'" % r[col_idx['Against Voucher']]
|
||||
|
||||
# if entry against JV & and not adjusted within period
|
||||
elif r[col_idx['Against Voucher Type']] == 'Purchase Invoice' \
|
||||
and r[col_idx['Against Voucher']] in pv_after_to_date:
|
||||
booking_amt = 0
|
||||
cond = """ and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'""" \
|
||||
% (r[col_idx['Voucher No']], r[col_idx['Against Voucher']])
|
||||
|
||||
# if un-adjusted
|
||||
elif not r[col_idx['Against Voucher']]:
|
||||
booking_amt = 0
|
||||
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:
|
||||
outstanding_amt = flt(sql("""select sum(ifnull(credit, 0))-sum(ifnull(debit, 0))
|
||||
from `tabGL Entry` where account = %s and ifnull(is_cancelled, 'No') = 'No'
|
||||
and posting_date <= %s %s"""
|
||||
% ('%s', '%s', cond), (r[col_idx['Account']], to_date,))[0][0] or 0)
|
||||
|
||||
# add to total outstanding
|
||||
total_outstanding_amt += flt(outstanding_amt)
|
||||
|
||||
# add to total booking amount
|
||||
if outstanding_amt and r[col_idx['Voucher Type']] == 'Purchase Invoice' \
|
||||
and r[col_idx['Against Voucher']]:
|
||||
total_booking_amt += flt(booking_amt)
|
||||
|
||||
r += [booking_amt, outstanding_amt]
|
||||
|
||||
# split into date ranges
|
||||
val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above= 0
|
||||
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
|
||||
if diff < cint(filter_values['range_1']):
|
||||
val_l1 = outstanding_amt
|
||||
if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
|
||||
val_l2 = outstanding_amt
|
||||
if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
|
||||
val_l3 = outstanding_amt
|
||||
if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
|
||||
val_l4 = outstanding_amt
|
||||
if diff >= cint(filter_values['range_4']):
|
||||
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
|
||||
if abs(flt(outstanding_amt)) > 0.001:
|
||||
out.append(r)
|
||||
|
||||
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")
|
||||
raise Exception
|
||||
|
||||
|
||||
# Append Extra rows to RES
|
||||
# ------------------------------------------------------------------
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[col_idx['Voucher No']] = 'Total'
|
||||
t_row[col_idx['Opening Amt']] = total_booking_amt
|
||||
t_row[col_idx['Outstanding Amt']] = total_outstanding_amt
|
||||
out.append(t_row)
|
@ -1,16 +0,0 @@
|
||||
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`
|
||||
WHERE
|
||||
`tabGL Entry`.`posting_date`<= '%(posting_date1)s'
|
||||
AND `tabGL Entry`.`account` LIKE '%(account)s%%'
|
||||
AND `tabGL Entry`.`company` LIKE '%(company)s%%'
|
||||
AND ((ifnull(`tabGL Entry`.`voucher_type`,'') = 'Purchase Invoice'
|
||||
AND `tabGL Entry`.`credit`>0) OR `tabGL Entry`.voucher_type = 'Journal Voucher')
|
||||
AND `tabGL Entry`.`is_cancelled` = 'No'
|
||||
AND `tabAccount`.master_type = 'Supplier'
|
||||
AND `tabAccount`.name = `tabGL Entry`.account
|
||||
ORDER BY `tabGL Entry`.`posting_date`
|
@ -1,26 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-05-14 18:05:41",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-10-17 10:51:41"
|
||||
},
|
||||
{
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{\"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\"}",
|
||||
"doctype": "Search Criteria",
|
||||
"doc_type": "GL Entry",
|
||||
"name": "__common__",
|
||||
"sort_by": "`tabGL Entry`.`name`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Accounts Payable",
|
||||
"columns": "GL Entry\u0001Posting Date,GL Entry\u0001Account,GL Entry\u0001Against Voucher,GL Entry\u0001Voucher No"
|
||||
},
|
||||
{
|
||||
"name": "accounts_payable",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,35 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 1;
|
||||
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.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_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_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default']=dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
|
||||
|
||||
this.dt.set_no_limit(1);
|
||||
}
|
@ -1,168 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Check mandatory filters
|
||||
#------------------------------
|
||||
from __future__ import unicode_literals
|
||||
if not filter_values.get('posting_date1'):
|
||||
msgprint("Please select To Posting Date", raise_exception=1)
|
||||
else:
|
||||
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']:
|
||||
msgprint("Please select aging ranges in no of days in 'More Filters' section")
|
||||
raise Exception
|
||||
|
||||
# validate Range
|
||||
range_list = ['range_1','range_2','range_3','range_4']
|
||||
for r in range(len(range_list)-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)))
|
||||
raise Exception
|
||||
|
||||
|
||||
# Add columns
|
||||
# -----------
|
||||
data = [['Aging Date','Date','80px',''],
|
||||
['Account','Data','120px',''],
|
||||
['Against Voucher Type','Data','120px',''],
|
||||
['Against Voucher','Data','120px',''],
|
||||
['Voucher Type','Data','120px',''],
|
||||
['Voucher No','Data','120px',''],
|
||||
['Remarks','Data','160px',''],
|
||||
['Territory','Data','120px',''],
|
||||
['Due Date', 'Date', '80px', ''],
|
||||
['Opening Amt','Currency','120px',''],
|
||||
['Outstanding Amt','Currency','120px',''],
|
||||
['Age (Days)', 'Data', '60px', ''],
|
||||
['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_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
|
||||
[cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
|
||||
[cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
|
||||
|
||||
|
||||
for d in data:
|
||||
colnames.append(d[0])
|
||||
coltypes.append(d[1])
|
||||
colwidths.append(d[2])
|
||||
coloptions.append(d[3])
|
||||
col_idx[d[0]] = len(colnames)-1
|
||||
|
||||
# ageing based on
|
||||
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:
|
||||
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
|
||||
|
||||
|
||||
# get supplier type
|
||||
territory_dict = {}
|
||||
for each in sql("""select t2.name, t1.territory from `tabCustomer` t1, `tabAccount` t2
|
||||
where t1.name = t2.master_name group by t2.name"""):
|
||||
territory_dict[each[0]] = each[1]
|
||||
|
||||
# get due_date from sales invoice
|
||||
si_dict = {}
|
||||
for t in sql("""select name, due_date from `tabSales Invoice` group by name"""):
|
||||
si_dict[t[0]] = t[1]
|
||||
|
||||
# sales invoice after to-date
|
||||
si_after_to_date = [d[0] for d in sql("""select distinct name from `tabSales Invoice`
|
||||
where posting_date > %s and docstatus = 1""", (to_date,))]
|
||||
|
||||
|
||||
from webnotes.utils import nowdate
|
||||
out = []
|
||||
total_booking_amt, total_outstanding_amt = 0,0
|
||||
for r in res:
|
||||
outstanding_amt = 0
|
||||
cond = due_date = ''
|
||||
booking_amt = r.pop(7)
|
||||
|
||||
# get customer territory
|
||||
r.append(territory_dict.get(r[col_idx['Account']], ''))
|
||||
|
||||
# if entry against Sales Invoice
|
||||
if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Sales Invoice':
|
||||
# get due date
|
||||
due_date = si_dict.get(r[col_idx['Voucher No']], '')
|
||||
cond = """ and ifnull(against_voucher, '') = '%s'""" % r[col_idx['Against Voucher']]
|
||||
|
||||
# if entry against JV & and not adjusted within period
|
||||
elif r[col_idx['Against Voucher Type']] == 'Sales Invoice' \
|
||||
and r[col_idx['Against Voucher']] in si_after_to_date:
|
||||
booking_amt = 0
|
||||
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
|
||||
elif not r[col_idx['Against Voucher']]:
|
||||
booking_amt = 0
|
||||
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:
|
||||
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"""
|
||||
% ('%s', '%s', cond), (r[col_idx['Account']], to_date,))[0][0] or 0)
|
||||
|
||||
# add to total outstanding
|
||||
total_outstanding_amt += flt(outstanding_amt)
|
||||
# add to total booking amount
|
||||
if outstanding_amt and r[col_idx['Voucher Type']] == 'Sales Invoice' and r[col_idx['Against Voucher']]:
|
||||
total_booking_amt += flt(booking_amt)
|
||||
|
||||
r += [due_date, booking_amt, outstanding_amt]
|
||||
|
||||
#Ageing Outstanding
|
||||
val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = 0
|
||||
diff = 0
|
||||
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
|
||||
if diff <= cint(filter_values['range_1']):
|
||||
val_l1 = outstanding_amt
|
||||
if diff > cint(filter_values['range_1']) and diff <= cint(filter_values['range_2']):
|
||||
val_l2 = outstanding_amt
|
||||
if diff > cint(filter_values['range_2']) and diff <= cint(filter_values['range_3']):
|
||||
val_l3 = outstanding_amt
|
||||
if diff > cint(filter_values['range_3']) and diff <= cint(filter_values['range_4']):
|
||||
val_l4 = outstanding_amt
|
||||
if diff > cint(filter_values['range_4']):
|
||||
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
|
||||
if abs(flt(outstanding_amt)) > 0.001:
|
||||
out.append(r)
|
||||
|
||||
if len(out) > 500 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")
|
||||
raise Exception
|
||||
|
||||
# Append Extra rows to res
|
||||
if len(out) > 0:
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[col_idx['Voucher No']] = 'Total'
|
||||
t_row[col_idx['Opening Amt']] = total_booking_amt
|
||||
t_row[col_idx['Outstanding Amt']] = total_outstanding_amt
|
||||
out.append(t_row)
|
@ -1,16 +0,0 @@
|
||||
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`, `tabGL Entry`.`debit`
|
||||
FROM
|
||||
`tabGL Entry`,`tabAccount`
|
||||
WHERE
|
||||
`tabGL Entry`.`posting_date`<= '%(posting_date1)s'
|
||||
AND `tabGL Entry`.`account` LIKE '%(account)s%%'
|
||||
AND `tabGL Entry`.`company` LIKE '%(company)s%%'
|
||||
AND ((`tabGL Entry`.`voucher_type` = 'Sales Invoice' and `tabGL Entry`.`debit`>0)
|
||||
OR `tabGL Entry`.`voucher_type` = 'Journal Voucher')
|
||||
AND `tabGL Entry`.`is_cancelled` = 'No'
|
||||
AND `tabAccount`.`master_type` = 'Customer'
|
||||
AND `tabAccount`.`name` = `tabGL Entry`.`account`
|
||||
ORDER BY `tabGL Entry`.`posting_date`, `tabGL Entry`.`account`
|
@ -1,25 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:50",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:50"
|
||||
},
|
||||
{
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "ASC",
|
||||
"filters": "{'GL Entry\u0001Is Cancelled':'No','GL Entry\u0001Fiscal Year':'','GL Entry\u0001Company':'','GL Entry\u0001Range 1':'30','GL Entry\u0001Range 2':'45','GL Entry\u0001Range 3':'60','GL Entry\u0001Range 4':'90'}",
|
||||
"doctype": "Search Criteria",
|
||||
"doc_type": "GL Entry",
|
||||
"name": "__common__",
|
||||
"sort_by": "`tabGL Entry`.`name`",
|
||||
"criteria_name": "Accounts Receivable",
|
||||
"columns": "GL Entry\u0001Posting Date,GL Entry\u0001Transaction Date,GL Entry\u0001Account,GL Entry\u0001Against Voucher,GL Entry\u0001Voucher No"
|
||||
},
|
||||
{
|
||||
"name": "accounts_receivable",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,50 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Voucher Type'].df.in_first_page = 0;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Clearance Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.in_first_page = 1;
|
||||
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'ID'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Saved'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Against Receivable'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'TDS Category'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Cost Center'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Against Payable'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'TDS Applicable'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Debit >='].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Debit <='].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Credit >='].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Credit <='].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'User Remark'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Voucher Date'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Voucher Date'].df.filter_hide = 1;
|
||||
}
|
||||
|
||||
this.mytabs.items['More Filters'].hide()
|
@ -1,32 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2012-05-14 18:05:41",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-04-30 14:49:06",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"columns": "Journal Voucher\u0001ID,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Debit,Journal Voucher Detail\u0001Credit,Journal Voucher\u0001Clearance Date,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher\u0001Voucher Date,Journal Voucher\u0001Posting Date,Journal Voucher Detail\u0001Against Payable,Journal Voucher Detail\u0001Against Receivable",
|
||||
"criteria_name": "Bank Clearance report",
|
||||
"custom_query": "",
|
||||
"description": "Bank Clearance report",
|
||||
"dis_filters": "fiscal_year",
|
||||
"disabled": 0,
|
||||
"doc_type": "Journal Voucher Detail",
|
||||
"doctype": "Search Criteria",
|
||||
"filters": "{'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Fiscal Year':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':''}",
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"page_len": 50,
|
||||
"parent_doc_type": "Journal Voucher",
|
||||
"report_script": null,
|
||||
"sort_by": "ID",
|
||||
"sort_order": "DESC",
|
||||
"standard": "Yes"
|
||||
},
|
||||
{
|
||||
"doctype": "Search Criteria",
|
||||
"name": "bank_clearance_report"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,34 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
|
||||
this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.in_first_page = 1;
|
||||
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
|
||||
this.dt.set_no_limit(1);
|
||||
}
|
||||
|
||||
this.mytabs.items['More Filters'].hide();
|
@ -1,66 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#get company
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import webnotes.defaults
|
||||
company = filter_values.get('company') or webnotes.defaults.get_user_default('company')
|
||||
|
||||
# To date
|
||||
if not filter_values.get('clearance_date1'):
|
||||
msgprint('Please enter To Clearance Date')
|
||||
raise Exception
|
||||
else:
|
||||
to_date = filter_values['clearance_date1']
|
||||
|
||||
|
||||
#Fiscal year and year start date
|
||||
#----------------------------------
|
||||
ysd, fiscal_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",to_date)[0]
|
||||
# Account
|
||||
if not filter_values.get('account'):
|
||||
msgprint('Please select Account in filter section')
|
||||
raise Exception
|
||||
else:
|
||||
acc_name = filter_values.get('account')
|
||||
|
||||
|
||||
if len(res) > 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")
|
||||
raise Exception
|
||||
|
||||
acc = sql("select debit_or_credit, is_pl_account, lft, rgt from tabAccount where name = '%s'" % acc_name)
|
||||
|
||||
from accounts.utils import get_balance_on
|
||||
opening = get_balance_on(acc_name, to_date)
|
||||
|
||||
total_debit, total_credit = 0,0
|
||||
out = []
|
||||
|
||||
for r in res:
|
||||
total_debit = flt(total_debit) + flt(r[col_idx['Debit']])
|
||||
total_credit = flt(total_credit) + flt(r[col_idx['Credit']])
|
||||
out.append(r)
|
||||
|
||||
if acc and acc[0][0] == 'Debit':
|
||||
bank_bal = flt(opening)-flt(total_debit)+flt(total_credit)
|
||||
else:
|
||||
bank_bal = flt(opening)+flt(total_debit)-flt(total_credit)
|
||||
|
||||
out.append(['','','','<font color = "#000"><b>Balance as per Company Books: </b></font>', opening,'', ''])
|
||||
out.append(['','','','<font color = "#000"><b>Amounts not reflected in Bank: </b></font>', total_debit,total_credit,''])
|
||||
out.append(['','','','<font color = "#000"><b>Balance as per Bank: </b></font>', bank_bal,'',''])
|
@ -1,29 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:50",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:50"
|
||||
},
|
||||
{
|
||||
"parent_doc_type": "Journal Voucher",
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':''}",
|
||||
"dis_filters": "clearance_date\nfiscal_year",
|
||||
"doc_type": "Journal Voucher Detail",
|
||||
"name": "__common__",
|
||||
"add_cond": "(`tabJournal Voucher Detail`.credit >= 0 or `tabJournal Voucher Detail`.credit is null)\n(`tabJournal Voucher`.cheque_no is not null or `tabJournal Voucher`.cheque_no != '')\n(ifnull(`tabJournal Voucher`.clearance_date, '0000-00-00') >'%(clearance_date1)s' or `tabJournal Voucher`.clearance_date is null or `tabJournal Voucher`.clearance_date = '0000-00-00')\n(`tabJournal Voucher`.posting_date <= '%(clearance_date1)s')",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabJournal Voucher`.`name`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Bank Reconciliation Statement",
|
||||
"columns": "Journal Voucher\u0001ID,Journal Voucher\u0001Posting Date,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher\u0001Clearance Date,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Debit,Journal Voucher Detail\u0001Credit,Journal Voucher Detail\u0001Against Account"
|
||||
},
|
||||
{
|
||||
"name": "bank_reconciliation_statement",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,31 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Budget Detail'});
|
||||
this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Budget Detail', in_first_page:1});
|
||||
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Period'].df.in_first_page = 1;
|
||||
|
||||
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
}
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',1,{whiteSpace:'pre'});
|
||||
}
|
||||
|
||||
this.mytabs.items['More Filters'].hide();
|
||||
this.mytabs.items['Select Columns'].hide();
|
@ -1,184 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# validate Filters
|
||||
from __future__ import unicode_literals
|
||||
flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period'}
|
||||
for f in flt_dict:
|
||||
if not filter_values.get(f):
|
||||
msgprint("Please Select " + cstr(flt_dict[f]))
|
||||
raise Exception
|
||||
|
||||
# Get Values from fliters
|
||||
fiscal_year = filter_values.get('fiscal_year')
|
||||
period = filter_values.get('period')
|
||||
under = "GL Entry"
|
||||
based_on = "Cost Center"
|
||||
|
||||
#add distributed id field
|
||||
col = []
|
||||
col.append([based_on,'Date','150px',''])
|
||||
col.append(['Budget Allocated','Currency','150px',''])
|
||||
col.append(['Distribution Id','Date','150px',''])
|
||||
|
||||
for c in col:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
|
||||
col_idx[c[0]] = len(colnames)-1
|
||||
|
||||
def make_child_lst(based_on,name):
|
||||
rg = sql("select lft, rgt from `tab%s` where name = '%s'"%(based_on,name))
|
||||
ch_name = sql("select name from `tab%s` where lft between %d and %d"%(based_on,int(rg[0][0]),int(rg[0][1])))
|
||||
chl ='('
|
||||
flag = 1
|
||||
for c in ch_name:
|
||||
if flag == 1:
|
||||
chl += "'%s'"%c[0]
|
||||
flag = 2
|
||||
else:
|
||||
chl +=",'%s'"%c[0]
|
||||
|
||||
chl +=")"
|
||||
return chl
|
||||
|
||||
|
||||
|
||||
for r in res:
|
||||
|
||||
cond1 =" t1.fiscal_year ='%s' and t1.parent=t2.name and t1.parenttype = '%s' and t1.docstatus !=2"
|
||||
|
||||
q = "select t1.name from `tabBudget Detail` t1, `tab%s` t2 where "+cond1+" and t2.name = '%s'"
|
||||
ch = sql(q%(based_on,fiscal_year,based_on,r[0].strip()))
|
||||
q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where "
|
||||
cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and "
|
||||
if ch:
|
||||
qur = q1+cond2+cond1+" and t2.name = '%s'"
|
||||
ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))
|
||||
|
||||
|
||||
#----------------------------------------------------------------
|
||||
else:
|
||||
node_lst = make_child_lst(based_on,r[0].strip())
|
||||
qur = q1+cond1+' and '+cond2+" t2.name in %s"
|
||||
|
||||
ret_amt = sql(qur%(based_on,fiscal_year,based_on,node_lst))
|
||||
|
||||
#----------------------------------------------------------------
|
||||
ret_dis_id = sql("select distribution_id from `tab%s` where name = '%s'"%(based_on,r[0].strip()))
|
||||
|
||||
target_amt = ret_amt and flt(ret_amt[0][0]) or 0
|
||||
dis_id = ret_dis_id and ret_dis_id[0][0] or ''
|
||||
|
||||
r.append(target_amt)
|
||||
r.append(dis_id)
|
||||
|
||||
|
||||
|
||||
# Set required field names
|
||||
based_on_fn = 'cost_center'
|
||||
|
||||
date_fn = 'posting_date'
|
||||
|
||||
mon_list = []
|
||||
|
||||
data = {'start_date':0, 'end_date':1}
|
||||
|
||||
def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
|
||||
count = 1
|
||||
if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
|
||||
for m in range(12):
|
||||
# get last date
|
||||
last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
|
||||
|
||||
# make mon_list for Monthly Period
|
||||
if period == 'Monthly' :
|
||||
mon_list.append([start_date, last_date])
|
||||
# add months as Column names
|
||||
month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
|
||||
append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
|
||||
|
||||
# get start date
|
||||
start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
|
||||
|
||||
# make mon_list for Quaterly Period
|
||||
if period == 'Quarterly' and count % 3 == 0:
|
||||
mon_list[len(mon_list) - 1 ].append(last_date)
|
||||
# add Column names
|
||||
append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
|
||||
if count != 12: mon_list.append([start_date])
|
||||
|
||||
# make mon_list for Half Yearly Period
|
||||
if period == 'Half Yearly' and count % 6 == 0 :
|
||||
mon_list[len(mon_list) - 1 ].append(last_date)
|
||||
# add Column Names
|
||||
append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
|
||||
if count != 12: mon_list.append([start_date])
|
||||
|
||||
# make mon_list for Annual Period
|
||||
if period == 'Annual' and count % 12 == 0:
|
||||
mon_list[len(mon_list) - 1 ].append(last_date)
|
||||
# add Column Names
|
||||
append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
|
||||
count = count +1
|
||||
|
||||
def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
|
||||
col = ['Target', 'Actual', 'Variance']
|
||||
for c in col:
|
||||
n = str(name) and ' (' + str(name) +')' or ''
|
||||
colnames.append(str(c) + n)
|
||||
coltypes.append('Currency')
|
||||
colwidths.append('150px')
|
||||
coloptions.append('')
|
||||
col_idx[str(c) + n ] = len(colnames) - 1
|
||||
|
||||
|
||||
# get start date
|
||||
start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year, 'year_start_date')
|
||||
if not start_date:
|
||||
msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
|
||||
raise Exception
|
||||
start_date = start_date.strftime('%Y-%m-%d')
|
||||
|
||||
# make month list and columns
|
||||
make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
|
||||
|
||||
|
||||
bc_obj = get_obj('Budget Control')
|
||||
for r in res:
|
||||
count = 0
|
||||
|
||||
for idx in range(3, len(colnames), 3):
|
||||
cidx = 2
|
||||
|
||||
# ================= Calculate Target ==========================================
|
||||
r.append(bc_obj.get_monthly_budget( r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
|
||||
|
||||
#================== Actual Amount =============================================
|
||||
actual = 0
|
||||
|
||||
ch = make_child_lst(based_on,r[0].strip())
|
||||
|
||||
actual = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where ifnull(t2.is_pl_account, 'No') = 'Yes' and ifnull(t1.is_cancelled, 'No') = 'No' and t1.cost_center in %s and t2.debit_or_credit = 'Debit' and t1.posting_date between '%s' and '%s' and t1.account = t2.name"%(ch, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
|
||||
|
||||
#----------------------------------------------------------
|
||||
actual = flt(actual[0][0])
|
||||
r.append(actual)
|
||||
# ================ Variance ===================================================
|
||||
r.append(r[idx] - r[idx + 1])
|
||||
count = count +1
|
@ -1,10 +0,0 @@
|
||||
SELECT
|
||||
CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name
|
||||
FROM
|
||||
`tabCost Center` AS node,`tabCost Center` AS parent
|
||||
WHERE
|
||||
node.lft BETWEEN parent.lft AND parent.rgt
|
||||
AND node.docstatus !=2
|
||||
AND node.company_name like '%(company)s%%'
|
||||
GROUP BY node.name
|
||||
ORDER BY node.lft
|
@ -1,26 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "harshada@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:50",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:50"
|
||||
},
|
||||
{
|
||||
"parent_doc_type": "Cost Center",
|
||||
"module": "Accounts",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'Budget Detail\u0001Fiscal Year':''}",
|
||||
"standard": "Yes",
|
||||
"doc_type": "Budget Detail",
|
||||
"name": "__common__",
|
||||
"sort_by": "`tabCost Center`.`lft`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Budget Variance Report"
|
||||
},
|
||||
{
|
||||
"name": "budget_variance_report",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,26 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Sales Partner'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Sales Partner'].df.in_first_page = 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.mytabs.items['Select Columns'].hide();
|
||||
this.mytabs.items['More Filters'].hide();
|
@ -1,27 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
colwidths[col_idx['Business Associate']] = '200px'
|
||||
|
||||
coltypes[col_idx['Average Commission Rate']] = 'Currency'
|
||||
colwidths[col_idx['Average Commission Rate']] = '200px'
|
||||
|
||||
coltypes[col_idx['Net Total']] = 'Currency'
|
||||
colwidths[col_idx['Net Total']] = '150px'
|
||||
|
||||
coltypes[col_idx['Total Commission']] = 'Currency'
|
||||
colwidths[col_idx['Total Commission']] = '150px'
|
@ -1,29 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "saumil@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:50",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:50"
|
||||
},
|
||||
{
|
||||
"add_col": "SUM(`tabSales Invoice`.`total_commission`) AS 'Total Commission'\nSUM(`tabSales Invoice`.`net_total`) AS 'Net Total'\n((SUM(`tabSales Invoice`.`total_commission`) / SUM(`tabSales Invoice`.`net_total`)) * 100) AS 'Average Commission Rate'",
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'Sales Invoice\u0001Submitted':1}",
|
||||
"description": "Track total commission given to your Business Associate",
|
||||
"doc_type": "Sales Invoice",
|
||||
"name": "__common__",
|
||||
"add_cond": "`tabSales Invoice`.`net_total` > 0\n`tabSales Invoice`.`total_commission` > 0",
|
||||
"doctype": "Search Criteria",
|
||||
"group_by": "`tabSales Invoice`.sales_partner",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Business Associate Commission Report",
|
||||
"columns": "Sales Invoice\u0001Business Associate"
|
||||
},
|
||||
{
|
||||
"name": "business_associate_commission_report",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,40 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.filter_hide = 0;
|
||||
|
||||
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_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
|
||||
this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
|
||||
|
||||
this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date',ignore : 1, parent:'Sales Invoice', 'report_default': 'Aging Date'});
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
|
||||
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
|
||||
}
|
||||
this.mytabs.items['Select Columns'].hide()
|
@ -1,107 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#check mandatory
|
||||
from __future__ import unicode_literals
|
||||
if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
|
||||
msgprint("Please select From Posting Date and To Posting Date ")
|
||||
raise Exception
|
||||
else:
|
||||
from_date = filter_values.get('posting_date')
|
||||
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']:
|
||||
msgprint("Please select aging ranges in no of days in 'Set Filters' section")
|
||||
raise Exception
|
||||
|
||||
# ageing based on
|
||||
aging_based_on = 'Aging Date'
|
||||
if filter_values.get('aging_based_on'):
|
||||
aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
|
||||
|
||||
|
||||
# Add columns
|
||||
# -----------
|
||||
row_list = [['ID','Data','150px',''],
|
||||
['Account','Data','150px',''],
|
||||
['Credit','Data','150px',''],
|
||||
['Debit','Data','150px',''],
|
||||
['Against Receivable','Data','150px',''],
|
||||
['Is Advance','Data','150px',''],
|
||||
['Transaction Date','Date','150px',''],
|
||||
['Aging Date','Date','150px',''],
|
||||
['Company','Data','150px',''],
|
||||
['Cheque No','Data','100px',''],
|
||||
['Cheque Date','Date','150px',''],
|
||||
['Territory','Data','150px',''],
|
||||
['Remark','Data','250px',''],
|
||||
['Advance','Data','250px',''],
|
||||
['RV Transaction Date','Date','150px',''],
|
||||
['RV Aging Date','Date','150px',''],
|
||||
['Age (Days)','Data','50px',''],
|
||||
['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_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
|
||||
[cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
|
||||
[cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
|
||||
|
||||
for r in row_list:
|
||||
colnames.append(r[0])
|
||||
coltypes.append(r[1])
|
||||
colwidths.append(r[2])
|
||||
coloptions.append(r[3])
|
||||
col_idx[r[0]] = len(colnames)-1
|
||||
|
||||
for r in res:
|
||||
if r[col_idx['Against Receivable']]:
|
||||
dt=sql("select date(modified), Aging_date from `tabSales Invoice` where name='%s'"%r[col_idx['Against Receivable']])
|
||||
r.append('')
|
||||
r.append(dt and cstr(dt[0][0]) or '')
|
||||
r.append(dt and cstr(dt[0][1]) or '')
|
||||
else:
|
||||
r.append(r[col_idx['Credit']])
|
||||
r.append('')
|
||||
r.append('')
|
||||
|
||||
|
||||
# Aging Credit Amount
|
||||
val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = diff = 0
|
||||
|
||||
if r[col_idx['Against Receivable']]:
|
||||
amt = flt(r[col_idx['Credit']]) or (-1)*flt(r[col_idx['Debit']])
|
||||
|
||||
if aging_based_on == 'Transaction Date' and r[col_idx['RV Transaction Date']]:
|
||||
diff = (getdate(r[col_idx['Transaction Date']]) - getdate(r[col_idx['RV Transaction Date']])).days
|
||||
elif aging_based_on == 'Aging Date' and r[col_idx['RV Aging Date']]:
|
||||
diff = (getdate(r[col_idx['Aging Date']]) - getdate(r[col_idx['RV Aging Date']])).days
|
||||
|
||||
if diff < cint(filter_values['range_1']):
|
||||
val_l1 = amt
|
||||
if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
|
||||
val_l2 = amt
|
||||
if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
|
||||
val_l3 = amt
|
||||
if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
|
||||
val_l4 = amt
|
||||
if diff >= cint(filter_values['range_4']):
|
||||
val_l5_above = amt
|
||||
|
||||
r.append(diff)
|
||||
r.append(val_l1)
|
||||
r.append(val_l2)
|
||||
r.append(val_l3)
|
||||
r.append(val_l4)
|
||||
r.append(val_l5_above)
|
@ -1,13 +0,0 @@
|
||||
SELECT `tabJournal Voucher`.`name`,`tabJournal Voucher Detail`.`account`,`tabJournal Voucher Detail`.`credit`,`tabJournal Voucher Detail`.`debit`,`tabJournal Voucher Detail`.`against_invoice`,`tabJournal Voucher Detail`.`is_advance`,`tabJournal Voucher`.`voucher_date`,`tabJournal Voucher`.`aging_date`,`tabJournal Voucher`.`company`,`tabJournal Voucher`.`cheque_no`,`tabJournal Voucher`.`cheque_date`,`tabCustomer`.`territory`, `tabJournal Voucher`.`remark`
|
||||
FROM `tabJournal Voucher Detail`,`tabJournal Voucher`,`tabAccount`,`tabCustomer`
|
||||
WHERE `tabJournal Voucher`.docstatus=1
|
||||
AND `tabJournal Voucher`.`posting_date`>='%(posting_date)s'
|
||||
AND `tabJournal Voucher`.`posting_date`<='%(posting_date1)s'
|
||||
AND `tabJournal Voucher`.`company` LIKE '%(company)s%%'
|
||||
AND `tabJournal Voucher`.`is_opening` LIKE '%(is_opening)s%%'
|
||||
AND `tabJournal Voucher Detail`.`account` LIKE '%(account)s%%'
|
||||
AND `tabAccount`.master_type = 'Customer'
|
||||
AND `tabAccount`.`account_name` = `tabCustomer`.`name`
|
||||
AND `tabJournal Voucher Detail`.`account` = `tabAccount`.`name`
|
||||
AND `tabJournal Voucher Detail`.`parent` = `tabJournal Voucher`.`name`
|
||||
ORDER BY `tabJournal Voucher`.`name`
|
@ -1,26 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:50",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:50"
|
||||
},
|
||||
{
|
||||
"parent_doc_type": "Journal Voucher",
|
||||
"module": "Accounts",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'Journal Voucher\u0001Saved':1,'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':'','GL Entry\u0001Range 1':'30','GL Entry\u0001Range 2':'45','GL Entry\u0001Range 3':'60','GL Entry\u0001Range 4':'90'}",
|
||||
"standard": "Yes",
|
||||
"doc_type": "Journal Voucher Detail",
|
||||
"name": "__common__",
|
||||
"sort_by": "`tabJournal Voucher`.`name`",
|
||||
"criteria_name": "Collection Report",
|
||||
"columns": "Journal Voucher\u0001ID,Journal Voucher\u0001Posting Date,Journal Voucher\u0001Company,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Credit,Journal Voucher Detail\u0001Against Receivable,Journal Voucher Detail\u0001Is Advance"
|
||||
},
|
||||
{
|
||||
"name": "collection_report",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,39 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Cost Center'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From 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 +'From Posting Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Cost Center'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.in_first_page = 1;
|
||||
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
|
||||
}
|
||||
this.mytabs.items['Select Columns'].hide();
|
||||
this.mytabs.items['More Filters'].hide();
|
@ -1,30 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Add columns
|
||||
# -----------
|
||||
from __future__ import unicode_literals
|
||||
row_list = [['Cost Center','Data','160px'],
|
||||
['Account','Data','160px'],
|
||||
['Debit','Currency','120px'],
|
||||
['Credit','Currency','120px'],
|
||||
['Expense','Currency','120px']]
|
||||
|
||||
for r in row_list:
|
||||
colnames.append(r[0])
|
||||
coltypes.append(r[1])
|
||||
colwidths.append(r[2])
|
||||
col_idx[r[0]] = len(colnames)-1
|
@ -1,20 +0,0 @@
|
||||
SELECT
|
||||
`tabGL Entry`.`cost_center`,
|
||||
`tabAccount`.`parent_account`,
|
||||
sum(ifnull(`tabGL Entry`.`debit`, 0)),
|
||||
sum(ifnull(`tabGL Entry`.`credit`, 0)),
|
||||
sum(ifnull(`tabGL Entry`.`debit`,0))-sum(ifnull(`tabGL Entry`.`credit`, 0))
|
||||
FROM
|
||||
`tabGL Entry`,`tabAccount`
|
||||
WHERE
|
||||
`tabGL Entry`.`account`=`tabAccount`.`name`
|
||||
AND ifnull(`tabGL Entry`.`is_cancelled`,'No')='No'
|
||||
AND `tabAccount`.is_pl_account='Yes'
|
||||
AND `tabAccount`.debit_or_credit='Debit'
|
||||
AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
|
||||
AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
|
||||
AND `tabGL Entry`.`company` LIKE '%(company)s%%'
|
||||
AND `tabAccount`.`parent_account` LIKE '%(account)s%%'
|
||||
AND `tabGL Entry`.`cost_center` LIKE '%(cost_center)s%%'
|
||||
GROUP BY
|
||||
`tabGL Entry`.`cost_center` , `tabAccount`.`parent_account`
|
@ -1,26 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "swarnalata@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:50",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:50"
|
||||
},
|
||||
{
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'GL Entry\u0001Voucher Type':'','GL Entry\u0001Is Cancelled':'','GL Entry\u0001Fiscal Year':'','GL Entry\u0001Company':''}",
|
||||
"doctype": "Search Criteria",
|
||||
"dis_filters": "fiscal_year",
|
||||
"doc_type": "GL Entry",
|
||||
"name": "__common__",
|
||||
"sort_by": "`tabGL Entry`.`name`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Cost Center wise Expense"
|
||||
},
|
||||
{
|
||||
"name": "cost_center_wise_expense",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,40 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
|
||||
//to hide all filters
|
||||
this.hide_all_filters();
|
||||
field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
|
||||
for(var i=0;i<field_list.length;i++){
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
|
||||
}
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
}
|
||||
|
||||
this.mytabs.tabs['Select Columns'].hide()
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',2,{whiteSpace:'pre'});
|
||||
$yt(t,'*',3,{whiteSpace:'pre'});
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#get company
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import webnotes.defaults
|
||||
company = filter_values.get('company') or webnotes.defaults.get_user_default('company')
|
||||
|
||||
#get company letter head
|
||||
l_head = sql("select letter_head from `tabCompany` where name='%s'" % company)
|
||||
l_head = l_head and l_head[0][0] or ''
|
||||
|
||||
# Posting date, fiscal year and year start date
|
||||
#-----------------------------------------------
|
||||
if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
|
||||
msgprint("Please enter From Date and To Date")
|
||||
raise Exception
|
||||
else:
|
||||
from_date = filter_values['posting_date']
|
||||
to_date = filter_values['posting_date1']
|
||||
|
||||
ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",from_date)[0]
|
||||
|
||||
|
||||
# define columns
|
||||
#---------------
|
||||
col = []
|
||||
col.append(['Date','Date','80px',''])
|
||||
col.append(['Detail','Text','475px',''])
|
||||
col.append(['Debit','Currency','75px',''])
|
||||
col.append(['Credit','Currency','75px',''])
|
||||
|
||||
for c in col:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames)
|
||||
|
||||
|
||||
total_debit, total_credit, total_opening, total_diff = 0,0,0,0
|
||||
|
||||
#total query
|
||||
q = query.split('WHERE')[1].split('LIMIT')
|
||||
if len(q) > 2:
|
||||
query_where_clause = 'LIMIT'.join(q[:-1])
|
||||
else:
|
||||
query_where_clause = q[0]
|
||||
|
||||
tot = sql('select sum(`tabGL Entry`.debit),sum(`tabGL Entry`.credit) from `tabGL Entry`, tabAccount where %s' % query_where_clause)
|
||||
|
||||
for t in tot:
|
||||
total_debit += t and flt(t[0]) or 0
|
||||
total_credit += t and flt(t[1]) or 0
|
||||
|
||||
total_diff = total_debit - total_credit
|
||||
|
||||
# opening
|
||||
account = filter_values.get('account')
|
||||
if account:
|
||||
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
|
||||
from accounts.utils import get_balance_on
|
||||
opening_bal = get_balance_on(account, add_days(from_date, -1))
|
||||
|
||||
if acc_det[0][0] == 'Credit':
|
||||
opening_bal = -1*opening_bal
|
||||
|
||||
|
||||
out = []
|
||||
count = 0
|
||||
for r in res:
|
||||
count +=1
|
||||
det = r[1].split('~~~')
|
||||
if from_export == 1:
|
||||
a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
|
||||
else:
|
||||
a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
|
||||
r[1] = a
|
||||
out.append(r)
|
||||
|
||||
if total_debit != 0 or total_credit != 0:
|
||||
# Total debit/credit
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Total'
|
||||
t_row[col_idx['Debit']-1] = total_debit
|
||||
t_row[col_idx['Credit']-1] = total_credit
|
||||
out.append(t_row)
|
||||
|
||||
# opening
|
||||
if account:
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Opening Balance on '+ from_date
|
||||
t_row[col_idx['Debit']-1] = opening_bal
|
||||
out.append(t_row)
|
||||
|
||||
# diffrence (dr-cr)
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Total(Dr-Cr)'
|
||||
t_row[col_idx['Debit']-1] = total_diff
|
||||
out.append(t_row)
|
||||
|
||||
# closing
|
||||
if account:
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Closing Balance on ' + to_date
|
||||
t_row[col_idx['Debit']-1] = flt(opening_bal) + flt(total_diff )
|
||||
out.append(t_row)
|
||||
|
||||
# Print Format
|
||||
myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
|
||||
</tr>
|
||||
<tr> <td>
|
||||
<div><h3> %(acc)s </h3></div>
|
||||
<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
|
||||
|
||||
""" % {'acc':account,
|
||||
'fdt':from_date,
|
||||
'tdt':to_date}
|
||||
|
||||
page_template = myheader+"<div>%(table)s</div>"
|
@ -1,15 +0,0 @@
|
||||
SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
|
||||
FROM `tabGL Entry`, `tabAccount`
|
||||
WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
|
||||
AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
|
||||
AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
|
||||
AND `tabGL Entry`.`company` LIKE '%(company)s%%'
|
||||
AND `tabGL Entry`.`account` LIKE '%(account)s%%'
|
||||
AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
|
||||
AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
|
||||
AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
|
||||
AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
|
||||
AND `tabGL Entry`.`account` = `tabAccount`.`name`
|
||||
AND `tabAccount`.`master_type` = 'Supplier'
|
||||
GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
|
||||
ORDER BY `tabGL Entry`.`posting_date` DESC
|
@ -1,27 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "nabin@erpnext.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-05-14 18:05:41",
|
||||
"modified_by": "nabin@erpnext.com",
|
||||
"modified": "2012-12-06 11:36:10"
|
||||
},
|
||||
{
|
||||
"custom_query": null,
|
||||
"report_script": null,
|
||||
"page_len": 50,
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{\"GL Entry\\u0001Voucher Type\":[],\"GL Entry\\u0001Is Cancelled\":[\"No\"],\"GL Entry\\u0001Is Opening\":[\"\"],\"GL Entry\\u0001Fiscal Year\":[\"\"]}",
|
||||
"doc_type": "GL Entry",
|
||||
"name": "__common__",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabGL Entry`.`name`",
|
||||
"criteria_name": "Creditors Ledger"
|
||||
},
|
||||
{
|
||||
"name": "creditors_ledger",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,40 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
|
||||
//to hide all filters
|
||||
this.hide_all_filters();
|
||||
field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
|
||||
for(var i=0;i<field_list.length;i++){
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
|
||||
}
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
}
|
||||
|
||||
this.mytabs.tabs['Select Columns'].hide()
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',2,{whiteSpace:'pre'});
|
||||
$yt(t,'*',3,{whiteSpace:'pre'});
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#get company
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import webnotes.defaults
|
||||
company = filter_values.get('company') or webnotes.defaults.get_user_default('company')
|
||||
|
||||
#get company letter head
|
||||
l_head = sql("select letter_head from `tabCompany` where name='%s'" % company)
|
||||
l_head = l_head and l_head[0][0] or ''
|
||||
|
||||
# Posting date, fiscal year and year start date
|
||||
#-----------------------------------------------
|
||||
if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
|
||||
msgprint("Please enter From Date and To Date")
|
||||
raise Exception
|
||||
else:
|
||||
from_date = filter_values['posting_date']
|
||||
to_date = filter_values['posting_date1']
|
||||
|
||||
ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",from_date)[0]
|
||||
|
||||
|
||||
# define columns
|
||||
#---------------
|
||||
col = []
|
||||
col.append(['Date','Date','80px',''])
|
||||
col.append(['Detail','Text','475px',''])
|
||||
col.append(['Debit','Currency','75px',''])
|
||||
col.append(['Credit','Currency','75px',''])
|
||||
|
||||
for c in col:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames)
|
||||
|
||||
|
||||
total_debit, total_credit, total_opening, total_diff = 0,0,0,0
|
||||
|
||||
#total query
|
||||
q = query.split('WHERE')[1].split('LIMIT')
|
||||
if len(q) > 2:
|
||||
query_where_clause = 'LIMIT'.join(q[:-1])
|
||||
else:
|
||||
query_where_clause = q[0]
|
||||
|
||||
tot = sql('select sum(`tabGL Entry`.debit),sum(`tabGL Entry`.credit) from `tabGL Entry`, tabAccount where %s' % query_where_clause)
|
||||
|
||||
for t in tot:
|
||||
total_debit += t and flt(t[0]) or 0
|
||||
total_credit += t and flt(t[1]) or 0
|
||||
|
||||
total_diff = total_debit - total_credit
|
||||
|
||||
# opening
|
||||
account = filter_values.get('account')
|
||||
if account:
|
||||
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
|
||||
from accounts.utils import get_balance_on
|
||||
opening_bal = get_balance_on(account, add_days(from_date, -1))
|
||||
if acc_det[0][0] == 'Credit':
|
||||
opening_bal = -1*opening_bal
|
||||
|
||||
|
||||
out = []
|
||||
count = 0
|
||||
for r in res:
|
||||
count +=1
|
||||
det = r[1].split('~~~')
|
||||
if from_export == 1:
|
||||
a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
|
||||
else:
|
||||
a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
|
||||
r[1] = a
|
||||
out.append(r)
|
||||
|
||||
if total_debit != 0 or total_credit != 0:
|
||||
# Total debit/credit
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Total'
|
||||
t_row[col_idx['Debit']-1] = total_debit
|
||||
t_row[col_idx['Credit']-1] = total_credit
|
||||
out.append(t_row)
|
||||
|
||||
# opening
|
||||
if account:
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Opening Balance on '+ from_date
|
||||
t_row[col_idx['Debit']-1] = opening_bal
|
||||
out.append(t_row)
|
||||
|
||||
# diffrence (dr-cr)
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Total(Dr-Cr)'
|
||||
t_row[col_idx['Debit']-1] = total_diff
|
||||
out.append(t_row)
|
||||
|
||||
# closing
|
||||
if account:
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Closing Balance on ' + to_date
|
||||
t_row[col_idx['Debit']-1] = flt(opening_bal) + flt(total_diff )
|
||||
out.append(t_row)
|
||||
|
||||
# Print Format
|
||||
myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
|
||||
</tr>
|
||||
<tr> <td>
|
||||
<div><h3> %(acc)s </h3></div>
|
||||
<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
|
||||
|
||||
""" % {'acc':account,
|
||||
'fdt':from_date,
|
||||
'tdt':to_date}
|
||||
|
||||
page_template = myheader+"<div>%(table)s</div>"
|
@ -1,15 +0,0 @@
|
||||
SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
|
||||
FROM `tabGL Entry`, `tabAccount`
|
||||
WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
|
||||
AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
|
||||
AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
|
||||
AND `tabGL Entry`.`company` LIKE '%(company)s%%'
|
||||
AND `tabGL Entry`.`account` LIKE '%(account)s%%'
|
||||
AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
|
||||
AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
|
||||
AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
|
||||
AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
|
||||
AND `tabGL Entry`.`account` = `tabAccount`.`name`
|
||||
AND `tabAccount`.`master_type` = 'Customer'
|
||||
GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
|
||||
ORDER BY `tabGL Entry`.`posting_date` DESC
|
@ -1,27 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "nabin@erpnext.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-05-14 18:05:42",
|
||||
"modified_by": "nabin@erpnext.com",
|
||||
"modified": "2012-12-06 11:37:16"
|
||||
},
|
||||
{
|
||||
"custom_query": null,
|
||||
"report_script": null,
|
||||
"page_len": 50,
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{\"GL Entry\\u0001Voucher Type\":[],\"GL Entry\\u0001Is Cancelled\":[\"No\"],\"GL Entry\\u0001Is Opening\":[],\"GL Entry\\u0001Fiscal Year\":[]}",
|
||||
"doc_type": "GL Entry",
|
||||
"name": "__common__",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabGL Entry`.`name`",
|
||||
"criteria_name": "Debtors Ledger"
|
||||
},
|
||||
{
|
||||
"name": "debtors_ledger",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,39 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.mytabs.tabs['Select Columns'].hide();
|
||||
//to hide all filters
|
||||
this.hide_all_filters();
|
||||
field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
|
||||
for(var i=0;i<field_list.length;i++){
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
|
||||
}
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
|
||||
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
}
|
||||
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',2,{whiteSpace:'pre'});
|
||||
$yt(t,'*',3,{whiteSpace:'pre'});
|
||||
}
|
@ -1,141 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#get company letter head
|
||||
#---------------------------------------------------------------------
|
||||
from __future__ import unicode_literals
|
||||
l_head = sql("select content from `tabLetter Head` where ifnull(is_default, 0) = 1 and ifnull(disabled, 0) = 0")
|
||||
l_head = l_head and l_head[0][0] or ''
|
||||
|
||||
|
||||
# Posting date, fiscal year and year start date
|
||||
#---------------------------------------------------------------------
|
||||
if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
|
||||
msgprint("Please enter From Date and To Date")
|
||||
raise Exception
|
||||
else:
|
||||
from_date = filter_values['posting_date']
|
||||
to_date = filter_values['posting_date1']
|
||||
|
||||
# define columns
|
||||
#---------------------------------------------------------------------
|
||||
col = []
|
||||
col.append(['Date','Date','80px',''])
|
||||
col.append(['Detail','Text','475px',''])
|
||||
col.append(['Debit','Currency','75px',''])
|
||||
col.append(['Credit','Currency','75px',''])
|
||||
|
||||
for c in col:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames)
|
||||
|
||||
|
||||
#total query
|
||||
#---------------------------------------------------------------------
|
||||
total_debit, total_credit, total_opening, total_diff = 0,0,0,0
|
||||
q = query.split('WHERE')[1].split('LIMIT')
|
||||
if len(q) > 2:
|
||||
query_where_clause = 'LIMIT'.join(q[:-1])
|
||||
else:
|
||||
query_where_clause = q[0]
|
||||
|
||||
tot = sql('select sum(debit),sum(credit) from `tabGL Entry` where %s' % query_where_clause)
|
||||
|
||||
for t in tot:
|
||||
total_debit += t and flt(t[0]) or 0
|
||||
total_credit += t and flt(t[1]) or 0
|
||||
|
||||
total_diff = total_debit - total_credit
|
||||
|
||||
out = []
|
||||
|
||||
|
||||
# If account mentioned, show opening and closing
|
||||
#---------------------------------------------------------------------
|
||||
account = filter_values.get('account')
|
||||
|
||||
if account and (total_debit != 0 or total_credit != 0):
|
||||
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
|
||||
|
||||
from accounts.utils import get_balance_on
|
||||
opening_bal = get_balance_on(account, add_days(from_date, -1))
|
||||
closing_bal = get_balance_on(account, to_date)
|
||||
|
||||
if acc_det[0][0] == 'Credit':
|
||||
closing_bal = -1*closing_bal
|
||||
opening_bal = -1*opening_bal
|
||||
|
||||
# add opening row
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Opening as on '+formatdate(from_date)
|
||||
t_row[col_idx['Debit']-1] = opening_bal
|
||||
out.append(t_row)
|
||||
|
||||
|
||||
# table output
|
||||
#---------------------------------------------------------------------
|
||||
count = 0
|
||||
for r in res:
|
||||
count +=1
|
||||
det = r[1].split('~~~')
|
||||
if from_export == 1:
|
||||
a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
|
||||
else:
|
||||
a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
|
||||
r[1] = a
|
||||
out.append(r)
|
||||
|
||||
|
||||
# Total, Difference and closing balance
|
||||
#---------------------------------------------------------------------
|
||||
if total_debit != 0 or total_credit != 0:
|
||||
# Total debit/credit
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Total'
|
||||
t_row[col_idx['Debit']-1] = total_debit
|
||||
t_row[col_idx['Credit']-1] = total_credit
|
||||
out.append(t_row)
|
||||
|
||||
# diffrence (dr-cr)
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Total(Dr-Cr)'
|
||||
t_row[col_idx['Debit']-1] = total_diff
|
||||
out.append(t_row)
|
||||
|
||||
# closing
|
||||
if account:
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[1] = 'Closing Balance on ' + formatdate(to_date)
|
||||
t_row[col_idx['Debit']-1] = flt(closing_bal)
|
||||
out.append(t_row)
|
||||
|
||||
|
||||
# Print Format
|
||||
#---------------------------------------------------------------------
|
||||
myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
|
||||
</tr>
|
||||
<tr> <td>
|
||||
<div><h3> %(acc)s </h3></div>
|
||||
<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
|
||||
|
||||
""" % {'acc':account,
|
||||
'fdt':from_date,
|
||||
'tdt':to_date}
|
||||
|
||||
page_template = myheader+"<div>%(table)s</div>"
|
@ -1,13 +0,0 @@
|
||||
SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
|
||||
FROM `tabGL Entry`
|
||||
WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
|
||||
AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
|
||||
AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
|
||||
AND `tabGL Entry`.`company` LIKE '%(company)s%%'
|
||||
AND `tabGL Entry`.`account` LIKE '%(account)s%%'
|
||||
AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
|
||||
AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
|
||||
AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
|
||||
AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
|
||||
GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
|
||||
ORDER BY `tabGL Entry`.`posting_date` DESC
|
@ -1,25 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:51",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:51"
|
||||
},
|
||||
{
|
||||
"module": "Accounts",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'GL Entry\u0001From Posting Date\u0001lower':'','GL Entry\u0001To Posting Date\u0001upper':'','GL Entry\u0001Voucher Type':'','GL Entry\u0001Is Cancelled':'No','GL Entry\u0001Is Opening':'','GL Entry\u0001Fiscal Year':'','GL Entry\u0001Company':''}",
|
||||
"standard": "Yes",
|
||||
"doc_type": "GL Entry",
|
||||
"name": "__common__",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabGL Entry`.`name`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "General Ledger"
|
||||
},
|
||||
{
|
||||
"name": "general_ledger",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,27 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:51",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:51"
|
||||
},
|
||||
{
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'Sales Invoice\u0001Saved':1,'Sales Invoice\u0001Submitted':1,'Sales Invoice\u0001Is Opening':'','Sales Invoice\u0001Fiscal Year':''}",
|
||||
"doc_type": "Sales Invoice",
|
||||
"name": "__common__",
|
||||
"add_cond": "`tabSales Invoice`.due_date<now()\n`tabSales Invoice`.outstanding_amount!=0\n`tabSales Invoice`.docstatus=1",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabSales Invoice`.`name`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Invoices-Overdue",
|
||||
"columns": "Sales Invoice\u0001ID,Sales Invoice\u0001Debit To,Sales Invoice\u0001Voucher Date,Sales Invoice\u0001Due Date,Sales Invoice\u0001Outstanding Amount"
|
||||
},
|
||||
{
|
||||
"name": "invoices-overdue",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,43 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
var me = this;
|
||||
var set_filter_property = function(dt, field, property, value) {
|
||||
if (me.filter_fields_dict[dt + FILTER_SEP + field])
|
||||
me.filter_fields_dict[dt + FILTER_SEP + field].df[property] = value;
|
||||
}
|
||||
|
||||
this.hide_all_filters();
|
||||
filter_list = ['Credit To', 'Is Opening',
|
||||
'From Posting Date', 'To Posting Date', "Company"]
|
||||
|
||||
for(var i=0;i<filter_list.length;i++) {
|
||||
set_filter_property("Purchase Invoice", filter_list[i], "filter_hide", 0);
|
||||
}
|
||||
set_filter_property("Purchase Invoice Item", "Item", "filter_hide", 0);
|
||||
|
||||
set_filter_property("Purchase Invoice", "From Posting Date", "in_first_page", 1);
|
||||
set_filter_property("Purchase Invoice", "To Posting Date", "in_first_page", 1);
|
||||
set_filter_property("Purchase Invoice Item", "Item", "in_first_page", 1);
|
||||
|
||||
set_filter_property("Purchase Invoice", "From Posting Date",
|
||||
"report_default", sys_defaults.year_start_date);
|
||||
set_filter_property("Purchase Invoice", "To Posting Date",
|
||||
"report_default", dateutil.obj_to_str(new Date()));
|
||||
set_filter_property("Purchase Invoice", "Company",
|
||||
"report_default", sys_defaults.company);
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:51",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:51"
|
||||
},
|
||||
{
|
||||
"description": "Itemwise Purchase Register",
|
||||
"parent_doc_type": "Purchase Invoice",
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'Purchase Invoice\u0001Submitted':1,'Purchase Invoice\u0001Is Opening':'No','Purchase Invoice\u0001Company':'','Purchase Invoice\u0001Fiscal Year':''}",
|
||||
"dis_filters": "fiscal_year",
|
||||
"doc_type": "Purchase Invoice Item",
|
||||
"name": "__common__",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabPurchase Invoice`.`name`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Itemwise Purchase Register",
|
||||
"columns": "Purchase Invoice\u0001ID,Purchase Invoice\u0001Credit To,Purchase Invoice\u0001Company,Purchase Invoice Item\u0001Item,Purchase Invoice Item\u0001Item Name,Purchase Invoice Item\u0001Expense Head,Purchase Invoice Item\u0001Cost Center,Purchase Invoice Item\u0001Qty,Purchase Invoice Item\u0001Rate (Default Curr.),Purchase Invoice Item\u0001Amount (Default Curr.)"
|
||||
},
|
||||
{
|
||||
"name": "itemwise_purchase_register",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,43 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
var me = this;
|
||||
var set_filter_property = function(dt, field, property, value) {
|
||||
if (me.filter_fields_dict[dt + FILTER_SEP + field])
|
||||
me.filter_fields_dict[dt + FILTER_SEP + field].df[property] = value;
|
||||
}
|
||||
|
||||
this.hide_all_filters();
|
||||
filter_list_main = ['Debit To', 'From Posting Date', 'To Posting Date', "Company"]
|
||||
for(var i=0;i<filter_list_main.length;i++) {
|
||||
set_filter_property("Sales Invoice", filter_list_main[i], "filter_hide", 0);
|
||||
}
|
||||
filter_list_item = ["Item", "Item Group", "Brand Name", "Cost Center"]
|
||||
for(var i=0;i<filter_list_item.length;i++) {
|
||||
set_filter_property("Sales Invoice Item", filter_list_item[i], "filter_hide", 0);
|
||||
}
|
||||
set_filter_property("Sales Invoice", "From Posting Date", "in_first_page", 1);
|
||||
set_filter_property("Sales Invoice", "To Posting Date", "in_first_page", 1);
|
||||
set_filter_property("Sales Invoice Item", "Item", "in_first_page", 1);
|
||||
|
||||
set_filter_property("Sales Invoice", "From Posting Date",
|
||||
"report_default", sys_defaults.year_start_date);
|
||||
set_filter_property("Sales Invoice", "To Posting Date",
|
||||
"report_default", dateutil.obj_to_str(new Date()));
|
||||
set_filter_property("Sales Invoice", "Company",
|
||||
"report_default", sys_defaults.company);
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:51",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:51"
|
||||
},
|
||||
{
|
||||
"parent_doc_type": "Sales Invoice",
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'Sales Invoice\u0001Submitted':1,'Sales Invoice\u0001From Posting Date\u0001lower':'','Sales Invoice\u0001To Posting Date\u0001upper':'','Sales Invoice\u0001Is Opening':'','Sales Invoice\u0001Company':'','Sales Invoice\u0001Fiscal Year':''}",
|
||||
"doc_type": "Sales Invoice Item",
|
||||
"name": "__common__",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabSales Invoice Item`.`income_account`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Itemwise Sales Register",
|
||||
"columns": "Sales Invoice Item\u0001Item,Sales Invoice Item\u0001Item Name,Sales Invoice Item\u0001Item Group,Sales Invoice\u0001ID,Sales Invoice\u0001Voucher Date,Sales Invoice\u0001Posting Date,Sales Invoice\u0001Debit To,Sales Invoice Item\u0001Cost Center,Sales Invoice\u0001Territory,Sales Invoice Item\u0001Income Account,Sales Invoice Item\u0001Qty,Sales Invoice Item\u0001Basic Rate*,Sales Invoice Item\u0001Amount*"
|
||||
},
|
||||
{
|
||||
"name": "itemwise_sales_register",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,29 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.mytabs.items['Select Columns'].hide()
|
||||
this.hide_all_filters();
|
||||
this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'DocType'});
|
||||
this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'DocType'});
|
||||
this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',ignore : 1, parent:'DocType'});
|
||||
}
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',1,{NEWLINE:'<br>'});
|
||||
}
|
@ -1,168 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
if filter_values.get('period'):
|
||||
period_values = filter_values.get('period').split(NEWLINE)
|
||||
|
||||
if not filter_values.get('fiscal_year'):
|
||||
msgprint("Please Select Fiscal Year")
|
||||
raise Exception
|
||||
elif not filter_values.get('period'):
|
||||
msgprint("Please Select Period")
|
||||
raise Exception
|
||||
elif len(period_values) > 2:
|
||||
msgprint("You can view report only for one period. Please select only one value in period.")
|
||||
raise Exception
|
||||
else:
|
||||
fiscal_year = filter_values.get('fiscal_year')
|
||||
period = filter_values.get('period')
|
||||
company = filter_values.get('company')
|
||||
|
||||
# get fiscal year start date and start month
|
||||
# ---------------------------------------------------------
|
||||
year_start_date = sql("select year_start_date,MONTH(year_start_date) from `tabFiscal Year` where name = %s",fiscal_year)
|
||||
start_date = year_start_date and year_start_date[0][0] or ''
|
||||
start_month = year_start_date and year_start_date[0][1] or ''
|
||||
month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
|
||||
|
||||
# Add columns based on period
|
||||
# --------------------------------
|
||||
columns = []
|
||||
columns.append(['ID','Data','150px',''])
|
||||
columns.append(['Description','Data','150px',''])
|
||||
# ================ Annual ======================
|
||||
if period == 'Annual':
|
||||
columns.append([fiscal_year,'Currency','150px',''])
|
||||
|
||||
# =========== Half Yearly ======================
|
||||
elif period == 'Half Yearly':
|
||||
columns.append([month_name[start_month-1]+' to '+month_name[start_month+4],'Currency','150px','']) # first half
|
||||
if start_month == 1: # this is case when fiscal year starts with JAN
|
||||
columns.append([month_name[start_month+5]+' to '+month_name[start_month+11],'Currency','150px',''])
|
||||
else: #this is case when fiscal year starts with other than JAN
|
||||
columns.append([month_name[start_month+5]+' to '+month_name[start_month-2],'Currency','150px',''])
|
||||
columns.append(['Total','Currency','150px',''])
|
||||
|
||||
# ================ Quarterly ===================
|
||||
elif period == 'Quarterly':
|
||||
length_1 = (len(month_name) - start_month + 1) / 3 #this gives the total no. of times we need to iterate for quarter
|
||||
val = length_1 % 4
|
||||
q_no = 1
|
||||
for i in range(length_1):
|
||||
value = 3*i + val
|
||||
columns.append(['Q'+cstr(q_no)+' ('+month_name[value]+' to '+month_name[value+2]+')','Currency','150px',''])
|
||||
q_no += 1
|
||||
length_2 = (start_month - 1) / 3 #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
|
||||
for i in range(length_2):
|
||||
columns.append(['Q'+cstr(q_no)+' ('+month_name[3*i]+' to '+month_name[3*i+2]+')','Currency','150px',''])
|
||||
q_no += 1;
|
||||
columns.append(['Total','Currency','150px',''])
|
||||
|
||||
# =============== Monthly ======================
|
||||
elif period == 'Monthly':
|
||||
for i in range(start_month-1,len(month_name)):
|
||||
columns.append([month_name[i],'Currency','150px',''])
|
||||
for i in range(start_month-1):
|
||||
columns.append([month_name[i],'Currency','150px',''])
|
||||
columns.append(['Total','Currency','150px',''])
|
||||
|
||||
for c in columns:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames)-1
|
||||
|
||||
out = []
|
||||
if company:
|
||||
condition = 'docstatus = 1 and fiscal_year = "'+fiscal_year+'" and company = "'+company+'"'
|
||||
else:
|
||||
condition = 'docstatus = 1 and fiscal_year = "'+fiscal_year+'"'
|
||||
|
||||
for r in res:
|
||||
det = ''
|
||||
list_range = 0
|
||||
query = ''
|
||||
# ================= Annual Report ===============
|
||||
if period == 'Annual':
|
||||
# Main Query
|
||||
det = sql("SELECT count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s" %(r[col_idx['ID']],condition))
|
||||
list_range = 1
|
||||
|
||||
# ============ Half Yearly Report ===============
|
||||
elif period == 'Half Yearly':
|
||||
# first half
|
||||
query += 'COUNT(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),'
|
||||
# second half
|
||||
query += 'COUNT(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),'
|
||||
|
||||
# Main Query
|
||||
det = sql("SELECT %s count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s and transaction_date > CAST('%s' AS DATE)" %(query,r[col_idx['ID']],condition,start_date))
|
||||
list_range = 3
|
||||
|
||||
# =============== Quarterly Report ==============
|
||||
elif period == 'Quarterly':
|
||||
length_1 = (len(month_name) - start_month + 1) / 3; #this gives the total no. of times we need to iterate for quarter
|
||||
val = length_1 % 4;
|
||||
for i in range(length_1):
|
||||
value = 3*i + val;
|
||||
query += 'COUNT(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),'
|
||||
length_2 = (start_month - 1) / 3; #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
|
||||
for i in range(length_2):
|
||||
query += 'COUNT(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),';
|
||||
# Main Query
|
||||
det = sql("SELECT %s count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s and transaction_date > CAST('%s' AS DATE)" %(query,r[col_idx['ID']],condition,start_date))
|
||||
list_range = 5
|
||||
|
||||
# ================ Monthly Report ===============
|
||||
elif period == 'Monthly':
|
||||
# for loop is required twice coz fiscal year starts from April (this will also work if fiscal year starts in January)
|
||||
for i in range(start_month-1,len(month_name)):
|
||||
query += 'COUNT(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN name ELSE NULL END), SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), MAX(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), AVG(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
|
||||
# the above query calculates total_no, total_amt, min_amt, max_amt, avg_amt of doctypes in monthwise
|
||||
for i in range(start_month-1):
|
||||
query += 'COUNT(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN name ELSE NULL END), SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), MAX(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), AVG(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
|
||||
|
||||
# Main Query
|
||||
det = sql("SELECT %s count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s and transaction_date > CAST('%s' AS DATE)" %(query,r[col_idx['ID']],condition,start_date))
|
||||
list_range = 13
|
||||
|
||||
# bifurcate all values and append them in list
|
||||
total_no,total_amt,min_amt,max_amt,avg_amt = [],[],[],[],[]
|
||||
|
||||
count = 0
|
||||
# append values to list
|
||||
for i in range(list_range):
|
||||
total_no.append(cstr(det and det[0][count] or 0))
|
||||
total_amt.append(cstr(det and det[0][count+1] or 0))
|
||||
min_amt.append(cstr(det and det[0][count+2] or 0))
|
||||
max_amt.append(cstr(det and det[0][count+3] or 0))
|
||||
avg_amt.append(cstr(det and det[0][count+4] or 0))
|
||||
count += 5
|
||||
|
||||
for col in range(len(colnames)-1): # this would make all first row blank. just for look
|
||||
r.append('')
|
||||
out.append(r)
|
||||
|
||||
d = [['Total No',total_no],['Total Amount',total_amt],['Min Amount',min_amt],['Max Amount',max_amt],['Avg Amount',avg_amt]]
|
||||
|
||||
for des in range(5):
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[col_idx['Description']] = d[des][0]
|
||||
for v in range(list_range):
|
||||
t_row[col_idx[colnames[v+2]]] = flt(d[des][1][v])
|
||||
out.append(t_row)
|
@ -1 +0,0 @@
|
||||
SELECT DISTINCT name FROM tabDocType WHERE document_type="Transaction" AND ifnull(istable,0) = 0
|
@ -1,25 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:51",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:51"
|
||||
},
|
||||
{
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'DocType\u0001Period':'Monthly'}",
|
||||
"doctype": "Search Criteria",
|
||||
"doc_type": "Profile",
|
||||
"name": "__common__",
|
||||
"sort_by": "`tabProfile`.`name`",
|
||||
"criteria_name": "Monthly Transaction Summary",
|
||||
"columns": "Profile\u0001ID"
|
||||
},
|
||||
{
|
||||
"name": "monthly_transaction_summary",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,41 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
if not filter_values.get('posting_date'):
|
||||
msgprint("Enter From Posting Date.")
|
||||
raise Exception
|
||||
|
||||
if not filter_values.get('posting_date1'):
|
||||
msgprint("Enter To Posting Date.")
|
||||
raise Exception
|
||||
|
||||
if not filter_values.get('company'):
|
||||
msgprint("Select Company to proceed.")
|
||||
raise Exception
|
||||
|
||||
|
||||
|
||||
col_list = [['Account', 'Link', '150px', 'Account']
|
||||
,['Total', 'Currency', '150px', '']
|
||||
]
|
||||
|
||||
for c in col_list:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames) - 1
|
@ -1 +0,0 @@
|
||||
select t1.account, sum(if(t2.debit_or_credit = 'Debit', ifnull(t1.debit,0) - ifnull(t1.credit,0), ifnull(t1.credit,0) - ifnull(t1.debit,0))) from `tabGL Entry` t1, `tabAccount` t2 where t1.account = t2.name and t2.account_type != 'Bank or Cash' and t1.name in (select t1.name from `tabGL Entry` t1, `tabAccount` t2 where t1.against = t2.name and t2.account_type = 'Bank or Cash' and posting_date >= '%(posting_date)s' and posting_date <= '%(posting_date1)s') group by t1.account
|
@ -1,26 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "jai@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:51",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:51"
|
||||
},
|
||||
{
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'GL Entry\u0001Voucher Type':'','GL Entry\u0001Is Cancelled':'','GL Entry\u0001Is Opening':'','GL Entry\u0001Fiscal Year':''}",
|
||||
"doctype": "Search Criteria",
|
||||
"doc_type": "GL Entry",
|
||||
"name": "__common__",
|
||||
"sort_by": "`tabGL Entry`.`name`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Payment Receipt Report",
|
||||
"columns": "GL Entry\u0001ID,GL Entry\u0001Owner,GL Entry\u0001Posting Date,GL Entry\u0001Account,GL Entry\u0001Cost Center,GL Entry\u0001Against Voucher,GL Entry\u0001Voucher Type,GL Entry\u0001Voucher No,GL Entry\u0001Remarks,GL Entry\u0001Is Cancelled,GL Entry\u0001Is Opening,GL Entry\u0001Fiscal Year,GL Entry\u0001Company"
|
||||
},
|
||||
{
|
||||
"name": "payment_receipt_report",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,97 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# add expense head columns
|
||||
from __future__ import unicode_literals
|
||||
from webnotes.utils import flt
|
||||
|
||||
expense_acc = [c[0] for c in sql("""select distinct expense_head
|
||||
from `tabPurchase Invoice Item`
|
||||
where parenttype='Purchase Invoice'
|
||||
and docstatus=1
|
||||
order by expense_head asc""")]
|
||||
|
||||
expense_acc.append('Net Total')
|
||||
|
||||
for i in expense_acc:
|
||||
colnames.append(i)
|
||||
coltypes.append('Currency')
|
||||
colwidths.append('100px')
|
||||
coloptions.append('')
|
||||
|
||||
# Add tax head columns
|
||||
tax_acc = [c[0] for c in sql("""select distinct account_head
|
||||
from `tabPurchase Taxes and Charges`
|
||||
where parenttype = 'Purchase Invoice'
|
||||
and add_deduct_tax = 'Add'
|
||||
and category in ('Total', 'Valuation and Total')
|
||||
and docstatus=1
|
||||
order by account_head asc""")]
|
||||
|
||||
tax_acc.append('Total Tax')
|
||||
tax_acc.append('Grand Total')
|
||||
|
||||
for c in tax_acc:
|
||||
if c:
|
||||
colnames.append(c)
|
||||
coltypes.append('Currency')
|
||||
colwidths.append('100px')
|
||||
coloptions.append('')
|
||||
|
||||
# remove total columns from the list
|
||||
expense_acc = expense_acc[:-1]
|
||||
tax_acc = tax_acc[:-2]
|
||||
|
||||
# add the values
|
||||
for r in res:
|
||||
#Get amounts for expense heads
|
||||
exp_head_amount = sql("""select expense_head, sum(amount)
|
||||
from `tabPurchase Invoice Item`
|
||||
where parent = %s and parenttype='Purchase Invoice'
|
||||
group by expense_head""", (r[col_idx['ID']]))
|
||||
|
||||
#convert the result to dictionary for easy retrieval
|
||||
exp_head_amount_dict = {}
|
||||
for e in exp_head_amount:
|
||||
exp_head_amount_dict[e[0]] = e[1]
|
||||
|
||||
net_total = 0
|
||||
# get expense amount
|
||||
for i in expense_acc:
|
||||
val = exp_head_amount_dict.get(i, 0)
|
||||
net_total += val
|
||||
r.append(val)
|
||||
r.append(net_total)
|
||||
|
||||
#Get tax for account heads
|
||||
acc_head_tax = sql("""select account_head,
|
||||
sum(if(add_deduct_tax='Add', tax_amount, -tax_amount))
|
||||
from `tabPurchase Taxes and Charges` where parent = %s and parenttype = 'Purchase Invoice'
|
||||
and category in ('Total', 'Valuation and Total') group by account_head""", r[col_idx['ID']])
|
||||
|
||||
#Convert the result to dictionary for easy retrieval
|
||||
acc_head_tax_dict = {}
|
||||
for a in acc_head_tax:
|
||||
acc_head_tax_dict[a[0]] = flt(a[1])
|
||||
|
||||
# get tax amount
|
||||
total_tax = 0
|
||||
for c in tax_acc:
|
||||
val = acc_head_tax_dict.get(c, 0)
|
||||
total_tax += val
|
||||
r.append(val)
|
||||
r.append(total_tax)
|
||||
r.append(flt(total_tax)+ flt(net_total)) # grand total
|
@ -1,24 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:52",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:52"
|
||||
},
|
||||
{
|
||||
"doc_type": "Purchase Invoice",
|
||||
"name": "__common__",
|
||||
"add_cond": "`tabPurchase Invoice`.is_opening != 'Yes'\n`tabPurchase Invoice`.name not like 'OP/%'",
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"filters": "{'Purchase Invoice\u0001Submitted':1}",
|
||||
"doctype": "Search Criteria",
|
||||
"criteria_name": "Purchase Register",
|
||||
"columns": "Purchase Invoice\u0001ID,Purchase Invoice\u0001Voucher Date,Purchase Invoice\u0001Posting Date,Purchase Invoice\u0001Credit To,Purchase Invoice\u0001Expense Head"
|
||||
},
|
||||
{
|
||||
"name": "purchase_register",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,32 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'ID'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Owner'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Saved'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Grand Total >='].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Grand Total <='].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Sales Partner'].df.filter_hide = 1;
|
||||
this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Is Opening Entry'].df.filter_hide = 1;
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# add additional columns
|
||||
from __future__ import unicode_literals
|
||||
from webnotes.utils import flt
|
||||
|
||||
cl = [c[0] for c in sql("""select distinct account_head
|
||||
from `tabSales Taxes and Charges`
|
||||
where parenttype='Sales Invoice'
|
||||
and docstatus=1
|
||||
order by account_head asc""")]
|
||||
|
||||
income_acc = [c[0] for c in sql("""select distinct income_account
|
||||
from `tabSales Invoice Item`
|
||||
where parenttype='Sales Invoice'
|
||||
and docstatus=1
|
||||
order by income_account asc""")]
|
||||
|
||||
income_acc.append('Net Total')
|
||||
|
||||
for i in income_acc:
|
||||
colnames.append(i)
|
||||
coltypes.append('Currency')
|
||||
colwidths.append('100px')
|
||||
coloptions.append('')
|
||||
|
||||
cl.append('Total Tax')
|
||||
cl.append('Grand Total')
|
||||
for c in cl:
|
||||
colnames.append(c)
|
||||
coltypes.append('Currency')
|
||||
colwidths.append('100px')
|
||||
coloptions.append('')
|
||||
|
||||
income_acc = income_acc[:-1]
|
||||
cl = cl[:-2]
|
||||
|
||||
|
||||
# add the values
|
||||
for r in res:
|
||||
|
||||
#Get amounts for income account
|
||||
income_acc_list = sql("""select income_account, sum(amount)
|
||||
from `tabSales Invoice Item`
|
||||
where parent = %s
|
||||
and parenttype='Sales Invoice'
|
||||
group by income_account""", (r[col_idx['ID']],))
|
||||
|
||||
#convert the result to dictionary for easy retrieval
|
||||
income_acc_dict = {}
|
||||
for ia in income_acc_list:
|
||||
income_acc_dict[ia[0]] = flt(ia[1])
|
||||
|
||||
net_total = 0
|
||||
for i in income_acc:
|
||||
val = income_acc_dict.get(i, 0)
|
||||
net_total += val
|
||||
r.append(val)
|
||||
r.append(net_total)
|
||||
|
||||
#Get tax for account heads
|
||||
acc_head_tax = sql("""select account_head, sum(tax_amount)
|
||||
from `tabSales Taxes and Charges`
|
||||
where parent = '%s'
|
||||
and parenttype = 'Sales Invoice'
|
||||
group by account_head""" %(r[col_idx['ID']],))
|
||||
|
||||
#Convert the result to dictionary for easy retrieval
|
||||
acc_head_tax_dict = {}
|
||||
for a in acc_head_tax:
|
||||
acc_head_tax_dict[a[0]] = flt(a[1])
|
||||
|
||||
total_tax = 0
|
||||
for c in cl:
|
||||
val = acc_head_tax_dict.get(c, 0)
|
||||
total_tax += val
|
||||
r.append(val)
|
||||
r.append(total_tax)
|
||||
r.append(net_total+total_tax)
|
@ -1,30 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-11 17:36:48",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-18 17:41:46"
|
||||
},
|
||||
{
|
||||
"add_col": "`tabAccount`.`parent_account` AS 'Parent Account'\n`tabCustomer`.`territory` AS 'Territory'\n`tabCustomer`.`customer_details` AS 'Customer Details'",
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"add_tab": "`tabAccount`\n`tabCustomer`",
|
||||
"dis_filters": "fiscal_year",
|
||||
"doc_type": "Sales Invoice",
|
||||
"name": "__common__",
|
||||
"filters": "{'Sales Invoice\u0001Submitted':1,'Sales Invoice\u0001Is Opening':''}",
|
||||
"add_cond": "ifnull(`tabSales Invoice`.`is_opening`, 'No') = 'No'\n`tabAccount`.name =`tabSales Invoice`.debit_to\n`tabCustomer`.`name` = `tabAccount`.`master_name`",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`Parent Account`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Sales Register",
|
||||
"columns": "Sales Invoice\u0001ID,Sales Invoice\u0001Posting Date,Sales Invoice\u0001Debit To"
|
||||
},
|
||||
{
|
||||
"name": "sales_register",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,153 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
this.dt.set_no_limit(1);
|
||||
|
||||
// hide transaction based on permissions
|
||||
var all_transactions = ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice",
|
||||
"Purchase Order", "Purchase Receipt", "Purchase Invoice"];
|
||||
var transaction_list = [];
|
||||
$.each(all_transactions, function(i, dt) {
|
||||
if(wn.boot.profile.can_read.indexOf(dt)!=-1) {
|
||||
transaction_list.push(dt);
|
||||
}
|
||||
});
|
||||
|
||||
this.add_filter({fieldname:'transaction', label:'Transaction', fieldtype:'Select', options:transaction_list.join(NEWLINE),report_default:'Delivery Note',ignore : 1,parent:'Profile',in_first_page : 1,single_select : 1});
|
||||
|
||||
this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Profile',in_first_page:1,single_select:1});
|
||||
|
||||
this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Item'+NEWLINE+'Item Group'+NEWLINE+'Customer'+NEWLINE+'Customer Group'+NEWLINE+'Territory'+NEWLINE+'Supplier'+NEWLINE+'Supplier Type'+NEWLINE+'Project', ignore : 1, parent:'Profile', report_default:'Item', in_first_page : 1,single_select:1});
|
||||
|
||||
this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item'+NEWLINE+'Customer'+NEWLINE+'Supplier', ignore : 1, parent:'Profile',single_select:1});
|
||||
|
||||
this.add_filter({fieldname:'order_type', label:'Order Type', fieldtype:'Select', options:NEWLINE+'Sales'+NEWLINE+'Maintenance',ignore : 1, parent:'Profile',single_select:1});
|
||||
|
||||
this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Profile'});
|
||||
|
||||
this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile', in_first_page:1});
|
||||
|
||||
|
||||
// Add Filters
|
||||
this.add_filter({fieldname:'item', label:'Item', fieldtype:'Link', options:'Item', ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'Link', options:'Item Group', ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'customer', label:'Customer', fieldtype:'Link', options:'Customer', ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'customer_group', label:'Customer Group', fieldtype:'Link', options:'Customer Group', ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'territory', label:'Territory', fieldtype:'Link', options:'Territory', ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'supplier', label:'Supplier', fieldtype:'Link', options:'Supplier', ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'supplier_type', label:'Supplier Type', fieldtype:'Link', options:'Supplier Type', ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'project', label:'Project', fieldtype:'Link', options:'Project', ignore : 1, parent:'Profile'});
|
||||
}
|
||||
|
||||
|
||||
this.mytabs.tabs['Select Columns'].hide();
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',1,{whiteSpace:'pre'});
|
||||
}
|
||||
|
||||
var validate_values = function(trans,based_on,order_type) {
|
||||
if(!fiscal_year){
|
||||
msgprint("Please select Fiscal Year");
|
||||
return 0;
|
||||
}
|
||||
if((in_list(['Quotation','Sales Order','Delivery Note','Sales Invoice'],trans) && in_list(['Supplier','Supplier Type'],based_on)) || (in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && in_list(['Customer','Customer Group','Territory'],based_on))){
|
||||
msgprint("Sorry! You cannot fetch "+trans+" trend based on "+based_on);
|
||||
return 0;
|
||||
}
|
||||
if(in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && order_type){
|
||||
msgprint("Please deselect Order Type for "+trans);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
report.get_query = function() {
|
||||
trans = this.get_filter('Profile', 'Transaction').get_value();
|
||||
order_type = this.get_filter('Profile', 'Order Type').get_value();
|
||||
based_on = this.get_filter('Profile', 'Based On').get_value();
|
||||
company = this.get_filter('Profile', 'Company').get_value();
|
||||
fiscal_year = this.get_filter('Profile', 'Fiscal Year').get_value();
|
||||
|
||||
if(validate_values(trans,based_on,order_type)){
|
||||
col = '';
|
||||
add_cond = '';
|
||||
add_col = '';
|
||||
add_tables = '';
|
||||
sp_cond = '';
|
||||
|
||||
trans_det = trans+' Item'
|
||||
|
||||
if(order_type != '') add_code += ' AND t1.order_type = '+order_type;
|
||||
|
||||
switch(based_on){
|
||||
case 'Item' : item = this.get_filter('Profile', 'Item').get_value();
|
||||
col = 'DISTINCT t2.item_code, t3.item_name';
|
||||
add_tables = ',tabItem t3';
|
||||
add_cond += ' AND t2.item_code = t3.name';
|
||||
if(item) add_cond += ' AND t2.item_code = "'+item+'"';
|
||||
break;
|
||||
case 'Customer' : cust = this.get_filter('Profile', 'Customer').get_value();
|
||||
col = 'DISTINCT t1.customer, t3.territory';
|
||||
add_tables = ',tabCustomer t3';
|
||||
add_cond += ' AND t1.customer = t3.name';
|
||||
if(cust) add_cond += ' AND t1.customer = "'+cust+'"';
|
||||
break;
|
||||
case 'Supplier' : supp = this.get_filter('Profile', 'Supplier').get_value();
|
||||
col = 'DISTINCT t1.supplier, t3.supplier_type';
|
||||
add_tables = ',tabSupplier t3';
|
||||
add_cond += ' AND t1.supplier = t3.name';
|
||||
if(supp) add_cond += ' AND t1.supplier = "'+supp+'"';
|
||||
break;
|
||||
case 'Supplier Type' : supp_type = this.get_filter('Profile', 'Supplier Type').get_value();
|
||||
col = 'DISTINCT t3.supplier_type';
|
||||
add_tables = ',tabSupplier t3';
|
||||
add_cond += ' AND t1.supplier = t3.name';
|
||||
if(supp_type) add_cond += ' AND t1.supplier_type = "'+supp_type+'"';
|
||||
break;
|
||||
case 'Project' : pro = this.get_filter('Profile', 'Project').get_value();
|
||||
if (inList(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], trans)) {
|
||||
col = 'DISTINCT t2.project_name';
|
||||
if(pro) add_cond += ' AND t2.project_name = "'+pro+'"';
|
||||
} else {
|
||||
col = 'DISTINCT t1.project_name';
|
||||
if(pro) add_cond += ' AND t1.project_name = "'+pro+'"';
|
||||
}
|
||||
break;
|
||||
case 'Item Group' : ig = this.get_filter('Profile', 'Item Group').get_value();
|
||||
if(ig) sp_cond += ' AND parent.name = "'+ig+'"';
|
||||
break;
|
||||
case 'Customer Group' : cg = this.get_filter('Profile', 'Customer Group').get_value();
|
||||
if(cg) sp_cond += ' AND parent.name = "'+cg+'"';
|
||||
break;
|
||||
case 'Territory' : ter = this.get_filter('Profile', 'Territory').get_value();
|
||||
if(ter) sp_cond += ' AND parent.name = "'+ter+'"';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(based_on == 'Item' || based_on == 'Customer' || based_on == 'Supplier' || based_on == 'Supplier Type' || based_on == 'Project')
|
||||
var q ='SELECT '+col+' FROM `tab'+trans+'` t1, `tab'+trans_det+'` t2 '+add_tables+' WHERE t1.fiscal_year = "'+fiscal_year+'" and t1.company = "'+company+'" and t2.parent = t1.name '+add_cond;
|
||||
else
|
||||
var q = 'SELECT CONCAT(REPEAT(" ", COUNT(parent.name) - 1), node.name) AS "Name" FROM `tab'+based_on+'` node,`tab'+based_on+'` parent WHERE node.lft BETWEEN parent.lft and parent.rgt and node.docstatus !=2 '+sp_cond+' GROUP BY node.name ORDER BY node.lft';
|
||||
|
||||
return q;
|
||||
}
|
||||
}
|
@ -1,177 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# ********************************************* INITIALIZATION *******************************************
|
||||
from __future__ import unicode_literals
|
||||
out = []
|
||||
|
||||
# Filter Values
|
||||
# =============================================
|
||||
based_on = filter_values.get('based_on')
|
||||
group_by = filter_values.get('group_by')
|
||||
trans = filter_values.get('transaction')
|
||||
period = filter_values.get('period')
|
||||
order_type = filter_values.get('order_type')
|
||||
company = filter_values.get('company')
|
||||
fiscal_year = filter_values.get('fiscal_year')
|
||||
item = filter_values.get('item')
|
||||
item_group = filter_values.get('item_group')
|
||||
customer = filter_values.get('customer')
|
||||
customer_group = filter_values.get('customer_group')
|
||||
territory = filter_values.get('territory')
|
||||
supplier = filter_values.get('supplier')
|
||||
supplier_type = filter_values.get('supplier_type')
|
||||
project = filter_values.get('project')
|
||||
|
||||
|
||||
# ********************************************* SET DEFAULTS **************************************************
|
||||
# Details Table
|
||||
# --------------
|
||||
|
||||
trans_det = trans+' Item'
|
||||
|
||||
col_names, query_val = get_obj('Trend Analyzer Control').get_single_year_query_value(fiscal_year, period, trans, trans_det)
|
||||
query_val += 'SUM(t2.qty), SUM(t2.amount)'
|
||||
|
||||
col_names.append('Total (Qty)')
|
||||
col_names.append('Total (Amt)')
|
||||
|
||||
|
||||
# ********************************************* VALIDATIONS ***************************************************
|
||||
if (based_on in ['Customer','Customer Group','Territory'] and group_by == 'Supplier') or (based_on in ['Supplier','Supplier Type'] and group_by == 'Customer'):
|
||||
msgprint("Sorry! You cannot group Trend Analyzer based on %s by %s" % (based_on,group_by))
|
||||
raise Exception
|
||||
|
||||
if based_on == group_by:
|
||||
msgprint("Based On and Group By value cannot be same for Trend Analyzer")
|
||||
raise Exception
|
||||
|
||||
|
||||
# ********************************************** ADD COLUMNS **********************************************
|
||||
cols = [[based_on, 'Data', '300px', '']]
|
||||
cr = 1
|
||||
if based_on == 'Item':
|
||||
cols.append(['Item Name','Data','200px',''])
|
||||
cr = 2
|
||||
elif based_on == 'Customer':
|
||||
cols.append(['Territory','Link','150px','Territory'])
|
||||
cr = 2
|
||||
elif based_on == 'Supplier':
|
||||
cols.append(['Supplier Type','Link','150px','Supplier Type'])
|
||||
cr = 2
|
||||
if group_by:
|
||||
cr += 1
|
||||
|
||||
if group_by:
|
||||
cols.append([group_by,'Data','150px',''])
|
||||
|
||||
for c in col_names:
|
||||
cols.append([c, ("Amt" in c) and 'Currency' or 'Float','150px',''])
|
||||
|
||||
for c in cols:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames)-1
|
||||
|
||||
|
||||
# ******************************************* ADDITIONAL CONDITION ************************************************
|
||||
add_cond = ' t2.parent = t1.name AND t1.company = "%s" AND t1.fiscal_year = "%s" and t1.docstatus = 1' % (company, fiscal_year)
|
||||
add_tab = ' `tab'+trans+'` t1, `tab'+trans_det+'` t2'
|
||||
if order_type: add_cond += ' AND t1.order_type = "%s"' % order_type
|
||||
|
||||
|
||||
# Item
|
||||
if item or based_on == 'Item':
|
||||
add_cond += ' AND t2.item_code = "%s"' % (based_on != 'Item' and item or '%(value)s')
|
||||
|
||||
# Item Group
|
||||
if item_group or based_on == 'Item Group':
|
||||
add_tab += ' ,`tabItem` t3, `tabItem Group` t4 '
|
||||
add_cond += ' AND t3.name = t2.item_code AND t3.item_group = t4.name and (t4.name = "%s" or t4.name IN (SELECT t5.name FROM `tabItem Group` t5,`tabItem Group` t6 WHERE t5.lft BETWEEN t6.lft and t6.rgt and t5.docstatus !=2 and t6.name = "%s"))' % (based_on != 'Item Group' and item_group or '%(value)s', based_on != 'Item Group' and item_group or '%(value)s')
|
||||
|
||||
# Customer
|
||||
if customer or based_on == 'Customer':
|
||||
add_cond += ' AND t1.customer = "%s"' % (based_on != 'Customer' and customer or '%(value)s')
|
||||
|
||||
# Customer Group
|
||||
if customer_group or based_on == 'Customer Group':
|
||||
add_tab += ' ,`tabCustomer` t7, `tabCustomer Group` t8 '
|
||||
add_cond += ' AND t7.name = t1.customer AND t7.customer_group = t8.name and (t8.name = "%s" or t8.name IN (SELECT t9.name FROM `tabCustomer Group` t9,`tabCustomer Group` t10 WHERE t9.lft BETWEEN t10.lft and t10.rgt and t9.docstatus !=2 and ifnull(t9.is_group,"No") = "No" and t10.name = "%s"))' % (based_on != 'Customer Group' and customer_group or '%(value)s', based_on != 'Customer Group' and customer_group or '%(value)s')
|
||||
|
||||
# Territory
|
||||
if territory or based_on == 'Territory':
|
||||
add_tab += ' ,`tabTerritory` t11 '
|
||||
add_cond += ' AND t1.territory = t11.name and (t11.name = "%s" or t11.name IN (SELECT t12.name FROM `tabTerritory` t12,`tabTerritory` t13 WHERE t12.lft BETWEEN t13.lft and t13.rgt and t12.docstatus !=2 and ifnull(t12.is_group,"No") = "No" and t13.name = "%s"))' % (based_on != 'Territory' and territory or '%(value)s', based_on != 'Territory' and territory or '%(value)s')
|
||||
|
||||
# Supplier
|
||||
if supplier or based_on == 'Supplier':
|
||||
add_cond += ' AND t1.supplier = "%s"' % (based_on != 'Supplier' and supplier or '%(value)s')
|
||||
|
||||
# Supplier Type
|
||||
if supplier_type or based_on == 'Supplier Type':
|
||||
add_tab += ' ,`tabSupplier` t14, `tabSupplier Type` t15 '
|
||||
add_cond += ' AND t14.name = t1.supplier AND t14.supplier_type = t15.name and t15.name = "%s"' % (based_on != 'Supplier Type' and supplier_type or '%(value)s')
|
||||
|
||||
# Project
|
||||
if project or based_on == 'Project':
|
||||
if trans in ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']:
|
||||
add_cond += ' AND t2.project_name = "%s"' % (based_on != 'Project' and project or '%(value)s')
|
||||
else:
|
||||
add_cond += ' AND t1.project_name = "%s"' % (based_on != 'Project' and project or '%(value)s')
|
||||
|
||||
# Column to be seleted for group by condition
|
||||
# ==============================================
|
||||
sel_col = ''
|
||||
if group_by == 'Item':
|
||||
sel_col = 't2.item_code'
|
||||
elif group_by == 'Customer':
|
||||
sel_col = 't1.customer'
|
||||
elif group_by == 'Supplier':
|
||||
sel_col = 't1.supplier'
|
||||
|
||||
|
||||
# ********************************************** Result Set ************************************************
|
||||
for r in res:
|
||||
main_det = sql("SELECT %s FROM %s WHERE %s" % (query_val, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
|
||||
if group_by:
|
||||
for col in range(cr,cr+1): # this would make all first row blank. just for look
|
||||
r.append('')
|
||||
if main_det[0][len(colnames) - cr - 1]:
|
||||
for d in range(len(colnames) - cr):
|
||||
r.append(flt(main_det[0][d]))
|
||||
out.append(r)
|
||||
|
||||
if group_by:
|
||||
flag = 1
|
||||
# check for root nodes
|
||||
if based_on in ['Item Group','Customer Group','Territory']:
|
||||
is_grp = sql("select is_group from `tab%s` where name = '%s'" % (based_on, cstr(r[col_idx[based_on]]).strip()))
|
||||
is_grp = is_grp and cstr(is_grp[0][0]) or ''
|
||||
if is_grp != 'No':
|
||||
flag = 0
|
||||
|
||||
if flag == 1:
|
||||
det = [x[0] for x in sql("SELECT DISTINCT %s FROM %s where %s" % (sel_col, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))]
|
||||
|
||||
for des in range(len(det)):
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[col_idx[group_by]] = cstr(det[des])
|
||||
gr_det = sql("SELECT %s FROM %s WHERE %s = '%s' and %s" % (query_val, add_tab, sel_col, cstr(det[des]), add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
|
||||
for d in range(len(col_names)):
|
||||
t_row[col_idx[col_names[d]]] = flt(gr_det[0][d])
|
||||
out.append(t_row)
|
@ -1,26 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "saumil@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-23 12:46:00",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-05-04 12:49:43"
|
||||
},
|
||||
{
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{}",
|
||||
"doctype": "Search Criteria",
|
||||
"doc_type": "Profile",
|
||||
"name": "__common__",
|
||||
"sort_by": "`tabProfile`.`name`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Trend Analyzer",
|
||||
"columns": "Profile\u0001ID,Profile\u0001Owner"
|
||||
},
|
||||
{
|
||||
"name": "trend_analyzer",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,63 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
//Add filter
|
||||
this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice', report_default:'Sales Invoice', ignore : 1,parent:'Sales Taxes and Charges', single_select :1, in_first_page:1});
|
||||
|
||||
this.add_filter({fieldname:'posting_date', label:'Date', fieldtype:'Date', options:'', ignore : 1,parent:'Sales Taxes and Charges', in_first_page:1});
|
||||
|
||||
this.add_filter({fieldname:'voucher_id', label:'Voucher Id', fieldtype:'Data', options:'', ignore : 1,parent:'Sales Taxes and Charges', in_first_page:1});
|
||||
|
||||
this.add_filter({fieldname:'tax_account', label:'Tax Account', fieldtype:'Link', options:'Account', ignore : 1,parent:'Sales Taxes and Charges', in_first_page:1});
|
||||
}
|
||||
|
||||
|
||||
// hide sections
|
||||
//--------------------------------------
|
||||
this.mytabs.items['More Filters'].hide();
|
||||
this.mytabs.items['Select Columns'].hide();
|
||||
|
||||
// Get query
|
||||
//--------------------------------------
|
||||
report.get_query = function() {
|
||||
based_on = this.get_filter('Sales Taxes and Charges', 'Based On').get_value();
|
||||
from_date = this.get_filter('Sales Taxes and Charges', 'From Date').get_value();
|
||||
to_date = this.get_filter('Sales Taxes and Charges', 'To Date').get_value();
|
||||
vid = this.get_filter('Sales Taxes and Charges', 'Voucher Id').get_value();
|
||||
acc = this.get_filter('Sales Taxes and Charges', 'Tax Account').get_value();
|
||||
|
||||
date_fld = 'transaction_date';
|
||||
if(based_on == 'Sales Invoice') {
|
||||
based_on = 'Sales Invoice';
|
||||
date_fld = 'posting_date';
|
||||
}
|
||||
|
||||
sp_cond = '';
|
||||
if (from_date) sp_cond += repl(' AND t1.%(dt)s >= "%(from_date)s"', {dt:date_fld, from_date:from_date});
|
||||
if (to_date) sp_cond += repl(' AND t1.%(dt)s <= "%(to_date)s"', {dt:date_fld, to_date:to_date});
|
||||
if (vid) sp_cond += repl(' AND t1.name LIKE "%%(voucher)s%"', {voucher:vid});
|
||||
if (acc) sp_cond += repl(' AND t2.account_head = "%(acc)s"', {acc:acc});
|
||||
|
||||
return repl('SELECT t1.`name`, t1.`%(dt)s`, t1.`customer_name`, t1.net_total, t2.account_head, t2.description, t2.rate, t2.tax_amount \
|
||||
FROM `tab%(parent)s` t1, `tabSales Taxes and Charges` t2 \
|
||||
WHERE t1.docstatus=1 AND t2.`parenttype` = "%(parent)s" \
|
||||
AND t2.`parent` = t1.`name` \
|
||||
%(cond)s ORDER BY t1.`name` DESC, t1.%(dt)s DESC', {parent:based_on, cond:sp_cond, dt:date_fld});
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
if filter_values.get('based_on') == 'Sales Invoice':
|
||||
based_on_dt = 'Sales Invoice'
|
||||
else:
|
||||
based_on_dt = filter_values.get('based_on')
|
||||
|
||||
cols = [
|
||||
[filter_values.get('based_on'), 'Link','150px', based_on_dt],
|
||||
['Transaction Date', 'Date', '120px', ''],
|
||||
['Customer', 'Link','150px','Customer'],
|
||||
['Net Total', 'Currency', '80px', ''],
|
||||
['Tax Account', 'Link','150px','Account'],
|
||||
['Description', 'Text','120px',''],
|
||||
['Tax Rate', 'Currency', '80px', ''],
|
||||
['Tax Amount', 'Currency', '80px', '']
|
||||
]
|
||||
|
||||
for c in cols:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames)-1
|
@ -1,27 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:53",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:53"
|
||||
},
|
||||
{
|
||||
"parent_doc_type": "Delivery Note",
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'Delivery Note\u0001Submitted':1,'Delivery Note\u0001Status':'','Delivery Note\u0001Fiscal Year':''}",
|
||||
"doc_type": "Sales Taxes and Charges",
|
||||
"name": "__common__",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabSales Taxes and Charges`.`parent`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Voucher wise tax details",
|
||||
"columns": "Sales Taxes and Charges\u0001Type,Sales Taxes and Charges\u0001Account Head,Sales Taxes and Charges\u0001Cost Center,Sales Taxes and Charges\u0001Description,Sales Taxes and Charges\u0001Rate,Sales Taxes and Charges\u0001Amount*,Sales Taxes and Charges\u0001Total*"
|
||||
},
|
||||
{
|
||||
"name": "voucher_wise_tax_details",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,28 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.mytabs.items['Select Columns'].hide()
|
||||
this.hide_all_filters();
|
||||
this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'from_fiscal_year', label:'From Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'to_fiscal_year', label:'To Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile'});
|
||||
this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'Profile'});
|
||||
}
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',1,{NEWLINE:'<br>'});
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
if not filter_values.get('from_fiscal_year'):
|
||||
msgprint("Please Select From Fiscal Year")
|
||||
raise Exception
|
||||
elif not filter_values.get('to_fiscal_year'):
|
||||
msgprint("Please Select To Fiscal Year")
|
||||
raise Exception
|
||||
else:
|
||||
from_fiscal_year = filter_values.get('from_fiscal_year')
|
||||
to_fiscal_year = filter_values.get('to_fiscal_year')
|
||||
company = filter_values.get('company')
|
||||
from_date = filter_values.get('date')
|
||||
to_date = filter_values.get('date1')
|
||||
if from_date != "" and to_date != "":
|
||||
get_obj('MIS Control').dates(from_fiscal_year,from_date,to_date) # validate dates (i.e. dates should be between particular fiscal year)
|
||||
|
||||
# Add columns based on from and to fiscal year---------
|
||||
columns = []
|
||||
columns.append(['ID','Data','150px',''])
|
||||
columns.append(['Description','Data','150px',''])
|
||||
columns.append([from_fiscal_year,'Data','150px','']) # append from fiscal year column
|
||||
|
||||
# === get no. of fiscal years between from and to fiscal year and append columns accordingly ========
|
||||
start_year = from_fiscal_year.split('-')[1] # eg. from fiscal year 2008-2009 . this gives value 2009
|
||||
end_year = to_fiscal_year.split('-')[0] # eg. to fiscal year 2009-2010 . this gives value 2009
|
||||
diff = cint(end_year)-cint(start_year)
|
||||
if diff > 0:
|
||||
year = cint(start_year);
|
||||
next_year = 0
|
||||
f_year = ''
|
||||
for i in range(1,diff+1):
|
||||
next_year = cint(year)+1
|
||||
f_year = cstr(year)+'-'+cstr(next_year)
|
||||
columns.append([f_year,'Data','150px',''])
|
||||
# ====================================================================================================
|
||||
|
||||
columns.append([to_fiscal_year,'Data','150px','']) # append to fiscal year column
|
||||
|
||||
for c in columns:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append(c[3])
|
||||
col_idx[c[0]] = len(colnames)-1
|
||||
|
||||
out = []
|
||||
# =========================== condition for result ===================================================
|
||||
if company:
|
||||
condition = 'docstatus = 1 and company = "'+company+'"'
|
||||
else:
|
||||
condition = 'docstatus = 1'
|
||||
|
||||
# ====================================================================================================
|
||||
|
||||
for r in res:
|
||||
det = ''
|
||||
query = ''
|
||||
list_range = 0
|
||||
if from_date != "" and to_date != "":
|
||||
date_1 = cstr(get_obj('MIS Control').dates(from_fiscal_year,from_date,to_date))
|
||||
query += 'COUNT(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN name ELSE NULL END),SUM(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MIN(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MAX(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),AVG(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),'
|
||||
else:
|
||||
query += 'COUNT(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN name ELSE NULL END),SUM(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),MIN(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),MAX(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),AVG(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),'
|
||||
list_range += 1
|
||||
|
||||
if diff > 0:
|
||||
year = cint(start_year);
|
||||
next_year = 0
|
||||
f_year = ''
|
||||
for i in range(1,diff+1):
|
||||
next_year = cint(year)+1;
|
||||
f_year = cstr(year)+'-'+cstr(next_year);
|
||||
if from_date != "" and to_date != "":
|
||||
date_2 = cstr(get_obj('MIS Control').dates(f_year,from_date,to_date))
|
||||
query += 'COUNT(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN name ELSE NULL END),SUM(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MIN(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MAX(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),AVG(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),'
|
||||
else:
|
||||
query += 'COUNT(CASE WHEN fiscal_year = "'+f_year+'" THEN name ELSE NULL END),SUM(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),MIN(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),MAX(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),AVG(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),'
|
||||
year += 1
|
||||
list_range += 1
|
||||
|
||||
if from_date != "" and to_date != "":
|
||||
date_3 = cstr(get_obj('MIS Control').dates(to_fiscal_year,from_date,to_date))
|
||||
query += 'COUNT(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN name ELSE NULL END),SUM(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MIN(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MAX(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),AVG(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END)'
|
||||
else:
|
||||
query += 'COUNT(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN name ELSE NULL END),SUM(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END),MIN(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END),MAX(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END),AVG(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END)'
|
||||
list_range += 1
|
||||
|
||||
# Main Query
|
||||
det = sql("SELECT %s from `tab%s` where %s" %(query,r[col_idx['ID']],condition))
|
||||
|
||||
# bifurcate all values and append them in list
|
||||
total_no,total_amt,min_amt,max_amt,avg_amt = [],[],[],[],[]
|
||||
|
||||
count = 0
|
||||
# append values to list
|
||||
for i in range(list_range):
|
||||
total_no.append(cstr(det and det[0][count] or 0))
|
||||
total_amt.append(cstr(det and det[0][count+1] or 0))
|
||||
min_amt.append(cstr(det and det[0][count+2] or 0))
|
||||
max_amt.append(cstr(det and det[0][count+3] or 0))
|
||||
avg_amt.append(cstr(det and det[0][count+4] or 0))
|
||||
count += 5
|
||||
|
||||
for col in range(len(colnames)-1): # this would make all first row blank. just for look
|
||||
r.append('')
|
||||
out.append(r)
|
||||
|
||||
d = [['Total No',total_no],['Total Amount',total_amt],['Min Amount',min_amt],['Max Amount',max_amt],['Avg Amount',avg_amt]]
|
||||
|
||||
for des in range(5):
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[col_idx['Description']] = d[des][0]
|
||||
for v in range(list_range):
|
||||
t_row[col_idx[colnames[v+2]]] = flt(d[des][1][v])
|
||||
out.append(t_row)
|
@ -1 +0,0 @@
|
||||
SELECT DISTINCT name FROM tabDocType WHERE document_type="Transaction" AND ifnull(istable,0) = 0
|
@ -1,25 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:53",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:53"
|
||||
},
|
||||
{
|
||||
"module": "Accounts",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'DocType\u0001Fiscal Year':'2009-2010','DocType\u0001Company':'Alpha Company','DocType\u0001Period':'Monthly'}",
|
||||
"doctype": "Search Criteria",
|
||||
"doc_type": "Profile",
|
||||
"name": "__common__",
|
||||
"sort_by": "`tabProfile`.`name`",
|
||||
"criteria_name": "Yearly Transaction Summary",
|
||||
"columns": "Profile\u0001ID"
|
||||
},
|
||||
{
|
||||
"name": "yearly_transaction_summary",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -91,11 +91,6 @@ wn.module_page["Buying"] = [
|
||||
"label":wn._("Purchase Analytics"),
|
||||
page: "purchase-analytics"
|
||||
},
|
||||
{
|
||||
"label":wn._("Trend Analyzer"),
|
||||
route: "Report/Profile/Trend Analyzer",
|
||||
doctype: "Purchase Order"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,21 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'From Purchase Order Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'To Purchase Order Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-11 13:16:55",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-13 11:15:06"
|
||||
},
|
||||
{
|
||||
"parent_doc_type": "Purchase Order",
|
||||
"module": "Buying",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{\"Purchase Order\\u0001Submitted\":1,\"Purchase Order\\u0001Status\":[],\"Purchase Order\\u0001Fiscal Year\":[]}",
|
||||
"doc_type": "Purchase Order Item",
|
||||
"name": "__common__",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabPurchase Order`.`transaction_date`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Itemwise Purchase Details",
|
||||
"columns": "Purchase Order\u0001ID,Purchase Order\u0001Purchase Order Date,Purchase Order Item\u0001Item Code,Purchase Order Item\u0001Item Name,Purchase Order Item\u0001Quantity,Purchase Order Item\u0001Stock UOM,Purchase Order Item\u0001Rate ,Purchase Order Item\u0001Amount,Purchase Order\u0001Net Total*,Purchase Order\u0001Grand Total"
|
||||
},
|
||||
{
|
||||
"name": "itemwise_purchase_details",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,20 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "dhanalekshmi@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:51",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:51"
|
||||
},
|
||||
{
|
||||
"add_col": "(CASE WHEN (`tabPurchase Order Item`.qty- ifnull(`tabPurchase Order Item`.billed_qty, 0) > 0 ) THEN (`tabPurchase Order Item`.qty-ifnull(`tabPurchase Order Item`.billed_qty, 0) ) ELSE 0 END) AS \"Pending To Bill\"",
|
||||
"parent_doc_type": "Purchase Order",
|
||||
"module": "Buying",
|
||||
"standard": "Yes",
|
||||
"sort_order": "DESC",
|
||||
"filters": "{'Purchase Order\u0001Saved':1,'Purchase Order\u0001Submitted':1,'Purchase Order\u0001Status':'','Purchase Order\u0001Fiscal Year':''}",
|
||||
"description": "Pending PO Items To Bill",
|
||||
"doc_type": "Purchase Order Item",
|
||||
"name": "__common__",
|
||||
"add_cond": "(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0) > 0 or `tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.billed_qty, 0) > 0)\n`tabPurchase Order`.status != \"Stopped\"",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "`tabPurchase Order`.`name`",
|
||||
"page_len": 50,
|
||||
"criteria_name": "Pending PO Items To Bill",
|
||||
"columns": "Purchase Order\u0001ID,Purchase Order\u0001Supplier,Purchase Order\u0001Supplier Name,Purchase Order\u0001Status,Purchase Order\u0001PO Date,Purchase Order\u0001Fiscal Year,Purchase Order Item\u0001Material Request No,Purchase Order Item\u0001Item Code,Purchase Order Item\u0001Item Name,Purchase Order Item\u0001Description,Purchase Order Item\u0001Quantity,Purchase Order Item\u0001UOM,Purchase Order Item\u0001Received Qty"
|
||||
},
|
||||
{
|
||||
"name": "pending_po_items_to_bill",
|
||||
"doctype": "Search Criteria"
|
||||
}
|
||||
]
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,20 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
report.customize_filters = function() {
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user