labor cost
parent
54738bce05
commit
32ed942983
|
@ -30,7 +30,7 @@
|
|||
<field name="var_x" span="6" offset="6"/>
|
||||
</group>
|
||||
<group span="6" columns="1">
|
||||
<field name="total" span="6" offset="6"/>
|
||||
<field name="total" string="Total" span="6" offset="6"/>
|
||||
</group>
|
||||
</tab>
|
||||
<tab string="Nurses">
|
||||
|
@ -54,7 +54,7 @@
|
|||
<field name="amount"/>
|
||||
</form>
|
||||
</field>
|
||||
<field name="total_ncost" span="3" offset="9"/>
|
||||
<field name="total_ncost" string="Total" span="3" offset="9"/>
|
||||
</tab>
|
||||
<tab string="Doctors">
|
||||
<field name="doctor_lines" nolabel="1">
|
||||
|
@ -77,7 +77,7 @@
|
|||
<field name="amount"/>
|
||||
</form>
|
||||
</field>
|
||||
<field name="total_dcost" span="3" offset="9"/>
|
||||
<field name="total_dcost" string="Total" span="3" offset="9"/>
|
||||
</tab>
|
||||
<tab string="Other Staff">
|
||||
<field name="staff_lines" nolabel="1">
|
||||
|
@ -100,7 +100,7 @@
|
|||
<field name="amount"/>
|
||||
</form>
|
||||
</field>
|
||||
<field name="total_stcost" span="3" offset="9"/>
|
||||
<field name="total_stcost" string="Total" span="3" offset="9"/>
|
||||
</tab>
|
||||
</tabs>
|
||||
<foot>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<list model="clinic.labor.cost">
|
||||
<field name="cycle_item_id"/>
|
||||
<field name="total_dcost"/>
|
||||
<field name="total_ncost"/>
|
||||
<field name="total_stcost"/>
|
||||
<field name="total"/>
|
||||
</list>
|
||||
|
|
|
@ -38,7 +38,8 @@ class LaborCost(Model):
|
|||
total_stcost=0.0
|
||||
for line in obj.staff_lines:
|
||||
total_stcost+=line.amount or 0.0
|
||||
|
||||
#XXX
|
||||
total=total_ncost+total_dcost+total_stcost
|
||||
res[obj.id]={
|
||||
'var_pt': total_case,
|
||||
'var_ptx': total_case*(obj.var_k or 0),
|
||||
|
@ -63,10 +64,10 @@ class LaborCost(Model):
|
|||
'var_fml2': fields.Char("Step 2:",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),
|
||||
'total': fields.Float("Total",function="_get_all",function_multi=True),
|
||||
'total_ncost': fields.Float("Total",function="_get_all",function_multi=True),
|
||||
'total_dcost': fields.Float("Total",function="_get_all",function_multi=True),
|
||||
'total_stcost': fields.Float("Total",function="_get_all",function_multi=True),
|
||||
'total': fields.Float("Total (Baht)",function="_get_all",function_multi=True),
|
||||
'total_ncost': fields.Float("Nurse Cost",function="_get_all",function_multi=True),
|
||||
'total_dcost': fields.Float("Doctor Cost",function="_get_all",function_multi=True),
|
||||
'total_stcost': fields.Float("Staff Cost",function="_get_all",function_multi=True),
|
||||
'manual': fields.Boolean("Manual"),
|
||||
"formulars": fields.One2Many("clinic.labor.cost.formular", "labor_cost_id", "Formulars"),
|
||||
"nurse_lines": fields.One2Many("clinic.labor.cost.line", "labor_cost_id", "Nurse Lines",domain=[['type','=','nurse']]),
|
||||
|
|
|
@ -67,52 +67,45 @@ class ReportStaffFeeDetail(Model):
|
|||
dom.append(['date','>=',time_start])
|
||||
dom.append(['date','<=',time_stop])
|
||||
if department_id:
|
||||
dom.append(['department_id','=',department_id])
|
||||
dom.append(['staff_id.department_id','=',department_id])
|
||||
if branch_id:
|
||||
dom.append(['branch_id','=',branch_id])
|
||||
dom.append(['staff_id.branch_id','=',branch_id])
|
||||
staff_name=''
|
||||
if staff_id:
|
||||
staff=get_model("clinic.staff").browse(staff_id)
|
||||
staff_name=staff.name
|
||||
dom.append(['staff_id','=',staff.id])
|
||||
dlines=get_model('clinic.labor.cost.line').search_browse(dom)
|
||||
# group by date
|
||||
all_vals={}
|
||||
for dline in dlines:
|
||||
date=dline.date
|
||||
staff=dline.staff_id
|
||||
if staff_type:
|
||||
if staff_type!=staff.type:
|
||||
continue
|
||||
key=(date,staff.id)
|
||||
if key not in all_vals.keys():
|
||||
all_vals[key]={
|
||||
'qty': 0,
|
||||
'staff_type': utils.STAFF_TYPE.get(staff.type,''),
|
||||
'staff_name': staff.name or "",
|
||||
'amount': 0,
|
||||
}
|
||||
all_vals[key]['qty']+=dline.qty or 0
|
||||
all_vals[key]['amount']+=dline.amount or 0
|
||||
|
||||
dom.append(['staff_id','=',staff_id])
|
||||
lines=[]
|
||||
total_amount=0.0
|
||||
total_qty=0.0
|
||||
for key,vals in all_vals.items():
|
||||
date,staff_id=key
|
||||
qty=vals['qty'] or 0
|
||||
amount=vals['amount'] or 0
|
||||
_staff_name=vals['staff_name'] or ''
|
||||
staff_type=vals['staff_type']
|
||||
lines.append({
|
||||
'date': date,
|
||||
'qty': qty,
|
||||
'staff_type': staff_type,
|
||||
'staff_name': _staff_name,
|
||||
'amount': amount or 0.0,
|
||||
})
|
||||
total_qty+=qty
|
||||
total_amount+=amount
|
||||
total_qty=0
|
||||
total_amount=0
|
||||
lines=[]
|
||||
for lcline in get_model('clinic.labor.cost.line').search_browse(dom):
|
||||
lc=lcline.labor_cost_id
|
||||
item=lc.cycle_item_id
|
||||
date=item.date
|
||||
cycle=item.cycle_id
|
||||
branch=item.branch_id
|
||||
dpt=item.department_id
|
||||
for dt in lc.doctor_lines:
|
||||
staff=dt.staff_id
|
||||
lines.append({
|
||||
'staff_id': staff.id,
|
||||
'staff_name': staff.name or '',
|
||||
'staff_type': staff.type or '',
|
||||
'date': date,
|
||||
'cycle_id': cycle.id,
|
||||
'branch_id': branch.id,
|
||||
'department_id': dpt.id,
|
||||
})
|
||||
for nr in lc.nurse_lines:
|
||||
staff=dt.staff_id
|
||||
lines.append({
|
||||
'staff_id': staff.id,
|
||||
'staff_name': staff.name or '',
|
||||
'staff_type': staff.type or '',
|
||||
'date': date,
|
||||
'cycle_id': cycle.id,
|
||||
'branch_id': branch.id,
|
||||
'department_id': dpt.id,
|
||||
})
|
||||
|
||||
month_str=utils.MONTHS['th_TH'][int(month)]
|
||||
start=int(time_start[8:10])
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
todo:
|
||||
- report
|
||||
- doctor labort cost detail
|
||||
- matching payment
|
||||
- doctor labort cost detail ***
|
||||
- matching payment ***
|
||||
- popup messagging
|
||||
=======
|
||||
generate visit ใหม่ -> ok
|
||||
|
|
Loading…
Reference in New Issue