From 245f9207721132870c56d22726757f65eb0e6edb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 31 Aug 2012 11:01:21 +0530 Subject: [PATCH 1/2] removed cash flow statement --- .../cash_flow_statement/__init__.py | 0 .../cash_flow_statement.js | 34 ----- .../cash_flow_statement.py | 126 ------------------ .../cash_flow_statement.sql | 9 -- .../cash_flow_statement.txt | 33 ----- .../august_2012/remove_cash_flow_statement.py | 3 + erpnext/patches/patch_list.py | 4 + 7 files changed, 7 insertions(+), 202 deletions(-) delete mode 100644 erpnext/accounts/search_criteria/cash_flow_statement/__init__.py delete mode 100644 erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.js delete mode 100644 erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py delete mode 100644 erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.sql delete mode 100644 erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt create mode 100644 erpnext/patches/august_2012/remove_cash_flow_statement.py diff --git a/erpnext/accounts/search_criteria/cash_flow_statement/__init__.py b/erpnext/accounts/search_criteria/cash_flow_statement/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.js b/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.js deleted file mode 100644 index 8bcfa158b4..0000000000 --- a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.js +++ /dev/null @@ -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 . - -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'}); -} \ No newline at end of file diff --git a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py b/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py deleted file mode 100644 index 4c29803dc5..0000000000 --- a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.py +++ /dev/null @@ -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 . - -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) - diff --git a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.sql b/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.sql deleted file mode 100644 index 381e8de591..0000000000 --- a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.sql +++ /dev/null @@ -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 diff --git a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt b/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt deleted file mode 100644 index a9e748e098..0000000000 --- a/erpnext/accounts/search_criteria/cash_flow_statement/cash_flow_statement.txt +++ /dev/null @@ -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' - } -] \ No newline at end of file diff --git a/erpnext/patches/august_2012/remove_cash_flow_statement.py b/erpnext/patches/august_2012/remove_cash_flow_statement.py new file mode 100644 index 0000000000..a1243b807d --- /dev/null +++ b/erpnext/patches/august_2012/remove_cash_flow_statement.py @@ -0,0 +1,3 @@ +def execute(): + import webnotes + webnotes.conn.sql("delete from `tabSearch Criteria` where name = 'cash_flow_statement'") \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index d1d09e6608..e0895e5673 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -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', + }, ] \ No newline at end of file From 8981b586a1e0569c9e711921e2b1660c7a7b281a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 31 Aug 2012 12:03:46 +0530 Subject: [PATCH 2/2] fixed form header label issue: on change of field, label should change to Not Saved --- public/js/all-app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/all-app.js b/public/js/all-app.js index f7b34a30d1..cca206195d 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -1696,7 +1696,7 @@ d.cur_frm=f;d.dn=dn;d.table_form=f.meta.istable;f.refresh(dn);$(f.page_layout.wr */ _f.FrmHeader=Class.extend({init:function(parent,frm){this.appframe=new wn.ui.AppFrame(parent) this.appframe.$titlebar.append('\ - ');this.$w=this.appframe.$w;},refresh:function(){wn.views.breadcrumbs($(this.$w.find('.breadcrumb-area')),cur_frm.meta.module,cur_frm.meta.name,cur_frm.docname);this.refresh_labels();this.refresh_toolbar();},refresh_labels:function(){var labinfo={0:['Saved','label-success'],1:['Submitted','label-info'],2:['Cancelled','label-important']}[cint(cur_frm.doc.docstatus)];if(labinfo[0]=='Saved'&&cur_frm.meta.is_submittable){labinfo[0]='Saved, to Submit';} + ');this.$w=this.appframe.$w;},refresh:function(){wn.views.breadcrumbs($(this.$w.find('.breadcrumb-area')),cur_frm.meta.module,cur_frm.meta.name,cur_frm.docname);this.refresh_labels();this.refresh_toolbar();},refresh_labels:function(){cur_frm.doc=get_local(cur_frm.doc.doctype,cur_frm.doc.name);var labinfo={0:['Saved','label-success'],1:['Submitted','label-info'],2:['Cancelled','label-important']}[cint(cur_frm.doc.docstatus)];if(labinfo[0]=='Saved'&&cur_frm.meta.is_submittable){labinfo[0]='Saved, to Submit';} if(cur_frm.doc.__unsaved||cur_frm.doc.__islocal){labinfo[0]='Not Saved';labinfo[1]='label-warning'} this.set_label(labinfo);if(cur_frm.doc.__unsaved&&cint(cur_frm.doc.docstatus)==1&&this.appframe.buttons['Update']){this.appframe.buttons['Update'].toggle(true);}},set_label:function(labinfo){this.$w.find('.label').remove();$(repl('\ %(lab_status)s',{lab_status:labinfo[0],lab_class:labinfo[1]})).insertBefore(this.$w.find('.breadcrumb-area'))},refresh_toolbar:function(){this.appframe.clear_buttons();var p=cur_frm.get_doc_perms();if(cur_frm.meta.read_only_onload&&!cur_frm.doc.__islocal){if(!cur_frm.editable) @@ -1842,7 +1842,7 @@ this.copy_doc(fn,1);} _f.get_value=function(dt,dn,fn){if(locals[dt]&&locals[dt][dn]) return locals[dt][dn][fn];} _f.set_value=function(dt,dn,fn,v){var d=locals[dt][dn];if(!d){console.log('_f.set_value - '+fn+': "'+dt+','+dn+'" not found');return;} -var changed=d[fn]!=v;if(changed&&(d[fn]==null||v==null)&&(cstr(d[fn])==cstr(v)))changed=0;if(changed){var prev_unsaved=d.__unsaved +var changed=(d[fn]!=v);if(changed&&(d[fn]==null||v==null)&&(cstr(d[fn])==cstr(v)))changed=0;if(changed){var prev_unsaved=d.__unsaved d[fn]=v;d.__unsaved=1;if(d.parent&&d.parenttype){var doc=locals[d.parenttype][d.parent];doc.__unsaved=1;var frm=wn.views.formview[d.parenttype].frm;}else{var doc=locals[d.doctype][d.name] doc.__unsaved=1;var frm=wn.views.formview[d.doctype]&&wn.views.formview[d.doctype].frm;} if(frm&&frm==cur_frm&&frm.frm_head&&!prev_unsaved){frm.frm_head.refresh_labels();}}}