From f84e2337e4f53a4c95cf03468a719c1efe391c5c Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Thu, 13 Nov 2014 13:30:51 +0700 Subject: [PATCH] report --- netforce_clinic/layouts/clinic_board.xml | 12 ++-- netforce_clinic/layouts/clinic_menu.xml | 2 +- .../layouts/clinic_report_medical_summary.xml | 4 +- netforce_clinic/models/__init__.py | 1 + .../models/report_medical_summary.py | 49 ++++++++++++--- netforce_clinic/models/visit_dialy.py | 12 ++++ netforce_clinic/todo.txt | 62 +++---------------- 7 files changed, 69 insertions(+), 73 deletions(-) create mode 100644 netforce_clinic/models/visit_dialy.py diff --git a/netforce_clinic/layouts/clinic_board.xml b/netforce_clinic/layouts/clinic_board.xml index 1738390..e46937e 100644 --- a/netforce_clinic/layouts/clinic_board.xml +++ b/netforce_clinic/layouts/clinic_board.xml @@ -1,11 +1,7 @@ - + - - - - - - - + + + diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index face1da..17be872 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -32,7 +32,7 @@ - + diff --git a/netforce_clinic/layouts/clinic_report_medical_summary.xml b/netforce_clinic/layouts/clinic_report_medical_summary.xml index f8a9445..5984186 100644 --- a/netforce_clinic/layouts/clinic_report_medical_summary.xml +++ b/netforce_clinic/layouts/clinic_report_medical_summary.xml @@ -1,3 +1,5 @@
- + + + diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py index 5a69f70..284b0c5 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -15,6 +15,7 @@ from . import patient_comorbidity from . import patient_morbidity from . import race from . import visit +from . import visit_dialy from . import hd_case from . import hd_case_line from . import hd_case_personal diff --git a/netforce_clinic/models/report_medical_summary.py b/netforce_clinic/models/report_medical_summary.py index 0f92761..063b9f7 100644 --- a/netforce_clinic/models/report_medical_summary.py +++ b/netforce_clinic/models/report_medical_summary.py @@ -12,25 +12,47 @@ class ReportMedicalSummary(Model): _fields={ "date": fields.Date("Month", required=True), + "date_from": fields.Date("From", required=True), + "date_to": fields.Date("To", required=True), } + def _get_date_from(self,context={}): + year,month=time.strftime("%Y-%m").split("-") + return '%s-%s-01'%(year,month) + + def _get_date_to(self,context={}): + year,month,day=time.strftime("%Y-%m-%d").split("-") + weekday, total_day=monthrange(int(year), int(month)) + return "%s-%s-%s"%(year,month,total_day) + _defaults={ 'date': lambda *a: time.strftime("%Y-%m-%d"), + 'date_from': _get_date_from, + 'date_to': _get_date_to, } def get_report_data(self,ids,context={}): - date=time.strftime("%Y-%m-%d") + year, month=time.strftime("%Y-%m").split("-") + weekday, total_day=monthrange(int(year), int(month)) + time_start='%s-%s-01'%(year,str(month).zfill(2)) + time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day) + defaults=context.get('defaults') if defaults: - date=defaults['date'] - year=int(date[0:4]) - month=int(date[5:7]) - weekday, total_day=monthrange(year, month) + year,month,total_day=defaults['date'].split("-") + time_start='%s-%s-01'%(year,str(month).zfill(2)) + time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day) + + if ids: + obj=self.browse(ids)[0] + month=obj.date_from.split("-")[1] + time_start=obj.date_from + time_stop=obj.date_to dom=[] - dom.append([['state','=','completed']]) - dom.append([['time_start','>=','%s-%s-01 00:00:00'%(year,month)]]) - dom.append([['time_stop','<=','%s-%s-%s 23:59:59'%(year,month,total_day)]]) + #dom.append([['state','=','completed']]) + dom.append(['time_start','>=','%s 00:00:00'%time_start]) + dom.append(['time_stop','<=','%s 23:59:59'%time_stop]) products={} for prod in get_model("product").search_browse([['type','=','stock']]): @@ -73,7 +95,7 @@ class ReportMedicalSummary(Model): company_id=get_active_company() company=get_model('company').browse(company_id) - month_str=utils.MONTHS['th_TH'][month] + month_str=utils.MONTHS['th_TH'][int(month)] lines=sorted(lines, key=lambda x: x['prod_name']) titles={ @@ -94,4 +116,13 @@ class ReportMedicalSummary(Model): return data + def onchange_date(self,context={}): + data=context['data'] + date=data['date'] + year,month,day=date.split("-") + weekday, total_day=monthrange(int(year), int(month)) + data['date_from']="%s-%s-01"%(year,month) + data['date_to']="%s-%s-%s"%(year,month,total_day) + return data + ReportMedicalSummary.register() diff --git a/netforce_clinic/models/visit_dialy.py b/netforce_clinic/models/visit_dialy.py new file mode 100644 index 0000000..abb3276 --- /dev/null +++ b/netforce_clinic/models/visit_dialy.py @@ -0,0 +1,12 @@ +from netforce.model import Model, fields + +class VisitDialy(Model): + _name="clinic.visit.dialy" + _string="Visit Dialy" + _transient=True + + _fields={ + 'date': fields.Date('Date'), + } + +VisitDialy.register() diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 03a59d8..fa35e2f 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,54 +1,8 @@ -====== - design visit - design cycle item - -====== -flow: - planing schedule - plaining visit - - generate visit - hd case - - check list of personals -> popup - - nurse - - remove who - - doctor -====== -missing: - - search calendar - - can not move schedule in calendar - - color calendar - - can not move calendar's schedule - - order's visit report dialy - - same model & mode (list) but use diffent target - -dashboard - : hd summary report -> click and go direct -cycle item: - cycle_id - list's nurse - list's patient & doctor - -idea: - show popup to complete hd case - approve by nurse - -after finish hd case -> show popup to check nurse and doctor after finish - -formalar - tick: - find all -> replace -> multiple x - -order - - visit - - date, cycle (1, 2, 3), state - - by datenow, cycle sequence, state - - solution: maybe make some dashboard to that - - like a table treatment in 1 day - -widget - - - - summary hd case for each month (see. account dashboard) - bar char -tick - many2many=> add, set - one2many=> create, write +cycle dialy + cycle_id, date, + -list of cycle items + -list +visit dialy + list of visits +import payment + - error report