Quotation Trend
diff --git a/selling/page/selling_home/selling_home.js b/selling/page/selling_home/selling_home.js
index 9c18fda..15f9b86 100644
--- a/selling/page/selling_home/selling_home.js
+++ b/selling/page/selling_home/selling_home.js
@@ -170,6 +170,11 @@
route: "query-report/Customers Not Buying Since Long Time",
doctype: "Sales Order"
},
+ {
+ "label":wn._("Quotation Trend"),
+ route: "query-report/Quotation Trends",
+ doctype: "Sales Order"
+ },
]
}
diff --git a/selling/report/quotation_trends/__init__.py b/selling/report/quotation_trends/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/selling/report/quotation_trends/__init__.py
diff --git a/selling/report/quotation_trends/quotation_trends.js b/selling/report/quotation_trends/quotation_trends.js
new file mode 100644
index 0000000..e55e252
--- /dev/null
+++ b/selling/report/quotation_trends/quotation_trends.js
@@ -0,0 +1,40 @@
+wn.query_reports["Quotation Trends"] = {
+ "filters": [
+ {
+ "fieldname":"period",
+ "label": "Period",
+ "fieldtype": "Select",
+ "options": "Monthly"+NEWLINE+"Quarterly"+NEWLINE+"Half-yearly"+NEWLINE+"Yearly",
+ "default": "Monthly"
+ },
+ {
+ "fieldname":"based_on",
+ "label": "Based On",
+ "fieldtype": "Select",
+ "options": "Item"+NEWLINE+"Item Group"+NEWLINE+"Customer"+NEWLINE+"Customer Group"+NEWLINE+"Territory"+NEWLINE+"Project",
+ "default": "Item"
+ },
+ {
+ "fieldname":"group_by",
+ "label": "Group By",
+ "fieldtype": "Select",
+ "options": "Item"+NEWLINE+"Customer",
+ "default": "Customer"
+ },
+ {
+ "fieldname":"fiscal_year",
+ "label": "Fiscal Year",
+ "fieldtype": "Link",
+ "options":'Fiscal Year',
+ "default": "Fiscal Year"
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": "Company"
+ },
+
+ ]
+}
\ No newline at end of file
diff --git a/selling/report/quotation_trends/quotation_trends.py b/selling/report/quotation_trends/quotation_trends.py
new file mode 100644
index 0000000..5b9fc04
--- /dev/null
+++ b/selling/report/quotation_trends/quotation_trends.py
@@ -0,0 +1,96 @@
+# 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 getdate, cint
+
+def execute(filters=None):
+ if not filters: filters ={}
+
+ period = filters.get("period")
+ based_on = filters.get("based_on")
+ group_by = filters.get("group_by")
+
+ columns = get_columns(filters, period, based_on, group_by)
+ data = []
+
+ return columns, data
+
+def get_columns(filters, period, based_on, group_by):
+ columns = []
+ pwc = []
+ bon = []
+ gby = []
+
+ if not (period and based_on):
+ webnotes.msgprint("Value missing in 'Period' or 'Based On'",raise_exception=1)
+ elif based_on == group_by:
+ webnotes.msgprint("Plese select different values in 'Based On' and 'Group By'")
+ else:
+ pwc = period_wise_column(filters, period, pwc)
+ bon = base_wise_column(based_on, bon)
+ gby = gruoup_wise_column(group_by)
+
+ if gby:
+ columns = bon + gby + pwc
+ else:
+ columns = bon + pwc
+ return columns
+
+
+def period_wise_column(filters, period, pwc):
+
+ if period == "Monthly":
+ month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
+ for month in range(0,len(month_name)):
+ pwc.append(month_name[month]+' (Qty):Float:120')
+ pwc.append(month_name[month]+' (Amt):Currency:120')
+
+ elif period == "Quarterly":
+ pwc = ["Q1(qty):Float:120", "Q1(amt):Currency:120", "Q2(qty):Float:120", "Q2(amt):Currency:120",
+ "Q3(qty):Float:120", "Q3(amt):Currency:120", "Q4(qty):Float:120", "Q4(amt):Currency:120"
+ ]
+
+ elif period == "Half-yearly":
+ pwc = ["Fisrt Half(qty):Float:120", "Fisrt Half(amt):Currency:120", "Second Half(qty):Float:120",
+ "Second Half(amt):Currency:120"
+ ]
+ else:
+ pwc = [filters.get("fiscal_year")+"(qty):Float:120", filters.get("fiscal_year")+"(amt):Currency:120"]
+
+ return pwc
+
+def base_wise_column(based_on, bon):
+ if based_on == "Item":
+ bon = ["Item:Link/Item:120", "Item Name:Data:120"]
+ elif based_on == "Item Group":
+ bon = ["Item Group:Link/Item Group:120"]
+ elif based_on == "Customer":
+ bon = ["Customer:Link/Customer:120", "Territory:Link/Territory:120"]
+ elif based_on == "Customer Group":
+ bon = ["Customer Group:Link/Customer Group"]
+ elif based_on == "Territory":
+ bon = ["Territory:Link/Territory:120"]
+ else:
+ bon = ["Project:Link/Project:120"]
+ return bon
+
+def gruoup_wise_column(group_by):
+ if group_by:
+ return [group_by+":Link/"+group_by+":120"]
+ else:
+ return []
\ No newline at end of file
diff --git a/selling/report/quotation_trends/quotation_trends.txt b/selling/report/quotation_trends/quotation_trends.txt
new file mode 100644
index 0000000..a135c34
--- /dev/null
+++ b/selling/report/quotation_trends/quotation_trends.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-06-07 16:01:16",
+ "docstatus": 0,
+ "modified": "2013-06-07 16:01:16",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Quotation",
+ "report_name": "Quotation Trends",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Quotation Trends"
+ }
+]
\ No newline at end of file