19 lines
623 B
Python
19 lines
623 B
Python
from netforce.model import Model
|
|
from netforce.database import get_connection
|
|
from netforce.access import get_active_company
|
|
|
|
class Report(Model):
|
|
_name="clinic.report"
|
|
_store=False
|
|
|
|
def cycle_recent_widget(self,context={}):
|
|
db=get_connection()
|
|
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)
|
|
data=[]
|
|
for r in res:
|
|
data.append((r.name,r.count))
|
|
return {"value":data}
|
|
|
|
Report.register()
|