diff --git a/netforce_clinic/layouts/clinic_vascular_access_form.xml b/netforce_clinic/layouts/clinic_vascular_access_form.xml index 4668247..a9c52ec 100644 --- a/netforce_clinic/layouts/clinic_vascular_access_form.xml +++ b/netforce_clinic/layouts/clinic_vascular_access_form.xml @@ -1,4 +1,6 @@
+ + diff --git a/netforce_clinic/layouts/clinic_vascular_access_list.xml b/netforce_clinic/layouts/clinic_vascular_access_list.xml index f58c2df..57098f9 100644 --- a/netforce_clinic/layouts/clinic_vascular_access_list.xml +++ b/netforce_clinic/layouts/clinic_vascular_access_list.xml @@ -1,4 +1,5 @@ - + + diff --git a/netforce_clinic/models/report_cycle_item.py b/netforce_clinic/models/report_cycle_item.py index 6607d34..f2ba1b7 100644 --- a/netforce_clinic/models/report_cycle_item.py +++ b/netforce_clinic/models/report_cycle_item.py @@ -82,6 +82,15 @@ class ReportCycleItem(Model): dom.append(['department_id','=',department_id]) lines=[] cycles={} + vasculars={} + for vscl in get_model("clinic.vascular.access").search_read([],['code','description']): + vasculars[vscl['code']]={ + 'qty': 0, + 'description': vscl['description'] or '' + } + ptypes={} + for ptype in get_model("clinic.patient.type").search_read([],['name']): + ptypes[ptype['name'] or ""]=0 for citem in get_model('clinic.cycle.item').search_browse(dom,order="date"): cycle=citem.cycle_id if cycle.id not in cycles.keys(): @@ -91,9 +100,12 @@ class ReportCycleItem(Model): cycles[cycle.id].append(nurse.name) for hdcase in citem.hd_cases: patient=hdcase.patient_id + vascular=patient.vascular_acc + vasculars[vascular.code]['qty']+=1 ptype=patient.type_id if ptype_id and ptype_id!=ptype.id: continue + ptypes[ptype.name or ""]+=1 doctor=hdcase.doctor_id cycle=hdcase.cycle_id dpt=hdcase.department_id @@ -163,14 +175,31 @@ class ReportCycleItem(Model): line['no']=no nlines.append(line) no+=1 + vscl_lines=[] + for k,v in vasculars.items(): + vscl_lines.append({ + 'description': v['description'], + 'qty': v['qty'], + }) + ptype_lines=[] + total_pt=0 + for pname,qty in ptypes.items(): + ptype_lines.append({ + 'name': pname, + 'qty': qty, + }) + total_pt+=qty data={ 'company_name': company_name or "", 'lines': nlines, + 'vscl_lines': vscl_lines, + 'ptype_lines': ptype_lines, 'month': month_str, 'date_from': date_from, 'date_to': date_to, 'total_fee': total_fee, 'total_mdc': total_mdc, + 'total_pt': total_pt, } return data diff --git a/netforce_clinic/models/report_hd_case_summary.py b/netforce_clinic/models/report_hd_case_summary.py index ff10fa3..07a477d 100644 --- a/netforce_clinic/models/report_hd_case_summary.py +++ b/netforce_clinic/models/report_hd_case_summary.py @@ -54,7 +54,6 @@ class ReportHDCaseSummary(Model): 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") year=int(date[0:4]) crr_month=int(date[5:7]) @@ -63,9 +62,9 @@ class ReportHDCaseSummary(Model): date_from=defaults.get('date_from',date) date_to=defaults.get('date_to',date) branch_id=defaults.get("branch_id",None) + department_id=defaults.get("department_id",None) if branch_id: branch_id=branch_id[0] - department_id=defaults.get("department_id",None) if department_id: department_id=department_id[0] time_start='%s-%s-01 00:00:00'%(year,str(crr_month).zfill(2)) @@ -110,10 +109,10 @@ class ReportHDCaseSummary(Model): count=1 # number of hd case of this month dom=[] - dom.append(["time_start",">=",time_start]) - dom.append(["time_stop","<=",time_stop]) + dom.append(["date",">=",date_from]) + dom.append(["date","<=",date_to]) dom.append(["state","in",["completed","waiting_payment","paid"]]) - dom.append(['patient_id.walkin','=','no']) + #dom.append(['patient_id.walkin','=','no']) if branch_id: dom.append(['branch_id','=',branch_id]) if department_id: @@ -228,8 +227,6 @@ class ReportHDCaseSummary(Model): 'unit': 'คน', } }) - - dom=[] time_start='%s-%s-01'%(year,str(crr_month).zfill(2)) time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day) @@ -237,8 +234,6 @@ class ReportHDCaseSummary(Model): dom.append(['type_id','=',ptype['id']]) dom.append(['walkin','=',"no"]) dom.append(['dispose','=',False]) - #if resign_patients: - #dom.append(['id','not in',resign_patients]) if branch_id: dom.append(['branch_id','=',branch_id]) if department_id: @@ -283,7 +278,6 @@ class ReportHDCaseSummary(Model): elif branch_id: branch=get_model("clinic.branch").browse(branch_id) sub_name="(%s)" % branch.name or "" - print('>> ', context.get('defaults')) data={ 'branch_id': branch_id, 'department_id': department_id, diff --git a/netforce_clinic/models/report_labor_cost_summary.py b/netforce_clinic/models/report_labor_cost_summary.py index 4aa872e..91168c2 100644 --- a/netforce_clinic/models/report_labor_cost_summary.py +++ b/netforce_clinic/models/report_labor_cost_summary.py @@ -134,7 +134,7 @@ class ReportLaborCostSummary(Model): staffs[staff.name][dpt.name]['qty']+=qty if not citems.get(citem.id): - qty=len([hdcase for hdcase in citem.hd_cases]) + qty=len([hdcase for hdcase in citem.hd_cases if hdcase.state in ('completed', 'waiting_payment', 'paid')]) citems[citem.id]=qty lines=[] dom=[] diff --git a/netforce_clinic/models/vascular_access.py b/netforce_clinic/models/vascular_access.py index 785d788..c7e6c15 100644 --- a/netforce_clinic/models/vascular_access.py +++ b/netforce_clinic/models/vascular_access.py @@ -3,10 +3,14 @@ from netforce.model import Model, fields class VascularAccess(Model): _name="clinic.vascular.access" _string="Vascular Access" - + _fields={ "name": fields.Char("Name",required=True,search=True), + "code": fields.Char("Code",required=True,search=True), + "description": fields.Char("Description",search=True), 'note': fields.Text("Note"), } + _sql_constraints=("clinic_vascular_key_uniq","unique(code)","code should be unique"), + VascularAccess.register() diff --git a/netforce_clinic/reports/report_cycle_item.xlsx b/netforce_clinic/reports/report_cycle_item.xlsx index 52d8efc..fc924f8 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 d7016e9..00a119e 100644 --- a/netforce_clinic/templates/report_cycle_item.hbs +++ b/netforce_clinic/templates/report_cycle_item.hbs @@ -33,7 +33,7 @@ {{dname}} {{tname}} {{fee}} - {{mdc}} + {{mdc}} {{dlz_name}} {{dlz_use}} View @@ -49,9 +49,47 @@ {{currency total_fee zero=""}} - + {{currency total_mdc}} + + + + + +
+ + + + + + + {{#each vscl_lines}} + + + + {{/each}} + +
Vascular AccessQty
{{description}}{{qty}}
+
+ + + + + + + {{#each ptype_lines}} + + + + {{/each}} + + + + + +
Patient TypeQty
{{name}}{{qty}}
รวมผู้ป่วยทั้งหมด{{total_pt}}
+
diff --git a/netforce_clinic/templates/report_shop.hbs b/netforce_clinic/templates/report_shop.hbs index 2c6f28a..7d44be1 100644 --- a/netforce_clinic/templates/report_shop.hbs +++ b/netforce_clinic/templates/report_shop.hbs @@ -14,7 +14,6 @@ Receipt# Invoice# ชื่อยา - ค่าฟอก ค่ายา Lab Misc. @@ -37,7 +36,6 @@ {{view "link" string=inv_number action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}} {{mdc_name}} - {{currency fee zero=""}} {{currency mdc zero=""}} {{currency lab zero=""}} {{currency misc zero=""}}