diff --git a/netforce_clinic/models/labor_cost_entry.py b/netforce_clinic/models/labor_cost_entry.py index 5ac11c5..f8fb063 100644 --- a/netforce_clinic/models/labor_cost_entry.py +++ b/netforce_clinic/models/labor_cost_entry.py @@ -142,6 +142,7 @@ class LaborCostEntry(Model): for hd_case in item.hd_cases: #hids.update({hd_case.id}) pids.update({hd_case.patient_id.id}) + #print('pids ', pids) else: for hd_case in item.hd_cases: doctor_id=hd_case.doctor_id.id @@ -156,6 +157,7 @@ class LaborCostEntry(Model): })) plines=[] + print('pids ', list(pids)) for pid in list(pids): plines.append(('create',{ 'patient_id': pid, @@ -183,7 +185,6 @@ class LaborCostEntry(Model): for line in obj.lines: line.delete() - print('lines ', lines) obj.write({ 'lines': lines, }) diff --git a/netforce_clinic/models/report_staff.py b/netforce_clinic/models/report_staff.py index 3641dae..b9a7e9a 100644 --- a/netforce_clinic/models/report_staff.py +++ b/netforce_clinic/models/report_staff.py @@ -7,9 +7,10 @@ class ReportStaff(Model): def _get_store(self,ids,context={}): res={} for obj in self.browse(ids): - total=len(obj.lines) + htotal=len(obj.lines) + ptotal=len(obj.patients) res[obj.id]={ - 'name': total, + 'name': htotal or ptotal, } return res @@ -50,20 +51,36 @@ class ReportStaff(Model): refer_id=int(context.get("refer_id","0")) obj=get_model('clinic.report.staff').browse(refer_id) lines=[] - count=0 + count=1 for line in obj.lines: patient=line.patient_id hd_case=line.hd_case_id + amount=line.amount or 0 lines.append({ 'no': count, + 'date': line.date, + 'hd_case_name': hd_case.number, + 'patient_name': patient.name or '', + 'amount': amount + }) + count+=1 + count=1 + patients=[] + for pt in obj.patients: + patient=pt.patient_id + amount=pt.amount or 0 + patients.append({ + 'no': count, + 'patient_name': patient.name or '', + 'amount': amount, }) count+=1 data={ 'date_from': obj.date_from, 'date_to': obj.date_to, 'staff_name': obj.staff_id.name or '', - 'staff_type': obj.staff_type or '', - 'lines': lines, + 'lines': lines, # is doctor + 'patients': patients, } return data diff --git a/netforce_clinic/reports/report_staff.xlsx b/netforce_clinic/reports/report_staff.xlsx index 0b4265a..85089ec 100644 Binary files a/netforce_clinic/reports/report_staff.xlsx and b/netforce_clinic/reports/report_staff.xlsx differ