From f007db5ecf44b00c03392e3d16acc3af5a03d144 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Mon, 24 Nov 2014 15:50:46 +0700 Subject: [PATCH] reports --- .../layouts/clinic_report_nurse_fee_sum.xml | 1 + netforce_clinic/models/report_nurse_fee_detail.py | 3 +++ netforce_clinic/models/report_nurse_fee_sum.py | 12 ++++++++++-- netforce_clinic/models/utils.py | 6 ++++++ .../templates/report_nurse_fee_detail.hbs | 7 +++++-- netforce_clinic/templates/report_nurse_fee_sum.hbs | 6 +++--- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/netforce_clinic/layouts/clinic_report_nurse_fee_sum.xml b/netforce_clinic/layouts/clinic_report_nurse_fee_sum.xml index 6d752a7..9196150 100644 --- a/netforce_clinic/layouts/clinic_report_nurse_fee_sum.xml +++ b/netforce_clinic/layouts/clinic_report_nurse_fee_sum.xml @@ -2,4 +2,5 @@ + diff --git a/netforce_clinic/models/report_nurse_fee_detail.py b/netforce_clinic/models/report_nurse_fee_detail.py index bd484d0..042df6f 100644 --- a/netforce_clinic/models/report_nurse_fee_detail.py +++ b/netforce_clinic/models/report_nurse_fee_detail.py @@ -75,6 +75,7 @@ class ReportNurseFeeDetail(Model): if key not in all_vals.keys(): all_vals[key]={ 'qty': 0, + 'personal_type': utils.PERSONAL_TYPE.get(personal.type,''), 'personal_name': personal.name or "", 'amount': 0, } @@ -89,9 +90,11 @@ class ReportNurseFeeDetail(Model): qty=vals['qty'] or 0 amount=vals['amount'] or 0 _personal_name=vals['personal_name'] or '' + personal_type=vals['personal_type'] lines.append({ 'date': date, 'qty': qty, + 'personal_type': personal_type, 'personal_name': _personal_name, 'amount': amount or 0.0, }) diff --git a/netforce_clinic/models/report_nurse_fee_sum.py b/netforce_clinic/models/report_nurse_fee_sum.py index e1ab047..9c2903c 100644 --- a/netforce_clinic/models/report_nurse_fee_sum.py +++ b/netforce_clinic/models/report_nurse_fee_sum.py @@ -17,6 +17,7 @@ class ReportNurseFeeSum(Model): "date": fields.Date("Month"), "date_from": fields.Date("From", required=True), "date_to": fields.Date("To", required=True), + "nurse_id": fields.Many2One("clinic.personal","Nurse", domain=[['type','=','nurse']]), } def _get_date_from(self,context={}): @@ -47,8 +48,10 @@ class ReportNurseFeeSum(Model): year,month,day=defaults['date'].split("-") time_start='%s-%s-01'%(year,str(month).zfill(2)) time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day) + nurse_id=None if ids: obj=self.browse(ids)[0] + nurse_id=obj.nurse_id.id month=obj.date_from.split("-")[1] time_start=obj.date_from time_stop=obj.date_to @@ -70,7 +73,12 @@ class ReportNurseFeeSum(Model): lines=[] total_all={} total_sum=0.0 - for nurse in get_model("clinic.personal").search_browse([['type','=','nurse']]): + dom=[] + dom.append(['type','=','nurse']) + for nurse in get_model("clinic.personal").search_browse(dom): + if nurse_id: + if nurse_id!=nurse.id: + continue line={ 'nurse_id': nurse.id, 'nurse_name': nurse.name or '', @@ -111,7 +119,7 @@ class ReportNurseFeeSum(Model): 'amt': total_all[date], }) total_lines.append({ - 'amt': total_sum, + 'amt': round(total_sum,2), }) month_str=utils.MONTHS['th_TH'][int(month)] diff --git a/netforce_clinic/models/utils.py b/netforce_clinic/models/utils.py index 77bb040..c0a3067 100644 --- a/netforce_clinic/models/utils.py +++ b/netforce_clinic/models/utils.py @@ -14,6 +14,12 @@ PATIENT_TYPE={ "others": "อื่นๆ", } +PERSONAL_TYPE={ + 'doctor': 'Doctor', + 'nurse': 'Nurse', + 'personal': 'Personal', +} + TOPICS={ 'topic1': {'name': 'จำนวนครั้งการทำ Hemodialysis', 'unit': 'ครั้ง'}, 'topic2': {'name': 'จำนวนผู้ป่วยยกมาจากเดือน', 'unit': 'คน'}, diff --git a/netforce_clinic/templates/report_nurse_fee_detail.hbs b/netforce_clinic/templates/report_nurse_fee_detail.hbs index 0c93acc..59a5c94 100644 --- a/netforce_clinic/templates/report_nurse_fee_detail.hbs +++ b/netforce_clinic/templates/report_nurse_fee_detail.hbs @@ -15,11 +15,12 @@ {{#if lines}} - +
{{#unless ../personal_name}} - + + {{/unless}} @@ -30,6 +31,7 @@ {{#unless ../personal_name}} + {{/unless}} @@ -39,6 +41,7 @@ {{#unless ../personal_name}} + {{/unless}} diff --git a/netforce_clinic/templates/report_nurse_fee_sum.hbs b/netforce_clinic/templates/report_nurse_fee_sum.hbs index 8ff6677..8dd07c4 100644 --- a/netforce_clinic/templates/report_nurse_fee_sum.hbs +++ b/netforce_clinic/templates/report_nurse_fee_sum.hbs @@ -12,9 +12,9 @@ {{#if lines}} -
วันที่บุคลากรบุคลากรประเภทจำนวนคนไข้ จำนวนเงิน{{date}}{{personal_name}}{{personal_type}}{{qty}} {{currency amount}}
รวม {{total_qty}}
+
- + {{#each cols}} {{/each}} @@ -23,7 +23,7 @@ {{#each lines}} - + {{#each sub_lines}} {{#if last}}
พยาบาลพยาบาล{{name}}
{{nurse_name}}{{nurse_name}}{{amt}}