diff --git a/netforce_clinic/actions/clinic_schedule_board.xml b/netforce_clinic/actions/clinic_schedule_board.xml
new file mode 100644
index 0000000..daa06bc
--- /dev/null
+++ b/netforce_clinic/actions/clinic_schedule_board.xml
@@ -0,0 +1,8 @@
+
+ Schedule Board
+ report
+ clinic.schedule.board
+ schedule_board
+ schedule_board
+ clinic_menu
+
diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml
index 8c6cf7f..48af121 100644
--- a/netforce_clinic/layouts/clinic_menu.xml
+++ b/netforce_clinic/layouts/clinic_menu.xml
@@ -31,7 +31,10 @@
+ -
+
+
-
diff --git a/netforce_clinic/layouts/clinic_schedule_board.xml b/netforce_clinic/layouts/clinic_schedule_board.xml
new file mode 100644
index 0000000..31d491b
--- /dev/null
+++ b/netforce_clinic/layouts/clinic_schedule_board.xml
@@ -0,0 +1,4 @@
+
diff --git a/netforce_clinic/layouts/clinic_schedule_form.xml b/netforce_clinic/layouts/clinic_schedule_form.xml
index 5f1af9b..bc7e2d2 100644
--- a/netforce_clinic/layouts/clinic_schedule_form.xml
+++ b/netforce_clinic/layouts/clinic_schedule_form.xml
@@ -18,6 +18,7 @@
+
diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py
index af4f59a..2788785 100644
--- a/netforce_clinic/models/__init__.py
+++ b/netforce_clinic/models/__init__.py
@@ -47,6 +47,7 @@ from . import staff_level
from . import staff_rotation
from . import staff_cycle
from . import schedule
+from . import schedule_board
from . import schedule_line
from . import schedule_copy
from . import load_nurse
diff --git a/netforce_clinic/models/schedule_board.py b/netforce_clinic/models/schedule_board.py
new file mode 100644
index 0000000..a6b8848
--- /dev/null
+++ b/netforce_clinic/models/schedule_board.py
@@ -0,0 +1,100 @@
+import time
+
+from datetime import datetime, timedelta
+from netforce.model import Model, fields, get_model
+from netforce.access import get_active_company
+
+from . import utils
+
+DRT=5
+
+class ScheduleBoard(Model):
+ _name="clinic.schedule.board"
+ _string="Schedule Board"
+ _transient=True
+
+ _fields={
+ "date_from": fields.Date("From", required=True),
+ "date_to": fields.Date("To", required=True),
+ }
+
+ _defaults={
+ 'date_from': lambda *a: time.strftime("%Y-%m-%d"),
+ 'date_to': lambda *a: (datetime.now()+timedelta(days=DRT)).strftime("%Y-%m-%d"),
+ }
+
+ def get_report_data(self,ids,context={}):
+ company_id=get_active_company()
+ company=get_model("company").browse(company_id)
+
+ date_from=datetime.now().strftime("%Y-%m-%d")
+ date_to=(datetime.now()+timedelta(days=DRT)).strftime("%Y-%m-%d")
+ if ids:
+ obj=self.browse(ids)[0]
+ date_from=obj.date_from
+ date_to=obj.date_to
+
+ time_start='%s 00:00:00'%(date_from)
+ time_stop='%s 23:59:59'%(date_to)
+
+ dom=[]
+ dom.append(['time_start','>=','%s'%time_start])
+ dom.append(['time_stop','<=','%s'%time_stop])
+
+ lines=[]
+ empty_line={
+ 'no': '',
+ 'schedule_name': '',
+ 'cycle_name': '',
+ 'nurse_id': None,
+ 'nurse_name': '',
+ 'level_id': None,
+ 'level_name': '',
+ 'note':'',
+ 'title':True,
+ 'schedule_id': None,
+ }
+
+ for schedule in get_model("clinic.schedule").search_browse(dom):
+ no=1
+ line=empty_line.copy()
+ date=schedule.date
+ line['schedule_id']=schedule.id
+ line['schedule_name']=utils.date2thai(date,format='%(Td)s %(d)s %(Tm)s',lang="th_TH2"),
+ lines.append(line)
+ for line in schedule.lines:
+ nurse=line.nurse_id
+ level=line.level_id
+ cycle=line.cycle_id
+ line={
+ 'no': no,
+ 'cycle_id': cycle.id,
+ 'cycle_name': cycle.name or '',
+ 'cycle_color': cycle.color or '',
+ 'nurse_id': nurse.id,
+ 'nurse_name': nurse.name or "",
+ 'level_id': level.id,
+ 'level_name': level.name or "",
+ 'title': False,
+ 'schedule_id': None,
+ 'schedule_name': '',
+ 'note': line.note or "",
+ }
+ lines.append(line)
+ no+=1
+ has_duration=False
+ if date_from != date_to:
+ has_duration=True
+ data={
+ 'lines': lines,
+ 'date': utils.date2thai(date_from,format='ประจำวัน%(Td)s ที่ %(d)s %(Tm)s %(BY)s'),
+ 'company_name': company.name,
+ 'company_parent_name': company.parent_id.name,
+ 'has_duration': has_duration,
+ 'date_from': utils.date2thai(date_from,format='%(d)s %(Tm)s %(By)s',lang="th_TH2"),
+ 'date_to': utils.date2thai(date_to,format='%(d)s %(Tm)s %(By)s',lang="th_TH2"),
+ }
+
+ return data
+
+ScheduleBoard.register()
diff --git a/netforce_clinic/models/schedule_line.py b/netforce_clinic/models/schedule_line.py
index 8c1bb50..b4a4f9c 100644
--- a/netforce_clinic/models/schedule_line.py
+++ b/netforce_clinic/models/schedule_line.py
@@ -16,6 +16,7 @@ class ScheduleLine(Model):
'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item"),
"nurse_id": fields.Many2One("clinic.staff","Nurse",domain=[['type','=','nurse']]),
'level_id': fields.Many2One("clinic.staff.level","Level",function="_get_level"),
+ 'note': fields.Text("Note"),
}
ScheduleLine.register()
diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py
index 691cc0c..081c3b4 100644
--- a/netforce_clinic/models/visit_board.py
+++ b/netforce_clinic/models/visit_board.py
@@ -54,9 +54,11 @@ class VisitBoard(Model):
'visit_id': None,
'cycle_name': '',
'cycle_color': '',
+ 'patient_id': None,
'patient_name': '',
'patient_type': '',
'doctor_name': '',
+ 'doctor_id': None,
'hd_case_number': '',
'hd_case_id': None,
'success_color': '',
@@ -91,8 +93,10 @@ class VisitBoard(Model):
'cycle_name': cycle.name,
'cycle_color': cycle.color,
'patient_name': patient.name,
+ 'patient_id': patient.id,
'patient_type': utils.PATIENT_TYPE.get(patient.type,''),
'doctor_name': visit.doctor_id.name,
+ 'doctor_id': visit.doctor_id.id,
'hd_case_number': hd_case_number,
'hd_case_id': hd_case_id,
'visit_color': visit_color,
diff --git a/netforce_clinic/reports/visit_dialy.xlsx b/netforce_clinic/reports/schedule_board.xlsx
similarity index 100%
rename from netforce_clinic/reports/visit_dialy.xlsx
rename to netforce_clinic/reports/schedule_board.xlsx
diff --git a/netforce_clinic/reports/visit_board.xlsx b/netforce_clinic/reports/visit_board.xlsx
new file mode 100644
index 0000000..47b0b02
Binary files /dev/null and b/netforce_clinic/reports/visit_board.xlsx differ
diff --git a/netforce_clinic/templates/schedule_board.hbs b/netforce_clinic/templates/schedule_board.hbs
new file mode 100644
index 0000000..9e83c5e
--- /dev/null
+++ b/netforce_clinic/templates/schedule_board.hbs
@@ -0,0 +1,40 @@
+
+ ตารางเวร
+
+ {{parent_company_name}} {{company_name}}
+
+
+ {{#if has_duration}}
+ ระหว่างวันที่ {{date_from}} ถึง {{date_to}}
+ {{else}}
+ {{date}}
+ {{/if}}
+
+
+
diff --git a/netforce_clinic/templates/visit_board.hbs b/netforce_clinic/templates/visit_board.hbs
index ed58c1e..b9940c2 100644
--- a/netforce_clinic/templates/visit_board.hbs
+++ b/netforce_clinic/templates/visit_board.hbs
@@ -26,15 +26,15 @@
{{#each lines }}
{{#if title}}
- {{cycle_name}} |
- {{details}} |
+ {{cycle_name}} |
+ {{details}} |
{{else}}
{{cycle_name}} |
{{no}} |
{{number}} |
- {{patient_name}} |
+ {{patient_name}} |
{{patient_type}} |
- {{doctor_name}} |
+ {{doctor_name}} |
{{hd_case_number}} |
{{note}} |
{{/if}}