diff --git a/netforce_clinic/layouts/clinic_compute_labor_cost.xml b/netforce_clinic/layouts/clinic_compute_labor_cost.xml
index 65d3e10..dc8e569 100644
--- a/netforce_clinic/layouts/clinic_compute_labor_cost.xml
+++ b/netforce_clinic/layouts/clinic_compute_labor_cost.xml
@@ -2,6 +2,8 @@
+
+
diff --git a/netforce_clinic/models/compute_labor_cost.py b/netforce_clinic/models/compute_labor_cost.py
index 29bacbd..d2240cc 100644
--- a/netforce_clinic/models/compute_labor_cost.py
+++ b/netforce_clinic/models/compute_labor_cost.py
@@ -13,6 +13,8 @@ class ComputeLaborCost(Model):
"date": fields.Date("Month"),
"date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True),
+ 'branch_id': fields.Many2One("clinic.branch","Branch"),
+ 'department_id': fields.Many2One("clinic.department","Department"),
}
def _get_date_from(self,context={}):
@@ -35,8 +37,15 @@ class ComputeLaborCost(Model):
dom=[]
dom.append(['date','>=', obj.date_from])
dom.append(['date','<=', obj.date_to])
+ if obj.branch_id:
+ dom.append(['branch_id','=',obj.branch_id.id])
+ if obj.department_id:
+ dom.append(['department_id','=',obj.department_id.id])
for lcost in get_model("clinic.labor.cost").search_browse(dom):
print("compute %s ....", lcost.cycle_item_id.name)
+ #item=lcost.cycle_item_id
+ #item.to_draft()
+ #item.validate()
lcost.compute()
print("Done!")
return {
diff --git a/netforce_clinic/models/labor_cost.py b/netforce_clinic/models/labor_cost.py
index be8fbcd..e2e5538 100644
--- a/netforce_clinic/models/labor_cost.py
+++ b/netforce_clinic/models/labor_cost.py
@@ -69,10 +69,10 @@ class LaborCost(Model):
'var_fml3': '(%s%s)/%s'%(var_ptx,total_bstr,total_a),
'var_x': round(var_x,2),
'total': total,
- 'total_formular': total_formular,
- 'total_ncost': total_ncost,
+ 'total_formular': round(total_formular,0),
+ 'total_ncost': round(total_ncost,0),
'total_nqty': total_nqty,
- 'total_dcost': total_dcost,
+ 'total_dcost': round(total_dcost,0),
'total_dqty': total_dqty,
'total_stcost': total_stcost,
}
diff --git a/netforce_clinic/models/report_labor_cost_summary.py b/netforce_clinic/models/report_labor_cost_summary.py
index 499e434..4849b98 100644
--- a/netforce_clinic/models/report_labor_cost_summary.py
+++ b/netforce_clinic/models/report_labor_cost_summary.py
@@ -205,19 +205,15 @@ class ReportLaborCostSummary(Model):
total_cost+=amt
total_qty+=qty
- total_lines.append({'amt': total})
+ total_lines.append({'amt': round(total,0)})
company_id=get_active_company()
comp=get_model("company").browse(company_id)
- #staff_type=staff_type or staff.type #XXX
- print("staff_type ", staff_type)
if staff_type!='doctor':
total_hdcase=0
for k,hdcase_qty in citems.items():
total_hdcase+=hdcase_qty
- print("total_hdcase ", total_hdcase)
-
- # reset no
+ # run no
nlines=[]
no=1
for line in sorted(lines, key=lambda x: x['number']):
@@ -234,7 +230,7 @@ class ReportLaborCostSummary(Model):
'lines': nlines,
'total_lines': total_lines,
'total_hdcase': total_hdcase or 0,
- 'total_cost': total_cost or 0,
+ 'total_cost': round(total_cost,0) or 0,
}
return data
diff --git a/netforce_clinic/templates/report_labor_cost_summary.hbs b/netforce_clinic/templates/report_labor_cost_summary.hbs
index 10d0957..c8834b9 100644
--- a/netforce_clinic/templates/report_labor_cost_summary.hbs
+++ b/netforce_clinic/templates/report_labor_cost_summary.hbs
@@ -27,7 +27,7 @@
{{name}} |
{{/each}}
- รายได้ |
+ รวม |