diff --git a/netforce_clinic/layouts/clinic_labor_cost_form.xml b/netforce_clinic/layouts/clinic_labor_cost_form.xml
index d5a6a04..19bebbc 100644
--- a/netforce_clinic/layouts/clinic_labor_cost_form.xml
+++ b/netforce_clinic/layouts/clinic_labor_cost_form.xml
@@ -30,7 +30,7 @@
-
+
@@ -54,7 +54,7 @@
-
+
@@ -77,7 +77,7 @@
-
+
@@ -100,7 +100,7 @@
-
+
diff --git a/netforce_clinic/layouts/clinic_labor_cost_list.xml b/netforce_clinic/layouts/clinic_labor_cost_list.xml
index c02aeab..cb1fa6b 100644
--- a/netforce_clinic/layouts/clinic_labor_cost_list.xml
+++ b/netforce_clinic/layouts/clinic_labor_cost_list.xml
@@ -1,4 +1,7 @@
+
+
+
diff --git a/netforce_clinic/models/labor_cost.py b/netforce_clinic/models/labor_cost.py
index cfc12c0..2d425ab 100644
--- a/netforce_clinic/models/labor_cost.py
+++ b/netforce_clinic/models/labor_cost.py
@@ -38,7 +38,8 @@ class LaborCost(Model):
total_stcost=0.0
for line in obj.staff_lines:
total_stcost+=line.amount or 0.0
-
+ #XXX
+ total=total_ncost+total_dcost+total_stcost
res[obj.id]={
'var_pt': total_case,
'var_ptx': total_case*(obj.var_k or 0),
@@ -63,10 +64,10 @@ class LaborCost(Model):
'var_fml2': fields.Char("Step 2:",function="_get_all",function_multi=True),
'var_fml3': fields.Char("X:",function="_get_all",function_multi=True),
'var_x': fields.Char("X:",function="_get_all",function_multi=True),
- 'total': fields.Float("Total",function="_get_all",function_multi=True),
- 'total_ncost': fields.Float("Total",function="_get_all",function_multi=True),
- 'total_dcost': fields.Float("Total",function="_get_all",function_multi=True),
- 'total_stcost': fields.Float("Total",function="_get_all",function_multi=True),
+ 'total': fields.Float("Total (Baht)",function="_get_all",function_multi=True),
+ 'total_ncost': fields.Float("Nurse Cost",function="_get_all",function_multi=True),
+ 'total_dcost': fields.Float("Doctor Cost",function="_get_all",function_multi=True),
+ 'total_stcost': fields.Float("Staff Cost",function="_get_all",function_multi=True),
'manual': fields.Boolean("Manual"),
"formulars": fields.One2Many("clinic.labor.cost.formular", "labor_cost_id", "Formulars"),
"nurse_lines": fields.One2Many("clinic.labor.cost.line", "labor_cost_id", "Nurse Lines",domain=[['type','=','nurse']]),
diff --git a/netforce_clinic/models/report_staff_fee_detail.py b/netforce_clinic/models/report_staff_fee_detail.py
index d408659..4bfd536 100644
--- a/netforce_clinic/models/report_staff_fee_detail.py
+++ b/netforce_clinic/models/report_staff_fee_detail.py
@@ -67,53 +67,46 @@ class ReportStaffFeeDetail(Model):
dom.append(['date','>=',time_start])
dom.append(['date','<=',time_stop])
if department_id:
- dom.append(['department_id','=',department_id])
+ dom.append(['staff_id.department_id','=',department_id])
if branch_id:
- dom.append(['branch_id','=',branch_id])
+ dom.append(['staff_id.branch_id','=',branch_id])
staff_name=''
if staff_id:
- staff=get_model("clinic.staff").browse(staff_id)
- staff_name=staff.name
- dom.append(['staff_id','=',staff.id])
- dlines=get_model('clinic.labor.cost.line').search_browse(dom)
- # group by date
- all_vals={}
- for dline in dlines:
- date=dline.date
- staff=dline.staff_id
- if staff_type:
- if staff_type!=staff.type:
- continue
- key=(date,staff.id)
- if key not in all_vals.keys():
- all_vals[key]={
- 'qty': 0,
- 'staff_type': utils.STAFF_TYPE.get(staff.type,''),
- 'staff_name': staff.name or "",
- 'amount': 0,
- }
- all_vals[key]['qty']+=dline.qty or 0
- all_vals[key]['amount']+=dline.amount or 0
-
+ dom.append(['staff_id','=',staff_id])
lines=[]
- total_amount=0.0
- total_qty=0.0
- for key,vals in all_vals.items():
- date,staff_id=key
- qty=vals['qty'] or 0
- amount=vals['amount'] or 0
- _staff_name=vals['staff_name'] or ''
- staff_type=vals['staff_type']
- lines.append({
- 'date': date,
- 'qty': qty,
- 'staff_type': staff_type,
- 'staff_name': _staff_name,
- 'amount': amount or 0.0,
- })
- total_qty+=qty
- total_amount+=amount
-
+ total_qty=0
+ total_amount=0
+ lines=[]
+ for lcline in get_model('clinic.labor.cost.line').search_browse(dom):
+ lc=lcline.labor_cost_id
+ item=lc.cycle_item_id
+ date=item.date
+ cycle=item.cycle_id
+ branch=item.branch_id
+ dpt=item.department_id
+ for dt in lc.doctor_lines:
+ staff=dt.staff_id
+ lines.append({
+ 'staff_id': staff.id,
+ 'staff_name': staff.name or '',
+ 'staff_type': staff.type or '',
+ 'date': date,
+ 'cycle_id': cycle.id,
+ 'branch_id': branch.id,
+ 'department_id': dpt.id,
+ })
+ for nr in lc.nurse_lines:
+ staff=dt.staff_id
+ lines.append({
+ 'staff_id': staff.id,
+ 'staff_name': staff.name or '',
+ 'staff_type': staff.type or '',
+ 'date': date,
+ 'cycle_id': cycle.id,
+ 'branch_id': branch.id,
+ 'department_id': dpt.id,
+ })
+
month_str=utils.MONTHS['th_TH'][int(month)]
start=int(time_start[8:10])
stop=int(time_stop[8:10])
diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt
index 59649bc..67aaca5 100644
--- a/netforce_clinic/todo.txt
+++ b/netforce_clinic/todo.txt
@@ -1,7 +1,7 @@
todo:
- report
- - doctor labort cost detail
- - matching payment
+ - doctor labort cost detail ***
+ - matching payment ***
- popup messagging
=======
generate visit ใหม่ -> ok