report staff
parent
cd53611e49
commit
fd1048903c
|
@ -142,6 +142,7 @@ class LaborCostEntry(Model):
|
||||||
for hd_case in item.hd_cases:
|
for hd_case in item.hd_cases:
|
||||||
#hids.update({hd_case.id})
|
#hids.update({hd_case.id})
|
||||||
pids.update({hd_case.patient_id.id})
|
pids.update({hd_case.patient_id.id})
|
||||||
|
#print('pids ', pids)
|
||||||
else:
|
else:
|
||||||
for hd_case in item.hd_cases:
|
for hd_case in item.hd_cases:
|
||||||
doctor_id=hd_case.doctor_id.id
|
doctor_id=hd_case.doctor_id.id
|
||||||
|
@ -156,6 +157,7 @@ class LaborCostEntry(Model):
|
||||||
}))
|
}))
|
||||||
|
|
||||||
plines=[]
|
plines=[]
|
||||||
|
print('pids ', list(pids))
|
||||||
for pid in list(pids):
|
for pid in list(pids):
|
||||||
plines.append(('create',{
|
plines.append(('create',{
|
||||||
'patient_id': pid,
|
'patient_id': pid,
|
||||||
|
@ -183,7 +185,6 @@ class LaborCostEntry(Model):
|
||||||
|
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
line.delete()
|
line.delete()
|
||||||
print('lines ', lines)
|
|
||||||
obj.write({
|
obj.write({
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
})
|
})
|
||||||
|
|
|
@ -7,9 +7,10 @@ class ReportStaff(Model):
|
||||||
def _get_store(self,ids,context={}):
|
def _get_store(self,ids,context={}):
|
||||||
res={}
|
res={}
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
total=len(obj.lines)
|
htotal=len(obj.lines)
|
||||||
|
ptotal=len(obj.patients)
|
||||||
res[obj.id]={
|
res[obj.id]={
|
||||||
'name': total,
|
'name': htotal or ptotal,
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@ -50,20 +51,36 @@ class ReportStaff(Model):
|
||||||
refer_id=int(context.get("refer_id","0"))
|
refer_id=int(context.get("refer_id","0"))
|
||||||
obj=get_model('clinic.report.staff').browse(refer_id)
|
obj=get_model('clinic.report.staff').browse(refer_id)
|
||||||
lines=[]
|
lines=[]
|
||||||
count=0
|
count=1
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
patient=line.patient_id
|
patient=line.patient_id
|
||||||
hd_case=line.hd_case_id
|
hd_case=line.hd_case_id
|
||||||
|
amount=line.amount or 0
|
||||||
lines.append({
|
lines.append({
|
||||||
'no': count,
|
'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
|
count+=1
|
||||||
data={
|
data={
|
||||||
'date_from': obj.date_from,
|
'date_from': obj.date_from,
|
||||||
'date_to': obj.date_to,
|
'date_to': obj.date_to,
|
||||||
'staff_name': obj.staff_id.name or '',
|
'staff_name': obj.staff_id.name or '',
|
||||||
'staff_type': obj.staff_type or '',
|
'lines': lines, # is doctor
|
||||||
'lines': lines,
|
'patients': patients,
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue