[fix] meeting
parent
0bbf685f22
commit
016bfd85b5
|
@ -28,6 +28,15 @@
|
||||||
<tab string="Validation">
|
<tab string="Validation">
|
||||||
<field name="user_id" span="3"/>
|
<field name="user_id" span="3"/>
|
||||||
<button string="Validate" perm="clinic_cycle_item_validate" type="success" method="validate" icon="ok" size="small" states="draft" />
|
<button string="Validate" perm="clinic_cycle_item_validate" type="success" method="validate" icon="ok" size="small" states="draft" />
|
||||||
|
<group span="6" columns="1">
|
||||||
|
</group>
|
||||||
|
<group span="6" columns="1">
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<p></p>
|
||||||
|
<b>Note: </b> HD Case State Accepted: <b style="color:green">'Finish Treatment', 'Waiting Payment', 'Paid'.</b></div>
|
||||||
|
</template>
|
||||||
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
<related>
|
<related>
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
<field name="var_x" span="6" offset="6"/>
|
<field name="var_x" span="6" offset="6"/>
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="total" string="Total" span="6" offset="6"/>
|
<!--<field name="total" string="Total" span="6" offset="6"/>-->
|
||||||
|
<field name="total_formular" string="Total" span="6" offset="6"/>
|
||||||
</group>
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Nurse Cost">
|
<tab string="Nurse Cost">
|
||||||
|
@ -41,9 +42,12 @@
|
||||||
<field name="description"/>
|
<field name="description"/>
|
||||||
<field name="level_id"/>
|
<field name="level_id"/>
|
||||||
<field name="categ_id"/>
|
<field name="categ_id"/>
|
||||||
<field name="amount"/>
|
<field name="qty"/>
|
||||||
|
<!--<field name="amount"/>-->
|
||||||
|
<field name="rate"/>
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
|
<field name="total_nqty" string="Qty" span="3" offset="9"/>
|
||||||
<field name="total_ncost" string="Total" span="3" offset="9"/>
|
<field name="total_ncost" string="Total" span="3" offset="9"/>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Doctor Cost">
|
<tab string="Doctor Cost">
|
||||||
|
@ -60,6 +64,7 @@
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
|
<field name="total_dqty" string="Qty" span="3" offset="9"/>
|
||||||
<field name="total_dcost" string="Total" span="3" offset="9"/>
|
<field name="total_dcost" string="Total" span="3" offset="9"/>
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<field name="categ_id"/>
|
<field name="categ_id"/>
|
||||||
<field name="branch_id" required="1"/>
|
<field name="branch_id" required="1"/>
|
||||||
<field name="department_id" required="1" domain='[["branch_id","=",branch_id]]'/>
|
<field name="department_id" required="1" domain='[["branch_id","=",branch_id]]'/>
|
||||||
|
<field name="is_walkin"/>
|
||||||
<field name="active" invisible="1"/>
|
<field name="active" invisible="1"/>
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="General">
|
<tab string="General">
|
||||||
|
@ -65,13 +66,14 @@
|
||||||
<group span="8" columns="1">
|
<group span="8" columns="1">
|
||||||
<field name="cycles" nolabel="1">
|
<field name="cycles" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
|
<field name="department_id"/>
|
||||||
<field name="cycle_id"/>
|
<field name="cycle_id"/>
|
||||||
<field name="day"/>
|
<field name="day"/>
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</group>
|
</group>
|
||||||
<group span="4" columns="1">
|
<group span="4" columns="1">
|
||||||
<field name="cycle_id"/>
|
<!--<field name="cycle_id"/>-->
|
||||||
</group>
|
</group>
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Accounting">
|
<tab string="Accounting">
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<form model="clinic.report.hd.case.summary">
|
<form model="clinic.report.hd.case.summary">
|
||||||
<field name="date" span="3" mode="month" onchange="onchange_date"/>
|
<field name="date" span="2" mode="month" onchange="onchange_date"/>
|
||||||
|
<field name="date_from" span="2"/>
|
||||||
|
<field name="date_to" span="2"/>
|
||||||
<field name="branch_id" onchange="onchange_branch" span="3"/>
|
<field name="branch_id" onchange="onchange_branch" span="3"/>
|
||||||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="3"/>
|
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="3"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
<field name="date_to" required="1" span="2"/>
|
<field name="date_to" required="1" span="2"/>
|
||||||
<field name="staff_type" onchange="onchange_type" span="2"/>
|
<field name="staff_type" onchange="onchange_type" span="2"/>
|
||||||
<field name="staff_id" domain='[["type","=",staff_type]]' span="2"/>
|
<field name="staff_id" domain='[["type","=",staff_type]]' span="2"/>
|
||||||
|
<field name="branch_id" onchange="onchange_branch" span="2"/>
|
||||||
|
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
||||||
<field name="categ_id" span="2"/>
|
<field name="categ_id" span="2"/>
|
||||||
<field name="level_id" span="2"/>
|
<field name="level_id" span="2"/>
|
||||||
<field name="only_value" span="2"/>
|
<field name="only_value" span="2"/>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</tab>
|
</tab>
|
||||||
<tab string="Development">
|
<tab string="Development">
|
||||||
<button string="Click Me" type="default" method="run_script" perm="clinic_setting_test"/>
|
<button string="Click Me" type="default" method="run_script" perm="clinic_setting_test"/>
|
||||||
<button string="Remove Duplicate Visit" type="default" icon="arrow-right" method="remove_douplicate_visit" perm="clinic_setting_rm_dbl_visit"/>
|
<!--<button string="Remove Duplicate Visit" type="default" icon="arrow-right" method="remove_douplicate_visit" perm="clinic_setting_rm_dbl_visit"/>-->
|
||||||
</tab>
|
</tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
<foot>
|
<foot>
|
||||||
|
|
|
@ -97,6 +97,9 @@ class CycleItem(Model):
|
||||||
|
|
||||||
def validate(self,ids,context={}):
|
def validate(self,ids,context={}):
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
for hdcase in obj.hd_cases:
|
||||||
|
if hdcase.state not in ('completed','waiting_payment','paid'):
|
||||||
|
raise Exception('Invalidate cycle item %s: HD Case %s is not completed' % (obj.name, hdcase.patient_id.name))
|
||||||
for obj_id in ids:
|
for obj_id in ids:
|
||||||
lcost_ids=get_model("clinic.labor.cost").search([['cycle_item_id','=',obj_id]])
|
lcost_ids=get_model("clinic.labor.cost").search([['cycle_item_id','=',obj_id]])
|
||||||
labor_cost=get_model("clinic.labor.cost")
|
labor_cost=get_model("clinic.labor.cost")
|
||||||
|
@ -128,6 +131,12 @@ class CycleItem(Model):
|
||||||
|
|
||||||
def to_draft(self,ids,context={}):
|
def to_draft(self,ids,context={}):
|
||||||
for obj in self.browse(ids):
|
for obj in self.browse(ids):
|
||||||
|
dom=[
|
||||||
|
['cycle_item_id','=',obj.id]
|
||||||
|
]
|
||||||
|
for lcost in get_model("clinic.labor.cost").search_browse(dom):
|
||||||
|
print("labor cost of cycle item % s is deleted"%lcost.cycle_item_id.name)
|
||||||
|
lcost.delete()
|
||||||
obj.write({
|
obj.write({
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
})
|
})
|
||||||
|
|
|
@ -39,13 +39,22 @@ class LaborCost(Model):
|
||||||
if total_a:
|
if total_a:
|
||||||
var_x=eval('(%s%s)/%s'%(var_ptx,total_bstr,total_a))
|
var_x=eval('(%s%s)/%s'%(var_ptx,total_bstr,total_a))
|
||||||
|
|
||||||
|
total_nqty=0
|
||||||
|
total_formular=0
|
||||||
|
for line in obj.formulars:
|
||||||
|
total_nqty+=line.qty or 0
|
||||||
|
total_formular+=line.amount or 0
|
||||||
|
|
||||||
total_ncost=0.0
|
total_ncost=0.0
|
||||||
for line in obj.nurse_lines:
|
for line in obj.nurse_lines:
|
||||||
total_ncost+=line.amount or 0.0
|
#total_ncost+=line.amount or 0.0
|
||||||
|
total_ncost+=line.rate or 0.0
|
||||||
|
|
||||||
total_dcost=0.0
|
total_dcost=0.0
|
||||||
|
total_dqty=0.0
|
||||||
for line in obj.doctor_lines:
|
for line in obj.doctor_lines:
|
||||||
total_dcost+=line.amount or 0.0
|
total_dcost+=line.amount or 0.0
|
||||||
|
total_dqty+=line.qty or 0.0
|
||||||
|
|
||||||
total_stcost=0.0
|
total_stcost=0.0
|
||||||
for line in obj.staff_lines:
|
for line in obj.staff_lines:
|
||||||
|
@ -60,8 +69,11 @@ class LaborCost(Model):
|
||||||
'var_fml3': '(%s%s)/%s'%(var_ptx,total_bstr,total_a),
|
'var_fml3': '(%s%s)/%s'%(var_ptx,total_bstr,total_a),
|
||||||
'var_x': round(var_x,2),
|
'var_x': round(var_x,2),
|
||||||
'total': total,
|
'total': total,
|
||||||
|
'total_formular': total_formular,
|
||||||
'total_ncost': total_ncost,
|
'total_ncost': total_ncost,
|
||||||
|
'total_nqty': total_nqty,
|
||||||
'total_dcost': total_dcost,
|
'total_dcost': total_dcost,
|
||||||
|
'total_dqty': total_dqty,
|
||||||
'total_stcost': total_stcost,
|
'total_stcost': total_stcost,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,8 +89,11 @@ class LaborCost(Model):
|
||||||
'var_fml3': fields.Char("X:",function="_get_all",function_multi=True),
|
'var_fml3': fields.Char("X:",function="_get_all",function_multi=True),
|
||||||
'var_x': fields.Char("X:",function="_get_all",function_multi=True),
|
'var_x': fields.Char("X:",function="_get_all",function_multi=True),
|
||||||
'total': fields.Float("Total (Baht)",function="_get_all",function_multi=True),
|
'total': fields.Float("Total (Baht)",function="_get_all",function_multi=True),
|
||||||
|
'total_formular': fields.Float("Total",function="_get_all",function_multi=True),
|
||||||
'total_ncost': fields.Float("Nurse Cost",function="_get_all",function_multi=True),
|
'total_ncost': fields.Float("Nurse Cost",function="_get_all",function_multi=True),
|
||||||
|
'total_nqty': fields.Float("Nurse Cost",function="_get_all",function_multi=True),
|
||||||
'total_dcost': fields.Float("Doctor Cost",function="_get_all",function_multi=True),
|
'total_dcost': fields.Float("Doctor Cost",function="_get_all",function_multi=True),
|
||||||
|
'total_dqty': fields.Float("Doctor Cost",function="_get_all",function_multi=True),
|
||||||
'total_stcost': fields.Float("Staff Cost",function="_get_all",function_multi=True),
|
'total_stcost': fields.Float("Staff Cost",function="_get_all",function_multi=True),
|
||||||
'manual': fields.Boolean("Manual"),
|
'manual': fields.Boolean("Manual"),
|
||||||
"formulars": fields.One2Many("clinic.labor.cost.formular", "labor_cost_id", "Formulars"),
|
"formulars": fields.One2Many("clinic.labor.cost.formular", "labor_cost_id", "Formulars"),
|
||||||
|
@ -280,6 +295,7 @@ class LaborCost(Model):
|
||||||
'categ_id': nurse.categ_id.id,
|
'categ_id': nurse.categ_id.id,
|
||||||
'rate': rate,
|
'rate': rate,
|
||||||
'type': 'nurse',
|
'type': 'nurse',
|
||||||
|
#'qty': qty,
|
||||||
'qty': 1,
|
'qty': 1,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
@ -301,7 +317,7 @@ class LaborCost(Model):
|
||||||
'base': 0,
|
'base': 0,
|
||||||
'type': staff.type,
|
'type': staff.type,
|
||||||
'categ_id': staff.categ_id.id,
|
'categ_id': staff.categ_id.id,
|
||||||
'level_id': staff.level_id.id,
|
'level_id': staff.level_id.id, #XXX
|
||||||
'qty': 0,
|
'qty': 0,
|
||||||
}
|
}
|
||||||
if staff.type!='doctor':
|
if staff.type!='doctor':
|
||||||
|
|
|
@ -132,6 +132,7 @@ class Patient(Model):
|
||||||
'cycles': fields.One2Many("clinic.patient.cycle","patient_id", "Cycles"),
|
'cycles': fields.One2Many("clinic.patient.cycle","patient_id", "Cycles"),
|
||||||
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
|
"vascular_acc": fields.Many2One("clinic.vascular.access","Vascular Ac."),
|
||||||
'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'),
|
'state': fields.Selection([['admit','Admit'],['dispose','Dispose']],'State'),
|
||||||
|
'is_walkin': fields.Boolean("Walk In"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_number(self,context={}):
|
def _get_number(self,context={}):
|
||||||
|
|
|
@ -53,6 +53,7 @@ class ReportHDCaseSummary(Model):
|
||||||
branch_id=obj.branch_id.id
|
branch_id=obj.branch_id.id
|
||||||
department_id=obj.department_id.id
|
department_id=obj.department_id.id
|
||||||
date=obj.date
|
date=obj.date
|
||||||
|
crr_month=int(date[5:7]) #XXX
|
||||||
time_start='%s 00:00:00'%obj.date_from
|
time_start='%s 00:00:00'%obj.date_from
|
||||||
time_stop='%s 23:59:59'%obj.date_to
|
time_stop='%s 23:59:59'%obj.date_to
|
||||||
year=int(date[0:4])
|
year=int(date[0:4])
|
||||||
|
@ -90,6 +91,7 @@ class ReportHDCaseSummary(Model):
|
||||||
dom.append(['branch_id','=',branch_id])
|
dom.append(['branch_id','=',branch_id])
|
||||||
if department_id:
|
if department_id:
|
||||||
dom.append(['department_id','=',department_id])
|
dom.append(['department_id','=',department_id])
|
||||||
|
print('>> dom ', dom)
|
||||||
crr_total=len(get_model("clinic.hd.case").search(dom))
|
crr_total=len(get_model("clinic.hd.case").search(dom))
|
||||||
items={}
|
items={}
|
||||||
items['topic%s'%count]={
|
items['topic%s'%count]={
|
||||||
|
|
|
@ -16,6 +16,7 @@ class ReportLaborCostSummary(Model):
|
||||||
'staff_id': fields.Many2One("clinic.staff","Staff"),
|
'staff_id': fields.Many2One("clinic.staff","Staff"),
|
||||||
"staff_type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
|
"staff_type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type"),
|
||||||
'department_id': fields.Many2One("clinic.department","Department"),
|
'department_id': fields.Many2One("clinic.department","Department"),
|
||||||
|
'branch_id': fields.Many2One("clinic.branch","Branch"),
|
||||||
'level_id': fields.Many2One("clinic.staff.level","Level"),
|
'level_id': fields.Many2One("clinic.staff.level","Level"),
|
||||||
'categ_id': fields.Many2One("clinic.staff.categ","Category"),
|
'categ_id': fields.Many2One("clinic.staff.categ","Category"),
|
||||||
'only_value': fields.Boolean("Only Amount"),
|
'only_value': fields.Boolean("Only Amount"),
|
||||||
|
@ -56,6 +57,8 @@ class ReportLaborCostSummary(Model):
|
||||||
only_value=res['only_value']
|
only_value=res['only_value']
|
||||||
level_id=None
|
level_id=None
|
||||||
categ_id=None
|
categ_id=None
|
||||||
|
branch_id=None
|
||||||
|
department_id=None
|
||||||
dom=[]
|
dom=[]
|
||||||
if ids:
|
if ids:
|
||||||
obj=self.browse(ids)[0]
|
obj=self.browse(ids)[0]
|
||||||
|
@ -65,6 +68,8 @@ class ReportLaborCostSummary(Model):
|
||||||
staff_type=obj.staff_type
|
staff_type=obj.staff_type
|
||||||
level_id=obj.level_id.id
|
level_id=obj.level_id.id
|
||||||
categ_id=obj.categ_id.id
|
categ_id=obj.categ_id.id
|
||||||
|
branch_id=obj.branch_id.id
|
||||||
|
department_id=obj.department_id.id
|
||||||
only_value=obj.only_value
|
only_value=obj.only_value
|
||||||
dom.append(['date','>=',date_from])
|
dom.append(['date','>=',date_from])
|
||||||
dom.append(['date','<=',date_to])
|
dom.append(['date','<=',date_to])
|
||||||
|
@ -76,11 +81,20 @@ class ReportLaborCostSummary(Model):
|
||||||
dom.append(['amount','!=',0])
|
dom.append(['amount','!=',0])
|
||||||
if categ_id:
|
if categ_id:
|
||||||
dom.append(['staff_id.categ_id','=',categ_id])
|
dom.append(['staff_id.categ_id','=',categ_id])
|
||||||
|
if branch_id:
|
||||||
|
dom.append(['labor_cost_id.cycle_item_id.branch_id','=',branch_id])
|
||||||
|
if department_id:
|
||||||
|
dom.append(['labor_cost_id.cycle_item_id.department_id','=',department_id])
|
||||||
staffs={}
|
staffs={}
|
||||||
|
citems={}
|
||||||
|
print('dom ', dom)
|
||||||
|
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
|
||||||
citem=lcost.cycle_item_id
|
citem=lcost.cycle_item_id
|
||||||
dpt=citem.department_id
|
dpt=citem.department_id
|
||||||
|
qty=line.qty or 0 #XXX
|
||||||
|
total_hdcase+=qty
|
||||||
amt=line.amount or 0
|
amt=line.amount or 0
|
||||||
staff=line.staff_id
|
staff=line.staff_id
|
||||||
categ_name=''
|
categ_name=''
|
||||||
|
@ -89,13 +103,14 @@ class ReportLaborCostSummary(Model):
|
||||||
level_name=''
|
level_name=''
|
||||||
if not staff:
|
if not staff:
|
||||||
continue
|
continue
|
||||||
if level_id and staff.level_id.id!=level_id:
|
if level_id and staff.level_id.id !=level_id:
|
||||||
continue
|
continue
|
||||||
if categ:
|
if categ:
|
||||||
categ_id=categ.id
|
categ_id=categ.id
|
||||||
categ_name=categ.name or ""
|
categ_name=categ.name or ""
|
||||||
if staff.level_id:
|
if staff.level_id:
|
||||||
level_name=staff.level_id.name or ""
|
level=get_model("clinic.staff.level").browse(staff.level_id.id)
|
||||||
|
level_name=level.name or ""
|
||||||
if not staffs.get(staff.name):
|
if not staffs.get(staff.name):
|
||||||
staffs[staff.name]={
|
staffs[staff.name]={
|
||||||
'number': staff.number or '',
|
'number': staff.number or '',
|
||||||
|
@ -106,24 +121,35 @@ class ReportLaborCostSummary(Model):
|
||||||
'categ_id': categ_id,
|
'categ_id': categ_id,
|
||||||
dpt.name: {
|
dpt.name: {
|
||||||
'amt': 0,
|
'amt': 0,
|
||||||
|
'qty': qty,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if not staffs[staff.name].get(dpt.name):
|
if not staffs[staff.name].get(dpt.name):
|
||||||
staffs[staff.name].update({
|
staffs[staff.name].update({
|
||||||
dpt.name: {
|
dpt.name: {
|
||||||
'amt': 0,
|
'amt': 0,
|
||||||
|
'qty': qty,
|
||||||
}})
|
}})
|
||||||
staffs[staff.name][dpt.name]['amt']+=amt
|
staffs[staff.name][dpt.name]['amt']+=amt
|
||||||
|
staffs[staff.name][dpt.name]['qty']+=qty
|
||||||
|
|
||||||
|
if not citems.get(citem.id):
|
||||||
|
qty=len([hdcase for hdcase in citem.hd_cases])
|
||||||
|
citems[citem.id]=qty
|
||||||
lines=[]
|
lines=[]
|
||||||
dpts=get_model("clinic.department").search_read([],['name'])
|
dom=[]
|
||||||
|
if branch_id:
|
||||||
|
dom.append(['branch_id','=',branch_id])
|
||||||
|
if department_id:
|
||||||
|
dpt_name=get_model('clinic.department').browse(department_id).name
|
||||||
|
dom.append(['name','=',dpt_name])
|
||||||
|
dpts=get_model("clinic.department").search_read(dom,['name'])
|
||||||
dpts=sorted(dpts, key=lambda b: b['name'])
|
dpts=sorted(dpts, key=lambda b: b['name'])
|
||||||
no=1
|
|
||||||
staff_types=set()
|
staff_types=set()
|
||||||
snames=sorted(staffs.keys()) #sort by staff name
|
snames=sorted(staffs.keys()) #sort by staff name
|
||||||
for sname in snames:
|
for sname in snames:
|
||||||
vals=staffs[sname]
|
vals=staffs[sname]
|
||||||
lvals={
|
lvals={
|
||||||
'no': no,
|
|
||||||
'staff_name': sname,
|
'staff_name': sname,
|
||||||
'staff_id': vals.get('staff_id'),
|
'staff_id': vals.get('staff_id'),
|
||||||
'staff_type': vals.get('staff_type'),
|
'staff_type': vals.get('staff_type'),
|
||||||
|
@ -133,20 +159,24 @@ class ReportLaborCostSummary(Model):
|
||||||
'number': vals.get("number"),
|
'number': vals.get("number"),
|
||||||
}
|
}
|
||||||
total=0
|
total=0
|
||||||
|
total_qty=0
|
||||||
lvals['sub_lines']=[]
|
lvals['sub_lines']=[]
|
||||||
for dpt in dpts:
|
for dpt in dpts:
|
||||||
amt=0 #solve bug
|
amt=0 #solve bug
|
||||||
|
qty=0
|
||||||
dname=dpt['name'] or ''
|
dname=dpt['name'] or ''
|
||||||
vals2=vals.get(dname)
|
vals2=vals.get(dname)
|
||||||
if vals2:
|
if vals2:
|
||||||
amt=vals2.get("amt",0)
|
amt=vals2.get("amt",0)
|
||||||
staff_type=vals2.get("type",'')
|
qty=vals2.get("qty",0)
|
||||||
staff_types.update({staff_type})
|
_staff_type=vals2.get("type",'')
|
||||||
lvals['sub_lines'].append({'amt': amt,'dpt_id': dpt['id']})
|
staff_types.update({_staff_type})
|
||||||
|
lvals['sub_lines'].append({'amt': amt,'qty': qty, 'dpt_id': dpt['id']})
|
||||||
total+=amt
|
total+=amt
|
||||||
|
total_qty+=qty
|
||||||
lvals['total']=total
|
lvals['total']=total
|
||||||
|
lvals['qty']=qty
|
||||||
lines.append(lvals)
|
lines.append(lvals)
|
||||||
no+=1
|
|
||||||
|
|
||||||
title=''
|
title=''
|
||||||
for stype in list(staff_types):
|
for stype in list(staff_types):
|
||||||
|
@ -156,21 +186,44 @@ class ReportLaborCostSummary(Model):
|
||||||
title+='Nurse'
|
title+='Nurse'
|
||||||
title=' and'.join(t for t in title.split(" "))
|
title=' and'.join(t for t in title.split(" "))
|
||||||
|
|
||||||
total_lines=[{'amt': 0} for dpt in dpts]
|
total_lines=[{'amt': 0, 'qty':0} for dpt in dpts]
|
||||||
for line in lines:
|
for line in lines:
|
||||||
i=0
|
i=0
|
||||||
for sub_line in line['sub_lines']:
|
for sub_line in line['sub_lines']:
|
||||||
amt=sub_line['amt'] or 0
|
amt=sub_line['amt'] or 0
|
||||||
|
qty=sub_line['qty'] or 0
|
||||||
total_lines[i]['amt']+=amt
|
total_lines[i]['amt']+=amt
|
||||||
|
total_lines[i]['qty']+=qty
|
||||||
i+=1
|
i+=1
|
||||||
total=0
|
total=0
|
||||||
|
total_qty=0
|
||||||
|
total_cost=0
|
||||||
for tline in total_lines:
|
for tline in total_lines:
|
||||||
amt=tline['amt'] or 0
|
amt=tline['amt'] or 0
|
||||||
|
qty=tline['qty'] or 0
|
||||||
total+=amt
|
total+=amt
|
||||||
|
total_cost+=amt
|
||||||
|
total_qty+=qty
|
||||||
|
|
||||||
total_lines.append({'amt': total})
|
total_lines.append({'amt': total})
|
||||||
company_id=get_active_company()
|
company_id=get_active_company()
|
||||||
comp=get_model("company").browse(company_id)
|
comp=get_model("company").browse(company_id)
|
||||||
|
|
||||||
|
#staff_type=staff_type or staff.type #XXX
|
||||||
|
print("staff_type ", staff_type)
|
||||||
|
if staff_type!='doctor':
|
||||||
|
total_hdcase=0
|
||||||
|
for k,hdcase_qty in citems.items():
|
||||||
|
total_hdcase+=hdcase_qty
|
||||||
|
print("total_hdcase ", total_hdcase)
|
||||||
|
|
||||||
|
# reset no
|
||||||
|
nlines=[]
|
||||||
|
no=1
|
||||||
|
for line in sorted(lines, key=lambda x: x['number']):
|
||||||
|
line['no']=no
|
||||||
|
nlines.append(line)
|
||||||
|
no+=1
|
||||||
data={
|
data={
|
||||||
'title': title,
|
'title': title,
|
||||||
'date_from': date_from,
|
'date_from': date_from,
|
||||||
|
@ -178,8 +231,10 @@ class ReportLaborCostSummary(Model):
|
||||||
'dpts': dpts,
|
'dpts': dpts,
|
||||||
'comp_name': comp.name or 0,
|
'comp_name': comp.name or 0,
|
||||||
'comp_span': len(dpts),
|
'comp_span': len(dpts),
|
||||||
'lines': sorted(lines, key=lambda x: x['number']),
|
'lines': nlines,
|
||||||
'total_lines': total_lines,
|
'total_lines': total_lines,
|
||||||
|
'total_hdcase': total_hdcase or 0,
|
||||||
|
'total_cost': total_cost or 0,
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -197,4 +252,9 @@ class ReportLaborCostSummary(Model):
|
||||||
data['staff_id']=None
|
data['staff_id']=None
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def onchange_branch(self,context={}):
|
||||||
|
data=context['data']
|
||||||
|
data['department_id']=None
|
||||||
|
return data
|
||||||
|
|
||||||
ReportLaborCostSummary.register()
|
ReportLaborCostSummary.register()
|
||||||
|
|
|
@ -122,12 +122,32 @@ class ClinicSetting(Model):
|
||||||
print("Done!")
|
print("Done!")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def update_cycle_item_level(self,ids,context={}):
|
||||||
|
for citem in get_model("clinic.cycle.item").search_browse([]):
|
||||||
|
for line in citem.lines:
|
||||||
|
nurse=line.nurse_id
|
||||||
|
if nurse.level_id:
|
||||||
|
line.write({
|
||||||
|
'level_id': nurse.level_id.id,
|
||||||
|
})
|
||||||
|
|
||||||
def run_script(self,ids,context={}):
|
def run_script(self,ids,context={}):
|
||||||
user_id=get_active_user()
|
user_id=get_active_user()
|
||||||
if user_id !=1:
|
if user_id !=1:
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
|
#obj=self.browse(ids)[0]
|
||||||
|
#obj.update_staff_department()
|
||||||
|
#obj.remove_rotation()
|
||||||
|
#obj.update_staff_level()
|
||||||
|
#obj.update_cycle_item_level()
|
||||||
|
for st in get_model("clinic.staff").search_browse([]):
|
||||||
|
st.write({
|
||||||
|
'note': ' ',
|
||||||
|
})
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
return
|
||||||
|
|
||||||
lines=[]
|
lines=[]
|
||||||
for pt in get_model("clinic.patient").search_browse([['state','=','admit']]):
|
for pt in get_model("clinic.patient").search_browse([['state','=','admit']]):
|
||||||
partner_id=None
|
partner_id=None
|
||||||
|
@ -173,7 +193,7 @@ class ClinicSetting(Model):
|
||||||
print("Done!")
|
print("Done!")
|
||||||
return
|
return
|
||||||
|
|
||||||
def udpate_staff_level(self,ids,context={}):
|
def update_staff_level(self,ids,context={}):
|
||||||
user_id=get_active_user()
|
user_id=get_active_user()
|
||||||
if user_id !=1:
|
if user_id !=1:
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
|
|
|
@ -129,13 +129,13 @@ class Staff(Model):
|
||||||
"user_id": fields.Many2One("base.user","User",search=True),
|
"user_id": fields.Many2One("base.user","User",search=True),
|
||||||
'image': fields.File("Image"),
|
'image': fields.File("Image"),
|
||||||
'note': fields.Text("Note"),
|
'note': fields.Text("Note"),
|
||||||
'categ_id': fields.Many2One("clinic.staff.categ", "Category",function="_get_rotation",function_multi=True),
|
'categ_id': fields.Many2One("clinic.staff.categ", "Category",function="_get_rotation",function_multi=True,store=True),
|
||||||
'level_id': fields.Many2One("clinic.staff.level", "Level", function="_get_rotation",function_multi=True),
|
'level_id': fields.Many2One("clinic.staff.level", "Level", function="_get_rotation",function_multi=True,store=True),
|
||||||
'active': fields.Boolean("Active"),
|
'active': fields.Boolean("Active"),
|
||||||
'date': fields.Date("Register Date"),
|
'date': fields.Date("Register Date"),
|
||||||
'wage': fields.Float("Wage", function="_get_rotation",function_multi=True),
|
'wage': fields.Float("Wage", function="_get_rotation",function_multi=True,store=True),
|
||||||
'max_cycle': fields.Integer("Max Cycle", function="_get_rotation",function_multi=True),
|
'max_cycle': fields.Integer("Max Cycle", function="_get_rotation",function_multi=True,store=True),
|
||||||
'ot_per_cycle': fields.Integer("OT Per Cycle", function="_get_rotation",function_multi=True),
|
'ot_per_cycle': fields.Integer("OT Per Cycle", function="_get_rotation",function_multi=True,store=True),
|
||||||
'check_max_cycle': fields.Boolean("Check Max Cycle"),
|
'check_max_cycle': fields.Boolean("Check Max Cycle"),
|
||||||
'hire_date': fields.Date("Hire Date"),
|
'hire_date': fields.Date("Hire Date"),
|
||||||
'resign_date': fields.Date("Resign Date"),
|
'resign_date': fields.Date("Resign Date"),
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
<p></p>
|
<p>
|
||||||
|
</p>
|
||||||
<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">HD Case: {{total_hdcase}}</span>
|
||||||
|
<span class="label label-success">Cost : ฿{{currency total_cost zero=""}}</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
@ -20,7 +27,7 @@
|
||||||
<th style="text-align:right">{{name}}</th>
|
<th style="text-align:right">{{name}}</th>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</th>
|
</th>
|
||||||
<th rowspan="2" style="text-align:right;">รวม</th>
|
<th rowspan="2" style="text-align:right;">รายได้</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -53,6 +60,5 @@
|
||||||
{{#each total_lines}}
|
{{#each total_lines}}
|
||||||
<th style="text-align:right;">{{currency amt zero=""}}</th>
|
<th style="text-align:right;">{{currency amt zero=""}}</th>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<th></th>
|
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -2,6 +2,21 @@ todo:
|
||||||
- multi department access ***
|
- multi department access ***
|
||||||
- merge staff same name but different department
|
- merge staff same name but different department
|
||||||
- doctor นายแพทย์ ทวีชัย
|
- doctor นายแพทย์ ทวีชัย
|
||||||
|
- tick
|
||||||
|
1. create profile for all department + branch (2)
|
||||||
|
- create sharing setting for all model
|
||||||
|
- branch
|
||||||
|
- deparment
|
||||||
|
- patient
|
||||||
|
- patient cycle
|
||||||
|
- cycle item
|
||||||
|
- visit
|
||||||
|
- hd case
|
||||||
|
- dialyzer
|
||||||
|
- shop
|
||||||
|
- sickbed
|
||||||
|
- staff
|
||||||
|
- staff rotation : only manager nurse
|
||||||
- run script
|
- run script
|
||||||
- update level's nurse
|
- update level's nurse
|
||||||
- report k. boy (sub detail) -> ok
|
- report k. boy (sub detail) -> ok
|
||||||
|
|
Loading…
Reference in New Issue