reports
parent
c93b40dfc8
commit
e710105b26
|
@ -108,12 +108,8 @@ class ReportLaborCostDetail(Model):
|
||||||
dom.append(['cycle_id','=',cycle_id])
|
dom.append(['cycle_id','=',cycle_id])
|
||||||
if categ_id:
|
if categ_id:
|
||||||
dom.append(['staff_id.categ_id','=',categ_id])
|
dom.append(['staff_id.categ_id','=',categ_id])
|
||||||
print('dom ', dom)
|
|
||||||
def replace_quote(dom=""):
|
def replace_quote(dom=""):
|
||||||
return dom.replace("'","\"")
|
return dom.replace("'","\"")
|
||||||
#prevent to load more data
|
|
||||||
#if not staff_id:
|
|
||||||
#return {}
|
|
||||||
dates={}
|
dates={}
|
||||||
for line in get_model("clinic.labor.cost.line").search_browse(dom):
|
for line in get_model("clinic.labor.cost.line").search_browse(dom):
|
||||||
lcost=line.labor_cost_id
|
lcost=line.labor_cost_id
|
||||||
|
@ -122,8 +118,7 @@ class ReportLaborCostDetail(Model):
|
||||||
if not date:
|
if not date:
|
||||||
continue
|
continue
|
||||||
dpt=citem.department_id
|
dpt=citem.department_id
|
||||||
#amt=line.pay_amount or 0 #XXX
|
amt=line.amount or 0
|
||||||
amt=line.amount or 0 #XXX
|
|
||||||
staff=line.staff_id
|
staff=line.staff_id
|
||||||
qty=0
|
qty=0
|
||||||
if staff.type=='doctor':
|
if staff.type=='doctor':
|
||||||
|
@ -277,8 +272,43 @@ class ReportLaborCostDetail(Model):
|
||||||
'dpt_lines': dpt_lines,
|
'dpt_lines': dpt_lines,
|
||||||
'show_all': show_count <=1 and True or False,
|
'show_all': show_count <=1 and True or False,
|
||||||
}
|
}
|
||||||
print('department_id ', department_id)
|
data['dpts_txt']=[{0: '#', 1: 'วันที่'}]
|
||||||
print('branch_id ', branch_id)
|
vals={}
|
||||||
|
no=0
|
||||||
|
dpt_len=len(data['dpts_txt'][0])
|
||||||
|
for dpt in dpts:
|
||||||
|
data['dpts_txt'][0][no+dpt_len]=dpt['name']
|
||||||
|
vals[no]=0
|
||||||
|
no+=1
|
||||||
|
count=1
|
||||||
|
items=[]
|
||||||
|
def int2ths(r):
|
||||||
|
if type(r)==type(''):
|
||||||
|
return r
|
||||||
|
if not r:
|
||||||
|
return ""
|
||||||
|
return "{0:,.2f}".format(r)
|
||||||
|
for i in range(len(data['lines'])):
|
||||||
|
line=data['lines'][i]
|
||||||
|
item_vals=vals.copy()
|
||||||
|
item_vals['no']=count
|
||||||
|
item_vals['date']=line['date']
|
||||||
|
no=0
|
||||||
|
for sub_line in line['sub_lines']:
|
||||||
|
item_vals['item%s_qty'%no]=int2ths(sub_line['qty'])
|
||||||
|
item_vals['item%s_amt'%no]=int2ths(sub_line['amt'])
|
||||||
|
no+=1
|
||||||
|
item_vals['total_qty']=int2ths(line['total_qty'])
|
||||||
|
item_vals['total_amt']=int2ths(line['total_amt'])
|
||||||
|
items.append(item_vals)
|
||||||
|
count+=1
|
||||||
|
data['items']=items
|
||||||
|
data['total_lines_txt']=[{}]
|
||||||
|
no=0
|
||||||
|
for tline in data['dpt_lines']:
|
||||||
|
data['total_lines_txt'][0]['item%s_qty'%no]=int2ths(tline['qty'])
|
||||||
|
data['total_lines_txt'][0]['item%s_amt'%no]=int2ths(tline['amt'])
|
||||||
|
no+=1
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def onchange_date(self,context={}):
|
def onchange_date(self,context={}):
|
||||||
|
|
|
@ -38,10 +38,10 @@ class ReportLaborCostSubDetail(Model):
|
||||||
date_to=self._get_date_to()
|
date_to=self._get_date_to()
|
||||||
staff_type=defaults.get("staff_type","doctor")
|
staff_type=defaults.get("staff_type","doctor")
|
||||||
staff_id=int(defaults.get('staff_id', "0"))
|
staff_id=int(defaults.get('staff_id', "0"))
|
||||||
department_id=defaults.get('department_id')
|
department_id=defaults.get('department_id',None)
|
||||||
if department_id:
|
if department_id:
|
||||||
department_id=int(department_id)
|
department_id=int(department_id)
|
||||||
branch_id=defaults.get('branch_id')
|
branch_id=defaults.get('branch_id',None)
|
||||||
if branch_id:
|
if branch_id:
|
||||||
branch_id=int(branch_id)
|
branch_id=int(branch_id)
|
||||||
if not branch_id and department_id:
|
if not branch_id and department_id:
|
||||||
|
@ -56,6 +56,7 @@ class ReportLaborCostSubDetail(Model):
|
||||||
'department_id': department_id,
|
'department_id': department_id,
|
||||||
'branch_id': branch_id,
|
'branch_id': branch_id,
|
||||||
}
|
}
|
||||||
|
print('res ', res)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
|
@ -66,8 +67,8 @@ class ReportLaborCostSubDetail(Model):
|
||||||
date_to=defaults.get("date_to")
|
date_to=defaults.get("date_to")
|
||||||
staff_type=defaults.get("staff_type")
|
staff_type=defaults.get("staff_type")
|
||||||
staff_id=defaults.get("staff_id")
|
staff_id=defaults.get("staff_id")
|
||||||
branch_id=defaults.get("branch_id")
|
branch_id=defaults.get("branch_id",None)
|
||||||
department_id=defaults.get("department_id")
|
department_id=defaults.get("department_id",None)
|
||||||
staff_name=''
|
staff_name=''
|
||||||
dom=[]
|
dom=[]
|
||||||
if ids:
|
if ids:
|
||||||
|
|
|
@ -120,8 +120,6 @@ class ReportLaborCostSummary(Model):
|
||||||
if type(r)==type(''):
|
if type(r)==type(''):
|
||||||
return r
|
return r
|
||||||
return "{0:,.0f}".format(r)
|
return "{0:,.0f}".format(r)
|
||||||
|
|
||||||
print('--> dom: ', dom)
|
|
||||||
total_hdcase=0
|
total_hdcase=0
|
||||||
for line in get_model("clinic.labor.cost.line").search_browse(dom):
|
for line in get_model("clinic.labor.cost.line").search_browse(dom):
|
||||||
lcost=line.labor_cost_id
|
lcost=line.labor_cost_id
|
||||||
|
@ -283,8 +281,10 @@ class ReportLaborCostSummary(Model):
|
||||||
'staff_type': staff_type,
|
'staff_type': staff_type,
|
||||||
'branch_id': branch_id,
|
'branch_id': branch_id,
|
||||||
'department_id': department_id,
|
'department_id': department_id,
|
||||||
'dpts_txt': [{0: '#', 1: 'รหัส', 2: 'ชื่อ-สกุล',}],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# for report xlsx
|
||||||
|
data['dpts_txt']=[{0: '#', 1: 'รหัส', 2: 'ชื่อ-สกุล',}]
|
||||||
items=[]
|
items=[]
|
||||||
vals={}
|
vals={}
|
||||||
no=0
|
no=0
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -10,7 +10,15 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<th style="text-align:center" colspan="{{comp_span}}">
|
<th style="text-align:center" colspan="{{comp_span}}">
|
||||||
{{#if show_all}}
|
{{#if show_all}}
|
||||||
<a href="#name=clinic_report_labor_cost_sub_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.staff_type={{staff_type}}&defaults.staff_id={{staff_id}}&defaults.department_id={{department_id}}">{{comp_name}}</a>
|
{{#if department_id}}
|
||||||
|
<a href="#name=clinic_report_labor_cost_sub_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.staff_type={{staff_type}}&defaults.staff_id={{staff_id}}&defaults.department_id={{department_id}}">{{comp_name}}</a>
|
||||||
|
{{else}}
|
||||||
|
{{#if branch_id}}
|
||||||
|
<a href="#name=clinic_report_labor_cost_sub_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.staff_type={{staff_type}}&defaults.staff_id={{staff_id}}&defaults.branch_id={{branch_id}}">{{comp_name}}</a>
|
||||||
|
{{else}}
|
||||||
|
<a href="#name=clinic_report_labor_cost_sub_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}&defaults.staff_type={{staff_type}}&defaults.staff_id={{staff_id}}">{{comp_name}}</a>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{comp_name}}
|
{{comp_name}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
Loading…
Reference in New Issue