From 80520d8f712539263a197fa6b66891950daf9c77 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Tue, 24 Mar 2015 11:05:50 +0700 Subject: [PATCH] improve report cycle item --- netforce_clinic/models/report_cycle_item.py | 5 ++++- netforce_clinic/templates/report_cycle_item.hbs | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/netforce_clinic/models/report_cycle_item.py b/netforce_clinic/models/report_cycle_item.py index c7784e0..2f7492c 100644 --- a/netforce_clinic/models/report_cycle_item.py +++ b/netforce_clinic/models/report_cycle_item.py @@ -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 diff --git a/netforce_clinic/templates/report_cycle_item.hbs b/netforce_clinic/templates/report_cycle_item.hbs index 2975869..fdba8dd 100644 --- a/netforce_clinic/templates/report_cycle_item.hbs +++ b/netforce_clinic/templates/report_cycle_item.hbs @@ -12,7 +12,7 @@ ชื่อ-สกุล แพทย์ สิทธ์ - จ.น.เงิน + จ.น.เงิน ยาฉีด DZ N/U @@ -32,7 +32,7 @@ {{pname}} {{dname}} {{tname}} - {{fee}} + {{fee}} {{epo}} {{dlz_name}} {{dlz_use}} @@ -42,5 +42,16 @@ {{/each}} + + + + + + + {{currency total_fee zero=""}} + + + +