Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
687a655b36
@ -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.add_filter({fieldname:'show_group_balance', label:'Show Group Balance', fieldtype:'Select', options:NEWLINE+'Yes'+NEWLINE+'No',ignore : 1, parent:'Account'});
|
||||
this.add_filter({fieldname:'level', label:'Level', fieldtype:'Data', default:3,ignore : 1, parent:'Account'});
|
||||
|
||||
this.add_filter({fieldname:'from_date', label:'Date', fieldtype:'Date', parent:'Account'});
|
||||
|
||||
|
||||
this.filter_fields_dict['Account'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
//this.filter_fields_dict['Account'+FILTER_SEP +'From Date'].df.filter_hide = 0;
|
||||
//this.filter_fields_dict['Account'+FILTER_SEP +'To Date'].df.filter_hide = 0;
|
||||
|
||||
//this.large_report = 1;
|
||||
}
|
||||
|
||||
report.aftertableprint = function(t) {
|
||||
$yt(t,'*',1,{whiteSpace:'pre'});
|
||||
}
|
@ -1,126 +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/>.
|
||||
|
||||
cl = [['Account','Data', '200px'],['Debit/Credit', 'Data', '100px'], ['Group/Ledger', 'Data', '100px'], ['Opening','Data', '100px'],['Closing', 'Data', '100px'],['Inc in Cash','Data','100px']]
|
||||
|
||||
for c in cl:
|
||||
colnames.append(c[0])
|
||||
coltypes.append(c[1])
|
||||
colwidths.append(c[2])
|
||||
coloptions.append('')
|
||||
col_idx[c[0]] = len(colnames)-1
|
||||
|
||||
|
||||
company = filter_values['company']
|
||||
|
||||
# transaction date
|
||||
if not filter_values.get('transaction_date') or not filter_values.get('transaction_date1'):
|
||||
msgprint("Please enter From Date and To Date")
|
||||
raise Exception
|
||||
else:
|
||||
from_date = add_days(filter_values['transaction_date'], -1)
|
||||
to_date = filter_values['transaction_date1']
|
||||
|
||||
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)",from_date)[0]
|
||||
|
||||
|
||||
if from_export == 0 and len(res) >250:
|
||||
msgprint("This is very large report and cannot be shown in the browser as it is likely to make your browser very slow. Please click on 'Export' to open in excel")
|
||||
raise Exception
|
||||
|
||||
total_debit, total_credit, total = 0,0,0
|
||||
glc = get_obj('GL Control')
|
||||
|
||||
for r in res:
|
||||
acc = r[col_idx['Account']].strip()
|
||||
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % acc)
|
||||
r.append(acc_det[0][0])
|
||||
r.append(acc_det[0][4])
|
||||
|
||||
opening = glc.get_as_on_balance(acc, fiscal_year, from_date, acc_det[0][0], acc_det[0][2], acc_det[0][3])[2]
|
||||
|
||||
amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc_det[0][2], acc_det[0][3]))
|
||||
if acc_det[0][0] == 'Debit':
|
||||
closing = opening + flt(amount[0][0]) - flt(amount[0][1])
|
||||
else:
|
||||
closing = opening + flt(amount[0][1]) - flt(amount[0][0])
|
||||
|
||||
r.append(fmt_money(flt(opening)))
|
||||
r.append(fmt_money(flt(closing)))
|
||||
|
||||
diff = flt(closing) - flt(opening)
|
||||
if acc_det[0][0]=='Debit':
|
||||
r.append(fmt_money(-diff))
|
||||
total -= diff
|
||||
else:
|
||||
r.append(fmt_money(diff))
|
||||
total += diff
|
||||
|
||||
|
||||
# net profit
|
||||
# ------------------
|
||||
|
||||
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where account_name = %s AND company=%s", ('Income',company))
|
||||
amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc_det[0][2], acc_det[0][3]))
|
||||
net_income = flt(amount[0][1]) - flt(amount[0][0])
|
||||
|
||||
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where account_name = %s AND company=%s", ('Expenses',company))
|
||||
amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc_det[0][2], acc_det[0][3]))
|
||||
net_expenses = flt(amount[0][0]) - flt(amount[0][1])
|
||||
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[col_idx['Account']] = 'Net Profit'
|
||||
t_row[col_idx['Inc in Cash']] = fmt_money(net_income - net_expenses)
|
||||
|
||||
total += net_income - net_expenses
|
||||
|
||||
res.append(t_row)
|
||||
|
||||
# total row
|
||||
# ------------------
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[col_idx['Account']] = 'Total Cash Generated'
|
||||
t_row[col_idx['Inc in Cash']] = fmt_money(total)
|
||||
|
||||
res.append(t_row)
|
||||
|
||||
# Show Inc / Dec in Bank and Cash Accounts
|
||||
# ----------------------------------------
|
||||
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
res.append(t_row)
|
||||
|
||||
acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger, name from tabAccount where account_type = 'Bank or Cash' AND company=%s AND level=%s", (company, cint(filter_values['level'])))
|
||||
for acc in acc_det:
|
||||
r = [acc[5],]
|
||||
|
||||
opening = glc.get_as_on_balance(acc[5], fiscal_year, from_date, acc[0], acc[2], acc[3])[2]
|
||||
|
||||
amount = sql("select sum(t1.debit), sum(t1.credit) from `tabGL Entry` t1, `tabAccount` t2 WHERE t1.posting_date >= '%s' AND t1.posting_date <= '%s' and ifnull(t1.is_opening,'No') = 'No' AND t1.account = t2.name AND t2.lft >= %s AND t2.rgt <= %s AND is_cancelled = 'No'" % (from_date,to_date, acc[2], acc[3]))
|
||||
closing = opening + flt(amount[0][0]) - flt(amount[0][1])
|
||||
diff = closing - opening
|
||||
|
||||
|
||||
r.append(acc_det[0][0])
|
||||
r.append(acc_det[0][4])
|
||||
|
||||
r.append(fmt_money(flt(opening)))
|
||||
r.append(fmt_money(flt(closing)))
|
||||
|
||||
r.append(fmt_money(diff))
|
||||
|
||||
res.append(r)
|
||||
|
@ -1,9 +0,0 @@
|
||||
SELECT
|
||||
DISTINCT 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.is_pl_account = 'No'
|
||||
AND node.level=%(level)s
|
||||
AND ifnull(node.account_type,'') != 'Bank or Cash'
|
||||
ORDER BY node.lft
|
@ -1,33 +0,0 @@
|
||||
# Search Criteria, cash_flow_statement
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-04-11 17:36:48',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-04-18 12:17:52',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Search Criteria
|
||||
{
|
||||
'columns': u'Account\x01ID',
|
||||
'criteria_name': u'Cash Flow Statement',
|
||||
'dis_filters': u'fiscal_year',
|
||||
'doc_type': u'Account',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': u"{'Account\x01Group or Ledger':'Ledger','Account\x01Is PL Account':'','Account\x01Is Active':'','Account\x01Account Type':'','Account\x01Company':'','Account\x01Fiscal Year':'','Account\x01Show Group Balance':'','Account\x01Level':'2'}",
|
||||
'module': u'Accounts',
|
||||
'name': '__common__',
|
||||
'sort_by': u'`tabAccount`.`name`',
|
||||
'sort_order': u'DESC',
|
||||
'standard': u'Yes'
|
||||
},
|
||||
|
||||
# Search Criteria, cash_flow_statement
|
||||
{
|
||||
'doctype': 'Search Criteria',
|
||||
'name': u'cash_flow_statement'
|
||||
}
|
||||
]
|
@ -0,0 +1,3 @@
|
||||
def execute():
|
||||
import webnotes
|
||||
webnotes.conn.sql("delete from `tabSearch Criteria` where name = 'cash_flow_statement'")
|
@ -529,4 +529,8 @@ patch_list = [
|
||||
'patch_module': 'patches.august_2012',
|
||||
'patch_file': 'repost_billed_amt',
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.august_2012',
|
||||
'patch_file': 'remove_cash_flow_statement',
|
||||
},
|
||||
]
|
Loading…
Reference in New Issue
Block a user