From d4b3598a990434191276f0c4c339b10750e2953a Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Sun, 5 Apr 2015 21:08:37 +0700 Subject: [PATCH] labor cost report --- netforce_clinic/models/report_labor_cost.py | 7 +++++-- .../models/report_labor_cost_summary.py | 16 ++++++++++++---- netforce_clinic/templates/report_labor_cost.hbs | 6 ++++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/netforce_clinic/models/report_labor_cost.py b/netforce_clinic/models/report_labor_cost.py index 68241ad..34c85da 100644 --- a/netforce_clinic/models/report_labor_cost.py +++ b/netforce_clinic/models/report_labor_cost.py @@ -59,7 +59,7 @@ class ReportLaborCost(Model): dom.append(['branch_id','=',branch_id]) if department_id: dom.append(['department_id','=',department_id]) - print('dom ', dom) + date=date_from hdcases={} for hdcase in get_model("clinic.hd.case").search_browse(dom): dpt=hdcase.department_id @@ -89,13 +89,16 @@ class ReportLaborCost(Model): elif branch_id: branch=get_model("clinic.branch").browse(branch_id) sub_name="(%s)" % branch.name or "" - + print('>>>>>> :: ', date) data={ 'company_name': '%s %s' % (company.name or "", sub_name), + 'date': date, 'date_from': date_from, 'date_to': date_to, 'lines': lines, 'total_hdcase': total_hdcase, + 'branch_id': branch_id, + 'department_id': department_id, } return data diff --git a/netforce_clinic/models/report_labor_cost_summary.py b/netforce_clinic/models/report_labor_cost_summary.py index 24e3ed6..6f280b7 100644 --- a/netforce_clinic/models/report_labor_cost_summary.py +++ b/netforce_clinic/models/report_labor_cost_summary.py @@ -33,14 +33,22 @@ class ReportLaborCostSummary(Model): def default_get(self,field_names=None,context={},**kw): defaults=context.get("defaults",{}) + date=defaults.get("date", time.strftime("%Y-%m-%d")) + print('date>>> ', date) 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")) + branch_id=defaults.get("branch_id") + if branch_id: + branch_id=int(branch_id) + department_id=defaults.get("department_id") + if department_id: + department_id=int(department_id) + staff_id=defaults.get('staff_id') + if staff_id: + staff_id=int(staff_id) staff_type=defaults.get("staff_type","doctor") - staff_id=int(defaults.get('staff_id', "0")) res={ - 'date': time.strftime("%Y-%m-%d"), + 'date': date, 'date_from': date_from, 'date_to': date_to, 'staff_type': staff_type, diff --git a/netforce_clinic/templates/report_labor_cost.hbs b/netforce_clinic/templates/report_labor_cost.hbs index 285e4e3..5b23581 100644 --- a/netforce_clinic/templates/report_labor_cost.hbs +++ b/netforce_clinic/templates/report_labor_cost.hbs @@ -18,13 +18,15 @@ {{name}} - {{currency qty}} + {{currency qty}} {{/each}} Total - {{currency total_hdcase}} + + {{currency total_hdcase}} +