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 "")
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),

View File

@ -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']