clinic/netforce_clinic/models/report_clinic.py

25 lines
1015 B
Python
Raw Permalink Normal View History

2014-11-23 13:44:25 +00:00
import time
2014-10-28 15:16:16 +00:00
from netforce.model import Model
from netforce.database import get_connection
2014-10-29 09:10:19 +00:00
from netforce.access import get_active_company
2014-10-28 15:16:16 +00:00
class Report(Model):
_name="clinic.report"
_store=False
def cycle_recent_widget(self,context={}):
db=get_connection()
2014-10-29 09:10:19 +00:00
company_id=get_active_company()
2014-11-23 13:44:25 +00:00
#datenow=time.strftime("%Y-%m-%d")
#time_start='%s 00:00:00'%(datenow)
#time_stop='%s 23:59:59'%(datenow)
#res=db.query("select count(cycle_id) as count, c.name from clinic_hd_case as hd inner join clinic_cycle as c on c.id=hd.cycle_id where hd.company_id =%s and hd.date >= %s and hd.date <= %s group by c.name",company_id,time_start,time_stop)
res=db.query("select count(cycle_id) as count, c.name from clinic_hd_case as hd inner join clinic_cycle as c on c.id=hd.cycle_id where hd.company_id =%s group by c.name",company_id)
2014-10-28 15:16:16 +00:00
data=[]
for r in res:
data.append((r.name,r.count))
return {"value":data}
Report.register()