mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
replaced convert_to_lists
This commit is contained in:
@@ -33,9 +33,9 @@ class DocType:
|
||||
def get_monthwise_amount(self,lst):
|
||||
lst = lst.split(',')
|
||||
if not lst[1]:
|
||||
ret = convert_to_lists(sql("SELECT SUM(grand_total) AMOUNT,CASE MONTH(due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME FROM `tabSales Invoice` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY MONTH(due_date) ORDER BY MONTH(due_date)"%lst[0]))
|
||||
ret = webnotes.conn.convert_to_lists(sql("SELECT SUM(grand_total) AMOUNT,CASE MONTH(due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME FROM `tabSales Invoice` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY MONTH(due_date) ORDER BY MONTH(due_date)"%lst[0]))
|
||||
else:
|
||||
ret = convert_to_lists(sql("select sum(t2.amount) AMOUNT ,CASE MONTH(t1.due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME from `tabSales Invoice` t1,`tabSales Invoice Item` t2 WHERE t1.name = t2.parent and t1.docstatus = 1 and t2.item_group = '%s' AND t1.fiscal_year = '%s' GROUP BY MONTH(t1.due_date) ORDER BY MONTH(t1.due_date)"%(lst[1],lst[0])))
|
||||
ret = webnotes.conn.convert_to_lists(sql("select sum(t2.amount) AMOUNT ,CASE MONTH(t1.due_date) WHEN 1 THEN 'JAN' WHEN 2 THEN 'FEB' WHEN 3 THEN 'MAR' WHEN 4 THEN 'APR' WHEN 5 THEN 'MAY' WHEN 6 THEN 'JUN' WHEN 7 THEN 'JUL' WHEN 8 THEN 'AUG' WHEN 9 THEN 'SEP' WHEN 10 THEN 'OCT' WHEN 11 THEN 'NOV' WHEN 12 THEN 'DEC' END MONTHNAME from `tabSales Invoice` t1,`tabSales Invoice Item` t2 WHERE t1.name = t2.parent and t1.docstatus = 1 and t2.item_group = '%s' AND t1.fiscal_year = '%s' GROUP BY MONTH(t1.due_date) ORDER BY MONTH(t1.due_date)"%(lst[1],lst[0])))
|
||||
|
||||
m =cint(sql("select month('%s')"%(get_defaults()['year_start_date']))[0][0])
|
||||
|
||||
@@ -62,13 +62,13 @@ class DocType:
|
||||
if not lst[2]:
|
||||
query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+ cases +"END Weekly FROM `tabSales Invoice` WHERE MONTH(due_date) = %d AND docstatus = 1 AND fiscal_year = '%s' GROUP BY Weekly ORDER BY Weekly"
|
||||
|
||||
ret = convert_to_lists(sql(query%(cint(lst[0]),lst[1])))
|
||||
ret = webnotes.conn.convert_to_lists(sql(query%(cint(lst[0]),lst[1])))
|
||||
|
||||
else:
|
||||
|
||||
query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly FROM `tabSales Invoice` t1, `tabSales Invoice Item` t2 WHERE MONTH(t1.due_date) = %d AND t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly ORDER BY Weekly"
|
||||
|
||||
ret =convert_to_lists(sql(query%(cint(lst[0]),lst[1],lst[2])))
|
||||
ret =webnotes.conn.convert_to_lists(sql(query%(cint(lst[0]),lst[1],lst[2])))
|
||||
|
||||
return ret and ret or ''
|
||||
#================================================================================
|
||||
@@ -106,12 +106,12 @@ class DocType:
|
||||
|
||||
if not lst[1]:
|
||||
query = "SELECT SUM(grand_total) AMOUNT,CASE WEEK(due_date)"+cases+"END Weekly, month(due_date) month FROM `tabSales Invoice` WHERE docstatus = 1 AND fiscal_year = '%s' GROUP BY `month`,weekly ORDER BY `month`,weekly"
|
||||
ret = convert_to_lists(sql(query%lst[0]))
|
||||
ret = webnotes.conn.convert_to_lists(sql(query%lst[0]))
|
||||
|
||||
else:
|
||||
|
||||
query = "SELECT SUM(t2.amount) AMOUNT,CASE WEEK(t1.due_date)" + cases + "END Weekly, month(due_date) month FROM `tabSales Invoice` t1, `tabSales Invoice Item` t2 WHERE t1.docstatus = 1 AND t1.fiscal_year = '%s' AND t1.name = t2.parent AND t2.item_group ='%s' GROUP BY Weekly ORDER BY Weekly"
|
||||
ret = convert_to_lists(sql(query%(lst[0],lst[1])))
|
||||
ret = webnotes.conn.convert_to_lists(sql(query%(lst[0],lst[1])))
|
||||
|
||||
|
||||
return ret and ret or ''
|
||||
@@ -228,10 +228,10 @@ class DocType:
|
||||
return d
|
||||
|
||||
def get_item_groups(self):
|
||||
ret = convert_to_lists(sql("select name from `tabItem Group` where docstatus != 2 and is_group = 'No'"))
|
||||
#ret = convert_to_lists(sql("select item_group from `tabItem` where is_sales_item='Yes' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) and item_group !=''"))
|
||||
ret = webnotes.conn.convert_to_lists(sql("select name from `tabItem Group` where docstatus != 2 and is_group = 'No'"))
|
||||
#ret = webnotes.conn.convert_to_lists(sql("select item_group from `tabItem` where is_sales_item='Yes' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now()) and item_group !=''"))
|
||||
return ret and ret or ''
|
||||
|
||||
def get_fiscal_year(self):
|
||||
ret = convert_to_lists(sql("select name from `tabFiscal Year` where docstatus =0"))
|
||||
ret = webnotes.conn.convert_to_lists(sql("select name from `tabFiscal Year` where docstatus =0"))
|
||||
return ret and ret or ''
|
||||
Reference in New Issue
Block a user