From 689df05bd9379a9987f13d1deb3d1c5779befcc6 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Wed, 19 Aug 2015 19:36:31 +0700 Subject: [PATCH] Report cycle item: wrong medical summary for each cycle and Vinofer is not show. --- netforce_clinic/models/hd_case.py | 3 ++- netforce_clinic/models/report_cycle_item.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 2c50580..3d196dd 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -128,7 +128,7 @@ class HDCase(Model): mdc_names.append(prod_name or "") else: mdc+=amt - mdc_names.append(name or "") + mdc_names.append(prod_name or "") if categ.code=='EPO': epo_names.append(prod_name.title()) elif categ.code=='IVR': @@ -217,6 +217,7 @@ class HDCase(Model): "mdc": fields.Float("MDC",function="_get_expense",function_multi=True), "srv": fields.Float("Service",function="_get_expense",function_multi=True), "mdc_name": fields.Float("MDC Name",function="_get_expense",function_multi=True), + "iron_name": fields.Float("Iron Name",function="_get_expense",function_multi=True), 'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'), "ref": fields.Char("Ref",search=True), "time_start": fields.DateTime("Start Time",required=True), diff --git a/netforce_clinic/models/report_cycle_item.py b/netforce_clinic/models/report_cycle_item.py index d66dfc2..545a348 100644 --- a/netforce_clinic/models/report_cycle_item.py +++ b/netforce_clinic/models/report_cycle_item.py @@ -141,14 +141,14 @@ class ReportCycleItem(Model): return number total_epo=0 + total_ivr=0 for line in hdcase.lines: prod=line.product_id if prod.categ_id: if prod.categ_id.code=='EPO': total_epo+=line.qty or 0 - else: - pass - #print('>>> ', hdcase.number, prod.id, prod.name) + if prod.categ_id.code=='IVR': + total_ivr+=line.qty or 0 lines.append({ 'dlz_drop': dlz_drop, @@ -166,6 +166,7 @@ class ReportCycleItem(Model): 'hdcase_number': reformat_number(hdcase.number), 'hdcase_id': hdcase.id, 'mdc_name': hdcase.mdc_name or hdcase.epo, + 'iron_name': hdcase.iron_name or '', 'fee': abs(hdcase.fee), 'dlz_name': hdcase.dlz_name, 'dlz_use': dlz_use, @@ -182,6 +183,7 @@ class ReportCycleItem(Model): 'dpt_id': dpt.id, 'dpt_name': dpt.name or "", 'total_epo': total_epo, + 'total_ivr': total_ivr, }) month_str=utils.MONTHS['th_TH'][int(month)] company_name=company.name or "" @@ -219,6 +221,10 @@ class ReportCycleItem(Model): sub_mdc+=x['mdc'] or 0 if not epos.get(x['mdc_name']): epos[x['mdc_name']]=0 + #XXX + if not epos.get(x['iron_name']): + epos[x['iron_name']]=0 + epos[x['iron_name']]+=x['total_ivr'] or 0 #XXX epos[x['mdc_name']]+=x['total_epo'] or 0 count+=1 line['date_txt']=line['date']