nurse category
parent
03341f26ac
commit
ab9920aab5
|
@ -1,8 +0,0 @@
|
||||||
<action>
|
|
||||||
<field name="string">Report Labor Cost</field>
|
|
||||||
<field name="view_cls">report</field>
|
|
||||||
<field name="model">clinic.report.labor.cost</field>
|
|
||||||
<field name="report_template">report_labor_cost</field>
|
|
||||||
<field name="report_template_xls">report_labor_cost</field>
|
|
||||||
<field name="menu">account_menu</field>
|
|
||||||
</action>
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<action>
|
||||||
|
<field name="string">Report Labor Cost Summary</field>
|
||||||
|
<field name="view_cls">report</field>
|
||||||
|
<field name="model">clinic.report.labor.cost.summary</field>
|
||||||
|
<field name="report_template">report_labor_cost_summary</field>
|
||||||
|
<field name="report_template_xls">report_labor_cost_summary</field>
|
||||||
|
<field name="menu">account_menu</field>
|
||||||
|
</action>
|
|
@ -22,7 +22,8 @@
|
||||||
<list>
|
<list>
|
||||||
<field name="nurse_id" domain='[["type","=","nurse"]]' onchange="onchange_nurse"/>
|
<field name="nurse_id" domain='[["type","=","nurse"]]' onchange="onchange_nurse"/>
|
||||||
<field name="level_id"/>
|
<field name="level_id"/>
|
||||||
<field name="state"/>
|
<field name="categ_id"/>
|
||||||
|
<!--<field name="state"/>-->
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</tab>
|
</tab>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<field name="date_to" span="2"/>
|
<field name="date_to" span="2"/>
|
||||||
<field name="branch_id" onchange="onchange_branch" span="2"/>
|
<field name="branch_id" onchange="onchange_branch" span="2"/>
|
||||||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
||||||
<field name="work_state" span="2"/>
|
<field name="categ_id" span="2"/>
|
||||||
</group>
|
</group>
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="Doctors">
|
<tab string="Doctors">
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<list>
|
<list>
|
||||||
<field name="staff_id"/>
|
<field name="staff_id"/>
|
||||||
<field name="department_id"/>
|
<field name="department_id"/>
|
||||||
<field name="state"/>
|
<field name="categ_id"/>
|
||||||
<field name="qty" string="Qty" onchange="onchange_line"/>
|
<field name="qty" string="Qty" onchange="onchange_line"/>
|
||||||
<field name="rate" onchange="onchange_line"/>
|
<field name="rate" onchange="onchange_line"/>
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<list>
|
<list>
|
||||||
<field name="staff_id"/>
|
<field name="staff_id"/>
|
||||||
<field name="department_id"/>
|
<field name="department_id"/>
|
||||||
<field name="state"/>
|
<field name="categ_id"/>
|
||||||
<field name="max_cycle" />
|
<field name="max_cycle" />
|
||||||
<field name="qty" onchange="onchange_line"/>
|
<field name="qty" onchange="onchange_line"/>
|
||||||
<field name="over_cycle" />
|
<field name="over_cycle" />
|
||||||
|
|
|
@ -5,12 +5,6 @@
|
||||||
</head>
|
</head>
|
||||||
<group form_layout="stacked">
|
<group form_layout="stacked">
|
||||||
<field name="cycle_item_id" span="3"/>
|
<field name="cycle_item_id" span="3"/>
|
||||||
<!--
|
|
||||||
<field name="date" span="3"/>
|
|
||||||
<field name="cycle_id" span="3"/>
|
|
||||||
<field name="branch_id" span="3"/>
|
|
||||||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="3"/>
|
|
||||||
-->
|
|
||||||
</group>
|
</group>
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="Computation">
|
<tab string="Computation">
|
||||||
|
@ -46,9 +40,7 @@
|
||||||
<field name="staff_id" domain="[['type','=','nurse']]"/>
|
<field name="staff_id" domain="[['type','=','nurse']]"/>
|
||||||
<field name="description"/>
|
<field name="description"/>
|
||||||
<field name="level_id"/>
|
<field name="level_id"/>
|
||||||
<field name="state"/>
|
<field name="categ_id"/>
|
||||||
<!--<field name="qty" onchange="onchange_cost_line"/>-->
|
|
||||||
<!--<field name="rate" onchange="onchange_cost_line"/>-->
|
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
|
@ -61,7 +53,7 @@
|
||||||
<field name="staff_id" domain="[['type','=','doctor']]"/>
|
<field name="staff_id" domain="[['type','=','doctor']]"/>
|
||||||
<field name="description"/>
|
<field name="description"/>
|
||||||
<field name="level_id"/>
|
<field name="level_id"/>
|
||||||
<field name="state"/>
|
<field name="categ_id"/>
|
||||||
<field name="qty" onchange="onchange_cost_line"/>
|
<field name="qty" onchange="onchange_cost_line"/>
|
||||||
<field name="rate" onchange="onchange_cost_line"/>
|
<field name="rate" onchange="onchange_cost_line"/>
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
|
|
|
@ -2,14 +2,12 @@
|
||||||
<item string="Settings" position="before">
|
<item string="Settings" position="before">
|
||||||
<item string="Ratchawat">
|
<item string="Ratchawat">
|
||||||
<item string="Labor Costs" action="clinic_labor_cost"/>
|
<item string="Labor Costs" action="clinic_labor_cost"/>
|
||||||
<!--<item string="Labor Cost Items" action="clinic_labor_cost_item" perm="clinic_labor_cost_item"/>-->
|
|
||||||
<item string="Labor Cost Entries" action="clinic_labor_cost_entry"/>
|
<item string="Labor Cost Entries" action="clinic_labor_cost_entry"/>
|
||||||
<!--<item string="Matching Payment(Old)" action="clinic_report_payment_matching"/>-->
|
|
||||||
<item string="Matching Payments" action="clinic_matching_payment"/>
|
<item string="Matching Payments" action="clinic_matching_payment"/>
|
||||||
<item string="HD Case Expenses" action="clinic_hd_case_expense"/>
|
<item string="HD Case Expenses" action="clinic_hd_case_expense"/>
|
||||||
<divider/>
|
<divider/>
|
||||||
<header string="REPORTS"/>
|
<header string="REPORTS"/>
|
||||||
<item string="Labor Cost" action="clinic_report_labor_cost"/>
|
<item string="Labor Cost Summary" action="clinic_report_labor_cost_summary"/>
|
||||||
<item string="Staff" action="clinic_report_staff"/>
|
<item string="Staff" action="clinic_report_staff"/>
|
||||||
<item string="Staff Fee" action="clinic_report_staff_fee"/>
|
<item string="Staff Fee" action="clinic_report_staff_fee"/>
|
||||||
<item string="Staff Fee Detail" action="clinic_report_staff_fee_detail"/>
|
<item string="Staff Fee Detail" action="clinic_report_staff_fee_detail"/>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<form model="clinic.report.labor.cost">
|
<form model="clinic.report.labor.cost.summary">
|
||||||
<field name="date" mode="month" onchange="onchange_date" span="2"/>
|
<field name="date" mode="month" onchange="onchange_date" span="2"/>
|
||||||
<field name="date_from" required="1" span="2"/>
|
<field name="date_from" required="1" span="2"/>
|
||||||
<field name="date_to" required="1" span="2"/>
|
<field name="date_to" required="1" span="2"/>
|
|
@ -1,6 +1,6 @@
|
||||||
<form model="clinic.staff" show_company="1">
|
<form model="clinic.staff" show_company="1">
|
||||||
<head>
|
<head>
|
||||||
<field name="state"/>
|
<field name="type"/>
|
||||||
<button string="Options" dropdown="1">
|
<button string="Options" dropdown="1">
|
||||||
<item string="Copy"/>
|
<item string="Copy"/>
|
||||||
</button>
|
</button>
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<field name="birthday"/>
|
<field name="birthday"/>
|
||||||
<field name="nation_id"/>
|
<field name="nation_id"/>
|
||||||
<field name="categ_id" domain="[['type','=',type]]"/>
|
<field name="categ_id" domain="[['type','=',type]]"/>
|
||||||
<field name="state"/>
|
<!--<field name="state"/>-->
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<field name="image"/>
|
<field name="image"/>
|
||||||
|
|
|
@ -15,5 +15,5 @@
|
||||||
<field name="level_id"/>
|
<field name="level_id"/>
|
||||||
<field name="categ_id"/>
|
<field name="categ_id"/>
|
||||||
<field name="image" preview="1"/>
|
<field name="image" preview="1"/>
|
||||||
<field name="state"/>
|
<!--<field name="state"/>-->
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -74,7 +74,7 @@ from . import report_staff_fee
|
||||||
from . import report_staff_fee_detail
|
from . import report_staff_fee_detail
|
||||||
from . import report_staff_fee_sum
|
from . import report_staff_fee_sum
|
||||||
from . import report_payment_matching
|
from . import report_payment_matching
|
||||||
from . import report_labor_cost
|
from . import report_labor_cost_summary
|
||||||
from . import branch
|
from . import branch
|
||||||
from . import period
|
from . import period
|
||||||
from . import period_line
|
from . import period_line
|
||||||
|
|
|
@ -108,7 +108,33 @@ class AccountPayment(Model):
|
||||||
'credit': rvals['credit'],
|
'credit': rvals['credit'],
|
||||||
"track_id": track_id,
|
"track_id": track_id,
|
||||||
}))
|
}))
|
||||||
lines=lines1+lines2 #debit, credit
|
|
||||||
|
if obj.type=="in":
|
||||||
|
rate_type="sell"
|
||||||
|
else:
|
||||||
|
rate_type="buy"
|
||||||
|
adjust_lines=[]
|
||||||
|
adjust_amt=0
|
||||||
|
for jline in obj.adjust_lines:
|
||||||
|
cur_amt=get_model("currency").convert(line.amount,obj.currency_id.id,settings.currency_id.id,date=obj.date,rate_type=rate_type)
|
||||||
|
tax_base=get_model("currency").convert(line.tax_base or 0,obj.currency_id.id,settings.currency_id.id,date=obj.date,rate_type=rate_type)
|
||||||
|
cur_amt=abs(cur_amt)
|
||||||
|
adjust_lines.append(('create',{
|
||||||
|
"move_id": move_id,
|
||||||
|
"description": desc,
|
||||||
|
"account_id": line.account_id.id,
|
||||||
|
"tax_comp_id": line.tax_comp_id.id,
|
||||||
|
"tax_base": tax_base,
|
||||||
|
"track_id": line.track_id.id,
|
||||||
|
"partner_id": obj.partner_id.id,
|
||||||
|
"credit":0,
|
||||||
|
"debit": cur_amt,
|
||||||
|
}))
|
||||||
|
#XXX
|
||||||
|
adjust_amt+=cur_amt
|
||||||
|
lines1[0][1]['debit']-=cur_amt
|
||||||
|
|
||||||
|
lines=lines1+adjust_lines+lines2 #debit, debit, credit
|
||||||
move=get_model("account.move").browse(move_id)
|
move=get_model("account.move").browse(move_id)
|
||||||
move.write({
|
move.write({
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
|
|
|
@ -139,6 +139,7 @@ class CycleItem(Model):
|
||||||
nurse_id=line['nurse_id']
|
nurse_id=line['nurse_id']
|
||||||
nurse=get_model('clinic.staff').browse(nurse_id)
|
nurse=get_model('clinic.staff').browse(nurse_id)
|
||||||
line['level_id']=nurse.level_id.id
|
line['level_id']=nurse.level_id.id
|
||||||
|
line['categ_id']=nurse.categ_id.id
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def view_schedule(self,ids,context={}):
|
def view_schedule(self,ids,context={}):
|
||||||
|
@ -201,6 +202,7 @@ class CycleItem(Model):
|
||||||
lines.append(('create',{
|
lines.append(('create',{
|
||||||
'nurse_id': nurse.id,
|
'nurse_id': nurse.id,
|
||||||
'level_id': level.id,
|
'level_id': level.id,
|
||||||
|
'categ_id': nurse.categ_id.id,
|
||||||
}))
|
}))
|
||||||
for line in obj.lines:
|
for line in obj.lines:
|
||||||
line.delete()
|
line.delete()
|
||||||
|
|
|
@ -84,7 +84,7 @@ class CycleItemCopy(Model):
|
||||||
lines.append(('create', {
|
lines.append(('create', {
|
||||||
'nurse_id': nr.id,
|
'nurse_id': nr.id,
|
||||||
'level_id': nr.level_id.id,
|
'level_id': nr.level_id.id,
|
||||||
'state': nr.state,
|
'categ_id': nr.categ_id.id,
|
||||||
}))
|
}))
|
||||||
item.write({
|
item.write({
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
|
|
|
@ -10,6 +10,7 @@ class CycleItemLine(Model):
|
||||||
'nurse_id': fields.Many2One("clinic.staff",'Nurse',domain=[['type','=','nurse']]),
|
'nurse_id': fields.Many2One("clinic.staff",'Nurse',domain=[['type','=','nurse']]),
|
||||||
'department_id': fields.Many2One("clinic.department","Department"),
|
'department_id': fields.Many2One("clinic.department","Department"),
|
||||||
"state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
|
"state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
|
||||||
|
'categ_id': fields.Many2One("clinic.staff.categ",'Category',domain=[['type','=','nurse']]),
|
||||||
}
|
}
|
||||||
|
|
||||||
CycleItemLine.register()
|
CycleItemLine.register()
|
||||||
|
|
|
@ -269,7 +269,7 @@ class LaborCost(Model):
|
||||||
'cycle_id': item.cycle_id.id,
|
'cycle_id': item.cycle_id.id,
|
||||||
'staff_id': nurse.id,
|
'staff_id': nurse.id,
|
||||||
'level_id': level_id,
|
'level_id': level_id,
|
||||||
'state': nurse.state,
|
'categ_id': nurse.categ_id.id,
|
||||||
'rate': rate,
|
'rate': rate,
|
||||||
'type': 'nurse',
|
'type': 'nurse',
|
||||||
'qty': 1,
|
'qty': 1,
|
||||||
|
@ -292,7 +292,7 @@ class LaborCost(Model):
|
||||||
staff_total[staff.id]={
|
staff_total[staff.id]={
|
||||||
'base': 0,
|
'base': 0,
|
||||||
'type': staff.type,
|
'type': staff.type,
|
||||||
'state': staff.state,
|
'categ_id': staff.categ_id.id,
|
||||||
'level_id': staff.level_id.id,
|
'level_id': staff.level_id.id,
|
||||||
'qty': 0,
|
'qty': 0,
|
||||||
}
|
}
|
||||||
|
@ -307,12 +307,12 @@ class LaborCost(Model):
|
||||||
type=value['type']
|
type=value['type']
|
||||||
qty=value['qty']
|
qty=value['qty']
|
||||||
level_id=value['level_id']
|
level_id=value['level_id']
|
||||||
state=value['state']
|
categ_id=value['categ_id']
|
||||||
lines.append(('create',{
|
lines.append(('create',{
|
||||||
'cycle_id': item.cycle_id.id,
|
'cycle_id': item.cycle_id.id,
|
||||||
'staff_id': doctor_id,
|
'staff_id': doctor_id,
|
||||||
'level_id': level_id,
|
'level_id': level_id,
|
||||||
'state': state,
|
'categ_id': categ_id,
|
||||||
'rate': base,
|
'rate': base,
|
||||||
'qty': qty,
|
'qty': qty,
|
||||||
'type': type,
|
'type': type,
|
||||||
|
@ -333,7 +333,7 @@ class LaborCost(Model):
|
||||||
staff_id=vals['staff_id']
|
staff_id=vals['staff_id']
|
||||||
rate=vals['rate'] or 0
|
rate=vals['rate'] or 0
|
||||||
qty=vals['qty'] or 0
|
qty=vals['qty'] or 0
|
||||||
state=vals['state']
|
categ_id=vals['categ_id']
|
||||||
amount=qty*rate
|
amount=qty*rate
|
||||||
key=(cycle_id,staff_id)
|
key=(cycle_id,staff_id)
|
||||||
if not key in glines.keys():
|
if not key in glines.keys():
|
||||||
|
@ -344,7 +344,7 @@ class LaborCost(Model):
|
||||||
'qty': qty,
|
'qty': qty,
|
||||||
'type': vals['type'],
|
'type': vals['type'],
|
||||||
'description': vals.get("description",""),
|
'description': vals.get("description",""),
|
||||||
'state': state,
|
'categ_id': categ_id,
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
glines[key]['amount']+=amount
|
glines[key]['amount']+=amount
|
||||||
|
|
|
@ -49,7 +49,8 @@ class LaborCostEntry(Model):
|
||||||
"lines": fields.One2Many("clinic.labor.cost.entry.line", "entry_id", "Lines"),
|
"lines": fields.One2Many("clinic.labor.cost.entry.line", "entry_id", "Lines"),
|
||||||
"nurse_lines": fields.One2Many("clinic.labor.cost.entry.line", "entry_id", "Nurse Lines",domain=[['type','=','nurse']]),
|
"nurse_lines": fields.One2Many("clinic.labor.cost.entry.line", "entry_id", "Nurse Lines",domain=[['type','=','nurse']]),
|
||||||
"doctor_lines": fields.One2Many("clinic.labor.cost.entry.line", "entry_id", "Doctor Lines",domain=[['type','=','doctor']]),
|
"doctor_lines": fields.One2Many("clinic.labor.cost.entry.line", "entry_id", "Doctor Lines",domain=[['type','=','doctor']]),
|
||||||
"work_state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
|
#"work_state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
|
||||||
|
'categ_id': fields.Many2One("clinic.staff.categ", "Category",search=True),
|
||||||
"state": fields.Selection([["draft","Draft"],["approved","Approved"]],"Status"),
|
"state": fields.Selection([["draft","Draft"],["approved","Approved"]],"Status"),
|
||||||
'user_id': fields.Many2One("base.user","Approver",search=True),
|
'user_id': fields.Many2One("base.user","Approver",search=True),
|
||||||
'note': fields.Text("Note"),
|
'note': fields.Text("Note"),
|
||||||
|
@ -91,8 +92,8 @@ class LaborCostEntry(Model):
|
||||||
dom.append(['labor_cost_id.cycle_item_id.branch_id','=',obj.branch_id.id])
|
dom.append(['labor_cost_id.cycle_item_id.branch_id','=',obj.branch_id.id])
|
||||||
if obj.department_id:
|
if obj.department_id:
|
||||||
dom.append(['labor_cost_id.cycle_item_id.department_id','=',obj.department_id.id])
|
dom.append(['labor_cost_id.cycle_item_id.department_id','=',obj.department_id.id])
|
||||||
if obj.work_state:
|
if obj.categ_id:
|
||||||
dom.append(['staff_id.state','=',obj.work_state])
|
dom.append(['staff_id.categ_id','=',obj.categ_id.id])
|
||||||
for lc_id in get_model("clinic.labor.cost.line").search(dom):
|
for lc_id in get_model("clinic.labor.cost.line").search(dom):
|
||||||
line_ids.append(lc_id)
|
line_ids.append(lc_id)
|
||||||
staffs={}
|
staffs={}
|
||||||
|
@ -100,7 +101,8 @@ class LaborCostEntry(Model):
|
||||||
staff=line.staff_id
|
staff=line.staff_id
|
||||||
qty=line.qty
|
qty=line.qty
|
||||||
amt=line.amount
|
amt=line.amount
|
||||||
state=line.state or staff.state
|
#state=line.state or staff.state
|
||||||
|
categ=line.categ_id
|
||||||
dpt=staff.department_id
|
dpt=staff.department_id
|
||||||
citem=line.labor_cost_id.cycle_item_id
|
citem=line.labor_cost_id.cycle_item_id
|
||||||
if not dpt:
|
if not dpt:
|
||||||
|
@ -112,7 +114,8 @@ class LaborCostEntry(Model):
|
||||||
'qty': 0,
|
'qty': 0,
|
||||||
'amt': 0,
|
'amt': 0,
|
||||||
'rate': 0, # XXX for special nurse
|
'rate': 0, # XXX for special nurse
|
||||||
'state': state,
|
#'state': state,
|
||||||
|
'categ_id': categ.id,
|
||||||
'report_staff_id': get_model("clinic.report.staff").create({
|
'report_staff_id': get_model("clinic.report.staff").create({
|
||||||
'date_from': obj.date_from,
|
'date_from': obj.date_from,
|
||||||
'date_to': obj.date_to,
|
'date_to': obj.date_to,
|
||||||
|
@ -130,7 +133,8 @@ class LaborCostEntry(Model):
|
||||||
for staff_id, vals in staffs.items():
|
for staff_id, vals in staffs.items():
|
||||||
qty=vals['qty'] or 0
|
qty=vals['qty'] or 0
|
||||||
amt=vals['amt'] or 0.0
|
amt=vals['amt'] or 0.0
|
||||||
state=vals['state']
|
#state=vals['state']
|
||||||
|
categ_id=vals['categ_id']
|
||||||
report_staff_id=vals['report_staff_id']
|
report_staff_id=vals['report_staff_id']
|
||||||
report_staff=get_model("clinic.report.staff").browse(report_staff_id)
|
report_staff=get_model("clinic.report.staff").browse(report_staff_id)
|
||||||
|
|
||||||
|
@ -178,7 +182,8 @@ class LaborCostEntry(Model):
|
||||||
'amount': amt,
|
'amount': amt,
|
||||||
'date': timenow,
|
'date': timenow,
|
||||||
'rate': rate,
|
'rate': rate,
|
||||||
'state': state,
|
#'state': state,
|
||||||
|
'categ_id': categ_id,
|
||||||
'department_id': vals['department_id'],
|
'department_id': vals['department_id'],
|
||||||
'report_staff_id': report_staff.id,
|
'report_staff_id': report_staff.id,
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -39,6 +39,7 @@ class LaborCostEntryLine(Model):
|
||||||
'max_cycle': fields.Integer("Max Cycle", function="_get_all",function_multi=True),
|
'max_cycle': fields.Integer("Max Cycle", function="_get_all",function_multi=True),
|
||||||
'over_cycle': fields.Integer("Over Cycle", function="_get_all",function_multi=True),
|
'over_cycle': fields.Integer("Over Cycle", function="_get_all",function_multi=True),
|
||||||
'report_staff_id2': fields.Many2One("clinic.report.staff","#PT",function="_get_all",function_multi=True),
|
'report_staff_id2': fields.Many2One("clinic.report.staff","#PT",function="_get_all",function_multi=True),
|
||||||
|
'categ_id': fields.Many2One("clinic.staff.categ",'Category'),
|
||||||
}
|
}
|
||||||
|
|
||||||
_order="type"
|
_order="type"
|
||||||
|
|
|
@ -18,7 +18,7 @@ class LaborCostLine(Model):
|
||||||
'date': fields.Date("Date",search=True),
|
'date': fields.Date("Date",search=True),
|
||||||
'description': fields.Char("Description"),
|
'description': fields.Char("Description"),
|
||||||
'company_id': fields.Many2One('company','Company'),
|
'company_id': fields.Many2One('company','Company'),
|
||||||
"state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
|
'categ_id': fields.Many2One("clinic.staff.categ", "Category",domain=[['type','=','nurse']],search=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
|
|
|
@ -4,9 +4,9 @@ from calendar import monthrange
|
||||||
from netforce.model import Model,fields,get_model
|
from netforce.model import Model,fields,get_model
|
||||||
from netforce.access import get_active_company
|
from netforce.access import get_active_company
|
||||||
|
|
||||||
class ReportLaborCost(Model):
|
class ReportLaborCostSummary(Model):
|
||||||
_name="clinic.report.labor.cost"
|
_name="clinic.report.labor.cost.summary"
|
||||||
_string="Report Labor Cost"
|
_string="Report Labor Cost Summary"
|
||||||
_transient=True
|
_transient=True
|
||||||
|
|
||||||
_fields={
|
_fields={
|
||||||
|
@ -52,6 +52,7 @@ class ReportLaborCost(Model):
|
||||||
if _type:
|
if _type:
|
||||||
dom.append(['type','=',_type])
|
dom.append(['type','=',_type])
|
||||||
staffs={}
|
staffs={}
|
||||||
|
print('dom ', dom)
|
||||||
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
|
||||||
|
@ -62,15 +63,19 @@ class ReportLaborCost(Model):
|
||||||
staffs[staff.name]={
|
staffs[staff.name]={
|
||||||
dpt.name: {
|
dpt.name: {
|
||||||
'type': staff.type,
|
'type': staff.type,
|
||||||
'amt': 0,
|
'amt': amt,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if not staffs[staff.name].get(dpt.name):
|
else:
|
||||||
staffs[staff.name][dpt.name]={
|
#XXX bug
|
||||||
'type': staff.type,
|
if not staffs[staff.name].get(dpt.name):
|
||||||
'amt': 0,
|
staffs[staff.name][dpt.name]={
|
||||||
}
|
'type': staff.type,
|
||||||
staffs[staff.name][dpt.name]['amt']+=amt
|
'amt': amt,
|
||||||
|
}
|
||||||
|
#if staffs.get(staff.name):
|
||||||
|
#if staffs[staff.name].get(dpt.name):
|
||||||
|
#staffs[staff.name][dpt.name]['amt']+=amt
|
||||||
|
|
||||||
lines=[]
|
lines=[]
|
||||||
dpts=get_model("clinic.department").search_read([],['name'])
|
dpts=get_model("clinic.department").search_read([],['name'])
|
||||||
|
@ -123,8 +128,8 @@ class ReportLaborCost(Model):
|
||||||
total_lines.append({'amt': total})
|
total_lines.append({'amt': total})
|
||||||
data={
|
data={
|
||||||
'title': title,
|
'title': title,
|
||||||
'date_from': obj.date_from,
|
'date_from': date_from,
|
||||||
'date_to': obj.date_to,
|
'date_to': date_to,
|
||||||
'dpts': dpts,
|
'dpts': dpts,
|
||||||
'comp_name': comp.name or 0,
|
'comp_name': comp.name or 0,
|
||||||
'comp_span': len(dpts),
|
'comp_span': len(dpts),
|
||||||
|
@ -142,4 +147,4 @@ class ReportLaborCost(Model):
|
||||||
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
data['date_to']="%s-%s-%s"%(year,month,total_day)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
ReportLaborCost.register()
|
ReportLaborCostSummary.register()
|
|
@ -109,45 +109,50 @@ class ClinicSetting(Model):
|
||||||
print("Only admin!!")
|
print("Only admin!!")
|
||||||
return
|
return
|
||||||
obj=self.browse(1)
|
obj=self.browse(1)
|
||||||
t={}
|
categs={}
|
||||||
[t.update({x.code : x.id}) for x in get_model("clinic.patient.type").search_browse([])]
|
for ct in get_model("clinic.staff.categ").search_read([['type','=','nurse']],['name']):
|
||||||
for prod in get_model("product").search_browse([]):
|
categs[ct['name']]=ct['id']
|
||||||
code=prod.code or ""
|
|
||||||
tcodes=code.split("-")
|
|
||||||
tids=[]
|
|
||||||
for tcode in tcodes:
|
|
||||||
tid=t.get(tcode,None)
|
|
||||||
if tid:
|
|
||||||
tids.append(tid)
|
|
||||||
|
|
||||||
prod.write({
|
for cline in get_model("clinic.cycle.item.line").search_browse([]):
|
||||||
'patient_types': [('add',tids)]
|
nr=cline.nurse_id
|
||||||
|
st=nr.state or ""
|
||||||
|
if st=='part_time':
|
||||||
|
st='Part Time'
|
||||||
|
elif st=='full_time':
|
||||||
|
st='Full Time'
|
||||||
|
else:
|
||||||
|
st='Others'
|
||||||
|
ct_id=categs.get(st,None)
|
||||||
|
cline.write({
|
||||||
|
'categ_id': ct_id,
|
||||||
})
|
})
|
||||||
|
|
||||||
for line in obj.account_products:
|
for cline in get_model("clinic.labor.cost.line").search_browse([]):
|
||||||
acc=line.ar_debit_id
|
staff=cline.staff_id
|
||||||
type='credit'
|
st=staff.state or ""
|
||||||
if acc:
|
if st=='part_time':
|
||||||
if acc.code=='101101':
|
st='Part Time'
|
||||||
type='cash'
|
elif st=='full_time':
|
||||||
line.write({
|
st='Full Time'
|
||||||
'type': type,
|
else:
|
||||||
|
st='Others'
|
||||||
|
ct_id=categs.get(st,None)
|
||||||
|
cline.write({
|
||||||
|
'categ_id': ct_id,
|
||||||
})
|
})
|
||||||
|
|
||||||
print("Update product completed!")
|
for staff in get_model("clinic.staff").search_browse([]):
|
||||||
for vs in get_model("clinic.visit").search_browse([['state','in', ['draft','pending']],['doctor_id','=',None]]):
|
st=staff.state
|
||||||
doctor=vs.patient_id.doctor_id
|
if st=='part_time':
|
||||||
if doctor:
|
st='Part Time'
|
||||||
vs.write({
|
elif st=='full_time':
|
||||||
'doctor_id': doctor.id,
|
st='Full Time'
|
||||||
})
|
else:
|
||||||
print("update visit.date ", vs.visit_date)
|
st='Others'
|
||||||
print("Update visit completed!")
|
ct_id=categs.get(st,None)
|
||||||
for shop in get_model("clinic.shop").search_browse([]):
|
staff.write({
|
||||||
shop.write({
|
'categ_id': ct_id,
|
||||||
'company_id': 1,
|
|
||||||
})
|
})
|
||||||
print("Update shop completed!")
|
|
||||||
print("Done! ")
|
print("Done! ")
|
||||||
|
|
||||||
def reset_last_import(self,ids,context={}):
|
def reset_last_import(self,ids,context={}):
|
||||||
|
|
|
@ -100,7 +100,7 @@ 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"),
|
'categ_id': fields.Many2One("clinic.staff.categ", "Category",search=True),
|
||||||
'level_id': fields.Many2One("clinic.staff.level", "Level", function="_get_level"),
|
'level_id': fields.Many2One("clinic.staff.level", "Level", function="_get_level"),
|
||||||
'active': fields.Boolean("Active"),
|
'active': fields.Boolean("Active"),
|
||||||
'date': fields.Date("Register Date"),
|
'date': fields.Date("Register Date"),
|
||||||
|
|
|
@ -258,7 +258,8 @@ class Visit(Model):
|
||||||
item_vals['lines'].append(('create',{
|
item_vals['lines'].append(('create',{
|
||||||
'nurse_id': nurse.id,
|
'nurse_id': nurse.id,
|
||||||
'level_id': nurse.level_id.id,
|
'level_id': nurse.level_id.id,
|
||||||
'state': nurse.state,
|
#'state': nurse.state,
|
||||||
|
'categ_id': nurse.categ_id.id,
|
||||||
}))
|
}))
|
||||||
item.write(item_vals)
|
item.write(item_vals)
|
||||||
|
|
||||||
|
@ -276,7 +277,8 @@ class Visit(Model):
|
||||||
lines.append(('create', {
|
lines.append(('create', {
|
||||||
'nurse_id': nr.id,
|
'nurse_id': nr.id,
|
||||||
'level_id': nr.level_id.id,
|
'level_id': nr.level_id.id,
|
||||||
'state': nr.state,
|
#'state': nr.state,
|
||||||
|
'categ_id': nr.categ_id.id,
|
||||||
}))
|
}))
|
||||||
if lines:
|
if lines:
|
||||||
print("copy nurse from %s to %s"%(item2.name, item.name))
|
print("copy nurse from %s to %s"%(item2.name, item.name))
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
{{#each dpts}}
|
{{#each dpts}}
|
||||||
<td>{{name}}</td>
|
<td style="text-align:right">{{name}}</td>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -24,9 +24,9 @@
|
||||||
<td>{{no}}</th>
|
<td>{{no}}</th>
|
||||||
<td>{{staff_name}}</td>
|
<td>{{staff_name}}</td>
|
||||||
{{#each sub_lines}}
|
{{#each sub_lines}}
|
||||||
<td style="text-align:right;">{{amt}}</td>
|
<td style="text-align:right;">{{currency amt zero=""}}</td>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<td style="text-align:right;">{{total}}</th>
|
<td style="text-align:right;">{{currency total zero=""}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<th></th>
|
<th></th>
|
||||||
<th style="text-align:right"></th>
|
<th style="text-align:right"></th>
|
||||||
{{#each total_lines}}
|
{{#each total_lines}}
|
||||||
<th style="text-align:right;">{{amt}}</th>
|
<th style="text-align:right;">{{currency amt zero=""}}</th>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<th></th>
|
<th></th>
|
||||||
</tfoot>
|
</tfoot>
|
Loading…
Reference in New Issue