clinic/netforce_clinic/models/report_clinic.py

19 lines
623 B
Python
Raw Normal View History

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()
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()