improve report
parent
a6a48ebf3f
commit
217047f577
|
@ -239,12 +239,13 @@ class ReportLaborCost(Model):
|
||||||
dom3=dom1+[['walkin','=',False]]
|
dom3=dom1+[['walkin','=',False]]
|
||||||
dlines.append({
|
dlines.append({
|
||||||
'name': dt_name,
|
'name': dt_name,
|
||||||
'qty': "{0:.2f}".format(round(qty,2)),
|
'qty': "{0:,.2f}".format(round(qty,2)),
|
||||||
'qty2': "{0:.2f}".format(round(walkin_qty,2)),
|
'qty2': "{0:,.2f}".format(round(walkin_qty,2)),
|
||||||
'walkin_qty': walkin_qty,
|
'walkin_qty': walkin_qty,
|
||||||
'option_qty': 'mode=list&search_domain=%s&tab_no=0'%replace_quote('%s'%(dom3)),
|
|
||||||
'option_qty2': 'mode=list&search_domain=%s&tab_no=0'%replace_quote('%s'%(dom2)),
|
|
||||||
'total_qty': walkin_qty+qty,
|
'total_qty': walkin_qty+qty,
|
||||||
|
'date': date,
|
||||||
|
'date_from': date_from,
|
||||||
|
'date_to': date_to,
|
||||||
'cost': cost,
|
'cost': cost,
|
||||||
'total': 0,
|
'total': 0,
|
||||||
'department_id': dpt_id,
|
'department_id': dpt_id,
|
||||||
|
@ -262,6 +263,9 @@ class ReportLaborCost(Model):
|
||||||
'department_id': None,
|
'department_id': None,
|
||||||
'branch_id':None,
|
'branch_id':None,
|
||||||
'staff_type': 'doctor',
|
'staff_type': 'doctor',
|
||||||
|
'date': date,
|
||||||
|
'date_from': date_from,
|
||||||
|
'date_to': date_to,
|
||||||
}]+sorted(dlines,key=lambda x: x['name'])
|
}]+sorted(dlines,key=lambda x: x['name'])
|
||||||
dom4=[
|
dom4=[
|
||||||
['date','>=',date_from],
|
['date','>=',date_from],
|
||||||
|
@ -284,6 +288,9 @@ class ReportLaborCost(Model):
|
||||||
'cycle_id': cycle_id,
|
'cycle_id': cycle_id,
|
||||||
'branch_id': branch_id,
|
'branch_id': branch_id,
|
||||||
'department_id': department_id,
|
'department_id': department_id,
|
||||||
|
'date': date,
|
||||||
|
'date_from': date_from,
|
||||||
|
'date_to': date_to,
|
||||||
'option_qty': 'mode=list&search_domain=%s&tab_no=0'%replace_quote('%s'%(dom4)),
|
'option_qty': 'mode=list&search_domain=%s&tab_no=0'%replace_quote('%s'%(dom4)),
|
||||||
'option_qty2': 'mode=list&search_domain=%s&tab_no=0'%replace_quote('%s'%(dom5)),
|
'option_qty2': 'mode=list&search_domain=%s&tab_no=0'%replace_quote('%s'%(dom5)),
|
||||||
})
|
})
|
||||||
|
@ -293,8 +300,8 @@ class ReportLaborCost(Model):
|
||||||
dlines[-1]['total_qty']+=dline['total_qty'] or 0
|
dlines[-1]['total_qty']+=dline['total_qty'] or 0
|
||||||
dlines[-1]['cost']+=dline['cost'] or 0
|
dlines[-1]['cost']+=dline['cost'] or 0
|
||||||
dlines[-1]['walkin_qty']+=float(dline['qty2']) or 0
|
dlines[-1]['walkin_qty']+=float(dline['qty2']) or 0
|
||||||
dlines[-1]['qty']="{0:.2f}".format(round(dlines[-1]['qty'],2)) #total
|
dlines[-1]['qty']="{0:,.2f}".format(round(dlines[-1]['qty'],2)) #total
|
||||||
dlines[-1]['qty2']="{0:.2f}".format(round(dlines[-1]['qty2'],2)) #total
|
dlines[-1]['qty2']="{0:,.2f}".format(round(dlines[-1]['qty2'],2)) #total
|
||||||
|
|
||||||
nlines.append({
|
nlines.append({
|
||||||
'name': 'พยาบาล',
|
'name': 'พยาบาล',
|
||||||
|
|
|
@ -34,12 +34,24 @@ class ReportLaborCostStaff(Model):
|
||||||
date_from=defaults.get("date_from", self._get_date_from())
|
date_from=defaults.get("date_from", self._get_date_from())
|
||||||
date_to=defaults.get("date_to", self._get_date_to())
|
date_to=defaults.get("date_to", self._get_date_to())
|
||||||
walkin=defaults.get("walkin", False)
|
walkin=defaults.get("walkin", False)
|
||||||
|
department_id=defaults.get("department_id") or None
|
||||||
|
if department_id:
|
||||||
|
department_id=int(department_id)
|
||||||
|
branch_id=defaults.get("branch_id") or None
|
||||||
|
if branch_id:
|
||||||
|
branch_id=int(branch_id)
|
||||||
|
if walkin and walkin=='False':
|
||||||
|
walkin=False
|
||||||
|
else:
|
||||||
|
walkin=True
|
||||||
print('defaults ', defaults)
|
print('defaults ', defaults)
|
||||||
res={
|
res={
|
||||||
'date': time.strftime("%Y-%m-%d"),
|
'date': time.strftime("%Y-%m-%d"),
|
||||||
'date_from': date_from,
|
'date_from': date_from,
|
||||||
'date_to': date_to,
|
'date_to': date_to,
|
||||||
'walkin': walkin,
|
'walkin': walkin,
|
||||||
|
'department_id': department_id,
|
||||||
|
'branch_id': branch_id,
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@ -71,23 +83,38 @@ class ReportLaborCostStaff(Model):
|
||||||
if cycle_id:
|
if cycle_id:
|
||||||
dom.append(['hd_case_id.cycle_id','=',cycle_id])
|
dom.append(['hd_case_id.cycle_id','=',cycle_id])
|
||||||
lines=[]
|
lines=[]
|
||||||
|
print('dom ', dom)
|
||||||
for sline in get_model("clinic.hd.case.staff").search_browse(dom):
|
for sline in get_model("clinic.hd.case.staff").search_browse(dom):
|
||||||
hdcase=sline.hd_case_id
|
hdcase=sline.hd_case_id
|
||||||
staff=sline.staff_id
|
staff=sline.staff_id
|
||||||
if walkin and staff:
|
patient=hdcase.patient_id
|
||||||
continue
|
if walkin:
|
||||||
|
if staff and staff.number!='walkin':
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if staff.number=='walkin':
|
||||||
|
continue
|
||||||
lines.append({
|
lines.append({
|
||||||
'id': sline.id,
|
'id': sline.id,
|
||||||
'date': sline.date,
|
'date': sline.date,
|
||||||
'number': hdcase.number or '',
|
'number': hdcase.number or '',
|
||||||
'staff_name': staff.name or '',
|
'staff_name': staff.name or '',
|
||||||
'staff_id': staff.id or '',
|
'staff_id': staff.id or None,
|
||||||
|
'patient_id': patient.id or None,
|
||||||
|
'patient_name': patient.name or None,
|
||||||
'department_name': sline.department_id.name or '',
|
'department_name': sline.department_id.name or '',
|
||||||
|
'date': sline.date,
|
||||||
})
|
})
|
||||||
|
nlines=[]
|
||||||
|
no=1
|
||||||
|
for line in sorted(lines,key=lambda x: (x['date'],x['number'])):
|
||||||
|
line['no']=no
|
||||||
|
nlines.append(line)
|
||||||
|
no+=1
|
||||||
data={
|
data={
|
||||||
'date_from': date_from,
|
'date_from': date_from,
|
||||||
'date_to': date_to,
|
'date_to': date_to,
|
||||||
'lines': lines,
|
'lines': nlines,
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,12 @@ class ClinicSetting(Model):
|
||||||
if user_id !=1:
|
if user_id !=1:
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
|
for sline in get_model("clinic.hd.case.staff").search_browse([]):
|
||||||
|
hdcase=sline.hd_case_id
|
||||||
|
sline.write({
|
||||||
|
'date': hdcase.date,
|
||||||
|
})
|
||||||
|
print('update ', sline.id, hdcase.date)
|
||||||
#obj=self.browse(ids)[0]
|
#obj=self.browse(ids)[0]
|
||||||
#obj.del_duplicate_staff()
|
#obj.del_duplicate_staff()
|
||||||
#obj.merge_staff()
|
#obj.merge_staff()
|
||||||
|
|
|
@ -72,7 +72,9 @@
|
||||||
<th style="text-align:left;width:10%">{{qty}}</th>
|
<th style="text-align:left;width:10%">{{qty}}</th>
|
||||||
{{else}}
|
{{else}}
|
||||||
<td style="text-align:right">
|
<td style="text-align:right">
|
||||||
{{view "link" string=qty action="clinic_report_labor_cost_staff" action_options=option_qty}}
|
<a href="/ui#name=clinic_report_labor_cost_staff&defaults.date={{date}}&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.branch_id={{branch_id}}&defaults.department_id={{department_id}}&defaults.walkin=False">
|
||||||
|
{{qty}}
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@ -84,7 +86,9 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
<td style="text-align:right">
|
<td style="text-align:right">
|
||||||
{{#if walkin_qty}}
|
{{#if walkin_qty}}
|
||||||
{{view "link" string=qty2 action="clinic_report_labor_cost_staff" action_options=option_qty2}}
|
<a href="/ui#name=clinic_report_labor_cost_staff&defaults.date={{date}}&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.branch_id={{branch_id}}&defaults.department_id={{department_id}}&defaults.walkin=false">
|
||||||
|
{{qty2}}
|
||||||
|
</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
0.00
|
0.00
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -3,20 +3,28 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead class="scroll-header">
|
<thead class="scroll-header">
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>Date</th>
|
||||||
<th>HDCase</th>
|
<th>HDCase</th>
|
||||||
<th>Doctor</th>
|
<th>Doctor</th>
|
||||||
|
<th>Patient</th>
|
||||||
<th>Department</th>
|
<th>Department</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each lines}}
|
{{#each lines}}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>{{no}}</td>
|
||||||
|
<td>{{date}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{view "link" string=number action="clinic_hd_case_staff" action_options="mode=form" active_id=id}}
|
{{view "link" string=number action="clinic_hd_case_staff" action_options="mode=form" active_id=id}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{view "link" string=staff_name action="clinic_staff" action_options="mode=form" active_id=staff_id}}
|
{{view "link" string=staff_name action="clinic_staff" action_options="mode=form" active_id=staff_id}}
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
{{view "link" string=patient_name action="clinic_patient" action_options="mode=form" active_id=patient_id}}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{department_name}}
|
{{department_name}}
|
||||||
</td>
|
</td>
|
||||||
|
@ -27,6 +35,8 @@
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue