From 98f644862afe6a082db6fb01b33e8899137a33a0 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Mon, 4 May 2015 18:18:41 +0700 Subject: [PATCH] xxx --- netforce_clinic/models/report_cycle_item.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/netforce_clinic/models/report_cycle_item.py b/netforce_clinic/models/report_cycle_item.py index 3a62586..bf0218f 100644 --- a/netforce_clinic/models/report_cycle_item.py +++ b/netforce_clinic/models/report_cycle_item.py @@ -93,11 +93,13 @@ class ReportCycleItem(Model): ptypes[ptype['name'] or ""]=0 for citem in get_model('clinic.cycle.item').search_browse(dom,order="date"): cycle=citem.cycle_id - if cycle.id not in cycles.keys(): - cycles[cycle.id]=[] + date=citem.date + key='%s-%s'%(date,cycle.id) + if key not in cycles.keys(): + cycles[key]=[] for line in citem.lines: nurse=line.nurse_id - cycles[cycle.id].append({ + cycles[key].append({ 'name': nurse.name, 'first_name': nurse.first_name or "", }) @@ -195,12 +197,13 @@ class ReportCycleItem(Model): total_fee+=line.get("fee",0) total_mdc+=line.get("mdc",0) cid=line['cid'] - if not cid in old: - old.append(cid) + if not key in old: + old.append(key) index=0 else: index+=1 - cres=cycles[cid] + key='%s-%s'%(date,cid) + cres=cycles[key] line['nurse']='' if index < len(cres): line['nurse']=cres[index]['name'] @@ -236,6 +239,8 @@ class ReportCycleItem(Model): 'v%s_1'%index: vscl_line['qty'], }) index+=1 + #for nline in nlines: + #print(nline.get('date'), nline.get('nfirst_name')) data={ 'company_name': company_name or "", 'lines': nlines,