diff --git a/netforce_clinic/actions/clinic_hd_report.xml b/netforce_clinic/actions/clinic_report_hd_dialy.xml similarity index 58% rename from netforce_clinic/actions/clinic_hd_report.xml rename to netforce_clinic/actions/clinic_report_hd_dialy.xml index 1983996..67e54ae 100644 --- a/netforce_clinic/actions/clinic_hd_report.xml +++ b/netforce_clinic/actions/clinic_report_hd_dialy.xml @@ -1,8 +1,8 @@ - HD Report Dialy + Report HD Dialy report - clinic.hd.report.dialy - report_hd_report_dialy - hd_report_dialy + clinic.report.hd.dialy + report_hd_dialy + report_hd_dialy clinic_menu diff --git a/netforce_clinic/actions/clinic_hd_report_monthly.xml b/netforce_clinic/actions/clinic_report_hd_monthly.xml similarity index 74% rename from netforce_clinic/actions/clinic_hd_report_monthly.xml rename to netforce_clinic/actions/clinic_report_hd_monthly.xml index 784e5f6..c0ed924 100644 --- a/netforce_clinic/actions/clinic_hd_report_monthly.xml +++ b/netforce_clinic/actions/clinic_report_hd_monthly.xml @@ -1,8 +1,8 @@ - Summary of the Hemodialysis + Report HD Monthly report - clinic.hd.report.monthly + clinic.report.hd.monthly report_hd_monthly - hd_report_monthly + report_hd_monthly clinic_menu diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 8979fd2..b15c647 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -21,8 +21,8 @@
- - + + diff --git a/netforce_clinic/layouts/clinic_report_hd_dialy.xml b/netforce_clinic/layouts/clinic_report_hd_dialy.xml index f19a9e3..b2eeb23 100644 --- a/netforce_clinic/layouts/clinic_report_hd_dialy.xml +++ b/netforce_clinic/layouts/clinic_report_hd_dialy.xml @@ -1,6 +1,7 @@ -
+ - + + diff --git a/netforce_clinic/layouts/clinic_report_hd_monthly.xml b/netforce_clinic/layouts/clinic_report_hd_monthly.xml index af7ea12..7249176 100644 --- a/netforce_clinic/layouts/clinic_report_hd_monthly.xml +++ b/netforce_clinic/layouts/clinic_report_hd_monthly.xml @@ -1,3 +1,3 @@ - + diff --git a/netforce_clinic/models/report_hd_dialy.py b/netforce_clinic/models/report_hd_dialy.py index 41fae4c..423b6ba 100644 --- a/netforce_clinic/models/report_hd_dialy.py +++ b/netforce_clinic/models/report_hd_dialy.py @@ -2,25 +2,23 @@ import time from netforce.model import Model, fields, get_model -class HDReportDialy(Model): - _name="clinic.hd.report.dialy" - _string="HD Report Dialy" +class ReportHDDialy(Model): + _name="clinic.report.hd.dialy" + _string="Report HD Dialy" _transient=True _fields={ - "date": fields.Date("Start-Date"), "patient_id" : fields.Many2One("clinic.patient","Patient"), "doctor_id" : fields.Many2One("clinic.doctor","Doctor"), "nurse_id" : fields.Many2One("clinic.nurse","Nurse"), - #"time_start": fields.DateTime("Time start",required=False,search=True), - #"time_stop": fields.DateTime("Time stop",required=False,search=True), + "date_from": fields.Date("From"), + "date_to": fields.Date("To"), "cycle_id": fields.Many2One("clinic.cycle","Cycle"), } _defaults={ - 'date': lambda *a: time.strftime("%Y-%m-%d"), - #'time_start': lambda *a: time.strftime("%Y-%m-%d"), - #'time_stop': lambda *a: time.strftime("%Y-%m-%d"), + 'date_from': lambda *a: time.strftime("%Y-%m-%d"), + 'date_to': lambda *a: time.strftime("%Y-%m-%d"), } _order="cycle_id desc" @@ -34,15 +32,18 @@ class HDReportDialy(Model): "personal": "Personal", "others": "Others", } - #time_start=time.strftime("%Y-%m-%d") - #time_stop=time.strftime("%Y-%m-%d") - date=time.strftime("%Y-%m-%d") + + date_from=time.strftime("%Y-%m-%d") + date_to=time.strftime("%Y-%m-%d") + dom=[] dom.append(['state','=','completed']) if ids: obj=self.browse(ids)[0] - if obj.date: - date=obj.date + if obj.date_from: + date_from=obj.date_from + if obj.date_to: + date_to=obj.date_to if obj.cycle_id: dom.append([ 'cycle_id','=',obj.cycle_id.id, @@ -55,8 +56,8 @@ class HDReportDialy(Model): dom.append([ 'doctor_id','=',obj.doctor_id.id, ]) - dom.append(['time_start', ">=", date+" 00:00:00"]) - dom.append(['time_stop',"<=", date+" 23:59:59"]) + dom.append(['time_start', ">=", date_from+" 00:00:00"]) + dom.append(['time_stop',"<=", date_to+" 23:59:59"]) lines=[] cycles=[] @@ -72,7 +73,6 @@ class HDReportDialy(Model): if not cycle_name in cycles: cycles.append(cycle_name) show_cycle=True - print("OK") vals={ 'color': 'success', 'show_cycle': False, @@ -125,7 +125,10 @@ class HDReportDialy(Model): del lines[0] data={ 'lines': lines, + 'same_date': date_from==date_to, + 'date_from': date_from, + 'date_to': date_to, } return data -HDReportDialy.register() +ReportHDDialy.register() diff --git a/netforce_clinic/models/report_hd_monthly.py b/netforce_clinic/models/report_hd_monthly.py index 00553cf..0cf58b5 100644 --- a/netforce_clinic/models/report_hd_monthly.py +++ b/netforce_clinic/models/report_hd_monthly.py @@ -4,9 +4,9 @@ from calendar import monthrange from netforce.model import Model, fields, get_model -class HDReportMonth(Model): - _name="clinic.hd.report.monthly" - _string="Summary of the Hemodialysis" +class ReportHDMonthly(Model): + _name="clinic.report.hd.monthly" + _string="Report HD Monthly" _transient=True _fields={ @@ -49,4 +49,4 @@ class HDReportMonth(Model): return data -HDReportMonth.register() +ReportHDMonthly.register() diff --git a/netforce_clinic/templates/report_hd_report_dialy.hbs b/netforce_clinic/templates/report_hd_dialy.hbs similarity index 85% rename from netforce_clinic/templates/report_hd_report_dialy.hbs rename to netforce_clinic/templates/report_hd_dialy.hbs index 9c63701..5056fd3 100644 --- a/netforce_clinic/templates/report_hd_report_dialy.hbs +++ b/netforce_clinic/templates/report_hd_dialy.hbs @@ -1,9 +1,13 @@
-

HD Case Report

-

- Clinic [Ratchawat]
- As at {{fmt_date date}} -

+

Summary of the Hemodialysis

+

Clinic [Ratchawat]

+

+ {{#if same_date}} + As at {{fmt_date date_from}} + {{else}} + From {{fmt_date date_from}} to {{fmt_date date_to}} + {{/if}} +

@@ -45,7 +49,7 @@ {{/if}} {{#if no_patient}} - + {{else}}
TotalTOTAL {{no_patient}}