[Reports] [Customers Not Buying Sinse Long Time] and [Itemwise Recommended Reorder level]

This commit is contained in:
Saurabh 2013-06-07 13:34:16 +05:30
parent 1efc8b3734
commit 5b1e899250
10 changed files with 34 additions and 15 deletions

View File

@ -166,8 +166,8 @@ wn.module_page["Selling"] = [
route: "query-report/Item-wise Sales History", route: "query-report/Item-wise Sales History",
}, },
{ {
"label":wn._("No Sales Order from Customers (Since 2 months)"), "label":wn._("Customers Not Buying Since Long Time"),
route: "query-report/No Sales Order from Customers", route: "query-report/Customers Not Buying Since Long Time",
doctype: "Sales Order" doctype: "Sales Order"
}, },

View File

@ -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
}
]
}

View File

@ -13,15 +13,24 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes import webnotes
from webnotes.utils import getdate, cint
def execute(filters=None): 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() columns = get_columns()
customers = get_so_details() customers = get_so_details()
data = [] data = []
for cust in customers: 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])) cust.insert(7,get_last_so_amt(cust[0]))
data.append(cust) data.append(cust)
return columns, data return columns, data

View File

@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-06-06 19:15:50", "creation": "2013-06-07 12:27:07",
"docstatus": 0, "docstatus": 0,
"modified": "2013-06-06 19:15:51", "modified": "2013-06-07 12:27:07",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -11,11 +11,11 @@
"is_standard": "Yes", "is_standard": "Yes",
"name": "__common__", "name": "__common__",
"ref_doctype": "Sales Order", "ref_doctype": "Sales Order",
"report_name": "No Sales Order from Customers", "report_name": "Customers Not Buying Since Long Time ",
"report_type": "Script Report" "report_type": "Script Report"
}, },
{ {
"doctype": "Report", "doctype": "Report",
"name": "No Sales Order from Customers" "name": "Customers Not Buying Since Long Time"
} }
] ]

View File

@ -206,8 +206,8 @@ wn.module_page["Stock"] = [
route: "query-report/Requested Items To Be Transferred", route: "query-report/Requested Items To Be Transferred",
}, },
{ {
"label":wn._("Item Reorder Level"), "label":wn._("Itemwise Recommended Reorder Level"),
route: "query-report/Item Reorder Level", route: "query-report/Itemwise Recommended Reorder Level",
doctype: "Item" doctype: "Item"
}, },
] ]

View File

@ -1,4 +1,4 @@
wn.query_reports["Item Reorder Level"] = { wn.query_reports["Itemwise Recommended Reorder Level"] = {
"filters": [ "filters": [
{ {
"fieldname":"from_date", "fieldname":"from_date",

View File

@ -61,7 +61,7 @@ def get_item_info():
def get_consumed_items(condition): def get_consumed_items(condition):
cn_items = webnotes.conn.sql("""select se_item.item_code, 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 from `tabStock Entry` se, `tabStock Entry Detail` se_item
where se.name = se_item.parent and se.docstatus = 1 where se.name = se_item.parent and se.docstatus = 1
and ifnull(se_item.t_warehouse, '') = '' %s and ifnull(se_item.t_warehouse, '') = '' %s

View File

@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-06-05 15:34:51", "creation": "2013-06-07 12:47:22",
"docstatus": 0, "docstatus": 0,
"modified": "2013-06-05 15:50:30", "modified": "2013-06-07 13:03:54",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -11,11 +11,11 @@
"is_standard": "Yes", "is_standard": "Yes",
"name": "__common__", "name": "__common__",
"ref_doctype": "Item", "ref_doctype": "Item",
"report_name": "Item Reorder Level", "report_name": "Itemwise Recommended Reorder Level",
"report_type": "Script Report" "report_type": "Script Report"
}, },
{ {
"doctype": "Report", "doctype": "Report",
"name": "Item Reorder Level" "name": "Itemwise Recommended Reorder Level"
} }
] ]