conv_bal
watcha.h@almacom.co.th 2015-05-04 18:18:41 +07:00
parent 4f38511f3b
commit 98f644862a
1 changed files with 11 additions and 6 deletions

View File

@ -93,11 +93,13 @@ class ReportCycleItem(Model):
ptypes[ptype['name'] or ""]=0 ptypes[ptype['name'] or ""]=0
for citem in get_model('clinic.cycle.item').search_browse(dom,order="date"): for citem in get_model('clinic.cycle.item').search_browse(dom,order="date"):
cycle=citem.cycle_id cycle=citem.cycle_id
if cycle.id not in cycles.keys(): date=citem.date
cycles[cycle.id]=[] key='%s-%s'%(date,cycle.id)
if key not in cycles.keys():
cycles[key]=[]
for line in citem.lines: for line in citem.lines:
nurse=line.nurse_id nurse=line.nurse_id
cycles[cycle.id].append({ cycles[key].append({
'name': nurse.name, 'name': nurse.name,
'first_name': nurse.first_name or "", 'first_name': nurse.first_name or "",
}) })
@ -195,12 +197,13 @@ class ReportCycleItem(Model):
total_fee+=line.get("fee",0) total_fee+=line.get("fee",0)
total_mdc+=line.get("mdc",0) total_mdc+=line.get("mdc",0)
cid=line['cid'] cid=line['cid']
if not cid in old: if not key in old:
old.append(cid) old.append(key)
index=0 index=0
else: else:
index+=1 index+=1
cres=cycles[cid] key='%s-%s'%(date,cid)
cres=cycles[key]
line['nurse']='' line['nurse']=''
if index < len(cres): if index < len(cres):
line['nurse']=cres[index]['name'] line['nurse']=cres[index]['name']
@ -236,6 +239,8 @@ class ReportCycleItem(Model):
'v%s_1'%index: vscl_line['qty'], 'v%s_1'%index: vscl_line['qty'],
}) })
index+=1 index+=1
#for nline in nlines:
#print(nline.get('date'), nline.get('nfirst_name'))
data={ data={
'company_name': company_name or "", 'company_name': company_name or "",
'lines': nlines, 'lines': nlines,