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