improve report
parent
ee291c7e87
commit
9b82b6f0b2
|
@ -1,5 +1,6 @@
|
||||||
<form model="clinic.matching.hdcase">
|
<form model="clinic.matching.hdcase">
|
||||||
<field name="date" span="2"/>
|
<field name="date_from" onchange="onchange_date" span="2"/>
|
||||||
|
<field name="date_to" span="2"/>
|
||||||
<field name="file" span="3"/>
|
<field name="file" span="3"/>
|
||||||
<field name="state" span="3"/>
|
<field name="state" span="3"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<form model="clinic.staff.categ" show_company="1">
|
<form model="clinic.staff.categ" show_company="1">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
|
<field name="note"/>
|
||||||
<field name="parent_id" domain="[['type','=',type]]"/>
|
<field name="parent_id" domain="[['type','=',type]]"/>
|
||||||
<field name="company_id" invisible="1"/>
|
<field name="company_id" invisible="1"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<list model="clinic.staff.categ">
|
<list model="clinic.staff.categ">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="note"/>
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
<field name="parent_id"/>
|
<field name="parent_id"/>
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -8,17 +8,22 @@ class MatchingHDCase(Model):
|
||||||
_transient=True
|
_transient=True
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
"date": fields.Date("Date", required=True),
|
"date_from": fields.Date("From", required=True),
|
||||||
|
"date_to": fields.Date("To", required=True),
|
||||||
'file': fields.File("File"),
|
'file': fields.File("File"),
|
||||||
'state': fields.Selection([["match","Math"],["not_match","Not Match"]],"State"),
|
'state': fields.Selection([["match","Math"],["not_match","Not Match"]],"State"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_date(self,context={}):
|
def default_get(self,field_names=None,context={},**kw):
|
||||||
return time.strftime("%Y-%m-%d")
|
defaults=context.get("defaults",{})
|
||||||
|
datenow=time.strftime("%Y-%m-%d")
|
||||||
_defaults={
|
date_from=defaults.get('date_from',datenow)
|
||||||
'date': _get_date,
|
date_to=defaults.get('date_to',datenow)
|
||||||
}
|
res={
|
||||||
|
'date_from': date_from,
|
||||||
|
'date_to': date_to,
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
|
||||||
def get_rows(self,fpath=None):
|
def get_rows(self,fpath=None):
|
||||||
if not fpath:
|
if not fpath:
|
||||||
|
@ -57,13 +62,16 @@ class MatchingHDCase(Model):
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
hdcases={}
|
hdcases={}
|
||||||
date=time.strftime("%Y-%m-%d")
|
defaults=self.default_get(context=context)
|
||||||
|
date_from=defaults.get("date_from")
|
||||||
|
date_to=defaults.get("date_to")
|
||||||
lines=[]
|
lines=[]
|
||||||
state="all"
|
state="all"
|
||||||
if ids:
|
if ids:
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
state=obj.state
|
state=obj.state
|
||||||
date=obj.date
|
date_from=obj.date_from
|
||||||
|
date_to=obj.date_to
|
||||||
if obj.file:
|
if obj.file:
|
||||||
fpath=get_file_path(obj.file)
|
fpath=get_file_path(obj.file)
|
||||||
rows=self.get_rows(fpath)
|
rows=self.get_rows(fpath)
|
||||||
|
@ -105,8 +113,8 @@ class MatchingHDCase(Model):
|
||||||
name=name.upper()
|
name=name.upper()
|
||||||
products[name]=prod['id']
|
products[name]=prod['id']
|
||||||
dom=[]
|
dom=[]
|
||||||
dom.append(['date',">=",obj.date])
|
dom.append(['date',">=",date_from])
|
||||||
dom.append(['date',"<=",obj.date])
|
dom.append(['date',"<=",date_to])
|
||||||
dom.append(['state','!=','cancelled'])
|
dom.append(['state','!=','cancelled'])
|
||||||
hdcases={}
|
hdcases={}
|
||||||
hdcases2={}
|
hdcases2={}
|
||||||
|
@ -122,14 +130,15 @@ class MatchingHDCase(Model):
|
||||||
categ=prod.categ_id
|
categ=prod.categ_id
|
||||||
if categ and line.reimbursable=='yes':
|
if categ and line.reimbursable=='yes':
|
||||||
if categ.code=='EPO':
|
if categ.code=='EPO':
|
||||||
#prod_line.append((prod.name or "").upper())
|
|
||||||
prod_name=(prod.name or "").split("-")
|
prod_name=(prod.name or "").split("-")
|
||||||
if len(prod_name) > 1:
|
if len(prod_name) >= 1:
|
||||||
prod_name=prod_name[0]
|
prod_name=prod_name[0]
|
||||||
prod_line.append(prod_name)
|
prod_line.append(prod_name)
|
||||||
elif categ.code=='FEE':
|
elif categ.code=='FEE':
|
||||||
fee_amt=line.amount or 0
|
fee_amt=line.amount or 0
|
||||||
prod_name='-'.join(prod_line)
|
prod_name=''
|
||||||
|
if prod_line:
|
||||||
|
prod_name='-'.join(prod_line)
|
||||||
key1='%s-%s-%s-%s'%(date,hn,prod_name,fee_amt)
|
key1='%s-%s-%s-%s'%(date,hn,prod_name,fee_amt)
|
||||||
hdcases[key1]={
|
hdcases[key1]={
|
||||||
'id': hdcase.id,
|
'id': hdcase.id,
|
||||||
|
@ -214,8 +223,16 @@ class MatchingHDCase(Model):
|
||||||
lines.append(line_vals)
|
lines.append(line_vals)
|
||||||
no=1
|
no=1
|
||||||
lines2=[]
|
lines2=[]
|
||||||
|
total=0
|
||||||
|
total_match=0
|
||||||
|
total_unmatch=0
|
||||||
for line in sorted(lines,key=lambda x: x['hn']):
|
for line in sorted(lines,key=lambda x: x['hn']):
|
||||||
is_match=line.get('is_match',False)
|
is_match=line.get('is_match',False)
|
||||||
|
if is_match:
|
||||||
|
total_match+=1
|
||||||
|
else:
|
||||||
|
total_unmatch+=1
|
||||||
|
total+=1
|
||||||
if state=='not_match' and is_match:
|
if state=='not_match' and is_match:
|
||||||
continue
|
continue
|
||||||
elif state=='match' and not is_match:
|
elif state=='match' and not is_match:
|
||||||
|
@ -226,10 +243,23 @@ class MatchingHDCase(Model):
|
||||||
lines2.append(line)
|
lines2.append(line)
|
||||||
no+=1
|
no+=1
|
||||||
lines=lines2
|
lines=lines2
|
||||||
|
date=''
|
||||||
|
if date_from==date_to:
|
||||||
|
date=date_from
|
||||||
data={
|
data={
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
|
'date_from': date_from,
|
||||||
|
'date_to': date_to,
|
||||||
'date': date,
|
'date': date,
|
||||||
|
'total': total,
|
||||||
|
'total_match': total_match,
|
||||||
|
'total_unmatch': total_unmatch,
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def onchange_date(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
data['date_to']=data['date_from']
|
||||||
|
return data
|
||||||
|
|
||||||
MatchingHDCase.register()
|
MatchingHDCase.register()
|
||||||
|
|
|
@ -110,14 +110,21 @@ class ClinicSetting(Model):
|
||||||
if user_id !=1:
|
if user_id !=1:
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
for citem in get_model("clinic.cycle.item").search_browse([]):
|
for st in get_model("clinic.staff").search_browse([]):
|
||||||
for line in citem.lines:
|
level=st.level_id
|
||||||
nurse=line.nurse_id
|
if level:
|
||||||
level=nurse.level_id
|
if level.name=='TH':
|
||||||
if level:
|
st.write({
|
||||||
line.write({
|
'categ_id': 3,
|
||||||
'level_id': level.id
|
|
||||||
})
|
})
|
||||||
|
#for citem in get_model("clinic.cycle.item").search_browse([]):
|
||||||
|
#for line in citem.lines:
|
||||||
|
#nurse=line.nurse_id
|
||||||
|
#level=nurse.level_id
|
||||||
|
#if level:
|
||||||
|
#line.write({
|
||||||
|
#'level_id': level.id
|
||||||
|
#})
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
def update_departments(self,ids,context={}):
|
def update_departments(self,ids,context={}):
|
||||||
|
|
|
@ -12,6 +12,7 @@ class StaffCategory(Model):
|
||||||
"type": fields.Selection([("doctor","Doctor"),("nurse","Nurse"),('others','Others')],"Type"),
|
"type": fields.Selection([("doctor","Doctor"),("nurse","Nurse"),('others','Others')],"Type"),
|
||||||
'parent_id': fields.Many2One("clinic.staff.categ","Parent"),
|
'parent_id': fields.Many2One("clinic.staff.categ","Parent"),
|
||||||
'company_id': fields.Many2One("company","Company"),
|
'company_id': fields.Many2One("company","Company"),
|
||||||
|
'note': fields.Text("Description"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
|
|
|
@ -4,6 +4,13 @@
|
||||||
<!--<table class="table table-bordered">-->
|
<!--<table class="table table-bordered">-->
|
||||||
<table class="table table-condensed table-striped">
|
<table class="table table-condensed table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="15" style="text-align:center">
|
||||||
|
<span class="label label-primary">Total: {{total}}</span>
|
||||||
|
<span class="label label-success">Match: {{total_match}}</span>
|
||||||
|
<span class="label label-default">Not Match: {{total_unmatch}}</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="10" style="text-align:center;background-color:#f9e37d;">Import File</th>
|
<th colspan="10" style="text-align:center;background-color:#f9e37d;">Import File</th>
|
||||||
<th colspan="5" style="text-align:center;background-color:#2d6ed2;color:white">Netforce</th>
|
<th colspan="5" style="text-align:center;background-color:#2d6ed2;color:white">Netforce</th>
|
||||||
|
|
Loading…
Reference in New Issue