diff --git a/netforce_clinic/layouts/clinic_cycle_form.xml b/netforce_clinic/layouts/clinic_cycle_form.xml index 771b278..fc4271c 100644 --- a/netforce_clinic/layouts/clinic_cycle_form.xml +++ b/netforce_clinic/layouts/clinic_cycle_form.xml @@ -1,4 +1,5 @@
+ diff --git a/netforce_clinic/layouts/clinic_cycle_list.xml b/netforce_clinic/layouts/clinic_cycle_list.xml index 9d2ffcd..f099825 100644 --- a/netforce_clinic/layouts/clinic_cycle_list.xml +++ b/netforce_clinic/layouts/clinic_cycle_list.xml @@ -1,4 +1,5 @@ + diff --git a/netforce_clinic/models/cycle.py b/netforce_clinic/models/cycle.py index 8313e7e..7740711 100644 --- a/netforce_clinic/models/cycle.py +++ b/netforce_clinic/models/cycle.py @@ -7,10 +7,12 @@ class Cycle(Model): _fields={ "name": fields.Char("Name",required=True,search=True), 'duration': fields.Integer("Duration (hrs)"), + 'sequence': fields.Integer("Sequence"), } _defaults={ 'duration': 1, + 'sequence': 1, } diff --git a/netforce_clinic/models/report_hd.py b/netforce_clinic/models/report_hd.py index 225e5a9..49555c0 100644 --- a/netforce_clinic/models/report_hd.py +++ b/netforce_clinic/models/report_hd.py @@ -19,8 +19,6 @@ class HDReport(Model): _order="cycle_id desc" def get_report_data(self,ids,context={}): - obj=self.browse(ids)[0] - lines=[] PATIENT_TYPE={ "mg":"Medical Government", "sc":"Social Security", @@ -28,33 +26,79 @@ class HDReport(Model): "personal": "Personal", "others": "Others", } + date=time.strftime("%Y-%m-%d") dom=[] - dom.append([ - 'state','=','completed', - ]) - if obj.cycle_id: - dom.append([ - 'cycle_id','=',obj.cycle_id.id, - ]) - - if obj.date: - dom.append(['time_start', ">=", obj.date+" 00:00:00"]) - dom.append(['time_stop', "<=", obj.date+" 23:59:59"]) - + dom.append(['state','=','completed']) + if ids: + obj=self.browse(ids)[0] + if obj.date: + date=obj.date + if obj.cycle_id: + dom.append([ + 'cycle_id','=',obj.cycle_id.id, + ]) + dom.append(['time_start', ">=", date+" 00:00:00"]) + dom.append(['time_stop', "<=", date+" 23:59:59"]) print("dom ", dom) - for hd_case in get_model("clinic.hd.case").search_browse(dom): + lines=[] + cycles=[] + index=0 + no_patient=0 + for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"): patient_type=hd_case.patient_id.type patient_type=PATIENT_TYPE.get(patient_type) - lines.append({ - 'cycle' : hd_case.cycle_id.name, + cycle_name=hd_case.cycle_id.name or "" + show_cycle=False + if not cycle_name in cycles: + cycles.append(cycle_name) + show_cycle=True + if index > 1: + vals={ + 'color': 'success', + 'show_cycle': False, + 'cycle' : "", + 'patient': "", + 'no_patient': no_patient, + 'patient_type' : "", + 'doctor' : "", + 'total' : "", + 'rc_no' : "", + 'nurse' : "", + } + lines.append(vals) + no_patient=1 + else: + no_patient+=1 + index+=1 + vals={ + 'show_cycle': show_cycle, + 'cycle' : cycle_name, 'patient': hd_case.patient_id.name, 'patient_type' : patient_type, + 'no_patient': 0, 'doctor' : hd_case.doctor_id.name, 'total' : hd_case.fee, 'rc_no' : hd_case.number, 'nurse' : hd_case.nurse_id.name, - }) + } + lines.append(vals) + # XXX + if lines: + vals={ + 'color': 'success', + 'show_cycle': False, + 'cycle' : "", + 'patient': "", + 'no_patient': no_patient, + 'patient_type' : "", + 'doctor' : "", + 'total' : "", + 'rc_no' : "", + 'nurse' : "", + } + lines.append(vals) + data={ 'lines': lines, } diff --git a/netforce_clinic/templates/report_dialyzer_drop.hbs~ b/netforce_clinic/templates/report_dialyzer_drop.hbs~ deleted file mode 100644 index 343f8eb..0000000 --- a/netforce_clinic/templates/report_dialyzer_drop.hbs~ +++ /dev/null @@ -1,63 +0,0 @@ -
-

- HD Case Report -

-
- - - - - - - - - - - - - {{#each lines context=context}} - - - - - - - - - - - - {{/each}} - - - - - - -
- Cycle - - Patient - - Doctor - - HD Fee - - RC.No - - Nurse -
- {{cycle}} -
- - - {{patient}} - - {{doctor}} - - {{total}} - - {{rc_no}} - - {{nurse}} -
diff --git a/netforce_clinic/templates/report_hd_report.hbs b/netforce_clinic/templates/report_hd_report.hbs index 343f8eb..19a27b9 100644 --- a/netforce_clinic/templates/report_hd_report.hbs +++ b/netforce_clinic/templates/report_hd_report.hbs @@ -15,6 +15,9 @@ Doctor + + Patient Type + HD Fee @@ -28,21 +31,27 @@ {{#each lines context=context}} - - - {{cycle}} - - - - - - - - {{patient}} - + {{#if show_cycle}} + + + {{cycle}} + + + {{/if}} + + {{#if no_patient}} + Total + {{no_patient}} + {{else}} + + {{patient}} + {{/if}} {{doctor}} + + {{patient_type}} + {{total}}