diff --git a/netforce_clinic/actions/clinic_hd_case_dialy.xml b/netforce_clinic/actions/clinic_hd_case_dialy.xml
new file mode 100644
index 0000000..5a13d45
--- /dev/null
+++ b/netforce_clinic/actions/clinic_hd_case_dialy.xml
@@ -0,0 +1,8 @@
+
+ HD Case Dialy
+ report
+ clinic.hd.case.dialy
+ hd_case_dialy
+ hd_case_dialy
+ clinic_menu
+
diff --git a/netforce_clinic/layouts/clinic_hd_case_dialy.xml b/netforce_clinic/layouts/clinic_hd_case_dialy.xml
new file mode 100644
index 0000000..bac7081
--- /dev/null
+++ b/netforce_clinic/layouts/clinic_hd_case_dialy.xml
@@ -0,0 +1,3 @@
+
diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml
index f79e8ba..6c1ddbf 100644
--- a/netforce_clinic/layouts/clinic_menu.xml
+++ b/netforce_clinic/layouts/clinic_menu.xml
@@ -36,8 +36,10 @@
-
-
+ -
+
+
+
-
diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py
index 406b09e..5cf384f 100644
--- a/netforce_clinic/models/__init__.py
+++ b/netforce_clinic/models/__init__.py
@@ -23,8 +23,9 @@ from . import hd_case_personal
from . import hd_case_gmline
from . import hd_case_discont
from . import hd_case_payment
+from . import hd_case_dialy
+from . import hd_case_dialyzer
from . import dialyzer
-from . import dialyzer_line
from . import import_payment
from . import cycle
from . import cycle_item
diff --git a/netforce_clinic/models/dialyzer_line.py b/netforce_clinic/models/dialyzer_line.py
deleted file mode 100644
index 63c4c5a..0000000
--- a/netforce_clinic/models/dialyzer_line.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from netforce.model import Model, fields
-
-class DialyzerLine(Model):
- _name="clinic.dialyzer.line"
- _fields={
- "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",on_delete="cascade"),
- "visit_id": fields.Many2One("clinic.visit","Visit",on_delete="cascade"),
- "dialyzer_id": fields.Many2One("clinic.dialyzer","Dialzer",search=True),
- "description": fields.Char("Description",search=True),
- "use_time":fields.Integer("Use time"),
- "max_use_time":fields.Integer("Max use time"),
- "member_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Member Type"),
- "dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Member Type"),
- "bid_flow_rate": fields.Integer("Bid Flow Rate (ml/min)"),
- "ultrafittration": fields.Float("Ultrafittration Kg."),
- "state":fields.Selection([("draft","New"),("active","Active"),("drop","Drop")],"Status"),
- }
-
-DialyzerLine.register()
-
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 4430310..9c2d4d6 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -49,7 +49,7 @@ class HDCase(Model):
"check_goverment_pay" : fields.Boolean("The Government Pay"),
"check_personal_pay" : fields.Boolean("Pay yourself"),
"state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True),
- "dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dialyzers"),
+ "dialyzers": fields.One2Many("clinic.hd.case.dialyzer","hd_case_id","Dialyzers"),
"lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"),
"personals": fields.One2Many("clinic.hd.case.personal","hd_case_id","Personals"),
"comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"),
@@ -694,7 +694,6 @@ class HDCase(Model):
doctor+= 1
else:
nurse+=1
- print('doctor ', doctor_id)
res[obj.id]={
'total_doctor': doctor,
'total_nurse': nurse,
diff --git a/netforce_clinic/models/hd_case_dialy.py b/netforce_clinic/models/hd_case_dialy.py
new file mode 100644
index 0000000..238b017
--- /dev/null
+++ b/netforce_clinic/models/hd_case_dialy.py
@@ -0,0 +1,77 @@
+import time
+import urllib.parse as urllib
+
+from datetime import datetime
+from calendar import monthrange
+from netforce.model import Model, fields, get_model
+from netforce.access import get_active_company
+
+from . import utils
+
+class HDCaseDialy(Model):
+ _name="clinic.hd.case.dialy"
+ _string="HD Case Dialy"
+ _transient=True
+
+ _fields={
+ "date": fields.Date("Date", required=True),
+ }
+
+ _defaults={
+ 'date': lambda *a: time.strftime("%Y-%m-%d"),
+ }
+
+ def get_report_data(self,ids,context={}):
+ company_id=get_active_company()
+ company=get_model("company").browse(company_id)
+
+ date=datetime.now().strftime("%Y-%m-%d")
+ if ids:
+ obj=self.browse(ids)[0]
+ date=obj.date
+ month=int(date[5:7])
+ day=date[8:10]
+ year=date[0:4]
+ month_str=utils.MONTHS['th_TH'][month]
+ dom=[]
+ dom.append(['time_start','>=','%s 00:00:00'%date])
+ dom.append(['time_stop','<=','%s 23:59:59'%date])
+ lines=[]
+ no=1
+ for obj in get_model("clinic.hd.case").search_browse(dom):
+ patient_type=utils.PATIENT_TYPE[obj.patient_id.type]
+ dlz_number=""
+ dlz_id=None
+ for line in obj.dialyzers:
+ dlz=line.dialyzer_id
+ dlz_id=dlz.id
+ dlz_number=dlz.number
+ line={
+ 'cycle_name': obj.cycle_id.name,
+ 'no': no,
+ 'hd_case_number': obj.number,
+ 'patient_name': obj.patient_id.name,
+ 'patient_type': patient_type,
+ 'doctor_name': obj.doctor_id.name,
+ 'doctor_id': obj.doctor_id.id,
+ 'fee_amount': obj.fee_amount,
+ 'hd_case_id': obj.id,
+ 'dlz_number': dlz_number,
+ 'dlz_id': dlz_id,
+ 'success_color': obj.state=='completed' and '#99ff99' or '',
+ 'note': obj.note or "",
+ }
+ lines.append(line)
+ no+=1
+ # XXX
+ year=int(year)+543
+ date_str='%s %s %s'%(day,month_str,year)
+ data={
+ 'lines': lines,
+ 'date': date_str,
+ 'company_name': company.name,
+ 'company_parent_name': company.parent_id.name,
+ }
+ return data
+
+HDCaseDialy.register()
diff --git a/netforce_clinic/models/hd_case_dialyzer.py b/netforce_clinic/models/hd_case_dialyzer.py
index f3f407a..2ca5186 100644
--- a/netforce_clinic/models/hd_case_dialyzer.py
+++ b/netforce_clinic/models/hd_case_dialyzer.py
@@ -1,9 +1,10 @@
from netforce.model import Model, fields
-class HdcaseDialyzer(Model):
+class HDCaseDialyzerLine(Model):
_name="clinic.hd.case.dialyzer"
_fields={
- "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"),
+ "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",on_delete="cascade"),
+ "visit_id": fields.Many2One("clinic.visit","Visit",on_delete="cascade"),
"dialyzer_id": fields.Many2One("clinic.dialyzer","Dialzer",search=True),
"description": fields.Char("Description",search=True),
"use_time":fields.Integer("Use time"),
@@ -15,5 +16,5 @@ class HdcaseDialyzer(Model):
"state":fields.Selection([("draft","New"),("active","Active"),("drop","Drop")],"Status"),
}
-HdcaseDialyzer.register()
+HDCaseDialyzerLine.register()
diff --git a/netforce_clinic/reports/hd_case_dialy.xlsx b/netforce_clinic/reports/hd_case_dialy.xlsx
new file mode 100644
index 0000000..47b0b02
Binary files /dev/null and b/netforce_clinic/reports/hd_case_dialy.xlsx differ
diff --git a/netforce_clinic/templates/hd_case_dialy.hbs b/netforce_clinic/templates/hd_case_dialy.hbs
new file mode 100644
index 0000000..53d7223
--- /dev/null
+++ b/netforce_clinic/templates/hd_case_dialy.hbs
@@ -0,0 +1,45 @@
+
+ ตารางการรักษาผู้ป่วย
+
+ {{parent_company_name}} {{company_name}}
+
+
+ ประจำวันที่ {{date}}
+
+
+
diff --git a/netforce_clinic/templates/visit_dialy.hbs b/netforce_clinic/templates/visit_dialy.hbs
index c7230b3..ccc0463 100644
--- a/netforce_clinic/templates/visit_dialy.hbs
+++ b/netforce_clinic/templates/visit_dialy.hbs
@@ -1,5 +1,5 @@
- ตารางการรักษาผู้ป่วย
+ ตารางการนัดผู้ป่วย
{{parent_company_name}} {{company_name}}
@@ -12,7 +12,7 @@
รอบ |
Ref. |
ผู้ป่วย |
- นพ. |
+ แพทย์ |
HD Case |
หมายเหตุ |
diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt
index 4ef68ef..5293baf 100644
--- a/netforce_clinic/todo.txt
+++ b/netforce_clinic/todo.txt
@@ -1,4 +1,7 @@
=======
+ - report salary
+ -
+========
customize ui
calendar -
- show search