mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 23:19:20 +00:00
[conflicts] [merged]
This commit is contained in:
@@ -81,7 +81,7 @@ class DocType(DocTypeNestedSet):
|
||||
"""
|
||||
Cost Center name must be unique
|
||||
"""
|
||||
if (self.doc.__islocal or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
|
||||
if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
|
||||
msgprint("Cost Center Name already exists, please rename", raise_exception=1)
|
||||
|
||||
self.validate_mandatory()
|
||||
|
||||
@@ -108,8 +108,8 @@ class DocType:
|
||||
and not 'Accounts Manager' in webnotes.user.get_roles():
|
||||
msgprint(_("Account") + ": " + self.doc.account + _(" has been freezed. \
|
||||
Only Accounts Manager can do transaction against this account"), raise_exception=1)
|
||||
|
||||
if ret and ret[0]["company"] != self.doc.company:
|
||||
|
||||
if self.doc.is_cancelled in ("No", None) and ret and ret[0]["company"] != self.doc.company:
|
||||
msgprint(_("Account") + ": " + self.doc.account + _(" does not belong to the company") \
|
||||
+ ": " + self.doc.company, raise_exception=1)
|
||||
|
||||
@@ -124,9 +124,10 @@ class DocType:
|
||||
|
||||
return self.cost_center_company[self.doc.cost_center]
|
||||
|
||||
if self.doc.cost_center and _get_cost_center_company() != self.doc.company:
|
||||
msgprint(_("Cost Center") + ": " + self.doc.cost_center \
|
||||
+ _(" does not belong to the company") + ": " + self.doc.company, raise_exception=True)
|
||||
if self.doc.is_cancelled in ("No", None) and \
|
||||
self.doc.cost_center and _get_cost_center_company() != self.doc.company:
|
||||
msgprint(_("Cost Center") + ": " + self.doc.cost_center \
|
||||
+ _(" does not belong to the company") + ": " + self.doc.company, raise_exception=True)
|
||||
|
||||
def check_freezing_date(self, adv_adj):
|
||||
"""
|
||||
|
||||
@@ -1283,18 +1283,6 @@
|
||||
"read_only": 0,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"report": 0,
|
||||
"role": "Accounts Manager",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
@@ -1302,33 +1290,10 @@
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"report": 0,
|
||||
"role": "Accounts User",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"match": "customer",
|
||||
@@ -1336,9 +1301,4 @@
|
||||
"report": 1,
|
||||
"role": "Customer"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Retail User"
|
||||
}
|
||||
]
|
||||
@@ -154,6 +154,11 @@ wn.module_page["Accounts"] = [
|
||||
route: "query-report/Sales Register",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Purchase Register"),
|
||||
route: "query-report/Purchase Register",
|
||||
doctype: "Purchase Invoice"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -182,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",
|
||||
@@ -192,6 +202,21 @@ 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"
|
||||
},
|
||||
{
|
||||
"label":wn._("Payment Collection With Ageing"),
|
||||
route: "query-report/Payment Collection With Ageing",
|
||||
doctype: "Journal Voucher"
|
||||
},
|
||||
{
|
||||
"label":wn._("Payment Made With Ageing"),
|
||||
route: "query-report/Payment Made With Ageing",
|
||||
doctype: "Journal Voucher"
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -186,7 +186,6 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
||||
var totals = this.make_summary_row("Totals", this.account);
|
||||
|
||||
var grouped_ledgers = {};
|
||||
|
||||
$.each(data, function(i, item) {
|
||||
if((me.is_default("company") ? true : me.apply_filter(item, "company")) &&
|
||||
(me.account ? me.is_child_account(me.account, item.account)
|
||||
@@ -217,8 +216,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
||||
grouped_ledgers[item.account].totals.debit += item.debit;
|
||||
grouped_ledgers[item.account].totals.credit += item.credit;
|
||||
}
|
||||
|
||||
if(me.account) {
|
||||
if(item.account) {
|
||||
item.against_account = me.voucher_accounts[item.voucher_type + ":"
|
||||
+ item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", ");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import getdate, nowdate, flt, cstr
|
||||
from webnotes import msgprint, _
|
||||
from accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
@@ -19,7 +21,6 @@ def execute(filters=None):
|
||||
and nowdate() or filters.get("report_date")
|
||||
|
||||
data = []
|
||||
total_invoiced_amount = total_paid = total_outstanding = 0
|
||||
for gle in entries:
|
||||
if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
|
||||
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
|
||||
@@ -36,7 +37,7 @@ def execute(filters=None):
|
||||
paid_amount = get_paid_amount(gle, filters.get("report_date") or nowdate(),
|
||||
entries_after_report_date)
|
||||
outstanding_amount = invoiced_amount - paid_amount
|
||||
|
||||
|
||||
if abs(flt(outstanding_amount)) > 0.01:
|
||||
row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no,
|
||||
gle.remarks, account_supplier_type_map.get(gle.account), due_date, bill_no,
|
||||
@@ -47,16 +48,9 @@ def execute(filters=None):
|
||||
ageing_based_on_date = due_date
|
||||
else:
|
||||
ageing_based_on_date = gle.posting_date
|
||||
|
||||
row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
|
||||
|
||||
# Add to total
|
||||
total_invoiced_amount += flt(invoiced_amount)
|
||||
total_paid += flt(paid_amount)
|
||||
total_outstanding += flt(outstanding_amount)
|
||||
data.append(row)
|
||||
if data:
|
||||
data.append(["", "", "", "", "", "", "", "Total", "", total_invoiced_amount, total_paid,
|
||||
total_outstanding, "", "", "", ""])
|
||||
|
||||
return columns, data
|
||||
|
||||
@@ -75,8 +69,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):
|
||||
@@ -87,13 +80,16 @@ def get_conditions(filters, before_report_date=True):
|
||||
supplier_accounts = []
|
||||
if filters.get("account"):
|
||||
supplier_accounts = [filters["account"]]
|
||||
elif filters.get("company"):
|
||||
else:
|
||||
supplier_accounts = webnotes.conn.sql_list("""select name from `tabAccount`
|
||||
where ifnull(master_type, '') = 'Supplier' and docstatus < 2 %s""" %
|
||||
conditions, filters)
|
||||
|
||||
if supplier_accounts:
|
||||
conditions += " and account in (%s)"
|
||||
conditions += " and account in (%s)" % (", ".join(['%s']*len(supplier_accounts)))
|
||||
else:
|
||||
msgprint(_("No Supplier Accounts found. Supplier Accounts are identified based on \
|
||||
'Master Type' value in account record."), raise_exception=1)
|
||||
|
||||
if filters.get("report_date"):
|
||||
if before_report_date:
|
||||
@@ -133,20 +129,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]
|
||||
return flt(paid_amount)
|
||||
@@ -2,11 +2,12 @@
|
||||
{
|
||||
"creation": "2013-04-22 16:16:03",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-04-23 14:54:27",
|
||||
"modified": "2013-04-30 17:55:54",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.utils import getdate, nowdate, flt, cstr
|
||||
|
||||
def execute(filters=None):
|
||||
@@ -18,7 +19,6 @@ def execute(filters=None):
|
||||
and nowdate() or filters.get("report_date")
|
||||
|
||||
data = []
|
||||
total_invoiced_amount = total_payment = total_outstanding = 0
|
||||
for gle in entries:
|
||||
if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
|
||||
or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
|
||||
@@ -41,17 +41,9 @@ def execute(filters=None):
|
||||
else:
|
||||
ageing_based_on_date = gle.posting_date
|
||||
row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
|
||||
|
||||
# Add to total
|
||||
total_invoiced_amount += flt(invoiced_amount)
|
||||
total_payment += flt(payment_amount)
|
||||
total_outstanding += flt(outstanding_amount)
|
||||
|
||||
|
||||
data.append(row)
|
||||
if data:
|
||||
data.append(["", "", "", "", "", "", "Total", total_invoiced_amount, total_payment,
|
||||
total_outstanding, "", "", "", ""])
|
||||
|
||||
|
||||
return columns, data
|
||||
|
||||
def get_columns():
|
||||
@@ -67,8 +59,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 = ""
|
||||
@@ -78,13 +69,16 @@ def get_conditions(filters, upto_report_date=True):
|
||||
customer_accounts = []
|
||||
if filters.get("account"):
|
||||
customer_accounts = [filters["account"]]
|
||||
elif filters.get("company"):
|
||||
else:
|
||||
customer_accounts = webnotes.conn.sql_list("""select name from `tabAccount`
|
||||
where ifnull(master_type, '') = 'Customer' and docstatus < 2 %s""" %
|
||||
conditions, filters)
|
||||
|
||||
if customer_accounts:
|
||||
conditions += " and account in (%s)"
|
||||
conditions += " and account in (%s)" % (", ".join(['%s']*len(customer_accounts)))
|
||||
else:
|
||||
msgprint(_("No Customer Accounts found. Customer Accounts are identified based on \
|
||||
'Master Type' value in account record."), raise_exception=1)
|
||||
|
||||
if filters.get("report_date"):
|
||||
if upto_report_date:
|
||||
@@ -105,7 +99,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
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
{
|
||||
"creation": "2013-04-16 11:31:13",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-04-16 11:31:13",
|
||||
"modified": "2013-04-30 17:54:47",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
|
||||
0
accounts/report/bank_clearance_summary/__init__.py
Normal file
0
accounts/report/bank_clearance_summary/__init__.py
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
@@ -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()
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
# 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
|
||||
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
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
wn.query_reports["Payment Collection With Ageing"] = {
|
||||
"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
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
# 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
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
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"]]
|
||||
else:
|
||||
cond = filters.get("company") and (" and company = '%s'" % filters["company"]) or ""
|
||||
customer_accounts = webnotes.conn.sql_list("""select name from `tabAccount`
|
||||
where ifnull(master_type, '') = 'Customer' and docstatus < 2 %s""" % cond)
|
||||
|
||||
if customer_accounts:
|
||||
conditions += " and jvd.account in (%s)" % (", ".join(['%s']*len(customer_accounts)))
|
||||
else:
|
||||
msgprint(_("No Customer Accounts found. Customer Accounts are identified based on \
|
||||
'Master Type' value in account record."), raise_exception=1)
|
||||
|
||||
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
|
||||
@@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-05-02 12:09:51",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-02 12:09:51",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Journal Voucher",
|
||||
"report_name": "Payment Collection With Ageing",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Payment Collection With Ageing"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,40 @@
|
||||
wn.query_reports["Payment Made With Ageing"] = {
|
||||
"filters": [
|
||||
{
|
||||
fieldname: "from_date",
|
||||
label: "From Date",
|
||||
fieldtype: "Date",
|
||||
default: wn.defaults.get_user_default("year_start_date"),
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
label: "To Date",
|
||||
fieldtype: "Date",
|
||||
default: get_today()
|
||||
},
|
||||
{
|
||||
fieldname:"account",
|
||||
label: "Supplier Account",
|
||||
fieldtype: "Link",
|
||||
options: "Account",
|
||||
get_query: function() {
|
||||
return {
|
||||
query: "accounts.utils.get_account_list",
|
||||
filters: {
|
||||
is_pl_account: "No",
|
||||
debit_or_credit: "Credit",
|
||||
company: wn.query_report.filters_by_name.company.get_value(),
|
||||
master_type: "Supplier"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
fieldname:"company",
|
||||
label: "Company",
|
||||
fieldtype: "Link",
|
||||
options: "Company",
|
||||
default: sys_defaults.company
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
# 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
|
||||
import webnotes
|
||||
from webnotes import msgprint, _
|
||||
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)
|
||||
pi_posting_date_map = get_pi_posting_date_map()
|
||||
|
||||
data = []
|
||||
for d in entries:
|
||||
against_voucher_date = d.against_voucher and pi_posting_date_map[d.against_voucher] or ""
|
||||
|
||||
row = [d.name, d.account, d.posting_date, d.against_voucher, against_voucher_date,
|
||||
d.debit, d.credit, d.cheque_no, d.cheque_date, d.remark]
|
||||
|
||||
if d.against_voucher:
|
||||
row += get_ageing_data(against_voucher_date, d.posting_date, d.debit or -1*d.credit)
|
||||
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/Purchase 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 = ""
|
||||
supplier_accounts = []
|
||||
if filters.get("account"):
|
||||
supplier_accounts = [filters["account"]]
|
||||
else:
|
||||
cond = filters.get("company") and (" and company = '%s'" % filters["company"]) or ""
|
||||
supplier_accounts = webnotes.conn.sql_list("""select name from `tabAccount`
|
||||
where ifnull(master_type, '') = 'Supplier' and docstatus < 2 %s""" % cond)
|
||||
|
||||
if supplier_accounts:
|
||||
conditions += " and jvd.account in (%s)" % (", ".join(['%s']*len(supplier_accounts)))
|
||||
else:
|
||||
msgprint(_("No Supplier Accounts found. Supplier Accounts are identified based on \
|
||||
'Master Type' value in account record."), raise_exception=1)
|
||||
|
||||
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, supplier_accounts
|
||||
|
||||
def get_entries(filters):
|
||||
conditions, supplier_accounts = get_conditions(filters)
|
||||
entries = webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date,
|
||||
jvd.against_voucher, 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(supplier_accounts), as_dict=1)
|
||||
|
||||
return entries
|
||||
|
||||
def get_pi_posting_date_map():
|
||||
pi_posting_date_map = {}
|
||||
for t in webnotes.conn.sql("""select name, posting_date from `tabPurchase Invoice`"""):
|
||||
pi_posting_date_map[t[0]] = t[1]
|
||||
|
||||
return pi_posting_date_map
|
||||
@@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-05-02 12:10:21",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-02 12:10:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Journal Voucher",
|
||||
"report_name": "Payment Made With Ageing",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Payment Made With Ageing"
|
||||
}
|
||||
]
|
||||
0
accounts/report/purchase_register/__init__.py
Normal file
0
accounts/report/purchase_register/__init__.py
Normal file
42
accounts/report/purchase_register/purchase_register.js
Normal file
42
accounts/report/purchase_register/purchase_register.js
Normal file
@@ -0,0 +1,42 @@
|
||||
wn.query_reports["Purchase Register"] = {
|
||||
"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": "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": "Credit",
|
||||
"company": company,
|
||||
"master_type": "Supplier"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"company",
|
||||
"label": "Company",
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": sys_defaults.company
|
||||
}
|
||||
]
|
||||
}
|
||||
146
accounts/report/purchase_register/purchase_register.py
Normal file
146
accounts/report/purchase_register/purchase_register.py
Normal file
@@ -0,0 +1,146 @@
|
||||
# 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
|
||||
import webnotes
|
||||
from webnotes.utils import flt
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
columns, expense_accounts, tax_accounts = get_columns()
|
||||
|
||||
invoice_list = get_invoices(filters)
|
||||
invoice_expense_map = get_invoice_expense_map(invoice_list)
|
||||
invoice_tax_map = get_invoice_tax_map(invoice_list)
|
||||
invoice_po_pr_map = get_invoice_po_pr_map(invoice_list)
|
||||
account_map = get_account_details(invoice_list)
|
||||
|
||||
data = []
|
||||
for inv in invoice_list:
|
||||
# invoice details
|
||||
purchase_order = ", ".join(invoice_po_pr_map.get(inv.name, {}).get("purchase_order", []))
|
||||
purchase_receipt = ", ".join(invoice_po_pr_map.get(inv.name, {}).get("purchase_receipt", []))
|
||||
row = [inv.name, inv.posting_date, inv.supplier, inv.credit_to,
|
||||
account_map.get(inv.credit_to), inv.project_name, inv.bill_no, inv.bill_date,
|
||||
inv.remarks, purchase_order, purchase_receipt]
|
||||
|
||||
# map expense values
|
||||
for expense_acc in expense_accounts:
|
||||
row.append(invoice_expense_map.get(inv.name, {}).get(expense_acc))
|
||||
|
||||
# net total
|
||||
row.append(inv.net_total)
|
||||
|
||||
# tax account
|
||||
for tax_acc in tax_accounts:
|
||||
row.append(invoice_tax_map.get(inv.name, {}).get(tax_acc))
|
||||
|
||||
# total tax, grand total
|
||||
row += [inv.total_tax, inv.grand_total]
|
||||
data.append(row)
|
||||
|
||||
return columns, data
|
||||
|
||||
|
||||
def get_columns():
|
||||
"""return columns based on filters"""
|
||||
columns = [
|
||||
"Invoice:Link/Purchase Invoice:120", "Posting Date:Date:80", "Supplier:Link/Supplier:120",
|
||||
"Supplier Account:Link/Account:120", "Account Group:LInk/Account:120",
|
||||
"Project:Link/Project:80", "Bill No::120", "Bill Date:Date:80", "Remarks::150",
|
||||
"Purchase Order:Link/Purchase Order:100", "Purchase Receipt:Link/Purchase Receipt:100"
|
||||
]
|
||||
|
||||
expense_accounts = webnotes.conn.sql_list("""select distinct expense_head
|
||||
from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(expense_head, '') != ''
|
||||
order by expense_head""")
|
||||
tax_accounts = webnotes.conn.sql_list("""select distinct account_head
|
||||
from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
|
||||
and docstatus = 1 and ifnull(account_head, '') != '' order by account_head""")
|
||||
|
||||
columns = columns + [(account + ":Currency:120") for account in expense_accounts] + \
|
||||
["Net Total:Currency:120"] + [(account + ":Currency:120") for account in tax_accounts] + \
|
||||
["Total Tax:Currency:120"] + ["Grand Total:Currency:120"]
|
||||
|
||||
return columns, expense_accounts, tax_accounts
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
|
||||
if filters.get("company"): conditions += " and company=%(company)s"
|
||||
if filters.get("account"): conditions += " and account = %(account)s"
|
||||
|
||||
if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
|
||||
if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
|
||||
|
||||
return conditions
|
||||
|
||||
def get_invoices(filters):
|
||||
conditions = get_conditions(filters)
|
||||
return webnotes.conn.sql("""select name, posting_date, credit_to, project_name, supplier,
|
||||
bill_no, bill_date, remarks, net_total, total_tax, grand_total
|
||||
from `tabPurchase Invoice` where docstatus = 1 %s
|
||||
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
|
||||
|
||||
def get_invoice_expense_map(invoice_list):
|
||||
expense_details = webnotes.conn.sql("""select parent, expense_head, sum(amount) as amount
|
||||
from `tabPurchase Invoice Item` where parent in (%s) group by parent, expense_head""" %
|
||||
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
|
||||
|
||||
invoice_expense_map = {}
|
||||
for d in expense_details:
|
||||
invoice_expense_map.setdefault(d.parent, webnotes._dict()).setdefault(d.expense_head, [])
|
||||
invoice_expense_map[d.parent][d.expense_head] = flt(d.amount)
|
||||
|
||||
return invoice_expense_map
|
||||
|
||||
def get_invoice_tax_map(invoice_list):
|
||||
tax_details = webnotes.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount
|
||||
from `tabPurchase Taxes and Charges` where parent in (%s) group by parent, account_head""" %
|
||||
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
|
||||
|
||||
invoice_tax_map = {}
|
||||
for d in tax_details:
|
||||
invoice_tax_map.setdefault(d.parent, webnotes._dict()).setdefault(d.account_head, [])
|
||||
invoice_tax_map[d.parent][d.account_head] = flt(d.tax_amount)
|
||||
|
||||
return invoice_tax_map
|
||||
|
||||
def get_invoice_po_pr_map(invoice_list):
|
||||
pi_items = webnotes.conn.sql("""select parent, purchase_order, purchase_receipt
|
||||
from `tabPurchase Invoice Item` where parent in (%s)
|
||||
and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')""" %
|
||||
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
|
||||
|
||||
invoice_po_pr_map = {}
|
||||
for d in pi_items:
|
||||
if d.purchase_order:
|
||||
invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
|
||||
"purchase_order", []).append(d.purchase_order)
|
||||
if d.purchase_receipt:
|
||||
invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
|
||||
"purchase_receipt", []).append(d.purchase_receipt)
|
||||
|
||||
return invoice_po_pr_map
|
||||
|
||||
def get_account_details(invoice_list):
|
||||
account_map = {}
|
||||
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[acc.name] = acc.parent_account
|
||||
|
||||
return account_map
|
||||
22
accounts/report/purchase_register/purchase_register.txt
Normal file
22
accounts/report/purchase_register/purchase_register.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-04-29 16:13:11",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-04-30 17:51:19",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Purchase Invoice",
|
||||
"report_name": "Purchase Register",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Purchase Register"
|
||||
}
|
||||
]
|
||||
@@ -94,8 +94,8 @@ def get_conditions(filters):
|
||||
|
||||
def get_invoices(filters):
|
||||
conditions = get_conditions(filters)
|
||||
return webnotes.conn.sql("""select name, posting_date, territory, debit_to, territory,
|
||||
project_name, customer, remarks, net_total, other_charges_total, grand_total
|
||||
return webnotes.conn.sql("""select name, posting_date, debit_to, project_name, customer,
|
||||
remarks, net_total, other_charges_total, grand_total
|
||||
from `tabSales Invoice` where docstatus = 1 %s
|
||||
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
|
||||
|
||||
@@ -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
|
||||
@@ -2,11 +2,12 @@
|
||||
{
|
||||
"creation": "2013-04-23 18:15:29",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-04-23 18:15:29",
|
||||
"modified": "2013-04-30 17:53:10",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"add_total_row": 1,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
|
||||
@@ -1,29 +1,32 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"creation": "2012-05-14 18:05:41",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:50",
|
||||
"modified": "2013-04-30 14:49:06",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:50"
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"description": "Bank Clearance report",
|
||||
"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\u0001Fiscal Year':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':''}",
|
||||
"dis_filters": "fiscal_year",
|
||||
"doc_type": "Journal Voucher Detail",
|
||||
"name": "__common__",
|
||||
"doctype": "Search Criteria",
|
||||
"sort_by": "ID",
|
||||
"page_len": 50,
|
||||
"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",
|
||||
"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"
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"name": "bank_clearance_report",
|
||||
"doctype": "Search Criteria"
|
||||
"doctype": "Search Criteria",
|
||||
"name": "bank_clearance_report"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user