labor cost summary

conv_bal
watcha.h 2015-03-05 18:10:56 +07:00
parent 016bfd85b5
commit 3d17dbcd72
5 changed files with 18 additions and 11 deletions

View File

@ -2,6 +2,8 @@
<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" span="3"/>
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="3"/>
<foot replace="1">
<button string="Compute" method="compute" icon="repeat" type="default"/>
</foot>

View File

@ -13,6 +13,8 @@ class ComputeLaborCost(Model):
"date": fields.Date("Month"),
"date_from": fields.Date("From", required=True),
"date_to": fields.Date("To", required=True),
'branch_id': fields.Many2One("clinic.branch","Branch"),
'department_id': fields.Many2One("clinic.department","Department"),
}
def _get_date_from(self,context={}):
@ -35,8 +37,15 @@ class ComputeLaborCost(Model):
dom=[]
dom.append(['date','>=', obj.date_from])
dom.append(['date','<=', obj.date_to])
if obj.branch_id:
dom.append(['branch_id','=',obj.branch_id.id])
if obj.department_id:
dom.append(['department_id','=',obj.department_id.id])
for lcost in get_model("clinic.labor.cost").search_browse(dom):
print("compute %s ....", lcost.cycle_item_id.name)
#item=lcost.cycle_item_id
#item.to_draft()
#item.validate()
lcost.compute()
print("Done!")
return {

View File

@ -69,10 +69,10 @@ class LaborCost(Model):
'var_fml3': '(%s%s)/%s'%(var_ptx,total_bstr,total_a),
'var_x': round(var_x,2),
'total': total,
'total_formular': total_formular,
'total_ncost': total_ncost,
'total_formular': round(total_formular,0),
'total_ncost': round(total_ncost,0),
'total_nqty': total_nqty,
'total_dcost': total_dcost,
'total_dcost': round(total_dcost,0),
'total_dqty': total_dqty,
'total_stcost': total_stcost,
}

View File

@ -205,19 +205,15 @@ class ReportLaborCostSummary(Model):
total_cost+=amt
total_qty+=qty
total_lines.append({'amt': total})
total_lines.append({'amt': round(total,0)})
company_id=get_active_company()
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
# run no
nlines=[]
no=1
for line in sorted(lines, key=lambda x: x['number']):
@ -234,7 +230,7 @@ class ReportLaborCostSummary(Model):
'lines': nlines,
'total_lines': total_lines,
'total_hdcase': total_hdcase or 0,
'total_cost': total_cost or 0,
'total_cost': round(total_cost,0) or 0,
}
return data

View File

@ -27,7 +27,7 @@
<th style="text-align:right">{{name}}</th>
{{/each}}
</th>
<th rowspan="2" style="text-align:right;">รายได้</th>
<th rowspan="2" style="text-align:right;">รวม</th>
</tr>
</thead>
<tbody>