diff --git a/netforce_clinic/models/gen_visit.py b/netforce_clinic/models/gen_visit.py index c8d2211..662102c 100644 --- a/netforce_clinic/models/gen_visit.py +++ b/netforce_clinic/models/gen_visit.py @@ -10,13 +10,15 @@ class GenVisit(Model): _name="clinic.gen.visit" _transient=True + def _get_duration(self,ids,context={}): res={} for obj in self.browse(ids): duration=datetime.strptime(obj.date_to,FMT_DATETIME)-datetime.strptime(obj.date_from,FMT_DATETIME) res[obj.id]=duration.days return res - + + _fields={ 'date_from': fields.DateTime("From", required=True), 'date_to': fields.DateTime("To", required=True), @@ -33,6 +35,7 @@ class GenVisit(Model): 'duration': fields.Integer("Duration (hrs)", function="_get_duration"), } + def _get_lines(self,context={}): ids=context.get("ids") if not ids: diff --git a/netforce_clinic/models/patient.py b/netforce_clinic/models/patient.py index fb7c1d4..23be00b 100644 --- a/netforce_clinic/models/patient.py +++ b/netforce_clinic/models/patient.py @@ -76,6 +76,7 @@ class Patient(Model): "hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"), "partner_id": fields.Many2One("partner","Contact"), "dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"), + "active":fields.Boolean("Active"), } def _get_number(self,context={}): @@ -96,12 +97,15 @@ class Patient(Model): cause_ids=get_model("clinic.cause.chronic").search([]) return cause_ids + _defaults={ "type": "mg", "reg_date": lambda *a: time.strftime("%Y-%m-%d"), "number": _get_number, "company_id": lambda *a: get_active_company(), #'cause_lines': _get_cause_line, + "active" : True, + } _order="date desc,number desc" diff --git a/netforce_clinic/models/report_hd_detail.py b/netforce_clinic/models/report_hd_detail.py index 08054e2..44c7536 100644 --- a/netforce_clinic/models/report_hd_detail.py +++ b/netforce_clinic/models/report_hd_detail.py @@ -28,19 +28,11 @@ class ReportHDDetail(Model): def get_report_data(self,ids,context={}): - - # company_id=get_active_company - # comp=get_model("company").browse(company_id) - # context=> dict - # inside context => keys => defaults => type => dict - # dict => key: value => '', 1, [], {} - # context['default'] => defaults(dict) => key => inside key => value => '2014-10-22' for item in get_model("company").search_browse([]): company_name=item.name date_from=time.strftime("%Y-%m-%d") date_to=time.strftime("%Y-%m-%d") - defaults=context.get("defaults") if defaults: if defaults.get("date_from"): @@ -80,10 +72,10 @@ class ReportHDDetail(Model): dom.append([ 'doctor_id','=',obj.doctor_id.id, ]) - if obj.type_id: + """if obj.patient_id: dom.append([ - 'type','=',obj.type_id.name, - ]) + 'type','=',obj.patient_id.type, + ])""" dom.append(['time_start', ">=", date_from+" 00:00:00"]) dom.append(['time_stop',"<=", date_to+" 23:59:59"]) diff --git a/netforce_clinic/models/report_hd_medical.py b/netforce_clinic/models/report_hd_medical.py index 777e820..79cc2da 100644 --- a/netforce_clinic/models/report_hd_medical.py +++ b/netforce_clinic/models/report_hd_medical.py @@ -56,9 +56,7 @@ class ReportHDMedical(Model): vals={ 'product_code' : product_code, 'medical' : product_name, - 'mg' : '-', 'uc' : '-', - 'sc' : '-', 'buy' : '-', 'amount' : product_amount, 'product_id': product_id, diff --git a/netforce_clinic/models/report_hd_summary.py b/netforce_clinic/models/report_hd_summary.py index 64b357e..ca1e20b 100644 --- a/netforce_clinic/models/report_hd_summary.py +++ b/netforce_clinic/models/report_hd_summary.py @@ -48,6 +48,8 @@ class ReportHDSummary(Model): time_start='2014-%s-01'%(month) # 2014-10-20 time_stop='2014-%s-%s'%(month,total_day) + + dom=[] dom.append(['type','=','mg']) patients_mg=len(get_model("clinic.patient").search(dom)) @@ -61,14 +63,14 @@ class ReportHDSummary(Model): patients_pn=len(get_model("clinic.patient").search(dom)) #New Patients #dom.append(['type','=','All']) - patients=len(get_model("clinic.patient").search_browse(['type','=','All'])) + #patients=len(get_model("clinic.patient").search_browse(['type','=','All'])) dom=[] dom.append(['state','=','completed']) dom.append(['time_start','>=',time_start]) dom.append(['time_stop','<=',time_stop]) - cur_total_case=len(get_model("clinic.hd.case").search(dom)) + patients=len(get_model("clinic.patient").search_browse(['type','=','All'])) weekday, prev_total_day=monthrange(year, previous_month) time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20 @@ -157,7 +159,6 @@ class ReportHDSummary(Model): 'lines': lines, 'company_name': company_name, } - print("data", data) return data