diff --git a/netforce_clinic/layouts/clinic_setting.xml b/netforce_clinic/layouts/clinic_setting.xml index b33ff9e..75a0875 100644 --- a/netforce_clinic/layouts/clinic_setting.xml +++ b/netforce_clinic/layouts/clinic_setting.xml @@ -10,11 +10,6 @@ - @@ -38,4 +33,6 @@ + + diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 465c37d..18f1692 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -128,7 +128,7 @@ class HDCase(Model): mdc_names.append(prod_name or "") else: mdc+=amt - mdc_names.append(name or "") + mdc_names.append(prod_name or "") if categ.code=='EPO': epo_names.append(prod_name.title()) elif categ.code=='IVR': @@ -222,6 +222,7 @@ class HDCase(Model): "mdc": fields.Float("MDC",function="_get_expense",function_multi=True), "srv": fields.Float("Service",function="_get_expense",function_multi=True), "mdc_name": fields.Float("MDC Name",function="_get_expense",function_multi=True), + "iron_name": fields.Float("Iron Name",function="_get_expense",function_multi=True), 'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'), "ref": fields.Char("Ref",search=True), "time_start": fields.DateTime("Start Time",required=True), diff --git a/netforce_clinic/models/report_cycle_item.py b/netforce_clinic/models/report_cycle_item.py index d66dfc2..9d01d74 100644 --- a/netforce_clinic/models/report_cycle_item.py +++ b/netforce_clinic/models/report_cycle_item.py @@ -141,14 +141,14 @@ class ReportCycleItem(Model): return number total_epo=0 + total_ivr=0 for line in hdcase.lines: prod=line.product_id if prod.categ_id: if prod.categ_id.code=='EPO': total_epo+=line.qty or 0 - else: - pass - #print('>>> ', hdcase.number, prod.id, prod.name) + if prod.categ_id.code=='IVR': + total_ivr+=line.qty or 0 lines.append({ 'dlz_drop': dlz_drop, @@ -166,6 +166,7 @@ class ReportCycleItem(Model): 'hdcase_number': reformat_number(hdcase.number), 'hdcase_id': hdcase.id, 'mdc_name': hdcase.mdc_name or hdcase.epo, + 'iron_name': hdcase.iron_name or '', 'fee': abs(hdcase.fee), 'dlz_name': hdcase.dlz_name, 'dlz_use': dlz_use, @@ -182,6 +183,7 @@ class ReportCycleItem(Model): 'dpt_id': dpt.id, 'dpt_name': dpt.name or "", 'total_epo': total_epo, + 'total_ivr': total_ivr, }) month_str=utils.MONTHS['th_TH'][int(month)] company_name=company.name or "" @@ -219,6 +221,10 @@ class ReportCycleItem(Model): sub_mdc+=x['mdc'] or 0 if not epos.get(x['mdc_name']): epos[x['mdc_name']]=0 + #XXX + if not epos.get(x['iron_name']): + epos[x['iron_name']]=0 + epos[x['iron_name']]+=x['total_ivr'] or 0 #XXX epos[x['mdc_name']]+=x['total_epo'] or 0 count+=1 line['date_txt']=line['date'] @@ -267,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/report_medical_detail.py b/netforce_clinic/models/report_medical_detail.py index 60cf69b..c6f280b 100644 --- a/netforce_clinic/models/report_medical_detail.py +++ b/netforce_clinic/models/report_medical_detail.py @@ -101,8 +101,12 @@ class ReportMedicalDetail(Model): dom.append(['hd_case_id.branch_id','=',branch_id]) if department_id: dom.append(['hd_case_id.department_id','=',department_id]) - if prod_categ_id: - dom.append(['product_categ_id.id','child_of',prod_categ_id]) + st=get_model("clinic.setting").browse(1) + ct_ids=[] + for categ in st.product_categ_view: + ct_ids.append(categ.id) + if ct_ids: + dom.append(['product_categ_id.id','in',ct_ids]) if product_id: dom.append(['product_id','=',product_id]) if types and ids: diff --git a/netforce_clinic/models/report_medical_summary.py b/netforce_clinic/models/report_medical_summary.py index 9110b4b..a11bd63 100644 --- a/netforce_clinic/models/report_medical_summary.py +++ b/netforce_clinic/models/report_medical_summary.py @@ -86,13 +86,17 @@ class ReportMedicalSummary(Model): dom=[] dom.append(['type','=','stock']) dom.append(['report_visible','=',True]) - if prod_categ_id: - dom.append(['categ_id.id','child_of',prod_categ_id]) + st=get_model("clinic.setting").browse(1) + ct_ids=[] + for categ in st.product_categ_view: + ct_ids.append(categ.id) + if ct_ids: + dom.append(['categ_id.id','in',ct_ids]) categ_ids=set() for prod in get_model("product").search_browse(dom): prod_code=prod.code or "" categ=prod.categ_id - if categ and categ.parent_id: + if categ: categ_ids.update({categ.id}) products[prod_code]={} for patient_type_id,type_name in patient_types.items(): @@ -124,10 +128,6 @@ class ReportMedicalSummary(Model): continue if categ and categ.id not in list(categ_ids): continue - #if line.type=='fee' or prod.type=='service': - #continue - #if prod_categ_id and prod_categ_id != prod.categ_id.id: - #continue products[prod_code][patient_type_id]['qty']+=line.qty lines=[] diff --git a/netforce_clinic/models/setting.py b/netforce_clinic/models/setting.py index 10ee472..907a73f 100644 --- a/netforce_clinic/models/setting.py +++ b/netforce_clinic/models/setting.py @@ -1,4 +1,3 @@ -import time from datetime import datetime, timedelta from calendar import monthrange @@ -54,7 +53,6 @@ class ClinicSetting(Model): 'schd_to': fields.Date("To"), 'department_id': fields.Many2One("clinic.department","Department"), 'branch_id': fields.Many2One("clinic.branch","Branch"), - 'shop_categs': fields.Many2Many("product.categ","Categs"), 'shop_type_id': fields.Many2One("clinic.patient.type","Patient Type"), 'skip_type_id': fields.Many2One("clinic.patient.type","Skip Type"), # Matching HD Case "cash_account_id": fields.Many2One("account.account","Cash Account",multi_company=True), @@ -65,6 +63,7 @@ class ClinicSetting(Model): 'next_date': fields.DateTime("Next Gen"), 'staff_from_id': fields.Many2One("clinic.staff","Staff From"), 'staff_to_id': fields.Many2One("clinic.staff","Staff To"), + 'product_categ_view': fields.Many2Many("product.categ","Product Category View"), } _defaults={ 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/reports/report_cycle_item.xlsx b/netforce_clinic/reports/report_cycle_item.xlsx index d867e67..fc1e5b1 100644 Binary files a/netforce_clinic/reports/report_cycle_item.xlsx and b/netforce_clinic/reports/report_cycle_item.xlsx differ diff --git a/netforce_clinic/templates/report_cycle_item.hbs b/netforce_clinic/templates/report_cycle_item.hbs index 7e902e5..5cab149 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}} 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}}