report staff
parent
cd53611e49
commit
fd1048903c
|
@ -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,
|
||||
})
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue