[Reports] [Customers Not Buying Sinse Long Time] and [Itemwise Recommended Reorder level]
diff --git a/selling/page/selling_home/selling_home.js b/selling/page/selling_home/selling_home.js
index 603bd3a..9c18fda 100644
--- a/selling/page/selling_home/selling_home.js
+++ b/selling/page/selling_home/selling_home.js
@@ -166,8 +166,8 @@
route: "query-report/Item-wise Sales History",
},
{
- "label":wn._("No Sales Order from Customers (Since 2 months)"),
- route: "query-report/No Sales Order from Customers",
+ "label":wn._("Customers Not Buying Since Long Time"),
+ route: "query-report/Customers Not Buying Since Long Time",
doctype: "Sales Order"
},
diff --git a/selling/report/no_sales_order_from_customers/__init__.py b/selling/report/customers_not_buying_since_long_time/__init__.py
similarity index 100%
rename from selling/report/no_sales_order_from_customers/__init__.py
rename to selling/report/customers_not_buying_since_long_time/__init__.py
diff --git a/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js
new file mode 100644
index 0000000..65d6348
--- /dev/null
+++ b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js
@@ -0,0 +1,10 @@
+wn.query_reports["Customers Not Buying Since Long Time"] = {
+ "filters": [
+ {
+ "fieldname":"days_since_last_order",
+ "label": "Days Since Last Order",
+ "fieldtype": "Int",
+ "default": 60
+ }
+ ]
+}
\ No newline at end of file
diff --git a/selling/report/no_sales_order_from_customers/no_sales_order_from_customers.py b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
similarity index 84%
rename from selling/report/no_sales_order_from_customers/no_sales_order_from_customers.py
rename to selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
index 789e168..d13315c 100644
--- a/selling/report/no_sales_order_from_customers/no_sales_order_from_customers.py
+++ b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
@@ -13,15 +13,24 @@
#
# 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 ={}
+
+ days_since_last_order = filters.get("days_since_last_order")
+ if not days_since_last_order or days_since_last_order <= 0:
+ webnotes.msgprint("Please mention legal value in days since last order field",raise_exception=1)
+
columns = get_columns()
customers = get_so_details()
data = []
for cust in customers:
- if cust[8] >= 60: # days_since_last_order
+ if cust[8] >= days_since_last_order:
cust.insert(7,get_last_so_amt(cust[0]))
data.append(cust)
return columns, data
diff --git a/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.txt b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.txt
new file mode 100644
index 0000000..4d94377
--- /dev/null
+++ b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-07 12:27:07",
+ "docstatus": 0,
+ "modified": "2013-06-07 12:27:07",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Order",
+ "report_name": "Customers Not Buying Since Long Time ",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Customers Not Buying Since Long Time"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/no_sales_order_from_customers/no_sales_order_from_customers.txt b/selling/report/no_sales_order_from_customers/no_sales_order_from_customers.txt
deleted file mode 100644
index 32b38ae..0000000
--- a/selling/report/no_sales_order_from_customers/no_sales_order_from_customers.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-[
- {
- "creation": "2013-06-06 19:15:50",
- "docstatus": 0,
- "modified": "2013-06-06 19:15:51",
- "modified_by": "Administrator",
- "owner": "Administrator"
- },
- {
- "doctype": "Report",
- "is_standard": "Yes",
- "name": "__common__",
- "ref_doctype": "Sales Order",
- "report_name": "No Sales Order from Customers",
- "report_type": "Script Report"
- },
- {
- "doctype": "Report",
- "name": "No Sales Order from Customers"
- }
-]
\ No newline at end of file
diff --git a/stock/page/stock_home/stock_home.js b/stock/page/stock_home/stock_home.js
index ab3d325..7e67cab 100644
--- a/stock/page/stock_home/stock_home.js
+++ b/stock/page/stock_home/stock_home.js
@@ -206,8 +206,8 @@
route: "query-report/Requested Items To Be Transferred",
},
{
- "label":wn._("Item Reorder Level"),
- route: "query-report/Item Reorder Level",
+ "label":wn._("Itemwise Recommended Reorder Level"),
+ route: "query-report/Itemwise Recommended Reorder Level",
doctype: "Item"
},
]
diff --git a/stock/report/item_reorder_level/item_reorder_level.txt b/stock/report/item_reorder_level/item_reorder_level.txt
deleted file mode 100644
index 93c6dfb..0000000
--- a/stock/report/item_reorder_level/item_reorder_level.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-[
- {
- "creation": "2013-06-05 15:34:51",
- "docstatus": 0,
- "modified": "2013-06-05 15:50:30",
- "modified_by": "Administrator",
- "owner": "Administrator"
- },
- {
- "doctype": "Report",
- "is_standard": "Yes",
- "name": "__common__",
- "ref_doctype": "Item",
- "report_name": "Item Reorder Level",
- "report_type": "Script Report"
- },
- {
- "doctype": "Report",
- "name": "Item Reorder Level"
- }
-]
\ No newline at end of file
diff --git a/stock/report/item_reorder_level/__init__.py b/stock/report/itemwise_recommended_reorder_level/__init__.py
similarity index 100%
rename from stock/report/item_reorder_level/__init__.py
rename to stock/report/itemwise_recommended_reorder_level/__init__.py
diff --git a/stock/report/item_reorder_level/item_reorder_level.js b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
similarity index 80%
rename from stock/report/item_reorder_level/item_reorder_level.js
rename to stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
index 30240e5..b8aa378 100644
--- a/stock/report/item_reorder_level/item_reorder_level.js
+++ b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
@@ -1,4 +1,4 @@
-wn.query_reports["Item Reorder Level"] = {
+wn.query_reports["Itemwise Recommended Reorder Level"] = {
"filters": [
{
"fieldname":"from_date",
diff --git a/stock/report/item_reorder_level/item_reorder_level.py b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
similarity index 98%
rename from stock/report/item_reorder_level/item_reorder_level.py
rename to stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
index 10ee182..588132f 100644
--- a/stock/report/item_reorder_level/item_reorder_level.py
+++ b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
@@ -61,7 +61,7 @@
def get_consumed_items(condition):
cn_items = webnotes.conn.sql("""select se_item.item_code,
- sum(se_item.actual_qty) as 'consume_qty'
+ sum(se_item.actual_qty) as 'consume_qty'
from `tabStock Entry` se, `tabStock Entry Detail` se_item
where se.name = se_item.parent and se.docstatus = 1
and ifnull(se_item.t_warehouse, '') = '' %s
diff --git a/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.txt b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.txt
new file mode 100644
index 0000000..2763f21
--- /dev/null
+++ b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-07 12:47:22",
+ "docstatus": 0,
+ "modified": "2013-06-07 13:03:54",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Item",
+ "report_name": "Itemwise Recommended Reorder Level",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Itemwise Recommended Reorder Level"
+ }
+]
\ No newline at end of file