trial bal: added filter to select what to show(group/ledger/both) and optionto show/hide zero balance
This commit is contained in:
parent
3c48be9e60
commit
9bffdc95da
@ -1,7 +1,10 @@
|
||||
report.customize_filters = function() {
|
||||
this.hide_all_filters();
|
||||
|
||||
this.add_filter({fieldname:'show_group_balance', label:'Show Group Balance', fieldtype:'Select', options:'Yes'+NEWLINE+'No',ignore : 1, parent:'Account', 'report_default':'No','in_first_page':1});
|
||||
this.add_filter({fieldname:'show_group_ledger', label:'Show Group/Ledger', fieldtype:'Select', options:'Only Groups'+NEWLINE+'Only Ledgers'+NEWLINE+'Both But Without Group Balance'+NEWLINE+'Both With Balance',ignore : 1, parent:'Account', 'report_default':'Both With Balance','in_first_page':1,single_select:1});
|
||||
|
||||
this.add_filter({fieldname:'show_zero_balance', label:'Show Zero Balance', fieldtype:'Select', options:'Yes'+NEWLINE+'No',ignore : 1, parent:'Account', 'report_default':'Yes','in_first_page':1,single_select:1});
|
||||
|
||||
this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'Account', 'in_first_page':1});
|
||||
|
||||
this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
@ -22,10 +25,21 @@ report.customize_filters = function() {
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',1,{whiteSpace:'pre'});
|
||||
}
|
||||
if(window.location.href.search('/v170/') != -1) {
|
||||
this.mytabs.items['More Filters'].hide();
|
||||
this.mytabs.items['Select Columns'].hide();
|
||||
} else {
|
||||
$dh(this.mytabs.tabs['More Filters']);
|
||||
$dh(this.mytabs.tabs['Select Columns']);
|
||||
|
||||
$dh(this.mytabs.tabs['More Filters']);
|
||||
$dh(this.mytabs.tabs['Select Columns']);
|
||||
|
||||
report.get_query = function() {
|
||||
var g_or_l = this.get_filter('Account', 'Show Group/Ledger').get_value();
|
||||
var comp = this.get_filter('Account', 'Company').get_value();
|
||||
|
||||
if (g_or_l == 'Only Ledgers') {
|
||||
var q = "SELECT name FROM tabAccount WHERE group_or_ledger = 'Ledger' and company = '" + comp + "' and docstatus != 2 ORDER BY lft";
|
||||
} else if (g_or_l == 'Only Groups') {
|
||||
var q = "SELECT CONCAT( REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM tabAccount AS node,tabAccount AS parent WHERE (node.lft BETWEEN parent.lft AND parent.rgt) and node.group_or_ledger = 'Group' and node.company = '" + comp + "' and node.docstatus != 2 GROUP BY node.name ORDER BY node.lft";
|
||||
} else {
|
||||
var q = "SELECT CONCAT( REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM tabAccount AS node,tabAccount AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt and node.company = '" + comp + "' and node.docstatus != 2 GROUP BY node.name ORDER BY node.lft";
|
||||
}
|
||||
|
||||
return q;
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
# Columns
|
||||
#----------
|
||||
cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Is PL Account', 'Data', '100px'], ['Opening','Data', '100px'],['Debit', 'Data', '100px'],['Credit', 'Data', '100px'],['Closing', 'Data', '100px']]
|
||||
@ -42,7 +41,7 @@ total_debit, total_credit = 0,0
|
||||
glc = get_obj('GL Control')
|
||||
|
||||
# Main logic
|
||||
# ----------------
|
||||
# ----------
|
||||
for r in res:
|
||||
# Fetch account details
|
||||
acc = r[col_idx['Account']].strip()
|
||||
@ -51,8 +50,8 @@ for r in res:
|
||||
r.append(acc_det[0][4])
|
||||
r.append(acc_det[0][1])
|
||||
|
||||
# if group, check user input
|
||||
if acc_det[0][4] == 'Group' and filter_values.get('show_group_balance') == 'No':
|
||||
#if shows group and ledger both but without group balance
|
||||
if filter_values.get('show_group_ledger') == 'Both But Without Group Balance' and acc_det[0][4] == 'Group':
|
||||
for i in range(4):
|
||||
r.append('')
|
||||
continue
|
||||
@ -70,7 +69,7 @@ for r in res:
|
||||
if from_date_year == to_date_year:
|
||||
debit = flt(debit_on_todate) - flt(debit_on_fromdate)
|
||||
credit = flt(credit_on_todate) - flt(credit_on_fromdate)
|
||||
else: # may be wrong
|
||||
else: # if from date is start date of the year
|
||||
debit = flt(debit_on_todate)
|
||||
credit = flt(credit_on_todate)
|
||||
|
||||
@ -89,20 +88,18 @@ for r in res:
|
||||
r.append(flt(closing))
|
||||
|
||||
|
||||
# Remove accounts if closing bal = debit = credit = 0
|
||||
# -----------------------------------------------------
|
||||
|
||||
out =[]
|
||||
for r in res:
|
||||
if r[col_idx['Opening']] or r[col_idx['Debit']] or r[col_idx['Credit']] or r[col_idx['Closing']]:
|
||||
# Remove accounts if opening bal = debit = credit = closing bal = 0
|
||||
# ------------------------------------------------------------------
|
||||
if filter_values.get('show_zero_balance') != 'No':
|
||||
out.append(r)
|
||||
|
||||
if r[col_idx['Group/Ledger']] == 'Group' and filter_values.get('show_group_balance') == 'No':
|
||||
elif r[col_idx['Opening']] or r[col_idx['Debit']] or r[col_idx['Credit']] or r[col_idx['Closing']] or (r[col_idx['Group/Ledger']] == 'Group' and filter_values.get('show_group_ledger') == 'Both But Without Group Balance'):
|
||||
out.append(r)
|
||||
|
||||
# Total Debit / Credit
|
||||
# --------------------------
|
||||
if filter_values.get('show_group_balance') == 'No':
|
||||
if filter_values.get('show_group_ledger') in ['Only Ledgers', 'Both But Without Group Balance']:
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[col_idx['Account']] = 'Total'
|
||||
t_row[col_idx['Debit']] = total_debit
|
||||
|
@ -1 +0,0 @@
|
||||
SELECT CONCAT( REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM tabAccount AS node,tabAccount AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt and node.company = '%(company)s' and node.docstatus != 2 GROUP BY node.name ORDER BY node.lft
|
@ -1,24 +1,24 @@
|
||||
[
|
||||
{
|
||||
'add_col': None,
|
||||
'add_cond': '',
|
||||
'add_cond': None,
|
||||
'add_tab': None,
|
||||
'columns': 'Account\x01ID',
|
||||
'creation': '2010-12-14 10:33:08',
|
||||
'creation': '2010-12-14 10:23:28',
|
||||
'criteria_name': 'Trial Balance',
|
||||
'custom_query': None,
|
||||
'custom_query': '',
|
||||
'description': 'Trial Balance',
|
||||
'dis_filters': 'transaction_date',
|
||||
'disabled': None,
|
||||
'doc_type': 'Account',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Account\x01Group or Ledger':'Ledger','Account\x01Is PL Account':'','Account\x01Account Type':'','Account\x01Show Group Balance':''}",
|
||||
'filters': "{'Account\x01Is PL Account':'','Account\x01Account Type':''}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': None,
|
||||
'idx': None,
|
||||
'modified': '2010-11-25 12:25:28',
|
||||
'modified': '2011-06-22 12:29:43',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Accounts',
|
||||
'name': 'trial_balance',
|
||||
|
Loading…
x
Reference in New Issue
Block a user