improve report cycle item

conv_bal
watcha.h@almacom.co.th 2015-03-24 11:05:50 +07:00
parent deea486556
commit 80520d8f71
2 changed files with 17 additions and 3 deletions

View File

@ -109,7 +109,7 @@ class ReportCycleItem(Model):
'dname': doctor.name or "",
'date': hdcase.date,
'epo': hdcase.epo,
'fee': hdcase.fee,
'fee': abs(hdcase.fee), #XXX
'dlz_name': hdcase.dlz_name,
'dlz_use': dlz_use,
'dlz_id': hdcase.dlz_id,
@ -137,7 +137,9 @@ class ReportCycleItem(Model):
nlines=[]
index=0
old=[]
total_fee=0
for line in sorted(lines,key=lambda x:(x['date'],x['cseq'])):
total_fee+=line.get("fee",0)
cid=line['cid']
if not cid in old:
old.append(cid)
@ -157,6 +159,7 @@ class ReportCycleItem(Model):
'month': month_str,
'date_from': date_from,
'date_to': date_to,
'total_fee': total_fee,
}
return data

View File

@ -12,7 +12,7 @@
<th>ชื่อ-สกุล</th>
<th>แพทย์</th>
<th>สิทธ์</th>
<th>จ.น.เงิน</th>
<th style="text-align:right">จ.น.เงิน</th>
<th>ยาฉีด</th>
<th>DZ</th>
<th>N/U</th>
@ -32,7 +32,7 @@
<td><a href="/ui#name=clinic_patient&active_id={{pid}}&mode=form">{{pname}}</a></td>
<td><a href="/ui#name=clinic_staff&active_id={{did}}&mode=form">{{dname}}</a></td>
<td><a href="/ui#name=clinic_patient_type&active_id={{tid}}&mode=form">{{tname}}</a></td>
<td>{{fee}}</td>
<td style="text-align:right">{{fee}}</td>
<td>{{epo}}</td>
<td><a href="/ui#name=clinic_dialyzer&active_id={{dlz_id}}&mode=form">{{dlz_name}}</a></td>
<td>{{dlz_use}}</td>
@ -42,5 +42,16 @@
{{/each}}
</tbody>
<tfoot>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th style="text-align:right">{{currency total_fee zero=""}}</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tfoot>
</table>