From 1e2df5ee65c6b5193a461b6e04a603130456cea0 Mon Sep 17 00:00:00 2001 From: "watcha.h@almacom.co.th" Date: Fri, 9 Jan 2015 14:48:01 +0700 Subject: [PATCH] visit board --- netforce_clinic/layouts/clinic_menu.xml | 2 ++ .../layouts/clinic_sickbed_form.xml | 1 + netforce_clinic/models/hd_case.py | 20 ++++++++----------- netforce_clinic/models/patient.py | 2 +- netforce_clinic/models/sickbed.py | 4 ++++ netforce_clinic/models/visit.py | 4 ++-- netforce_clinic/models/visit_board.py | 13 ++++++++---- netforce_clinic/templates/visit_board.hbs | 9 ++++++++- 8 files changed, 35 insertions(+), 20 deletions(-) diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index a8b3fcd..c91fcfc 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -39,6 +39,8 @@ + +
diff --git a/netforce_clinic/layouts/clinic_sickbed_form.xml b/netforce_clinic/layouts/clinic_sickbed_form.xml index 81d89fb..6966220 100644 --- a/netforce_clinic/layouts/clinic_sickbed_form.xml +++ b/netforce_clinic/layouts/clinic_sickbed_form.xml @@ -6,6 +6,7 @@ + diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 9795148..f28b67b 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -939,26 +939,29 @@ class HDCase(Model): def write(self,ids,vals,**kw): obj=self.browse(ids)[0] + ############ to show pay button ########### total_amt=0 due_amt=0 if 'lines' in vals.keys(): for line in vals['lines']: mode=line[0] + amt=0 if mode=='create': line_vals=line[1] + amt=line_vals.get("amount",0) else: + line_id=line[1][0] line_vals=line[2] - amt=line_vals.get("amount",0) + line=get_model('clinic.hd.case.line').browse(line_id) + amt=line.amount or 0 total_amt+=amt rmb=line_vals.get("reimbursable","no") - print('rmb ', rmb) if rmb=='no': due_amt+=amt else: for line in obj.lines: amt=line.amount or 0 total_amt+=amt - print('>> rmb ', line.reimbursable) if line.reimbursable=='no': due_amt+=amt pay_amt=0 @@ -975,19 +978,12 @@ class HDCase(Model): due_amt-=pay_amt vals['req_fee']=0 - print('due_amt ', due_amt) if due_amt<=0: - vals['req_fee']=1 + vals['req_fee']=0 elif due_amt>0: vals['req_fee']=1 - #if obj.state=='completed': - #if pay_amt==0: - #vals['req_fee']=0 # to hide button pay - #elif pay_amt==total_amt: - #vals['req_fee']=1 # to show button pay - #elif pay_amt rm visit from cycle item 'sequence': fields.Char("Sequence",function="_get_all",function_multi=True,store=True), - 'visit_date': fields.Date('Visit Date',function="_get_all",function_multi=True,store=True), + 'visit_date': fields.Date('Visit Date'), 'cycle_color': fields.Char('Color',function="_get_all",function_multi=True,store=True), 'note': fields.Text('Note'), } diff --git a/netforce_clinic/models/visit_board.py b/netforce_clinic/models/visit_board.py index 57fecf1..d03e214 100644 --- a/netforce_clinic/models/visit_board.py +++ b/netforce_clinic/models/visit_board.py @@ -138,7 +138,6 @@ class VisitBoard(Model): number='*(ยกเลิก)' else: number+='(ยกเลิก)' - print('sickbed_id ', sickbed_id) line={ 'number': number, 'hn_name': hn_name, @@ -160,6 +159,9 @@ class VisitBoard(Model): 'title': False, 'footer': False, 'details':'', + 'details1':'', + 'details2':'', + 'details3':'', 'no': no, 'note': visit.note, 'hd_case_state':HD_STATE.get(hd_case_state,''), @@ -199,10 +201,13 @@ class VisitBoard(Model): index+=1 # footer line=empty_line.copy() - patient_str='[%s]'%', '.join('%s: %s'%(patient_types[k],v) for k,v in types[date].items()) - cycle_str='[%s]'%', '.join('%s: %s'%(cycle_names[k],v) for k,v in cycles[date].items()) - summary_str='[%s]'%', '.join(['รับไว้: %s'%total_wait,'จำหน่ายแล้ว: %s'%total_done, 'ยกเลิก: %s'%total_cancel]) + patient_str='>> %s'%', '.join('%s: %s'%(patient_types[k],v) for k,v in types[date].items()) + cycle_str='>> %s'%', '.join('%s: %s'%(cycle_names[k],v) for k,v in cycles[date].items()) + summary_str='>> %s'%', '.join(['รับไว้: %s'%total_wait,'จำหน่ายแล้ว: %s'%total_done, 'ยกเลิก: %s'%total_cancel]) line['details']='ทั้งหมด %s: %s'%(total_qty,', '.join([summary_str,cycle_str,patient_str])) + line['details1']=summary_str + line['details2']=cycle_str + line['details3']=patient_str line['footer']=True line['title']=False lines.insert(index,line) diff --git a/netforce_clinic/templates/visit_board.hbs b/netforce_clinic/templates/visit_board.hbs index c55a0a3..cac069f 100644 --- a/netforce_clinic/templates/visit_board.hbs +++ b/netforce_clinic/templates/visit_board.hbs @@ -30,7 +30,14 @@ {{#each lines }} {{#if footer}} - {{details}} + TOTAL + {{details1}} + + + {{details2}} + + + {{details3}} {{else}}