diff --git a/netforce_clinic/layouts/clinic_report_labor_cost_detail.xml b/netforce_clinic/layouts/clinic_report_labor_cost_detail.xml
index 1462a97..602c81f 100644
--- a/netforce_clinic/layouts/clinic_report_labor_cost_detail.xml
+++ b/netforce_clinic/layouts/clinic_report_labor_cost_detail.xml
@@ -4,5 +4,6 @@
-
+
+
diff --git a/netforce_clinic/layouts/clinic_report_labor_cost_sub_detail.xml b/netforce_clinic/layouts/clinic_report_labor_cost_sub_detail.xml
index a076092..7982c05 100644
--- a/netforce_clinic/layouts/clinic_report_labor_cost_sub_detail.xml
+++ b/netforce_clinic/layouts/clinic_report_labor_cost_sub_detail.xml
@@ -4,5 +4,6 @@
-
+
+
diff --git a/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml b/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml
index 3f2452b..2c02be3 100644
--- a/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml
+++ b/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml
@@ -2,10 +2,10 @@
-
-
+
+
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 678706d..fb122c9 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -157,7 +157,6 @@ class HDCase(Model):
'dlz_use': dlz_use,
'dlz_max': dlz_max,
}
- print('no ', no)
set_active_user(user_id)
return res
diff --git a/netforce_clinic/models/report_labor_cost_detail.py b/netforce_clinic/models/report_labor_cost_detail.py
index 27a52ec..57a6280 100644
--- a/netforce_clinic/models/report_labor_cost_detail.py
+++ b/netforce_clinic/models/report_labor_cost_detail.py
@@ -39,7 +39,16 @@ class ReportLaborCostDetail(Model):
date_to=self._get_date_to()
staff_type=defaults.get("staff_type","doctor")
staff_id=int(defaults.get('staff_id', "0"))
- department_id=int(defaults.get('department_id', "0"))
+ print('defaults ', defaults)
+ department_id=defaults.get('department_id')
+ if department_id:
+ department_id=int(department_id)
+ branch_id=defaults.get('branch_id')
+ if branch_id:
+ branch_id=int(branch_id)
+ if not branch_id and department_id:
+ dpt=get_model('clinic.department').browse(department_id)
+ branch_id=dpt.branch_id.id
res={
'date': time.strftime("%Y-%m-%d"),
'date_from': date_from,
@@ -47,6 +56,7 @@ class ReportLaborCostDetail(Model):
'type': staff_type,
'staff_id': staff_id and staff_id or None,
'department_id': department_id and department_id or None,
+ 'branch_id': branch_id,
}
return res
@@ -59,6 +69,7 @@ class ReportLaborCostDetail(Model):
staff_type=defaults.get("type")
staff_id=defaults.get("staff_id")
department_id=defaults.get("department_id")
+ branch_id=defaults.get("branch_id")
dom=[]
if ids:
obj=self.browse(ids)[0]
@@ -67,6 +78,7 @@ class ReportLaborCostDetail(Model):
staff_id=obj.staff_id.id
staff_type=obj.type
department_id=obj.department_id.id
+ branch_id=obj.branch_id.id
dom.append(['date','>=',date_from])
dom.append(['date','<=',date_to])
if staff_id:
@@ -75,6 +87,8 @@ class ReportLaborCostDetail(Model):
dom.append(['type','=',staff_type])
if department_id:
dom.append(['labor_cost_id.cycle_item_id.department_id','=',department_id])
+ if branch_id:
+ dom.append(['labor_cost_id.cycle_item_id.branch_id','=',branch_id])
def replace_quote(dom=""):
return dom.replace("'","\"")
@@ -131,9 +145,18 @@ class ReportLaborCostDetail(Model):
department_name=get_model("clinic.department").browse(department_id).name or ""
# link to sub detail
show_count=0
+ show_dpt=[]
+ if department_name:
+ show_dpt.append(department_name)
+ if branch_id:
+ for dpt in get_model("clinic.department").search_read([['branch_id','=',branch_id]],['name']):
+ show_dpt.append(dpt['name'])
+ show_all=False
+ if not department_id and not branch_id:
+ show_all=True
for dpt in dpts:
show_link=True
- if dpt['name']!=department_name and department_name!='':
+ if dpt['name'] not in show_dpt and not show_all:
show_link=False
show_count+=1
dpt.update({
@@ -210,7 +233,8 @@ class ReportLaborCostDetail(Model):
'staff_name': staff_name,
'staff_id': staff_id,
'staff_type': staff_type,
- 'department_id': "0", #XXX
+ 'department_id': department_id,
+ 'branch_id': branch_id,
'date_from': date_from,
'date_to': date_to,
'dpts': dpts,
diff --git a/netforce_clinic/models/report_labor_cost_sub_detail.py b/netforce_clinic/models/report_labor_cost_sub_detail.py
index 3b25562..853b075 100644
--- a/netforce_clinic/models/report_labor_cost_sub_detail.py
+++ b/netforce_clinic/models/report_labor_cost_sub_detail.py
@@ -13,9 +13,9 @@ class ReportLaborCostSubDetail(Model):
"date": fields.Date("Month"),
"date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True),
- 'department_id': fields.Many2One("clinic.department","Department"),
'staff_id': fields.Many2One("clinic.staff","Staff"),
"staff_type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
+ 'branch_id': fields.Many2One("clinic.branch","Branch"),
'department_id': fields.Many2One("clinic.department","Department"),
}
@@ -38,16 +38,24 @@ class ReportLaborCostSubDetail(Model):
date_to=self._get_date_to()
staff_type=defaults.get("staff_type","doctor")
staff_id=int(defaults.get('staff_id', "0"))
- department_id=int(defaults.get('department_id', "0"))
+ department_id=defaults.get('department_id')
+ if department_id:
+ department_id=int(department_id)
+ branch_id=defaults.get('branch_id')
+ if branch_id:
+ branch_id=int(branch_id)
+ if not branch_id and department_id:
+ dpt=get_model("clinic.department").browse(department_id)
+ branch_id=dpt.branch_id.id
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 and department_id or None,
+ 'department_id': department_id,
+ 'branch_id': branch_id,
}
- print('res ', res)
return res
def get_report_data(self,ids,context={}):
@@ -58,6 +66,7 @@ class ReportLaborCostSubDetail(Model):
date_to=defaults.get("date_to")
staff_type=defaults.get("staff_type")
staff_id=defaults.get("staff_id")
+ branch_id=defaults.get("branch_id")
department_id=defaults.get("department_id")
staff_name=''
dom=[]
@@ -69,6 +78,7 @@ class ReportLaborCostSubDetail(Model):
staff_name=obj.staff_id.name or ""
staff_type=obj.staff_type
department_id=obj.department_id.id
+ branch_id=obj.branch_id.id
dom.append(['date','>=',date_from])
dom.append(['date','<=',date_to])
if staff_id and staff_type=='doctor':
@@ -79,6 +89,8 @@ class ReportLaborCostSubDetail(Model):
dom.append(['type','=',staff_type])
if department_id:
dom.append(['labor_cost_id.cycle_item_id.department_id','=',department_id])
+ if branch_id:
+ dom.append(['labor_cost_id.cycle_item_id.branch_id','=',branch_id])
if not staff_id:
return {}
def replace_quote(dom=""):
diff --git a/netforce_clinic/models/report_labor_cost_summary.py b/netforce_clinic/models/report_labor_cost_summary.py
index e954c3e..335c35f 100644
--- a/netforce_clinic/models/report_labor_cost_summary.py
+++ b/netforce_clinic/models/report_labor_cost_summary.py
@@ -245,6 +245,8 @@ class ReportLaborCostSummary(Model):
'total_hdcase': total_hdcase or 0,
'total_cost': round(total_cost,0) or 0,
'staff_type': staff_type,
+ 'branch_id': branch_id,
+ 'department_id': department_id,
}
return data
diff --git a/netforce_clinic/models/report_shop.py b/netforce_clinic/models/report_shop.py
index d3d88a9..f0522ba 100644
--- a/netforce_clinic/models/report_shop.py
+++ b/netforce_clinic/models/report_shop.py
@@ -25,8 +25,8 @@ class ReportShop(Model):
weekday, total_day=monthrange(int(year), int(month))
date_from=defaults.get('date_from','%s-%s-01'%(year,month))
date_to=defaults.get('date_to',"%s-%s-%s"%(year,month,total_day))
- date_from=defaults.get('date',date)
- date_to=defaults.get('date',date)
+ #date_from=defaults.get('date',date)
+ #date_to=defaults.get('date',date)
product_id=defaults.get('product_id')
branch_id=defaults.get('branch_id',None)
diff --git a/netforce_clinic/templates/report_labor_cost.hbs b/netforce_clinic/templates/report_labor_cost.hbs
index 669da25..66aff56 100644
--- a/netforce_clinic/templates/report_labor_cost.hbs
+++ b/netforce_clinic/templates/report_labor_cost.hbs
@@ -9,7 +9,7 @@
ชั้น |
- รวม |
+ รวมจำนวนครั้ง |
{{#each lines }}
diff --git a/netforce_clinic/templates/report_labor_cost_summary.hbs b/netforce_clinic/templates/report_labor_cost_summary.hbs
index c58a599..3033f88 100644
--- a/netforce_clinic/templates/report_labor_cost_summary.hbs
+++ b/netforce_clinic/templates/report_labor_cost_summary.hbs
@@ -18,20 +18,20 @@
|
- # |
- รหัส |
+ # |
+ รหัส |
{{#ifeq staff_type "nurse"}}
- ชื่อ-สกุล |
- ตำแหน่ง |
- หมวดหมู่ |
+ ชื่อ-สกุล |
+ ตำแหน่ง |
+ หมวดหมู่ |
{{else}}
- ชื่อ-สกุล |
+ ชื่อ-สกุล |
{{/ifeq}}
{{#each dpts}}
{{name}} |
{{/each}}
- รวม |
+ รวม |
@@ -52,11 +52,11 @@
{{/ifeq}}
{{#each sub_lines}}
- {{currency amt zero=""}}
+ {{currency amt zero=""}}
|
{{/each}}
- {{currency total zero=""}}
+ {{currency total zero=""}}
|
{{/each}}