diff --git a/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml b/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml
index 6e0a2c6..3b43778 100644
--- a/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml
+++ b/netforce_clinic/layouts/clinic_report_labor_cost_summary.xml
@@ -3,4 +3,6 @@
+
+
diff --git a/netforce_clinic/models/report_labor_cost_summary.py b/netforce_clinic/models/report_labor_cost_summary.py
index 95d5e5a..a1e76e3 100644
--- a/netforce_clinic/models/report_labor_cost_summary.py
+++ b/netforce_clinic/models/report_labor_cost_summary.py
@@ -17,6 +17,7 @@ class ReportLaborCostSummary(Model):
"type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
'department_id': fields.Many2One("clinic.department","Department"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
+ 'only_value': fields.Boolean("Only Value Exist"),
}
def _get_date_from(self,context={}):
@@ -32,6 +33,7 @@ class ReportLaborCostSummary(Model):
'date': lambda *a: time.strftime("%Y-%m-%d"),
'date_from': _get_date_from,
'date_to': _get_date_to,
+ 'only_value': True,
}
def get_report_data(self,ids,context={}):
@@ -40,19 +42,27 @@ class ReportLaborCostSummary(Model):
date_to=time.strftime(fmt)
company_id=get_active_company()
comp=get_model("company").browse(company_id)
- _type=None
+ staff_type=None
+ staff_id=None
+ only_value=False
dom=[]
if ids:
obj=self.browse(ids)[0]
date_from=obj.date_from
date_to=obj.date_to
- _type=obj.type
+ staff_id=obj.staff_id.id
+ staff_type=obj.type
+ only_value=obj.only_value
dom.append(['date','>=',date_from])
dom.append(['date','<=',date_to])
- if _type:
- dom.append(['type','=',_type])
+ if staff_id:
+ dom.append(['staff_id','=',staff_id])
+ if staff_type:
+ dom.append(['type','=',staff_type])
+ if only_value:
+ dom.append(['amount','!=',0])
+
staffs={}
- print('dom ', dom)
for line in get_model("clinic.labor.cost.line").search_browse(dom):
lcost=line.labor_cost_id
citem=lcost.cycle_item_id
@@ -68,24 +78,20 @@ class ReportLaborCostSummary(Model):
},
}
if not staffs[staff.name].get(dpt.name):
- staffs[staff.name]={
- 'staff_id': staff.id,
- dpt.name: {
- 'amt':amt,
- }
- }
- staffs[staff.name][dpt.name]['amt']+=amt
+ staffs[staff.name].update({
+ dpt.name: {
+ 'amt': 0,
+ }})
+ staffs[staff.name][dpt.name]['amt']+=amt
lines=[]
dpts=get_model("clinic.department").search_read([],['name'])
dpts=sorted(dpts, key=lambda b: b['name'])
no=1
-
staff_types=set()
snames=sorted(staffs.keys()) #sort by staff name
for sname in snames:
vals=staffs[sname]
- print(">> ", vals.get('staff_name'), ' ', sname)
lvals={
'no': no,
'staff_name': sname,
@@ -94,6 +100,7 @@ class ReportLaborCostSummary(Model):
total=0
lvals['sub_lines']=[]
for dpt in dpts:
+ amt=0 #solve bug
dname=dpt['name'] or ''
vals2=vals.get(dname)
if vals2:
diff --git a/netforce_clinic/templates/clinic_page.hbs b/netforce_clinic/templates/clinic_page.hbs
index f26dd0b..e94704a 100644
--- a/netforce_clinic/templates/clinic_page.hbs
+++ b/netforce_clinic/templates/clinic_page.hbs
@@ -92,9 +92,6 @@
-