working state
parent
4fd53c26b9
commit
9d41b1db76
|
@ -7,20 +7,20 @@
|
||||||
</button>
|
</button>
|
||||||
</head>
|
</head>
|
||||||
<group form_layout="stacked">
|
<group form_layout="stacked">
|
||||||
<!--<field name="name" span="2"/>-->
|
|
||||||
<field name="date" onchange="onchange_date" mode="month" span="2"/>
|
<field name="date" onchange="onchange_date" mode="month" span="2"/>
|
||||||
<field name="date_from" span="2"/>
|
<field name="date_from" span="2"/>
|
||||||
<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="state" span="2"/>
|
||||||
</group>
|
</group>
|
||||||
<tabs>
|
<tabs>
|
||||||
<tab string="Doctors">
|
<tab string="Doctors">
|
||||||
<field name="doctor_lines" nolabel="1">
|
<field name="doctor_lines" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
<field name="staff_id"/>
|
<field name="staff_id"/>
|
||||||
<!--<field name="type"/>-->
|
|
||||||
<field name="department_id"/>
|
<field name="department_id"/>
|
||||||
|
<field name="state"/>
|
||||||
<field name="qty" onchange="onchange_line"/>
|
<field name="qty" onchange="onchange_line"/>
|
||||||
<field name="rate" onchange="onchange_line"/>
|
<field name="rate" onchange="onchange_line"/>
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
|
@ -32,8 +32,8 @@
|
||||||
<field name="nurse_lines" nolabel="1">
|
<field name="nurse_lines" nolabel="1">
|
||||||
<list>
|
<list>
|
||||||
<field name="staff_id"/>
|
<field name="staff_id"/>
|
||||||
<!--<field name="type"/>-->
|
|
||||||
<field name="department_id"/>
|
<field name="department_id"/>
|
||||||
|
<field name="state"/>
|
||||||
<field name="qty" string="PT" onchange="onchange_line"/>
|
<field name="qty" string="PT" onchange="onchange_line"/>
|
||||||
<field name="rate" onchange="onchange_line"/>
|
<field name="rate" onchange="onchange_line"/>
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
|
|
|
@ -46,19 +46,11 @@
|
||||||
<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="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"/>
|
||||||
</list>
|
</list>
|
||||||
<form>
|
|
||||||
<field name="cycle_id"/>
|
|
||||||
<field name="staff_id"/>
|
|
||||||
<field name="description"/>
|
|
||||||
<field name="level_id"/>
|
|
||||||
<field name="qty"/>
|
|
||||||
<field name="rate"/>
|
|
||||||
<field name="amount"/>
|
|
||||||
</form>
|
|
||||||
</field>
|
</field>
|
||||||
<field name="total_ncost" string="Total" span="3" offset="9"/>
|
<field name="total_ncost" string="Total" span="3" offset="9"/>
|
||||||
</tab>
|
</tab>
|
||||||
|
@ -69,47 +61,14 @@
|
||||||
<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="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"/>
|
||||||
</list>
|
</list>
|
||||||
<form>
|
|
||||||
<field name="cycle_id"/>
|
|
||||||
<field name="staff_id"/>
|
|
||||||
<field name="description"/>
|
|
||||||
<field name="level_id"/>
|
|
||||||
<field name="qty"/>
|
|
||||||
<field name="rate"/>
|
|
||||||
<field name="amount"/>
|
|
||||||
</form>
|
|
||||||
</field>
|
</field>
|
||||||
<field name="total_dcost" string="Total" span="3" offset="9"/>
|
<field name="total_dcost" string="Total" span="3" offset="9"/>
|
||||||
</tab>
|
</tab>
|
||||||
<!--
|
|
||||||
<tab string="Other Staff">
|
|
||||||
<field name="staff_lines" nolabel="1">
|
|
||||||
<list>
|
|
||||||
<field name="cycle_id"/>
|
|
||||||
<field name="staff_id" domain="[['type','=','staff']]"/>
|
|
||||||
<field name="description"/>
|
|
||||||
<field name="level_id"/>
|
|
||||||
<field name="qty" onchange="onchange_cost_line"/>
|
|
||||||
<field name="rate" onchange="onchange_cost_line"/>
|
|
||||||
<field name="amount"/>
|
|
||||||
</list>
|
|
||||||
<form>
|
|
||||||
<field name="cycle_id"/>
|
|
||||||
<field name="staff_id"/>
|
|
||||||
<field name="description"/>
|
|
||||||
<field name="level_id"/>
|
|
||||||
<field name="qty"/>
|
|
||||||
<field name="rate"/>
|
|
||||||
<field name="amount"/>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
<field name="total_stcost" string="Total" span="3" offset="9"/>
|
|
||||||
</tab>
|
|
||||||
-->
|
|
||||||
</tabs>
|
</tabs>
|
||||||
<foot>
|
<foot>
|
||||||
<button string="Compute" icon="repeat" type="default" method="compute"/>
|
<button string="Compute" icon="repeat" type="default" method="compute"/>
|
||||||
|
|
|
@ -269,6 +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,
|
||||||
'rate': rate,
|
'rate': rate,
|
||||||
'type': 'nurse',
|
'type': 'nurse',
|
||||||
'qty': 1,
|
'qty': 1,
|
||||||
|
@ -291,6 +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,
|
||||||
'level_id': staff.level_id.id,
|
'level_id': staff.level_id.id,
|
||||||
'qty': 0,
|
'qty': 0,
|
||||||
}
|
}
|
||||||
|
@ -305,10 +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']
|
||||||
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,
|
||||||
'rate': base,
|
'rate': base,
|
||||||
'qty': qty,
|
'qty': qty,
|
||||||
'type': type,
|
'type': type,
|
||||||
|
@ -329,6 +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']
|
||||||
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():
|
||||||
|
@ -339,6 +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,
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
glines[key]['amount']+=amount
|
glines[key]['amount']+=amount
|
||||||
|
|
|
@ -2,7 +2,6 @@ import time
|
||||||
from calendar import monthrange
|
from calendar import monthrange
|
||||||
|
|
||||||
from netforce.model import Model, fields, get_model
|
from netforce.model import Model, fields, get_model
|
||||||
from netforce.database import get_connection
|
|
||||||
from netforce.access import get_active_user, get_active_company
|
from netforce.access import get_active_user, get_active_company
|
||||||
from netforce.utils import get_data_path
|
from netforce.utils import get_data_path
|
||||||
|
|
||||||
|
@ -56,6 +55,7 @@ class LaborCostEntry(Model):
|
||||||
'company_id': fields.Many2One("company","Company"),
|
'company_id': fields.Many2One("company","Company"),
|
||||||
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
'department_id': fields.Many2One("clinic.department","Department",search=True),
|
||||||
'branch_id': fields.Many2One("clinic.branch","Branch",search=True),
|
'branch_id': fields.Many2One("clinic.branch","Branch",search=True),
|
||||||
|
"state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_date_from(self,context={}):
|
def _get_date_from(self,context={}):
|
||||||
|
@ -91,7 +91,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.state:
|
||||||
|
dom.append(['staff_id.state','=',obj.state])
|
||||||
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={}
|
||||||
|
@ -99,6 +100,7 @@ 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
|
||||||
dpt=staff.department_id
|
dpt=staff.department_id
|
||||||
if not dpt:
|
if not dpt:
|
||||||
dpt=line.labor_cost_id.cycle_item_id.department_id
|
dpt=line.labor_cost_id.cycle_item_id.department_id
|
||||||
|
@ -108,6 +110,7 @@ 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,
|
||||||
}
|
}
|
||||||
staffs[staff.id]['qty']+=qty
|
staffs[staff.id]['qty']+=qty
|
||||||
staffs[staff.id]['amt']+=amt
|
staffs[staff.id]['amt']+=amt
|
||||||
|
@ -117,6 +120,7 @@ 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']
|
||||||
rate=0.0
|
rate=0.0
|
||||||
if qty:
|
if qty:
|
||||||
rate=amt/qty # average
|
rate=amt/qty # average
|
||||||
|
@ -126,6 +130,7 @@ class LaborCostEntry(Model):
|
||||||
'amount': amt,
|
'amount': amt,
|
||||||
'date': timenow,
|
'date': timenow,
|
||||||
'rate': rate,
|
'rate': rate,
|
||||||
|
'state': state,
|
||||||
'department_id': vals['department_id'],
|
'department_id': vals['department_id'],
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ class LaborCostEntryLine(Model):
|
||||||
'company_id': fields.Many2One("company","Company"),
|
'company_id': fields.Many2One("company","Company"),
|
||||||
'department_id': fields.Many2One("clinic.department","Department"),
|
'department_id': fields.Many2One("clinic.department","Department"),
|
||||||
"type": fields.Selection([['staff','Staff'],["doctor","Doctor"],["nurse","Nurse"]],"Type"),
|
"type": fields.Selection([['staff','Staff'],["doctor","Doctor"],["nurse","Nurse"]],"Type"),
|
||||||
|
"state": fields.Selection([["part_time","Part Time"],["full_time","Full Time"]],"Working Status",search=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
_order="type"
|
_order="type"
|
||||||
|
|
|
@ -18,6 +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),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
|
|
|
@ -4,7 +4,7 @@ todo:
|
||||||
- report
|
- report
|
||||||
- doctor labort cost detail ***
|
- doctor labort cost detail ***
|
||||||
- how much hd of that doctor in that period
|
- how much hd of that doctor in that period
|
||||||
-
|
- working status
|
||||||
- matching payment ***
|
- matching payment ***
|
||||||
|
|
||||||
- popup messagging -> Ask DJ
|
- popup messagging -> Ask DJ
|
||||||
|
|
Loading…
Reference in New Issue