conv_bal
watcha.h@almacom.co.th 2015-01-19 15:30:51 +07:00
parent 171f09fbb3
commit c4eb3b0aee
6 changed files with 47 additions and 17 deletions

View File

@ -12,8 +12,8 @@
<field name="note"/> <field name="note"/>
<!--<field name="company_id" invisible="1"/>--> <!--<field name="company_id" invisible="1"/>-->
<related> <related>
<field name="cycle_items"/> <field name="cycle_items" readonly="1"/>
<field name="visits"/> <field name="visits" readonly="1"/>
<field name="hd_cases"/> <field name="hd_cases" readonly="1"/>
</related> </related>
</form> </form>

View File

@ -1,5 +1,5 @@
<form model="clinic.make.apt" title="Make An Appoitment"> <form model="clinic.make.apt" title="Make An Appointment">
<separator string="1. Select Period And Add Some Filter> 2. Click Load Data > 3. Select Patient > 4. Generate Visit"/> <separator string="1. Select Period And Add Some Filter > 2. Click Load Data > 3. Select Patient > 4. Generate Visit"/>
<field name="date" span="2" mode="month" onchange="onchange_date"/> <field name="date" span="2" mode="month" onchange="onchange_date"/>
<field name="date_from" span="2"/> <field name="date_from" span="2"/>
<field name="date_to" span="2"/> <field name="date_to" span="2"/>

View File

@ -39,7 +39,7 @@
<item string="Visit Board" action="clinic_visit_board"/> <item string="Visit Board" action="clinic_visit_board"/>
<divider/> <divider/>
<item string="New Visit" action="clinic_visit" action_options="mode=form"/> <item string="New Visit" action="clinic_visit" action_options="mode=form"/>
<item string="Make An Appoitment" action="clinic_make_apt"/> <item string="Make An Appointment" action="clinic_make_apt"/>
</item> </item>
<item string="HD Cases" perm="clinic_hdcase"> <item string="HD Cases" perm="clinic_hdcase">
<item string="HD Cases" action="clinic_hd_case"/> <item string="HD Cases" action="clinic_hd_case"/>

View File

@ -110,12 +110,16 @@ class VisitBoard(Model):
patient_types={t['id']:t['name'] for t in get_model("clinic.patient.type").search_read([[]],['name'])} patient_types={t['id']:t['name'] for t in get_model("clinic.patient.type").search_read([[]],['name'])}
cycle_names={t['id']:t['name'] for t in get_model("clinic.cycle").search_read([[]],['name'])} cycle_names={t['id']:t['name'] for t in get_model("clinic.cycle").search_read([[]],['name'])}
brch_names={t['id']:t['name'] for t in get_model("clinic.branch").search_read([[]],['name'])}
dpt_names={t['id']:t['name'] for t in get_model("clinic.department").search_read([[]],['name'])}
total_wait=0 total_wait=0
total_done=0 total_done=0
total_cancel=0 total_cancel=0
types={} types={}
cycles={} cycles={}
no=1 no=1
dpt={}
brch={}
for visit in get_model("clinic.visit").search_browse(dom): for visit in get_model("clinic.visit").search_browse(dom):
if visit.state in ('draft','pending'): if visit.state in ('draft','pending'):
total_wait+=1 total_wait+=1
@ -137,7 +141,7 @@ class VisitBoard(Model):
hd_case_id=hd_case.id, hd_case_id=hd_case.id,
if hd_case.number=='/': if hd_case.number=='/':
hd_case_number='*รอการรรักษา' hd_case_number='*Waiting'
else: else:
hd_case_number=hd_case.number hd_case_number=hd_case.number
@ -150,7 +154,7 @@ class VisitBoard(Model):
number=visit.number number=visit.number
if number=='/': if number=='/':
number='*รอการยืนยัน' number='*Waiting'
cycle=visit.cycle_id cycle=visit.cycle_id
patient=visit.patient_id patient=visit.patient_id
branch=visit.branch_id branch=visit.branch_id
@ -164,9 +168,11 @@ class VisitBoard(Model):
if visit.state=='cancelled': if visit.state=='cancelled':
visit_color='#dbdbdb', visit_color='#dbdbdb',
if visit.number=='/': if visit.number=='/':
number='*(ยกเลิก)' number='*(Cancelled)'
else: else:
number+='(ยกเลิก)' number+='(Cancelled)'
line={ line={
'number': number, 'number': number,
'hn_name': hn_name, 'hn_name': hn_name,
@ -195,6 +201,8 @@ class VisitBoard(Model):
'details1':'', 'details1':'',
'details2':'', 'details2':'',
'details3':'', 'details3':'',
'details4':'',
'details5':'',
'no': no, 'no': no,
'note': visit.note, 'note': visit.note,
'hd_case_state':HD_STATE.get(hd_case_state,''), 'hd_case_state':HD_STATE.get(hd_case_state,''),
@ -213,6 +221,18 @@ class VisitBoard(Model):
cycles[visit_date]=cycle_name cycles[visit_date]=cycle_name
cycles[visit_date][cycle.id]+=1 cycles[visit_date][cycle.id]+=1
if not brch.get(visit_date):
brch_name={}
[brch_name.setdefault(cid,0) for cid in brch_names.keys()]
brch[visit_date]=brch_name
brch[visit_date][branch.id]+=1
if not dpt.get(visit_date):
dpt_name={}
[dpt_name.setdefault(cid,0) for cid in dpt_names.keys()]
dpt[visit_date]=dpt_name
dpt[visit_date][department.id]+=1
dates=[] dates=[]
index=0 index=0
total_qty=0 total_qty=0
@ -236,11 +256,15 @@ class VisitBoard(Model):
line=empty_line.copy() line=empty_line.copy()
patient_str='%s'%', '.join('%s: %s'%(patient_types[k],v) for k,v in types[date].items()) 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()) cycle_str='%s'%', '.join('%s: %s'%(cycle_names[k],v) for k,v in cycles[date].items())
brch_str='%s'%', '.join('%s: %s'%(brch_names[k],v) for k,v in brch[date].items())
dpt_str='%s'%', '.join('%s: %s'%(dpt_names[k],v) for k,v in dpt[date].items())
summary_str='%s'%', '.join(['รับไว้: %s'%total_wait,'จำหน่ายแล้ว: %s'%total_done, 'ยกเลิก: %s'%total_cancel]) 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['details']='ทั้งหมด %s: %s'%(total_qty,', '.join([summary_str,cycle_str,patient_str]))
line['details1']=summary_str line['details2']=summary_str
line['details2']=cycle_str line['details3']=cycle_str
line['details3']=patient_str line['details1']=brch_str
line['details4']=dpt_str
line['details5']=patient_str
line['footer']=True line['footer']=True
line['title']=False line['title']=False
lines.insert(index,line) lines.insert(index,line)

View File

@ -34,14 +34,20 @@
{{#each lines }} {{#each lines }}
{{#if footer}} {{#if footer}}
<tr> <tr>
<td rowspan="3" align="middle" style="vertical-align:middle; background-color:#4183c4;color:white"><span><b>สรุป</b></span></td> <td rowspan="5" align="middle" style="vertical-align:middle; background-color:#4183c4;color:white"><span><b>สรุป</b></span></td>
<td colspan="10" style="text-align:right; background-color:#dbdbdb"><b>{{details1}}</b></td> <td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details1}}</b></td>
</tr> </tr>
<tr> <tr>
<td colspan="10" style="text-align:right; background-color:#dbdbdb"><b>{{details2}}</b></td> <td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details2}}</b></td>
</tr> </tr>
<tr> <tr>
<td colspan="10" style="text-align:right; background-color:#dbdbdb"><b>{{details3}}</b></td> <td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details3}}</b></td>
</tr>
<tr>
<td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details4}}</b></td>
</tr>
<tr>
<td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details5}}</b></td>
</tr> </tr>
{{else}} {{else}}
<tr style="background-color:{{visit_color}}"> <tr style="background-color:{{visit_color}}">