wrong summary total mecical for each round
parent
16676dcf4b
commit
765a9884ed
|
@ -111,6 +111,7 @@ class HDCase(Model):
|
||||||
dlz_price=0
|
dlz_price=0
|
||||||
srv=0
|
srv=0
|
||||||
mdc=0
|
mdc=0
|
||||||
|
mdc_items={}
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
amt=line.amount or 0
|
amt=line.amount or 0
|
||||||
prod=line.product_id
|
prod=line.product_id
|
||||||
|
@ -129,8 +130,12 @@ class HDCase(Model):
|
||||||
else:
|
else:
|
||||||
mdc+=amt
|
mdc+=amt
|
||||||
mdc_names.append(prod_name or "")
|
mdc_names.append(prod_name or "")
|
||||||
|
mdc_items.setdefault(prod_name,0)
|
||||||
|
mdc_items[prod_name]=line.qty
|
||||||
if categ.code=='EPO':
|
if categ.code=='EPO':
|
||||||
epo_names.append(prod_name.title())
|
epo_names.append(prod_name.title())
|
||||||
|
mdc_items.setdefault(prod_name,0)
|
||||||
|
mdc_items[prod_name]=line.qty
|
||||||
elif categ.code=='IVR':
|
elif categ.code=='IVR':
|
||||||
iron_names.append(prod_name.title())
|
iron_names.append(prod_name.title())
|
||||||
elif categ.code=='FEE':
|
elif categ.code=='FEE':
|
||||||
|
@ -154,6 +159,7 @@ class HDCase(Model):
|
||||||
res[obj.id]={
|
res[obj.id]={
|
||||||
'epo': ','.join([n for n in epo_names]),
|
'epo': ','.join([n for n in epo_names]),
|
||||||
'mdc_name': ','.join([n for n in mdc_names]),
|
'mdc_name': ','.join([n for n in mdc_names]),
|
||||||
|
'mdc_items': str(mdc_items),
|
||||||
'iron_name': ','.join([n for n in iron_names]),
|
'iron_name': ','.join([n for n in iron_names]),
|
||||||
'fee': fee,
|
'fee': fee,
|
||||||
'lab': lab,
|
'lab': lab,
|
||||||
|
@ -222,6 +228,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),
|
||||||
|
"mdc_items": fields.Float("MDC Items",function="_get_expense",function_multi=True),
|
||||||
"iron_name": fields.Float("Iron 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),
|
||||||
|
|
|
@ -147,6 +147,7 @@ class ReportCycleItem(Model):
|
||||||
|
|
||||||
total_epo=0
|
total_epo=0
|
||||||
total_ivr=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:
|
||||||
|
@ -171,6 +172,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,
|
||||||
|
'mdc_items': hdcase.mdc_items,
|
||||||
'iron_name': hdcase.iron_name or '',
|
'iron_name': hdcase.iron_name or '',
|
||||||
'fee': abs(hdcase.fee),
|
'fee': abs(hdcase.fee),
|
||||||
'dlz_name': hdcase.dlz_name,
|
'dlz_name': hdcase.dlz_name,
|
||||||
|
@ -224,12 +226,16 @@ class ReportCycleItem(Model):
|
||||||
if x['cseq']==line['cseq'] and x['date']==date:
|
if x['cseq']==line['cseq'] and x['date']==date:
|
||||||
sub_fee+=x['fee'] or 0
|
sub_fee+=x['fee'] or 0
|
||||||
sub_mdc+=x['mdc'] or 0
|
sub_mdc+=x['mdc'] or 0
|
||||||
if not epos.get(x['mdc_name']):
|
x_name=x['mdc_name']
|
||||||
epos[x['mdc_name']]=0
|
epos.setdefault(x_name,0)
|
||||||
if not epos.get(x['iron_name']):
|
epos.setdefault(x['iron_name'],0)
|
||||||
epos[x['iron_name']]=0
|
|
||||||
epos[x['iron_name']]+=x['total_ivr'] or 0 #XXX
|
epos[x['iron_name']]+=x['total_ivr'] or 0 #XXX
|
||||||
epos[x['mdc_name']]+=x['total_epo'] or 0
|
if ',' in x_name:
|
||||||
|
del epos[x_name]
|
||||||
|
for k,v in eval(x['mdc_items']).items():
|
||||||
|
epos[k]=v
|
||||||
|
else:
|
||||||
|
epos[x_name]+=x['total_epo'] or 0
|
||||||
count+=1
|
count+=1
|
||||||
line['date_txt']=line['date']
|
line['date_txt']=line['date']
|
||||||
line['cseq_txt']=line['cseq']
|
line['cseq_txt']=line['cseq']
|
||||||
|
|
Loading…
Reference in New Issue