report labor cost
parent
f7349c2542
commit
9b65b7cc36
|
@ -11,8 +11,8 @@
|
|||
<header string="REPORTS"/>
|
||||
<item string="HD Case Expense" action="clinic_report_account_hd_case_summary"/>
|
||||
<item string="RD Shop Expense" action="clinic_report_account_shop"/>
|
||||
<!--<item string="Labor Cost" action="clinic_report_labor_cost"/>-->
|
||||
<item string="Labor Cost Summary" action="clinic_report_labor_cost_summary"/>
|
||||
<item string="Labor Cost" action="clinic_report_labor_cost"/>
|
||||
<!--<item string="Labor Cost Summary" action="clinic_report_labor_cost_summary"/>-->
|
||||
<!--<item string="Labor Cost Detail" action="clinic_report_labor_cost_detail"/>-->
|
||||
<!--<item string="Labor Cost Sub Detail" action="clinic_report_labor_cost_sub_detail"/>-->
|
||||
<!--<item string="Labor Cost Daily" action="clinic_report_labor_cost_daily"/>-->
|
||||
|
|
|
@ -56,29 +56,32 @@ class ReportLaborCost(Model):
|
|||
dom.append(['date','>=',date_from])
|
||||
dom.append(['date','<=',date_to])
|
||||
if branch_id:
|
||||
dom.append(['labor_cost_id.cycle_item_id.branch_id','=',branch_id])
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
if department_id:
|
||||
dom.append(['labor_cost_id.cycle_item_id.department_id','=',department_id])
|
||||
dom.append(['department_id','=',department_id])
|
||||
print('dom ', dom)
|
||||
hdcases={}
|
||||
for hdcase in get_model("clinic.hd.case").search_browse(dom):
|
||||
dpt=hdcase.department_id
|
||||
if dpt.id not in hdcases.keys():
|
||||
hdcases[dpt.id]={
|
||||
'name': dpt.name,
|
||||
'department_id': dpt.id,
|
||||
'branch_id': dpt.branch_id.id,
|
||||
'qty':0,
|
||||
}
|
||||
hdcases[dpt.id]['qty']+=1
|
||||
lines=[]
|
||||
citems={}
|
||||
for line in get_model("clinic.labor.cost.line").search_browse(dom):
|
||||
#print('xx')
|
||||
lcost=line.labor_cost_id
|
||||
citem=lcost.cycle_item_id
|
||||
dpt=citem.department_id
|
||||
qty=line.qty or 0 #XXX
|
||||
print(citem.id)
|
||||
import pdb; pdb.set_trace()
|
||||
if not citem.id not in list(citems.keys()):
|
||||
print("zzz")
|
||||
citems[citem.id]=citem
|
||||
|
||||
total_hdcase=0
|
||||
for citem_id, citem in citems.items():
|
||||
for hdcase in citem.hd_cases:
|
||||
if hdcase.state in ('completed','waitting_payment','paid'):
|
||||
total_hdcase+=1
|
||||
for dpt_id, vals in hdcases.items():
|
||||
qty=vals['qty'] or 0
|
||||
total_hdcase+=qty
|
||||
lines.append({
|
||||
'name': vals['name'],
|
||||
'branch_id': vals['branch_id'],
|
||||
'department_id': vals['department_id'],
|
||||
'qty': qty,
|
||||
})
|
||||
sub_name=''
|
||||
if department_id:
|
||||
dpt=get_model("clinic.department").browse(department_id)
|
||||
|
@ -86,6 +89,7 @@ class ReportLaborCost(Model):
|
|||
elif branch_id:
|
||||
branch=get_model("clinic.branch").browse(branch_id)
|
||||
sub_name="(%s)" % branch.name or ""
|
||||
|
||||
data={
|
||||
'company_name': '%s %s' % (company.name or "", sub_name),
|
||||
'date_from': date_from,
|
||||
|
|
|
@ -35,15 +35,18 @@ class ReportLaborCostSummary(Model):
|
|||
defaults=context.get("defaults",{})
|
||||
date_from=defaults.get("date_from", self._get_date_from())
|
||||
date_to=defaults.get("date_to", self._get_date_to())
|
||||
branch_id=int(defaults.get("branch_id","0"))
|
||||
department_id=int(defaults.get("department_id","0"))
|
||||
staff_type=defaults.get("staff_type","doctor")
|
||||
staff_id=int(defaults.get('staff_id', "0"))
|
||||
print('defaults ', defaults)
|
||||
res={
|
||||
'date': time.strftime("%Y-%m-%d"),
|
||||
'date_from': date_from,
|
||||
'date_to': date_to,
|
||||
'staff_type': staff_type,
|
||||
'staff_id': staff_id and staff_id or None,
|
||||
'department_id': department_id,
|
||||
'branch_id': branch_id,
|
||||
'only_value': True,
|
||||
}
|
||||
return res
|
||||
|
@ -55,10 +58,10 @@ class ReportLaborCostSummary(Model):
|
|||
staff_id=defaults['staff_id']
|
||||
staff_type=defaults['staff_type']
|
||||
only_value=defaults['only_value']
|
||||
department_id=defaults['department_id']
|
||||
branch_id=defaults['branch_id']
|
||||
level_id=None
|
||||
categ_id=None
|
||||
branch_id=None
|
||||
department_id=None
|
||||
dom=[]
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
|
|
|
@ -8,17 +8,23 @@
|
|||
</center>
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<th>ชั้น</th>
|
||||
<th style="text-align:right">จำนวน HD Case</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each lines }}
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
{{name}}
|
||||
</td>
|
||||
<td style="text-align:right">
|
||||
<a href="#name=clinic_report_labor_cost_summary&defaults.date_from={{../date_from}}&defaults.date_to={{../date_to}}&defaults.branch_id={{branch_id}}&defaults.department_id={{department_id}}">{{currency qty}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<th>Total</th>
|
||||
<th style="text-align:right">{{currency total_hdcase}}</th>
|
||||
</tfoot>
|
||||
</table>
|
||||
<p>
|
||||
{{total_hdcase}}
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue