diff --git a/netforce_clinic/models/report_cycle_item.py b/netforce_clinic/models/report_cycle_item.py index 545a348..9d01d74 100644 --- a/netforce_clinic/models/report_cycle_item.py +++ b/netforce_clinic/models/report_cycle_item.py @@ -273,6 +273,7 @@ class ReportCycleItem(Model): 'description': v['description'], 'qty': v['qty'], }) + vscl_lines=sorted(vscl_lines,key=lambda x: x['description']) ptype_lines=[] total_pt=0 pkeys=list(ptypes.keys()) diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py index 6eba335..fafea9f 100644 --- a/netforce_clinic/models/visit_board.py +++ b/netforce_clinic/models/visit_board.py @@ -229,8 +229,17 @@ class VisitBoard(Model): visit_color='' sickbed_name='N/A' sickbed_id=None + found_hdcase=False + is_paid=False + is_waiting=False if visit.hd_cases: hd_case=visit.hd_cases[0] + if hd_case.state in ('waiting_payment', 'paid'): + found_hdcase=True + if hd_case.state=='waiting_payment': + is_waiting=True + elif hd_case.state=='paid': + is_paid=True sickbed_name=hd_case.sickbed_id.name or "N/A" sickbed_id=hd_case.sickbed_id.id hd_case_id=hd_case.id, @@ -288,7 +297,7 @@ class VisitBoard(Model): 'patient_type_id': patient.type_id.id or None, 'doctor_name': visit.doctor_id.name, 'doctor_id': visit.doctor_id.id, - 'hd_case_number': hd_case_number, + 'hd_case_number': (hd_case_number or '').replace('HDC/',''), 'hd_case_state': hd_case_state, 'hd_case_state_txt':HD_STATE.get(hd_case_state,''), 'hd_case_id': hd_case_id, @@ -304,7 +313,12 @@ class VisitBoard(Model): 'details5':'', 'no': no, 'note': visit.note, + 'cost': 0, + 'is_paid': is_paid, + 'is_waiting': is_waiting, } + if found_hdcase: + line['cost']=hd_case.total_amount or 0 lines.append(line) no+=1 if not types.get(visit_date): diff --git a/netforce_clinic/templates/report_cycle_item.hbs b/netforce_clinic/templates/report_cycle_item.hbs index 7e902e5..b5b150a 100644 --- a/netforce_clinic/templates/report_cycle_item.hbs +++ b/netforce_clinic/templates/report_cycle_item.hbs @@ -8,8 +8,8 @@ วันที่ รอบ - No - HDC# + No. + HDC/ ชื่อ-สกุล แพทย์ สิทธ์ @@ -32,7 +32,7 @@ {{/ifeq}} {{#if cseq_txt}} {{date_txt}} - {{cseq_txt}} + {{cseq_txt}} {{no}} {{hdcase_number}} {{pname}} @@ -49,7 +49,7 @@ รวม {{no}} - + {{#each epo_items}} {{name}} = {{qty}}     {{/each}} diff --git a/netforce_clinic/templates/visit_board.hbs b/netforce_clinic/templates/visit_board.hbs index 352f00e..d114a29 100644 --- a/netforce_clinic/templates/visit_board.hbs +++ b/netforce_clinic/templates/visit_board.hbs @@ -11,8 +11,8 @@ สิทธ์ แพทย์ ชั้น - เตียง - บันทึกการรักษา + HDC/ + {{#each lines }} @@ -49,11 +49,6 @@ {{patient_type}} {{doctor_name}} {{department_name}} - {{#if sickbed_id}} - {{sickbed_name}} - {{else}} - {{sickbed_name}} - {{/if}} {{#ifeq number "Waiting"}} @@ -83,6 +78,17 @@ + {{/if}} {{/if}}