Fixed conflict merge
This commit is contained in:
commit
e6974d10c2
@ -257,6 +257,16 @@ wn.module_page["Accounts"] = [
|
||||
route: "query-report/Budget Variance Report",
|
||||
doctype: "Cost Center"
|
||||
},
|
||||
{
|
||||
"label":wn._("Purchase Invoice Trends"),
|
||||
route: "query-report/Purchase Invoice Trends",
|
||||
doctype: "Purchase Invoice"
|
||||
},
|
||||
{
|
||||
"label":wn._("Sales Invoice Trends"),
|
||||
route: "query-report/Sales Invoice Trends",
|
||||
doctype: "Sales Invoice"
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
0
accounts/report/purchase_invoice_trends/__init__.py
Normal file
0
accounts/report/purchase_invoice_trends/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
wn.require("app/js/purchase_trends_filters.js");
|
||||
|
||||
wn.query_reports["Purchase Invoice Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
# 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 controllers.trends import get_columns,get_data
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters ={}
|
||||
data = []
|
||||
|
||||
trans = "Purchase Invoice"
|
||||
tab = ["tabPurchase Invoice","tabPurchase Invoice Item"]
|
||||
|
||||
details = get_columns(filters, trans)
|
||||
data = get_data(filters, tab, details)
|
||||
|
||||
if not data :
|
||||
webnotes.msgprint("Data not found for selected criterias")
|
||||
|
||||
return details["columns"], data
|
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-13 18:46:55",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-13 18:46:55",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Purchase Invoice",
|
||||
"report_name": "Purchase Invoice Trends",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Purchase Invoice Trends"
|
||||
}
|
||||
]
|
@ -107,6 +107,7 @@ def get_invoices(filters):
|
||||
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""" %
|
||||
|
0
accounts/report/sales_invoice_trends/__init__.py
Normal file
0
accounts/report/sales_invoice_trends/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
wn.require("app/js/sales_trends_filters.js");
|
||||
|
||||
wn.query_reports["Sales Invoice Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
34
accounts/report/sales_invoice_trends/sales_invoice_trends.py
Normal file
34
accounts/report/sales_invoice_trends/sales_invoice_trends.py
Normal file
@ -0,0 +1,34 @@
|
||||
# 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 controllers.trends import get_columns,get_data
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters ={}
|
||||
data = []
|
||||
|
||||
trans = "Sales Invoice"
|
||||
tab = ["tabSales Invoice","tabSales Invoice Item"]
|
||||
|
||||
details = get_columns(filters, trans)
|
||||
data = get_data(filters, tab, details)
|
||||
|
||||
if not data :
|
||||
webnotes.msgprint("Data not found for selected criterias")
|
||||
|
||||
return details["columns"], data
|
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-13 18:44:21",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-13 18:44:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Sales Invoice Trends",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Sales Invoice Trends"
|
||||
}
|
||||
]
|
@ -155,7 +155,7 @@ for r in res:
|
||||
for d in range(len(colnames) - cr):
|
||||
r.append(flt(main_det[0][d]))
|
||||
out.append(r)
|
||||
|
||||
|
||||
if group_by:
|
||||
flag = 1
|
||||
# check for root nodes
|
||||
@ -167,11 +167,11 @@ for r in res:
|
||||
|
||||
if flag == 1:
|
||||
det = [x[0] for x in sql("SELECT DISTINCT %s FROM %s where %s" % (sel_col, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))]
|
||||
|
||||
|
||||
for des in range(len(det)):
|
||||
t_row = ['' for i in range(len(colnames))]
|
||||
t_row[col_idx[group_by]] = cstr(det[des])
|
||||
gr_det = sql("SELECT %s FROM %s WHERE %s = '%s' and %s" % (query_val, add_tab, sel_col, cstr(det[des]), add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
|
||||
for d in range(len(col_names)):
|
||||
t_row[col_idx[col_names[d]]] = flt(gr_det[0][d])
|
||||
out.append(t_row)
|
||||
out.append(t_row)
|
@ -115,6 +115,15 @@ wn.module_page["Buying"] = [
|
||||
"label":wn._("Requested Items To Be Ordered"),
|
||||
route: "query-report/Requested Items To Be Ordered",
|
||||
},
|
||||
{
|
||||
"label":wn._("Purchase Order Trends"),
|
||||
route: "query-report/Purchase Order Trends",
|
||||
doctype: "Purchase Order"
|
||||
},
|
||||
{
|
||||
"label":wn._("Item-wise Last Purchase Rate"),
|
||||
route: "query-report/Item-wise Last Purchase Rate",
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-18 11:24:36",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-18 15:28:57",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"query": "select * from (select \n result.item_code as \"Item Code:Link/Item:120\",\n result.item_name as \"Item Name::120\",\n result.description as \"Description::150\",\n result.posting_date as \"Date::150\",\n result.purchase_ref_rate as \"Price List Rate::180\", \n result.discount_rate as \"Discount::120\", \n result.purchase_rate as \"Rate::120\"\nfrom (\n (select \n po_item.item_code,\n po_item.item_name,\n po_item.description,\n po.transaction_date as posting_date,\n po_item.purchase_ref_rate, \n po_item.discount_rate, \n po_item.purchase_rate\n from `tabPurchase Order` po, `tabPurchase Order Item` po_item\n where po.name = po_item.parent and po.docstatus = 1)\n union\n (select \n pr_item.item_code,\n pr_item.item_name,\n pr_item.description,\n pr.posting_date,\n pr_item.purchase_ref_rate,\n pr_item.discount_rate,\n pr_item.purchase_rate\n from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item\n where pr.name = pr_item.parent and pr.docstatus = 1)\n) result\norder by result.item_code asc, result.posting_date desc) result_wrapper\ngroup by `Item Code:Link/Item:120`\n",
|
||||
"ref_doctype": "Purchase Order",
|
||||
"report_name": "Item-wise Last Purchase Rate",
|
||||
"report_type": "Query Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Item-wise Last Purchase Rate"
|
||||
}
|
||||
]
|
0
buying/report/purchase_order_trends/__init__.py
Normal file
0
buying/report/purchase_order_trends/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
wn.require("app/js/purchase_trends_filters.js");
|
||||
|
||||
wn.query_reports["Purchase Order Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
34
buying/report/purchase_order_trends/purchase_order_trends.py
Normal file
34
buying/report/purchase_order_trends/purchase_order_trends.py
Normal file
@ -0,0 +1,34 @@
|
||||
# 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 controllers.trends import get_columns,get_data
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters ={}
|
||||
data = []
|
||||
|
||||
trans = "Purchase Order"
|
||||
tab = ["tabPurchase Order","tabPurchase Order Item"]
|
||||
|
||||
details = get_columns(filters, trans)
|
||||
data = get_data(filters, tab, details)
|
||||
|
||||
if not data :
|
||||
webnotes.msgprint("Data not found for selected criterias")
|
||||
|
||||
return details["columns"], data
|
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-13 18:45:01",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-13 18:45:01",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Purchase Order",
|
||||
"report_name": "Purchase Order Trends",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Purchase Order Trends"
|
||||
}
|
||||
]
|
@ -54,16 +54,7 @@ class BuyingController(StockController):
|
||||
raise_exception=WrongWarehouseCompany)
|
||||
|
||||
def validate_stock_or_nonstock_items(self):
|
||||
items = [d.item_code for d in self.doclist.get({"parentfield": self.fname})]
|
||||
if self.stock_items:
|
||||
nonstock_items = list(set(items) - set(self.stock_items))
|
||||
if nonstock_items:
|
||||
webnotes.msgprint(_("Stock and non-stock items can not be entered in the same ") +
|
||||
self.doc.doctype + _(""". You should make separate documents for them.
|
||||
Stock Items: """) + ", ".join(self.stock_items) + _("""
|
||||
Non-stock Items: """) + ", ".join(nonstock_items), raise_exception=1)
|
||||
|
||||
elif items and not self.stock_items:
|
||||
if not self.stock_items:
|
||||
tax_for_valuation = [d.account_head for d in
|
||||
self.doclist.get({"parentfield": "purchase_tax_details"})
|
||||
if d.category in ["Valuation", "Valuation and Total"]]
|
||||
|
265
controllers/trends.py
Normal file
265
controllers/trends.py
Normal file
@ -0,0 +1,265 @@
|
||||
# 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 cint, add_days, add_months, cstr
|
||||
from datetime import datetime
|
||||
|
||||
def get_columns(filters, trans):
|
||||
|
||||
if not (filters.get("period") and filters.get("based_on")):
|
||||
webnotes.msgprint("Value missing in 'Period' or 'Based On'", raise_exception=1)
|
||||
|
||||
elif filters.get("based_on") == filters.get("group_by"):
|
||||
webnotes.msgprint("Plese select different values in 'Based On' and 'Group By'", raise_exception=1)
|
||||
|
||||
else:
|
||||
bonc, query_bon, based, sup_tab = basedon_wise_colums_query(filters.get("based_on"), trans)
|
||||
pwc, query_pwc = period_wise_colums_query(filters, trans)
|
||||
grbc = group_wise_column(filters.get("group_by"))
|
||||
|
||||
columns = bonc + pwc + ["TOTAL(Qty):Float:120", "TOTAL(Amt):Currency:120"]
|
||||
if grbc:
|
||||
columns = bonc + grbc + pwc +["TOTAL(Qty):Float:120", "TOTAL(Amt):Currency:120"]
|
||||
|
||||
details = {"query_bon": query_bon, "query_pwc": query_pwc, "columns": columns, "basedon": based,
|
||||
"grbc": grbc, "sup_tab": sup_tab}
|
||||
|
||||
return details
|
||||
|
||||
def get_data(filters, tab, details):
|
||||
|
||||
data = []
|
||||
inc, cond= '',''
|
||||
query_details = details["query_bon"] + details["query_pwc"]
|
||||
|
||||
if details["query_bon"] in ["t1.project_name,", "t2.project_name,"]:
|
||||
cond = 'and '+ details["query_bon"][:-1] +' IS Not NULL'
|
||||
|
||||
if filters.get("group_by"):
|
||||
sel_col = ''
|
||||
ind = details["columns"].index(details["grbc"][0])
|
||||
|
||||
if filters.get("group_by") == 'Item':
|
||||
sel_col = 't2.item_code'
|
||||
elif filters.get("group_by") == 'Customer':
|
||||
sel_col = 't1.customer'
|
||||
elif filters.get("group_by") == 'Supplier':
|
||||
sel_col = 't1.supplier'
|
||||
|
||||
if filters.get('based_on') in ['Item','Customer','Supplier']:
|
||||
inc = 2
|
||||
else :
|
||||
inc = 1
|
||||
|
||||
data1 = webnotes.conn.sql(""" select %s from `%s` t1, `%s` t2 %s
|
||||
where t2.parent = t1.name and t1.company = %s
|
||||
and t1.fiscal_year = %s and t1.docstatus = 1 %s
|
||||
group by %s
|
||||
""" % (query_details, tab[0], tab[1], details["sup_tab"], "%s",
|
||||
"%s", cond, details["basedon"]), (filters.get("company"),
|
||||
filters["fiscal_year"]),
|
||||
as_list=1)
|
||||
|
||||
for d in range(len(data1)):
|
||||
#to add blanck column
|
||||
dt = data1[d]
|
||||
dt.insert(ind,'')
|
||||
data.append(dt)
|
||||
|
||||
#to get distinct value of col specified by group_by in filter
|
||||
row = webnotes.conn.sql("""select DISTINCT(%s) from `%s` t1, `%s` t2 %s
|
||||
where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s
|
||||
and t1.docstatus = 1 and %s = %s
|
||||
"""%(sel_col, tab[0], tab[1], details["sup_tab"], "%s", "%s", details["basedon"], "%s"),
|
||||
(filters.get("company"), filters.get("fiscal_year"), data1[d][0]),
|
||||
as_list=1)
|
||||
|
||||
for i in range(len(row)):
|
||||
des = ['' for q in range(len(details["columns"]))]
|
||||
|
||||
#get data for each group_by filter
|
||||
row1 = webnotes.conn.sql(""" select %s , %s from `%s` t1, `%s` t2 %s
|
||||
where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s
|
||||
and t1.docstatus = 1 and %s = %s and %s = %s
|
||||
"""%(sel_col, details["query_pwc"], tab[0], tab[1], details["sup_tab"],
|
||||
"%s", "%s", sel_col, "%s", details["basedon"], "%s"),
|
||||
(filters.get("company"), filters.get("fiscal_year"), row[i][0], data1[d][0]),
|
||||
as_list=1)
|
||||
|
||||
des[ind] = row[i]
|
||||
for j in range(1,len(details["columns"])-inc):
|
||||
des[j+inc] = row1[0][j]
|
||||
data.append(des)
|
||||
else:
|
||||
|
||||
data = webnotes.conn.sql(""" select %s from `%s` t1, `%s` t2 %s
|
||||
where t2.parent = t1.name and t1.company = %s
|
||||
and t1.fiscal_year = %s and t1.docstatus = 1 %s
|
||||
group by %s
|
||||
"""%(query_details, tab[0], tab[1], details["sup_tab"], "%s",
|
||||
"%s", cond,details["basedon"]), (filters.get("company"),
|
||||
filters.get("fiscal_year")),
|
||||
as_list=1)
|
||||
|
||||
return data
|
||||
|
||||
def get_mon(date):
|
||||
"""convert srting formated date into date and retrieve month abbrevation"""
|
||||
return (datetime.strptime(date, '%Y-%m-%d')).strftime("%b")
|
||||
|
||||
def period_wise_colums_query(filters, trans):
|
||||
from datetime import datetime
|
||||
|
||||
query_details = ''
|
||||
pwc = []
|
||||
ysd = webnotes.conn.sql("""select year_start_date from `tabFiscal Year` where name = '%s'
|
||||
"""%filters.get("fiscal_year"))[0][0]
|
||||
|
||||
year_start_date = ysd.strftime('%Y-%m-%d')
|
||||
start_month = cint(year_start_date.split('-')[1])
|
||||
|
||||
if trans in ['Purchase Receipt', 'Delivery Note', 'Purchase Invoice', 'Sales Invoice']:
|
||||
trans_date = 'posting_date'
|
||||
else:
|
||||
trans_date = 'transaction_date'
|
||||
|
||||
if filters.get("period") == "Monthly":
|
||||
month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
|
||||
|
||||
for month in range(start_month-1,len(month_name)):
|
||||
pwc.append(month_name[month]+' (Qty):Float:120')
|
||||
pwc.append(month_name[month]+' (Amt):Currency:120')
|
||||
|
||||
query_details += """
|
||||
Sum(IF(MONTH(t1.%(trans)s)= %(mon_num)s, t2.qty, NULL)),
|
||||
SUM(IF(MONTH(t1.%(trans)s)= %(mon_num)s, t1.grand_total, NULL)),
|
||||
"""%{"trans": trans_date,"mon_num": cstr(month+1)}
|
||||
|
||||
for month in range(0, start_month-1):
|
||||
pwc.append(month_name[month]+' (Qty):Float:120')
|
||||
pwc.append(month_name[month]+' (Amt):Currency:120')
|
||||
|
||||
query_details += """
|
||||
Sum(IF(MONTH(t1.%(trans)s)= %(mon_num)s, t2.qty, NULL)),
|
||||
SUM(IF(MONTH(t1.%(trans)s)= %(mon_num)s, t1.grand_total, NULL)),
|
||||
"""%{"trans": trans_date, "mon_num": cstr(month+1)}
|
||||
|
||||
elif filters.get("period") == "Quarterly":
|
||||
|
||||
first_qsd, second_qsd, third_qsd, fourth_qsd = year_start_date, add_months(year_start_date,3), add_months(year_start_date,6), add_months(year_start_date,9)
|
||||
first_qed, second_qed, third_qed, fourth_qed = add_days(add_months(first_qsd,3),-1), add_days(add_months(second_qsd,3),-1), add_days(add_months(third_qsd,3),-1), add_days(add_months(fourth_qsd,3),-1)
|
||||
bet_dates = [[first_qsd,first_qed],[second_qsd,second_qed],[third_qsd,third_qed],[fourth_qsd,fourth_qed]]
|
||||
|
||||
pwc = [get_mon(first_qsd)+"-"+get_mon(first_qed)+" (Qty):Float:120", get_mon(first_qsd)+"-"+get_mon(first_qed)+"(Amt):Currency:120",
|
||||
get_mon(second_qsd)+"-"+get_mon(second_qed)+" (Qty):Float:120", get_mon(second_qsd)+"-"+get_mon(second_qed)+" (Amt):Currency:120",
|
||||
get_mon(third_qsd)+"-"+get_mon(third_qed)+" (Qty):Float:120", get_mon(third_qsd)+"-"+get_mon(third_qed)+" (Amt):Currency:120",
|
||||
get_mon(fourth_qsd)+"-"+get_mon(fourth_qed)+" (Qty):Float:120", get_mon(fourth_qsd)+"-"+get_mon(fourth_qed)+" (Amt):Currency:120"]
|
||||
|
||||
for d in bet_dates:
|
||||
query_details += """
|
||||
SUM(IF(t1.%(trans)s BETWEEN '%(sd)s' AND '%(ed)s', t2.qty, NULL)),
|
||||
SUM(IF(t1.%(trans)s BETWEEN '%(sd)s' AND '%(ed)s', t1.grand_total, NULL)),
|
||||
"""%{"trans": trans_date, "sd": d[0],"ed": d[1]}
|
||||
|
||||
elif filters.get("period") == "Half-yearly":
|
||||
|
||||
first_half_start = year_start_date
|
||||
first_half_end = add_days(add_months(first_half_start,6),-1)
|
||||
second_half_start = add_days(first_half_end,1)
|
||||
second_half_end = add_days(add_months(second_half_start,6),-1)
|
||||
|
||||
pwc = [get_mon(first_half_start)+"-"+get_mon(first_half_end)+"(Qty):Float:120", get_mon(first_half_start)+"-"+get_mon(first_half_end)+" (Amt):Currency:120",
|
||||
get_mon(second_half_start)+"-"+get_mon(second_half_end)+" (Qty):Float:120", get_mon(second_half_start)+"-"+get_mon(second_half_end)+" (Amt):Currency:120"]
|
||||
|
||||
query_details = """
|
||||
SUM(IF(t1.%(trans)s BETWEEN '%(fhs)s' AND '%(fhe)s', t2.qty, NULL)),
|
||||
SUM(IF(t1.%(trans)s BETWEEN '%(fhs)s' AND '%(fhe)s', t1.grand_total, NULL)),
|
||||
SUM(IF(t1.%(trans)s BETWEEN '%(shs)s' AND '%(she)s', t2.qty, NULL)),
|
||||
SUM(IF(t1.%(trans)s BETWEEN '%(shs)s' AND '%(she)s', t1.grand_total, NULL)),
|
||||
"""%{"trans": trans_date, "fhs": first_half_start, "fhe": first_half_end,"shs": second_half_start,
|
||||
"she": second_half_end}
|
||||
|
||||
else:
|
||||
pwc = [filters.get("fiscal_year")+" (Qty):Float:120", filters.get("fiscal_year")+" (Amt):Currency:120"]
|
||||
query_details = " SUM(t2.qty), SUM(t1.grand_total),"
|
||||
|
||||
query_details += 'SUM(t2.qty), SUM(t1.grand_total)'
|
||||
return pwc, query_details
|
||||
|
||||
def basedon_wise_colums_query(based_on, trans):
|
||||
sup_tab = ''
|
||||
|
||||
if based_on == "Item":
|
||||
bon = ["Item:Link/Item:120", "Item Name:Data:120"]
|
||||
query_details = "t2.item_code, t2.item_name,"
|
||||
based = 't2.item_code'
|
||||
|
||||
elif based_on == "Item Group":
|
||||
bon = ["Item Group:Link/Item Group:120"]
|
||||
query_details = "t2.item_group,"
|
||||
based = 't2.item_group'
|
||||
|
||||
elif based_on == "Customer":
|
||||
bon = ["Customer:Link/Customer:120", "Territory:Link/Territory:120"]
|
||||
query_details = "t1.customer_name, t1.territory, "
|
||||
based = 't1.customer_name'
|
||||
|
||||
elif based_on == "Customer Group":
|
||||
bon = ["Customer Group:Link/Customer Group"]
|
||||
query_details = "t1.customer_group,"
|
||||
based = 't1.customer_group'
|
||||
|
||||
elif based_on == 'Supplier':
|
||||
bon = ["Supplier:Link/Supplier:120", "Supplier Type:Link/Supplier Type:120"]
|
||||
query_details = "t1.supplier, t3.supplier_type,"
|
||||
based = 't1.supplier'
|
||||
sup_tab = '`tabSupplier` t3',
|
||||
|
||||
elif based_on == 'Supplier Type':
|
||||
bon = ["Supplier Type:Link/Supplier Type:120"]
|
||||
query_details = "t3.supplier_type,"
|
||||
based = 't3.supplier_type'
|
||||
sup_tab ='`tabSupplier` t3',
|
||||
|
||||
elif based_on == "Territory":
|
||||
bon = ["Territory:Link/Territory:120"]
|
||||
query_details = "t1.territory,"
|
||||
based = 't1.territory'
|
||||
|
||||
elif based_on == "Project":
|
||||
|
||||
if trans in ['Sales Invoice', 'Delivery Note', 'Sales Order']:
|
||||
bon = ["Project:Link/Project:120"]
|
||||
query_details = "t1.project_name,"
|
||||
based = 't1.project_name'
|
||||
|
||||
elif trans in ['Purchase Order', 'Purchase Invoice', 'Purchase Receipt']:
|
||||
bon = ["Project:Link/Project:120"]
|
||||
query_details = "t2.project_name,"
|
||||
based = 't2.project_name'
|
||||
|
||||
else:
|
||||
webnotes.msgprint("Information Not Available", raise_exception=1)
|
||||
|
||||
return bon, query_details, based, sup_tab
|
||||
|
||||
def group_wise_column(group_by):
|
||||
if group_by:
|
||||
return [group_by+":Link/"+group_by+":120"]
|
||||
else:
|
||||
return []
|
39
public/js/purchase_trends_filters.js
Normal file
39
public/js/purchase_trends_filters.js
Normal file
@ -0,0 +1,39 @@
|
||||
var get_filters = function(){
|
||||
return [
|
||||
{
|
||||
"fieldname":"period",
|
||||
"label": "Period",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Monthly", "Quarterly", "Half-yearly", "Yearly"].join("\n"),
|
||||
"default": "Monthly"
|
||||
},
|
||||
{
|
||||
"fieldname":"based_on",
|
||||
"label": "Based On",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Item", "Item Group", "Supplier", "Supplier Type", "Project"].join("\n"),
|
||||
"default": "Item"
|
||||
},
|
||||
{
|
||||
"fieldname":"group_by",
|
||||
"label": "Group By",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Item", "Supplier"].join("\n"),
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"fieldname":"fiscal_year",
|
||||
"label": "Fiscal Year",
|
||||
"fieldtype": "Link",
|
||||
"options":'Fiscal Year',
|
||||
"default": sys_defaults.fiscal_year
|
||||
},
|
||||
{
|
||||
"fieldname":"company",
|
||||
"label": "Company",
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": sys_defaults.company
|
||||
},
|
||||
];
|
||||
}
|
39
public/js/sales_trends_filters.js
Normal file
39
public/js/sales_trends_filters.js
Normal file
@ -0,0 +1,39 @@
|
||||
var get_filters = function(){
|
||||
return[
|
||||
{
|
||||
"fieldname":"period",
|
||||
"label": "Period",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Monthly", "Quarterly", "Half-yearly", "Yearly"].join("\n"),
|
||||
"default": "Monthly"
|
||||
},
|
||||
{
|
||||
"fieldname":"based_on",
|
||||
"label": "Based On",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Item", "Item Group", "Customer", "Customer Group", "Territory", "Project"].join("\n"),
|
||||
"default": "Item"
|
||||
},
|
||||
{
|
||||
"fieldname":"group_by",
|
||||
"label": "Group By",
|
||||
"fieldtype": "Select",
|
||||
"options": ["Item", "Customer"].join("\n"),
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"fieldname":"fiscal_year",
|
||||
"label": "Fiscal Year",
|
||||
"fieldtype": "Link",
|
||||
"options":'Fiscal Year',
|
||||
"default": sys_defaults.fiscal_year
|
||||
},
|
||||
{
|
||||
"fieldname":"company",
|
||||
"label": "Company",
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": sys_defaults.company
|
||||
},
|
||||
];
|
||||
}
|
@ -130,6 +130,29 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
||||
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.shipping_address_name.get_query = cur_frm.fields_dict['customer_address'].get_query;
|
||||
|
||||
cur_frm.cscript.shipping_address_name = function() {
|
||||
if(cur_frm.doc.shipping_address_name) {
|
||||
wn.model.with_doc("Address", cur_frm.doc.shipping_address_name, function(name) {
|
||||
var address = wn.model.get_doc("Address", name);
|
||||
|
||||
var out = $.map(["address_line1", "address_line2", "city"],
|
||||
function(f) { return address[f]; });
|
||||
|
||||
var state_pincode = $.map(["state", "pincode"], function(f) { return address[f]; }).join(" ");
|
||||
if(state_pincode) out.push(state_pincode);
|
||||
|
||||
if(address["country"]) out.push(address["country"]);
|
||||
|
||||
out.concat($.map([["Phone:", address["phone"]], ["Fax:", address["fax"]]],
|
||||
function(val) { return val[1] ? val.join(" ") : null; }));
|
||||
|
||||
cur_frm.set_value("shipping_address", out.join("\n"));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
|
||||
var callback = function(r,rt){
|
||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-07 14:48:34",
|
||||
"creation": "2013-06-18 12:39:59",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-01-29 17:14:58",
|
||||
"modified": "2013-06-18 17:49:11",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -32,6 +32,7 @@
|
||||
"parent": "Sales Order",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1
|
||||
},
|
||||
{
|
||||
@ -202,7 +203,7 @@
|
||||
"label": "Shipping Address Name",
|
||||
"options": "Address",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -950,104 +951,33 @@
|
||||
"options": "Sales Team",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"report": 0,
|
||||
"role": "Sales Manager",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Sales Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"report": 0,
|
||||
"role": "Sales User",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Maintenance Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"role": "Maintenance Manager",
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Maintenance User",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"role": "Maintenance User",
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Accounts User"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"match": "customer",
|
||||
"permlevel": 0,
|
||||
"role": "Customer"
|
||||
}
|
||||
]
|
@ -180,6 +180,16 @@ wn.module_page["Selling"] = [
|
||||
route: "query-report/Customers Not Buying Since Long Time",
|
||||
doctype: "Sales Order"
|
||||
},
|
||||
{
|
||||
"label":wn._("Quotation Trend"),
|
||||
route: "query-report/Quotation Trends",
|
||||
doctype: "Quotation"
|
||||
},
|
||||
{
|
||||
"label":wn._("Sales Order Trend"),
|
||||
route: "query-report/Sales Order Trends",
|
||||
doctype: "Sales Order"
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
0
selling/report/quotation_trends/__init__.py
Normal file
0
selling/report/quotation_trends/__init__.py
Normal file
5
selling/report/quotation_trends/quotation_trends.js
Normal file
5
selling/report/quotation_trends/quotation_trends.js
Normal file
@ -0,0 +1,5 @@
|
||||
wn.require("app/js/sales_trends_filters.js");
|
||||
|
||||
wn.query_reports["Quotation Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
34
selling/report/quotation_trends/quotation_trends.py
Normal file
34
selling/report/quotation_trends/quotation_trends.py
Normal file
@ -0,0 +1,34 @@
|
||||
# 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 controllers.trends import get_columns,get_data
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters ={}
|
||||
data = []
|
||||
|
||||
trans = "Quotation"
|
||||
tab = ["tabQuotation","tabQuotation Item"]
|
||||
|
||||
details = get_columns(filters, trans)
|
||||
data = get_data(filters, tab, details)
|
||||
|
||||
if not data:
|
||||
webnotes.msgprint("Data not found for selected criterias")
|
||||
|
||||
return details["columns"], data
|
22
selling/report/quotation_trends/quotation_trends.txt
Normal file
22
selling/report/quotation_trends/quotation_trends.txt
Normal file
@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-07 16:01:16",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-12 16:31:23",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"add_total_row": 0,
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Quotation",
|
||||
"report_name": "Quotation Trends",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Quotation Trends"
|
||||
}
|
||||
]
|
0
selling/report/sales_order_trends/__init__.py
Normal file
0
selling/report/sales_order_trends/__init__.py
Normal file
5
selling/report/sales_order_trends/sales_order_trends.js
Normal file
5
selling/report/sales_order_trends/sales_order_trends.js
Normal file
@ -0,0 +1,5 @@
|
||||
wn.require("app/js/sales_trends_filters.js");
|
||||
|
||||
wn.query_reports["Sales Order Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
34
selling/report/sales_order_trends/sales_order_trends.py
Normal file
34
selling/report/sales_order_trends/sales_order_trends.py
Normal file
@ -0,0 +1,34 @@
|
||||
# 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 controllers.trends import get_columns,get_data
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters ={}
|
||||
data = []
|
||||
|
||||
trans = "Sales Order"
|
||||
tab = ["tabSales Order","tabSales Order Item"]
|
||||
|
||||
details = get_columns(filters, trans)
|
||||
data = get_data(filters, tab, details)
|
||||
|
||||
if not data :
|
||||
webnotes.msgprint("Data not found for selected criterias")
|
||||
|
||||
return details["columns"], data
|
21
selling/report/sales_order_trends/sales_order_trends.txt
Normal file
21
selling/report/sales_order_trends/sales_order_trends.txt
Normal file
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-13 18:43:30",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-13 18:43:30",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Sales Order",
|
||||
"report_name": "Sales Order Trends",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Sales Order Trends"
|
||||
}
|
||||
]
|
@ -223,6 +223,16 @@ wn.module_page["Stock"] = [
|
||||
route: "query-report/Itemwise Recommended Reorder Level",
|
||||
doctype: "Item"
|
||||
},
|
||||
{
|
||||
"label":wn._("Delivery Note Trends"),
|
||||
route: "query-report/Delivery Note Trends",
|
||||
doctype: "Delivery Note"
|
||||
},
|
||||
{
|
||||
"label":wn._("Purchase Receipt Trends"),
|
||||
route: "query-report/Purchase Receipt Trends",
|
||||
doctype: "Purchase Receipt"
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
0
stock/report/delivery_note_trends/__init__.py
Normal file
0
stock/report/delivery_note_trends/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
wn.require("app/js/sales_trends_filters.js");
|
||||
|
||||
wn.query_reports["Delivery Note Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
34
stock/report/delivery_note_trends/delivery_note_trends.py
Normal file
34
stock/report/delivery_note_trends/delivery_note_trends.py
Normal file
@ -0,0 +1,34 @@
|
||||
# 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 controllers.trends import get_columns,get_data
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters ={}
|
||||
data = []
|
||||
|
||||
trans = "Delivery Note"
|
||||
tab = ["tabDelivery Note","tabDelivery Note Item"]
|
||||
|
||||
details = get_columns(filters, trans)
|
||||
data = get_data(filters, tab, details)
|
||||
|
||||
if not data :
|
||||
webnotes.msgprint("Data not found for selected criterias")
|
||||
|
||||
return details["columns"], data
|
21
stock/report/delivery_note_trends/delivery_note_trends.txt
Normal file
21
stock/report/delivery_note_trends/delivery_note_trends.txt
Normal file
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-13 18:42:11",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-13 18:42:11",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Delivery Note",
|
||||
"report_name": "Delivery Note Trends",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Delivery Note Trends"
|
||||
}
|
||||
]
|
@ -69,10 +69,11 @@ def get_price_list():
|
||||
from `tabItem Price` where docstatus<2""", as_dict=1)
|
||||
|
||||
for j in price_list:
|
||||
if j.selling:
|
||||
rate.setdefault(j.parent, {}).setdefault("selling", []).append(j.price)
|
||||
if j.buying:
|
||||
rate.setdefault(j.parent, {}).setdefault("buying", []).append(j.price)
|
||||
if j.price:
|
||||
if j.selling:
|
||||
rate.setdefault(j.parent, {}).setdefault("selling", []).append(j.price)
|
||||
if j.buying:
|
||||
rate.setdefault(j.parent, {}).setdefault("buying", []).append(j.price)
|
||||
|
||||
item_rate_map = {}
|
||||
|
||||
|
0
stock/report/purchase_receipt_trends/__init__.py
Normal file
0
stock/report/purchase_receipt_trends/__init__.py
Normal file
@ -0,0 +1,5 @@
|
||||
wn.require("app/js/purchase_trends_filters.js");
|
||||
|
||||
wn.query_reports["Purchase Receipt Trends"] = {
|
||||
filters: get_filters()
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
# 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 controllers.trends import get_columns,get_data
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters ={}
|
||||
data = []
|
||||
|
||||
trans = "Purchase Receipt"
|
||||
tab = ["tabPurchase Receipt","tabPurchase Receipt Item"]
|
||||
|
||||
details = get_columns(filters, trans)
|
||||
data = get_data(filters, tab, details)
|
||||
|
||||
if not data :
|
||||
webnotes.msgprint("Data not found for selected criterias")
|
||||
|
||||
return details["columns"], data
|
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-13 18:45:44",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-13 18:45:44",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Purchase Receipt",
|
||||
"report_name": "Purchase Receipt Trends",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Purchase Receipt Trends"
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user