[Reprots][No Sales Order From Customer] and [Item Reorder Level]

This commit is contained in:
Saurabh
2013-06-06 19:31:14 +05:30
parent 7b48218b6f
commit 1efc8b3734
6 changed files with 52 additions and 48 deletions

View File

@@ -149,11 +149,6 @@ wn.module_page["Selling"] = [
right: true,
icon: "icon-list",
items: [
{
"label":wn._("No Sales Order from Customers (Since 2 months)"),
route: "query-report/No Sales Order from Customers (Since 2 months)",
doctype: "Sales Order"
},
{
"label":wn._("Customer Addresses And Contacts"),
route: "query-report/Customer Addresses And Contacts"
@@ -170,6 +165,11 @@ wn.module_page["Selling"] = [
"label":wn._("Item-wise Sales History"),
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",
doctype: "Sales Order"
},
]
}

View File

@@ -16,7 +16,6 @@
import webnotes
def execute(filters=None):
columns = get_columns()
customers = get_so_details()
@@ -25,7 +24,6 @@ def execute(filters=None):
if cust[8] >= 60: # days_since_last_order
cust.insert(7,get_last_so_amt(cust[0]))
data.append(cust)
return columns, data
def get_so_details():
@@ -40,19 +38,18 @@ def get_so_details():
so.net_total * so.per_delivered/100,
so.net_total)) as 'total_order_considered',
max(so.transaction_date) as 'last_sales_order_date',
DATEDIFF(CURDATE(),max(so.transaction_date)) as 'days_since_last_order'
DATEDIFF(CURDATE(), max(so.transaction_date)) as 'days_since_last_order'
from `tabCustomer` cust, `tabSales Order` so
where cust.name = so.customer and so.docstatus = 1
group by cust.name
order by 'days_since_last_order' desc """,as_list=1)
def get_last_so_amt(customer):
return webnotes.conn.sql("""select net_total from `tabSales Order`
where customer ='%(customer)s' and docstatus = 1 and
transaction_date = (select max(transaction_date)
from `tabSales Order`
where customer = '%(customer)s')
"""%{'customer':customer})
res = webnotes.conn.sql("""select net_total from `tabSales Order`
where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc
limit 1""" % {'customer':customer})
return res and res[0][0] or 0
def get_columns():
return [

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-06-05 11:40:49",
"creation": "2013-06-06 19:15:50",
"docstatus": 0,
"modified": "2013-06-05 11:40:49",
"modified": "2013-06-06 19:15:51",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -11,11 +11,11 @@
"is_standard": "Yes",
"name": "__common__",
"ref_doctype": "Sales Order",
"report_name": "No Sales Order from Customers (Since 2 months)",
"report_name": "No Sales Order from Customers",
"report_type": "Script Report"
},
{
"doctype": "Report",
"name": "No Sales Order from Customers (Since 2 months)"
"name": "No Sales Order from Customers"
}
]