Report cycle item: wrong medical summary for each cycle and Vinofer is

not show.
fix_acc
watcha.h 2015-08-19 19:36:31 +07:00
parent 9b1331443f
commit 689df05bd9
2 changed files with 11 additions and 4 deletions

View File

@ -128,7 +128,7 @@ class HDCase(Model):
mdc_names.append(prod_name or "") mdc_names.append(prod_name or "")
else: else:
mdc+=amt mdc+=amt
mdc_names.append(name or "") mdc_names.append(prod_name or "")
if categ.code=='EPO': if categ.code=='EPO':
epo_names.append(prod_name.title()) epo_names.append(prod_name.title())
elif categ.code=='IVR': elif categ.code=='IVR':
@ -217,6 +217,7 @@ class HDCase(Model):
"mdc": fields.Float("MDC",function="_get_expense",function_multi=True), "mdc": fields.Float("MDC",function="_get_expense",function_multi=True),
"srv": fields.Float("Service",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), "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'), 'sickbed_id': fields.Many2One("clinic.sickbed",'Sickbed'),
"ref": fields.Char("Ref",search=True), "ref": fields.Char("Ref",search=True),
"time_start": fields.DateTime("Start Time",required=True), "time_start": fields.DateTime("Start Time",required=True),

View File

@ -141,14 +141,14 @@ class ReportCycleItem(Model):
return number return number
total_epo=0 total_epo=0
total_ivr=0
for line in hdcase.lines: for line in hdcase.lines:
prod=line.product_id prod=line.product_id
if prod.categ_id: if prod.categ_id:
if prod.categ_id.code=='EPO': if prod.categ_id.code=='EPO':
total_epo+=line.qty or 0 total_epo+=line.qty or 0
else: if prod.categ_id.code=='IVR':
pass total_ivr+=line.qty or 0
#print('>>> ', hdcase.number, prod.id, prod.name)
lines.append({ lines.append({
'dlz_drop': dlz_drop, 'dlz_drop': dlz_drop,
@ -166,6 +166,7 @@ class ReportCycleItem(Model):
'hdcase_number': reformat_number(hdcase.number), 'hdcase_number': reformat_number(hdcase.number),
'hdcase_id': hdcase.id, 'hdcase_id': hdcase.id,
'mdc_name': hdcase.mdc_name or hdcase.epo, 'mdc_name': hdcase.mdc_name or hdcase.epo,
'iron_name': hdcase.iron_name or '',
'fee': abs(hdcase.fee), 'fee': abs(hdcase.fee),
'dlz_name': hdcase.dlz_name, 'dlz_name': hdcase.dlz_name,
'dlz_use': dlz_use, 'dlz_use': dlz_use,
@ -182,6 +183,7 @@ class ReportCycleItem(Model):
'dpt_id': dpt.id, 'dpt_id': dpt.id,
'dpt_name': dpt.name or "", 'dpt_name': dpt.name or "",
'total_epo': total_epo, 'total_epo': total_epo,
'total_ivr': total_ivr,
}) })
month_str=utils.MONTHS['th_TH'][int(month)] month_str=utils.MONTHS['th_TH'][int(month)]
company_name=company.name or "" company_name=company.name or ""
@ -219,6 +221,10 @@ class ReportCycleItem(Model):
sub_mdc+=x['mdc'] or 0 sub_mdc+=x['mdc'] or 0
if not epos.get(x['mdc_name']): if not epos.get(x['mdc_name']):
epos[x['mdc_name']]=0 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 epos[x['mdc_name']]+=x['total_epo'] or 0
count+=1 count+=1
line['date_txt']=line['date'] line['date_txt']=line['date']