improve report
parent
75acc0e98a
commit
317e2d6a51
|
@ -126,13 +126,22 @@ class ReportLaborCostDetail(Model):
|
|||
dates[date][dpt.name]['qty']+=qty
|
||||
lines=[]
|
||||
dpts=get_model("clinic.department").search_read([],['name'])
|
||||
department_name=""
|
||||
if department_id:
|
||||
department_name=get_model("clinic.department").browse(department_id).name or ""
|
||||
# link to sub detail
|
||||
show_count=0
|
||||
for dpt in dpts:
|
||||
show_link=True
|
||||
if dpt['name']!=department_name and department_name!='':
|
||||
show_link=False
|
||||
show_count+=1
|
||||
dpt.update({
|
||||
'staff_id': staff_id,
|
||||
'staff_type': staff_type,
|
||||
'date_from': date_from,
|
||||
'date_to': date_to,
|
||||
'show_link': show_link,
|
||||
})
|
||||
dpts=sorted(dpts, key=lambda b: b['name'])
|
||||
no=1
|
||||
|
@ -209,6 +218,7 @@ class ReportLaborCostDetail(Model):
|
|||
'comp_span': comp_span, #qty, amt
|
||||
'lines': lines,
|
||||
'dpt_lines': dpt_lines,
|
||||
'show_all': show_count <=1 and True or False,
|
||||
}
|
||||
return data
|
||||
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
<th></th>
|
||||
<th></th>
|
||||
<th style="text-align:center" colspan="{{comp_span}}">
|
||||
<a href="#name=clinic_report_labor_cost_sub_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.staff_type={{staff_type}}&defaults.staff_id={{staff_id}}&defaults.department_id={{department_id}}">{{comp_name}}</a>
|
||||
{{#if show_all}}
|
||||
<a href="#name=clinic_report_labor_cost_sub_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.staff_type={{staff_type}}&defaults.staff_id={{staff_id}}&defaults.department_id={{department_id}}">{{comp_name}}</a>
|
||||
{{else}}
|
||||
{{comp_name}}
|
||||
{{/if}}
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
@ -16,10 +20,20 @@
|
|||
<th rowspan="2">วันที่</th>
|
||||
{{#each dpts}}
|
||||
<th rowspan="2" colspan="2" style="text-align:center">
|
||||
{{#if show_link}}
|
||||
<a href="#name=clinic_report_labor_cost_sub_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.staff_type={{staff_type}}&defaults.staff_id={{staff_id}}&defaults.department_id={{id}}">{{name}}</a>
|
||||
{{else}}
|
||||
{{name}}
|
||||
{{/if}}
|
||||
</th>
|
||||
{{/each}}
|
||||
<th rowspan="2" colspan="2" style="text-align:center;">รวม</th>
|
||||
<th rowspan="2" colspan="2" style="text-align:center;">
|
||||
{{#if show_all}}
|
||||
<a href="#name=clinic_report_labor_cost_sub_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.staff_type={{staff_type}}&defaults.staff_id={{staff_id}}">รวม</a>
|
||||
{{else}}
|
||||
รวม
|
||||
{{/if}}
|
||||
</th>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
<tr>
|
||||
|
|
Loading…
Reference in New Issue