visit board
parent
cbde2cc6ff
commit
1e2df5ee65
|
@ -39,6 +39,8 @@
|
|||
</item>
|
||||
<item string="HD Cases">
|
||||
<item string="HD Cases" action="clinic_hd_case"/>
|
||||
<divider/>
|
||||
<header string="OTHERS"/>
|
||||
<item string="Sickbed" action="clinic_sickbed"/>
|
||||
</item>
|
||||
<item string="Reports">
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
</head>
|
||||
<field name="name"/>
|
||||
<field name="available" readonly="1"/>
|
||||
<field name="sequence"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<related>
|
||||
<field name="hd_cases"/>
|
||||
|
|
|
@ -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<total_amt:
|
||||
#vals['req_fee']=1 # to show button pay
|
||||
#################################################3
|
||||
|
||||
if 'sickbed_id' in vals.keys():
|
||||
if vals['sickbed_id']!=obj.sickbed_id.id and obj.state!='draft':
|
||||
|
|
|
@ -230,7 +230,7 @@ class Patient(Model):
|
|||
name=obj.name or ''
|
||||
if obj.hn_no:
|
||||
name+=" (HN: %s)"%obj.hn_no
|
||||
vals.append((obj.id,name))
|
||||
vals.append((obj.id,name,obj.image))
|
||||
return vals
|
||||
|
||||
def name_search(self,name,domain=None,context={},**kw):
|
||||
|
|
|
@ -33,13 +33,17 @@ class SickBed(Model):
|
|||
'image': fields.File("Image",function="_get_all",function_multi=True),
|
||||
'date': fields.Date("Date",function="_get_all",function_multi=True),
|
||||
"state": fields.Selection([("available","Available"),("not_available","Not Available")],"Status"),
|
||||
'sequence': fields.Integer("Sequence"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'available': True,
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
'sequence': 0,
|
||||
}
|
||||
|
||||
_order="sequence"
|
||||
|
||||
def copy(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
new_id=get_model("clinic.sickbed").create({
|
||||
|
|
|
@ -27,7 +27,7 @@ class Visit(Model):
|
|||
res[obj.id]={
|
||||
'cycle_color': color,
|
||||
'sequence': '%s-%s'%(obj.time_start[0:10],cycle.sequence), #date-sequence
|
||||
'visit_date': obj.time_start[0:10]
|
||||
#'visit_date': obj.time_start[0:10]
|
||||
}
|
||||
return res
|
||||
|
||||
|
@ -48,7 +48,7 @@ class Visit(Model):
|
|||
'print_date': fields.Date('Print Date',function="_get_print_date"),
|
||||
'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item"), #XXX on_delete="cascade" -> 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'),
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -30,7 +30,14 @@
|
|||
{{#each lines }}
|
||||
{{#if footer}}
|
||||
<tr>
|
||||
<td colspan="10" style="text-align:right; background-color:#dbdbdb"><b>{{details}}</b></td>
|
||||
<td rowspan="3" align="middle" style="vertical-align:middle; background-color:#4183c4;color:white"><span><b>TOTAL</b></span></td>
|
||||
<td colspan="10" style="text-align:right; background-color:#dbdbdb"><b>{{details1}}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="10" style="text-align:right; background-color:#dbdbdb"><b>{{details2}}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="10" style="text-align:right; background-color:#dbdbdb"><b>{{details3}}</b></td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr style="background-color:{{visit_color}}">
|
||||
|
|
Loading…
Reference in New Issue