merge production

report_acc_hdcase_summary
watcha.h 2016-08-18 10:38:17 +07:00
commit 6df39d56e1
2 changed files with 43 additions and 1 deletions

View File

@ -6,6 +6,7 @@
<field name="ptype_id" span="2"/>
<field name="branch_id" onchange="onchange_type" span="2"/>
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
<field name="sort_by" span="2"/>
<group span="6" columns="1">
<template>
<div>

View File

@ -19,6 +19,7 @@ class ReportCycleItem(Model):
"ptype_id": fields.Many2One("clinic.patient.type","Patient Type"),
'branch_id': fields.Many2One("clinic.branch","Branch"),
'department_id': fields.Many2One("clinic.department","Department"),
'sort_by': fields.Selection([['hdcase_number','HDCase Number'],['pname','Patient Name'],['mdc_name','EPO']],'Sort By'),
}
def default_get(self,field_names=None,context={},**kw):
@ -51,6 +52,7 @@ class ReportCycleItem(Model):
'branch_id': branch_id,
'department_id': department_id,
'ptype_id': ptype_id,
'sort_by': 'mdc_name',
}
print('report.cycle.item.defautls', res)
return res
@ -67,6 +69,7 @@ class ReportCycleItem(Model):
print('date_from ', date_from)
month=date_from.split("-")[1]
cycle_id=None
sort_by='mdc_name'
if ids:
obj=self.browse(ids)[0]
month=obj.date_from.split("-")[1]
@ -76,6 +79,7 @@ class ReportCycleItem(Model):
department_id=obj.department_id.id
cycle_id=obj.cycle_id.id
ptype_id=obj.ptype_id.id
sort_by=obj.sort_by or 'mdc_name'
# new patient of this month
dom=[]
dom.append(['date','>=',date_from])
@ -201,6 +205,7 @@ class ReportCycleItem(Model):
branch=get_model("clinic.branch").browse(branch_id)
company_name+=" ("+branch.name+")"
nlines=[]
clines=[]
index=0
old=[]
total_fee=0
@ -266,11 +271,47 @@ class ReportCycleItem(Model):
'nfirst_name': cres[i]['first_name'],
'ctid': cres[i]['cycle_item_id'],
})
nlines.append(line)
#nlines.append(line)
clines.append(line)
# if nurse more that cres, should show name of nurses
nlines+=more_lines
if no==count:
epo_items=[{'name': k, 'qty': v} for k,v in epos.items() if k ]
#sort item
clines=sorted(clines,key=lambda cl: cl[sort_by])
no=1
index=len(nlines)
date_txt=''
cseq_txt=''
nurse_items=[]
for cline in clines:
if cline.get('nfirst_name'):
nurse_items.append({
'nurse': cline.get('nurse'),
'nfirst_name': cline.get('nfirst_name'),
'ctid': cline.get('ctid'),
})
cline['nurse']=''
cline['nfirst_name']=''
cline['ctid']=''
if cline.get('cseq_txt'):
date_txt=cline.get('date_txt')
cseq_txt=cline.get('cseq_txt')
cline['date_txt']=''
cline['cseq_txt']=''
cline['no']=no
nlines.append(cline)
no+=1
nlines[index]['date_txt']=date_txt
nlines[index]['cseq_txt']=cseq_txt
for nurse_item in nurse_items:
nlines[index].update({
'nurse': nurse_item['nurse'],
'nfirst_name': nurse_item['nfirst_name'],
'ctid': nurse_item['ctid'],
})
index+=1
clines=[]
nlines.append({
'sub': 'show',
'is_sub': True,