From 76646fb279849deafe52ffc3451ac6d1945a6b08 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 1 May 2013 11:23:44 +0530 Subject: [PATCH 1/6] [script report] bank reconciliation statement in new style --- accounts/page/accounts_home/accounts_home.js | 5 ++ .../bank_reconciliation_statement/__init__.py | 0 .../bank_reconciliation_statement.js | 25 ++++++++ .../bank_reconciliation_statement.py | 63 +++++++++++++++++++ .../bank_reconciliation_statement.txt | 22 +++++++ 5 files changed, 115 insertions(+) create mode 100644 accounts/report/bank_reconciliation_statement/__init__.py create mode 100644 accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js create mode 100644 accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py create mode 100644 accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.txt diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js index 6a9f91a719..5779307f70 100644 --- a/accounts/page/accounts_home/accounts_home.js +++ b/accounts/page/accounts_home/accounts_home.js @@ -187,6 +187,11 @@ wn.module_page["Accounts"] = [ right: true, icon: "icon-list", items: [ + { + "label":wn._("Bank Reconciliation Statement"), + route: "query-report/Bank Reconciliation Statement", + doctype: "Journal Voucher" + }, { "label":wn._("Delivered Items To Be Billed"), route: "query-report/Delivered Items To Be Billed", diff --git a/accounts/report/bank_reconciliation_statement/__init__.py b/accounts/report/bank_reconciliation_statement/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js new file mode 100644 index 0000000000..28ac9205a6 --- /dev/null +++ b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js @@ -0,0 +1,25 @@ +wn.query_reports["Bank Reconciliation Statement"] = { + "filters": [ + { + "fieldname":"account", + "label": "Bank Account", + "fieldtype": "Link", + "options": "Account", + "get_query": function() { + return { + "query": "accounts.utils.get_account_list", + "filters": { + "is_pl_account": "No", + "account_type": "Bank or Cash" + } + } + } + }, + { + "fieldname":"report_date", + "label": "Date", + "fieldtype": "Date", + "default": get_today() + }, + ] +} \ No newline at end of file diff --git a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py new file mode 100644 index 0000000000..4275958e5d --- /dev/null +++ b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py @@ -0,0 +1,63 @@ +from __future__ import unicode_literals +import webnotes +from webnotes import _, msgprint +from webnotes.utils import flt + +def execute(filters=None): + if not filters: filters = {} + + columns = get_columns() + data = get_entries(filters) + + from accounts.utils import get_balance_on + balance_as_per_company = get_balance_on(filters["account"], filters["report_date"]) + + total_debit, total_credit = 0,0 + for d in data: + total_debit += flt(d[4]) + total_credit += flt(d[5]) + + if webnotes.conn.get_value("Account", filters["account"], "debit_or_credit") == 'Debit': + bank_bal = flt(balance_as_per_company) - flt(total_debit) + flt(total_credit) + else: + bank_bal = flt(balance_as_per_company) + flt(total_debit) - flt(total_credit) + + data += [ + ["", "", "", "Balance as per company books", balance_as_per_company, ""], + ["", "", "", "Amounts not reflected in bank", total_debit, total_credit], + ["", "", "", "Balance as per bank", bank_bal, ""] + ] + + return columns, data + + +def get_columns(): + return ["Journal Voucher:Link/Journal Voucher:140", "Posting Date:Date:100", + "Clearance Date:Date:110", "Against Account:Link/Account:200", + "Debit:Currency:120", "Credit:Currency:120" + ] + +def get_conditions(filters): + conditions = "" + if not filters.get("account"): + msgprint(_("Please select Bank Account"), raise_exception=1) + else: + conditions += " and jvd.account = %(account)s" + + if not filters.get("report_date"): + msgprint(_("Please select Date on which you want to run the report"), raise_exception=1) + else: + conditions += """ and jv.posting_date <= %(report_date)s + and ifnull(jv.clearance_date, '4000-01-01') > %(report_date)s""" + + return conditions + +def get_entries(filters): + conditions = get_conditions(filters) + entries = webnotes.conn.sql("""select jv.name, jv.posting_date, jv.clearance_date, + jvd.against_account, jvd.debit, jvd.credit + from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv + where jvd.parent = jv.name and jv.docstatus=1 and ifnull(jv.cheque_no, '')!= '' %s + order by jv.name DESC""" % conditions, filters, as_list=1) + + return entries \ No newline at end of file diff --git a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.txt b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.txt new file mode 100644 index 0000000000..9867c5ded7 --- /dev/null +++ b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.txt @@ -0,0 +1,22 @@ +[ + { + "creation": "2013-04-30 18:30:21", + "docstatus": 0, + "modified": "2013-05-01 10:53:12", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "add_total_row": 0, + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "ref_doctype": "Journal Voucher", + "report_name": "Bank Reconciliation Statement", + "report_type": "Script Report" + }, + { + "doctype": "Report", + "name": "Bank Reconciliation Statement" + } +] \ No newline at end of file From e388465e17acf20a00bf54c2870c7944d3524aa0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 1 May 2013 12:23:07 +0530 Subject: [PATCH 2/6] [script report] bank clearance summary --- accounts/page/accounts_home/accounts_home.js | 5 ++ .../report/bank_clearance_summary/__init__.py | 0 .../bank_clearance_summary.js | 32 +++++++++++ .../bank_clearance_summary.py | 54 +++++++++++++++++++ .../bank_clearance_summary.txt | 21 ++++++++ .../bank_reconciliation_statement.py | 16 ++++++ .../delivered_items_to_be_billed.txt | 4 +- 7 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 accounts/report/bank_clearance_summary/__init__.py create mode 100644 accounts/report/bank_clearance_summary/bank_clearance_summary.js create mode 100644 accounts/report/bank_clearance_summary/bank_clearance_summary.py create mode 100644 accounts/report/bank_clearance_summary/bank_clearance_summary.txt diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js index 5779307f70..99d92b576c 100644 --- a/accounts/page/accounts_home/accounts_home.js +++ b/accounts/page/accounts_home/accounts_home.js @@ -202,6 +202,11 @@ wn.module_page["Accounts"] = [ route: "query-report/Ordered Items To Be Billed", doctype: "Sales Invoice" }, + { + "label":wn._("Bank Clearance Summary"), + route: "query-report/Bank Clearance Summary", + doctype: "Journal Voucher" + }, ] } ] diff --git a/accounts/report/bank_clearance_summary/__init__.py b/accounts/report/bank_clearance_summary/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/accounts/report/bank_clearance_summary/bank_clearance_summary.js b/accounts/report/bank_clearance_summary/bank_clearance_summary.js new file mode 100644 index 0000000000..76adfd3174 --- /dev/null +++ b/accounts/report/bank_clearance_summary/bank_clearance_summary.js @@ -0,0 +1,32 @@ +wn.query_reports["Bank Clearance Summary"] = { + "filters": [ + { + "fieldname":"from_date", + "label": "From Date", + "fieldtype": "Date", + "default": wn.defaults.get_user_default("year_start_date"), + "width": "80" + }, + { + "fieldname":"to_date", + "label": "To Date", + "fieldtype": "Date", + "default": get_today() + }, + { + "fieldname":"account", + "label": "Bank Account", + "fieldtype": "Link", + "options": "Account", + "get_query": function() { + return { + "query": "accounts.utils.get_account_list", + "filters": { + "is_pl_account": "No", + "account_type": "Bank or Cash" + } + } + } + }, + ] +} \ No newline at end of file diff --git a/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/accounts/report/bank_clearance_summary/bank_clearance_summary.py new file mode 100644 index 0000000000..49ac1a46c8 --- /dev/null +++ b/accounts/report/bank_clearance_summary/bank_clearance_summary.py @@ -0,0 +1,54 @@ +# 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 . + +from __future__ import unicode_literals +import webnotes +from webnotes import _, msgprint + +def execute(filters=None): + if not filters: filters = {} + + columns = get_columns() + data = get_entries(filters) + + return columns, data + +def get_columns(): + return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140", + "Posting Date:Date:100", "Clearance Date:Date:110", "Against Account:Link/Account:200", + "Debit:Currency:120", "Credit:Currency:120" + ] + +def get_conditions(filters): + conditions = "" + if not filters.get("account"): + msgprint(_("Please select Bank Account"), raise_exception=1) + else: + conditions += " and jvd.account = %(account)s" + + if filters.get("from_date"): conditions += " and jv.posting_date>=%(from_date)s" + if filters.get("to_date"): conditions += " and jv.posting_date<=%(to_date)s" + + return conditions + +def get_entries(filters): + conditions = get_conditions(filters) + entries = webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date, + jv.clearance_date, jvd.against_account, jvd.debit, jvd.credit + from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv + where jvd.parent = jv.name and jv.docstatus=1 %s + order by jv.name DESC""" % conditions, filters, as_list=1) + return entries \ No newline at end of file diff --git a/accounts/report/bank_clearance_summary/bank_clearance_summary.txt b/accounts/report/bank_clearance_summary/bank_clearance_summary.txt new file mode 100644 index 0000000000..3dd2079f3a --- /dev/null +++ b/accounts/report/bank_clearance_summary/bank_clearance_summary.txt @@ -0,0 +1,21 @@ +[ + { + "creation": "2013-05-01 12:13:25", + "docstatus": 0, + "modified": "2013-05-01 12:13:25", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "ref_doctype": "Journal Voucher", + "report_name": "Bank Clearance Summary", + "report_type": "Script Report" + }, + { + "doctype": "Report", + "name": "Bank Clearance Summary" + } +] \ No newline at end of file diff --git a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py index 4275958e5d..1345cd8006 100644 --- a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py +++ b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py @@ -1,3 +1,19 @@ +# 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 . + from __future__ import unicode_literals import webnotes from webnotes import _, msgprint diff --git a/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt b/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt index c84854f39d..e84c597b1d 100644 --- a/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt +++ b/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-02-22 17:55:23", + "creation": "2013-02-25 10:38:57", "docstatus": 0, - "modified": "2013-02-23 14:35:28", + "modified": "2013-05-01 11:56:43", "modified_by": "Administrator", "owner": "Administrator" }, From 006d074b260574d5d1b556b0f8e9fb96d2c9d327 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 1 May 2013 15:05:29 +0530 Subject: [PATCH 3/6] [script report] collection report --- .../accounts_payable/accounts_payable.py | 5 +- .../accounts_receivable.py | 7 +- accounts/report/collection_report/__init__.py | 0 .../collection_report/collection_report.js | 42 +++++++++ .../collection_report/collection_report.py | 86 +++++++++++++++++++ .../collection_report/collection_report.txt | 22 +++++ .../purchase_register/purchase_register.py | 1 - .../report/sales_register/sales_register.py | 2 - 8 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 accounts/report/collection_report/__init__.py create mode 100644 accounts/report/collection_report/collection_report.js create mode 100644 accounts/report/collection_report/collection_report.py create mode 100644 accounts/report/collection_report/collection_report.txt diff --git a/accounts/report/accounts_payable/accounts_payable.py b/accounts/report/accounts_payable/accounts_payable.py index a10dc7e7e7..5e944a1b84 100644 --- a/accounts/report/accounts_payable/accounts_payable.py +++ b/accounts/report/accounts_payable/accounts_payable.py @@ -67,8 +67,7 @@ def get_gl_entries(filters, before_report_date=True): gl_entries = [] gl_entries = webnotes.conn.sql("""select * from `tabGL Entry` where ifnull(is_cancelled, 'No') = 'No' %s order by posting_date, account""" % - (conditions) % (", ".join(['%s']*len(supplier_accounts))), - tuple(supplier_accounts), as_dict=1) + (conditions), tuple(supplier_accounts), as_dict=1) return gl_entries def get_conditions(filters, before_report_date=True): @@ -85,7 +84,7 @@ def get_conditions(filters, before_report_date=True): conditions, filters) if supplier_accounts: - conditions += " and account in (%s)" + conditions += " and account in (%s)" % (", ".join(['%s']*len(supplier_accounts))) if filters.get("report_date"): if before_report_date: diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index a8c6d2311e..47908c3f13 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -58,8 +58,7 @@ def get_gl_entries(filters, upto_report_date=True): conditions, customer_accounts = get_conditions(filters, upto_report_date) return webnotes.conn.sql("""select * from `tabGL Entry` where ifnull(is_cancelled, 'No') = 'No' %s order by posting_date, account""" % - (conditions) % (", ".join(['%s']*len(customer_accounts))), - tuple(customer_accounts), as_dict=1) + (conditions), tuple(customer_accounts), as_dict=1) def get_conditions(filters, upto_report_date=True): conditions = "" @@ -75,7 +74,7 @@ def get_conditions(filters, upto_report_date=True): conditions, filters) if customer_accounts: - conditions += " and account in (%s)" + conditions += " and account in (%s)" % (", ".join(['%s']*len(customer_accounts))) if filters.get("report_date"): if upto_report_date: @@ -96,7 +95,7 @@ def get_account_territory_map(): def get_si_due_date_map(): """ get due_date from sales invoice """ si_due_date_map = {} - for t in webnotes.conn.sql("""select name, due_date from `tabSales Invoice` group by name"""): + for t in webnotes.conn.sql("""select name, due_date from `tabSales Invoice`"""): si_due_date_map[t[0]] = t[1] return si_due_date_map diff --git a/accounts/report/collection_report/__init__.py b/accounts/report/collection_report/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/accounts/report/collection_report/collection_report.js b/accounts/report/collection_report/collection_report.js new file mode 100644 index 0000000000..697a779c16 --- /dev/null +++ b/accounts/report/collection_report/collection_report.js @@ -0,0 +1,42 @@ +wn.query_reports["Collection Report"] = { + "filters": [ + { + "fieldname":"from_date", + "label": "From Date", + "fieldtype": "Date", + "default": wn.defaults.get_user_default("year_start_date"), + "width": "80" + }, + { + "fieldname":"to_date", + "label": "To Date", + "fieldtype": "Date", + "default": get_today() + }, + { + "fieldname":"account", + "label": "Customer Account", + "fieldtype": "Link", + "options": "Account", + "get_query": function() { + var company = wn.query_report.filters_by_name.company.get_value(); + return { + "query": "accounts.utils.get_account_list", + "filters": { + "is_pl_account": "No", + "debit_or_credit": "Debit", + "company": company, + "master_type": "Customer" + } + } + } + }, + { + "fieldname":"company", + "label": "Company", + "fieldtype": "Link", + "options": "Company", + "default": sys_defaults.company + }, + ] +} \ No newline at end of file diff --git a/accounts/report/collection_report/collection_report.py b/accounts/report/collection_report/collection_report.py new file mode 100644 index 0000000000..50f74e0e82 --- /dev/null +++ b/accounts/report/collection_report/collection_report.py @@ -0,0 +1,86 @@ +# 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 . + +from __future__ import unicode_literals +import webnotes +from accounts.report.accounts_receivable.accounts_receivable import get_ageing_data + +def execute(filters=None): + if not filters: filters = {} + + columns = get_columns() + entries = get_entries(filters) + si_posting_date_map = get_si_posting_date_map() + + data = [] + for d in entries: + against_invoice_date = d.against_invoice and si_posting_date_map[d.against_invoice] or "" + + row = [d.name, d.account, d.posting_date, d.against_invoice, against_invoice_date, + d.debit, d.credit, d.cheque_no, d.cheque_date, d.remark] + + if d.against_invoice: + row += get_ageing_data(against_invoice_date, d.posting_date, d.credit or -1*d.debit) + else: + row += ["", "", "", "", ""] + + data.append(row) + + return columns, data + +def get_columns(): + return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140", + "Posting Date:Date:100", "Against Invoice:Link/Sales Invoice:130", + "Against Invoice Posting Date:Date:130", "Debit:Currency:120", "Credit:Currency:120", + "Reference No::100", "Reference Date:Date:100", "Remarks::150", "Age:Int:40", + "0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100" + ] + +def get_conditions(filters): + conditions = "" + + customer_accounts = [] + if filters.get("account"): + customer_accounts = [filters["account"]] + elif filters.get("company"): + customer_accounts = webnotes.conn.sql_list("""select name from `tabAccount` + where ifnull(master_type, '') = 'Customer' and docstatus < 2 + and company = %s""", filters["company"]) + + if customer_accounts: + conditions += " and jvd.account in (%s)" % (", ".join(['%s']*len(customer_accounts))) + + if filters.get("from_date"): conditions += " and jv.posting_date >= '%s'" % filters["from_date"] + if filters.get("to_date"): conditions += " and jv.posting_date <= '%s'" % filters["to_date"] + + return conditions, customer_accounts + +def get_entries(filters): + conditions, customer_accounts = get_conditions(filters) + entries = webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date, + jvd.against_invoice, jvd.debit, jvd.credit, jv.cheque_no, jv.cheque_date, jv.remark + from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv + where jvd.parent = jv.name and jv.docstatus=1 %s order by jv.name DESC""" % + (conditions), tuple(customer_accounts), as_dict=1) + + return entries + +def get_si_posting_date_map(): + si_posting_date_map = {} + for t in webnotes.conn.sql("""select name, posting_date from `tabSales Invoice`"""): + si_posting_date_map[t[0]] = t[1] + + return si_posting_date_map \ No newline at end of file diff --git a/accounts/report/collection_report/collection_report.txt b/accounts/report/collection_report/collection_report.txt new file mode 100644 index 0000000000..3933dee3a6 --- /dev/null +++ b/accounts/report/collection_report/collection_report.txt @@ -0,0 +1,22 @@ +[ + { + "creation": "2013-05-01 12:29:12", + "docstatus": 0, + "modified": "2013-05-01 12:29:12", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "add_total_row": 1, + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "ref_doctype": "Journal Voucher", + "report_name": "Collection Report", + "report_type": "Script Report" + }, + { + "doctype": "Report", + "name": "Collection Report" + } +] \ No newline at end of file diff --git a/accounts/report/purchase_register/purchase_register.py b/accounts/report/purchase_register/purchase_register.py index 01dc93700b..c131c17b4b 100644 --- a/accounts/report/purchase_register/purchase_register.py +++ b/accounts/report/purchase_register/purchase_register.py @@ -141,7 +141,6 @@ def get_account_details(invoice_list): accounts = list(set([inv.credit_to for inv in invoice_list])) for acc in webnotes.conn.sql("""select name, parent_account from tabAccount where name in (%s)""" % ", ".join(["%s"]*len(accounts)), tuple(accounts), as_dict=1): - account_map.setdefault(acc.name, "") account_map[acc.name] = acc.parent_account return account_map \ No newline at end of file diff --git a/accounts/report/sales_register/sales_register.py b/accounts/report/sales_register/sales_register.py index a0020c45a0..23d2227fc2 100644 --- a/accounts/report/sales_register/sales_register.py +++ b/accounts/report/sales_register/sales_register.py @@ -145,7 +145,6 @@ def get_customer_deatils(invoice_list): customers = list(set([inv.customer for inv in invoice_list])) for cust in webnotes.conn.sql("""select name, territory from `tabCustomer` where name in (%s)""" % ", ".join(["%s"]*len(customers)), tuple(customers), as_dict=1): - customer_map.setdefault(cust.name, "") customer_map[cust.name] = cust.territory return customer_map @@ -155,7 +154,6 @@ def get_account_details(invoice_list): accounts = list(set([inv.debit_to for inv in invoice_list])) for acc in webnotes.conn.sql("""select name, parent_account from tabAccount where name in (%s)""" % ", ".join(["%s"]*len(accounts)), tuple(accounts), as_dict=1): - account_map.setdefault(acc.name, "") account_map[acc.name] = acc.parent_account return account_map \ No newline at end of file From 81bbfba0cc212ce38c29ca1094e7168935c4f9d4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 2 May 2013 11:27:25 +0530 Subject: [PATCH 4/6] [hr] allowed rename in earning and deduction type --- .../accounts_payable/accounts_payable.py | 19 ++-------- .../collection_report/collection_report.js | 2 +- hr/doctype/deduction_type/deduction_type.txt | 5 +-- hr/doctype/earning_type/earning_type.txt | 5 +-- stock/doctype/batch/batch.txt | 35 +++++-------------- 5 files changed, 18 insertions(+), 48 deletions(-) diff --git a/accounts/report/accounts_payable/accounts_payable.py b/accounts/report/accounts_payable/accounts_payable.py index 5e944a1b84..4e9b2c88ba 100644 --- a/accounts/report/accounts_payable/accounts_payable.py +++ b/accounts/report/accounts_payable/accounts_payable.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals import webnotes from webnotes.utils import getdate, nowdate, flt, cstr +from accounts.report.accounts_receivable.accounts_receivable import get_ageing_data def execute(filters=None): if not filters: filters = {} @@ -124,20 +125,4 @@ def get_paid_amount(gle, report_date, entries_after_report_date): and against_voucher = %s and name != %s and ifnull(is_cancelled, 'No') = 'No'""", (gle.account, report_date, gle.voucher_type, gle.voucher_no, gle.name))[0][0] - return flt(paid_amount) - -def get_ageing_data(ageing_based_on_date, age_on, outstanding_amount): - val1 = val2 = val3 = val4 = diff = 0 - diff = age_on and ageing_based_on_date \ - and (getdate(age_on) - getdate(ageing_based_on_date)).days or 0 - - if diff <= 30: - val1 = outstanding_amount - elif 30 < diff <= 60: - val2 = outstanding_amount - elif 60 < diff <= 90: - val3 = outstanding_amount - elif diff > 90: - val4 = outstanding_amount - - return [diff, val1, val2, val3, val4] \ No newline at end of file + return flt(paid_amount) \ No newline at end of file diff --git a/accounts/report/collection_report/collection_report.js b/accounts/report/collection_report/collection_report.js index 697a779c16..b370453c5f 100644 --- a/accounts/report/collection_report/collection_report.js +++ b/accounts/report/collection_report/collection_report.js @@ -1,7 +1,7 @@ wn.query_reports["Collection Report"] = { "filters": [ { - "fieldname":"from_date", + "fieldname": "from_date", "label": "From Date", "fieldtype": "Date", "default": wn.defaults.get_user_default("year_start_date"), diff --git a/hr/doctype/deduction_type/deduction_type.txt b/hr/doctype/deduction_type/deduction_type.txt index 4c9ad7ac4c..f3467936f5 100644 --- a/hr/doctype/deduction_type/deduction_type.txt +++ b/hr/doctype/deduction_type/deduction_type.txt @@ -1,12 +1,13 @@ [ { - "creation": "2013-01-10 16:34:13", + "creation": "2013-01-22 16:50:30", "docstatus": 0, - "modified": "2013-01-22 14:25:38", + "modified": "2013-05-02 11:22:59", "modified_by": "Administrator", "owner": "Administrator" }, { + "allow_rename": 1, "autoname": "field:deduction_name", "doctype": "DocType", "document_type": "Master", diff --git a/hr/doctype/earning_type/earning_type.txt b/hr/doctype/earning_type/earning_type.txt index 18cac6821a..d69f48619c 100644 --- a/hr/doctype/earning_type/earning_type.txt +++ b/hr/doctype/earning_type/earning_type.txt @@ -1,12 +1,13 @@ [ { - "creation": "2013-01-10 16:34:13", + "creation": "2013-01-24 11:03:32", "docstatus": 0, - "modified": "2013-01-23 16:32:07", + "modified": "2013-05-02 11:22:48", "modified_by": "Administrator", "owner": "Administrator" }, { + "allow_rename": 1, "autoname": "field:earning_name", "doctype": "DocType", "document_type": "Master", diff --git a/stock/doctype/batch/batch.txt b/stock/doctype/batch/batch.txt index 4722996c0f..c6ed3c370a 100644 --- a/stock/doctype/batch/batch.txt +++ b/stock/doctype/batch/batch.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-01 19:09:43", + "creation": "2013-03-05 14:50:38", "docstatus": 0, - "modified": "2013-03-01 08:22:16", + "modified": "2013-05-01 15:49:47", "modified_by": "Administrator", "owner": "harshada@webnotestech.com" }, @@ -24,14 +24,19 @@ "permlevel": 0 }, { + "cancel": 1, + "create": 1, "doctype": "DocPerm", "name": "__common__", "parent": "Batch", "parentfield": "permissions", "parenttype": "DocType", + "permlevel": 0, "read": 1, + "report": 1, "role": "Material Master Manager", - "submit": 0 + "submit": 0, + "write": 1 }, { "doctype": "DocType", @@ -94,28 +99,6 @@ "oldfieldtype": "Date" }, { - "doctype": "DocField", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "oldfieldtype": "Small Text", - "read_only": 1 - }, - { - "cancel": 1, - "create": 1, - "doctype": "DocPerm", - "permlevel": 0, - "report": 1, - "write": 1 - }, - { - "amend": 0, - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "match": "", - "permlevel": 1 + "doctype": "DocPerm" } ] \ No newline at end of file From f2edbbd5cb4b0f3c80eeee58634f38cb33e0cf7b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 2 May 2013 11:49:02 +0530 Subject: [PATCH 5/6] [serial no][validation] status delivered -> in store, allowed for material receipt --- stock/doctype/stock_ledger/stock_ledger.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stock/doctype/stock_ledger/stock_ledger.py b/stock/doctype/stock_ledger/stock_ledger.py index 3c83de3260..8fdb50e7a4 100644 --- a/stock/doctype/stock_ledger/stock_ledger.py +++ b/stock/doctype/stock_ledger/stock_ledger.py @@ -114,7 +114,8 @@ class DocType: def update_serial_purchase_details(self, obj, d, serial_no, is_submit, purpose = '', rejected=None): exists = webnotes.conn.sql("select name, status, docstatus from `tabSerial No` where name = '%s'" % (serial_no)) if is_submit: - if exists and exists[0][2] != 2 and purpose not in ['Material Transfer', 'Sales Return']: + if exists and exists[0][2] != 2 and \ + purpose not in ['Material Transfer', "Material Receipt", 'Sales Return']: msgprint("Serial No: %s already %s" % (serial_no, exists and exists[0][1]), raise_exception = 1) elif exists: s = Document('Serial No', exists and exists[0][0]) From d7889cd5d505e4104aa60afb5192500f69cd805c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 2 May 2013 12:14:59 +0530 Subject: [PATCH 6/6] [script report] payment collection with ageing --- accounts/page/accounts_home/accounts_home.js | 5 +++++ .../__init__.py | 0 .../payment_collection_with_ageing.js} | 2 +- .../payment_collection_with_ageing.py} | 0 .../payment_collection_with_ageing.txt} | 8 ++++---- 5 files changed, 10 insertions(+), 5 deletions(-) rename accounts/report/{collection_report => payment_collection_with_ageing}/__init__.py (100%) rename accounts/report/{collection_report/collection_report.js => payment_collection_with_ageing/payment_collection_with_ageing.js} (94%) rename accounts/report/{collection_report/collection_report.py => payment_collection_with_ageing/payment_collection_with_ageing.py} (100%) rename accounts/report/{collection_report/collection_report.txt => payment_collection_with_ageing/payment_collection_with_ageing.txt} (63%) diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js index 99d92b576c..7038fe9720 100644 --- a/accounts/page/accounts_home/accounts_home.js +++ b/accounts/page/accounts_home/accounts_home.js @@ -207,6 +207,11 @@ wn.module_page["Accounts"] = [ route: "query-report/Bank Clearance Summary", doctype: "Journal Voucher" }, + { + "label":wn._("Payment Collection With Ageing"), + route: "query-report/Payment Collection With Ageing", + doctype: "Journal Voucher" + }, ] } ] diff --git a/accounts/report/collection_report/__init__.py b/accounts/report/payment_collection_with_ageing/__init__.py similarity index 100% rename from accounts/report/collection_report/__init__.py rename to accounts/report/payment_collection_with_ageing/__init__.py diff --git a/accounts/report/collection_report/collection_report.js b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.js similarity index 94% rename from accounts/report/collection_report/collection_report.js rename to accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.js index b370453c5f..d608fbd1d8 100644 --- a/accounts/report/collection_report/collection_report.js +++ b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.js @@ -1,4 +1,4 @@ -wn.query_reports["Collection Report"] = { +wn.query_reports["Payment Collection With Ageing"] = { "filters": [ { "fieldname": "from_date", diff --git a/accounts/report/collection_report/collection_report.py b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.py similarity index 100% rename from accounts/report/collection_report/collection_report.py rename to accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.py diff --git a/accounts/report/collection_report/collection_report.txt b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.txt similarity index 63% rename from accounts/report/collection_report/collection_report.txt rename to accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.txt index 3933dee3a6..3405d197a7 100644 --- a/accounts/report/collection_report/collection_report.txt +++ b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-05-01 12:29:12", + "creation": "2013-05-02 12:09:51", "docstatus": 0, - "modified": "2013-05-01 12:29:12", + "modified": "2013-05-02 12:09:51", "modified_by": "Administrator", "owner": "Administrator" }, @@ -12,11 +12,11 @@ "is_standard": "Yes", "name": "__common__", "ref_doctype": "Journal Voucher", - "report_name": "Collection Report", + "report_name": "Payment Collection With Ageing", "report_type": "Script Report" }, { "doctype": "Report", - "name": "Collection Report" + "name": "Payment Collection With Ageing" } ] \ No newline at end of file