staff summary report

conv_bal
watcha.h@almacom.co.th 2015-01-19 23:11:57 +07:00
parent 32ed942983
commit 8397892443
7 changed files with 43 additions and 35 deletions

View File

@ -79,6 +79,7 @@
</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"> <tab string="Other Staff">
<field name="staff_lines" nolabel="1"> <field name="staff_lines" nolabel="1">
<list> <list>
@ -102,6 +103,7 @@
</field> </field>
<field name="total_stcost" string="Total" span="3" offset="9"/> <field name="total_stcost" string="Total" span="3" offset="9"/>
</tab> </tab>
-->
</tabs> </tabs>
<foot> <foot>
<button string="Compute" icon="repeat" type="default" method="compute"/> <button string="Compute" icon="repeat" type="default" method="compute"/>

View File

@ -2,6 +2,6 @@
<field name="cycle_item_id"/> <field name="cycle_item_id"/>
<field name="total_dcost"/> <field name="total_dcost"/>
<field name="total_ncost"/> <field name="total_ncost"/>
<field name="total_stcost"/> <!--<field name="total_stcost"/>-->
<field name="total"/> <field name="total"/>
</list> </list>

View File

@ -13,7 +13,7 @@ class LaborCostEntryLine(Model):
'entry_id': fields.Many2One("clinic.labor.cost.entry","Entry",required=True), 'entry_id': fields.Many2One("clinic.labor.cost.entry","Entry",required=True),
'staff_id': fields.Many2One("clinic.staff","Staff",required=True), 'staff_id': fields.Many2One("clinic.staff","Staff",required=True),
'date': fields.Date("Date"), 'date': fields.Date("Date"),
'qty': fields.Integer("No.HD"), 'qty': fields.Integer("#HDCase"),
'rate': fields.Float("Rate Avg."), 'rate': fields.Float("Rate Avg."),
'amount': fields.Float("Amount"), 'amount': fields.Float("Amount"),
'company_id': fields.Many2One("company","Company"), 'company_id': fields.Many2One("company","Company"),

View File

@ -12,7 +12,7 @@ class LaborCostLine(Model):
'staff_id': fields.Many2One("clinic.staff", "Staff",search=True), 'staff_id': fields.Many2One("clinic.staff", "Staff",search=True),
'level_id': fields.Many2One("clinic.staff.level", "Level",search=True), 'level_id': fields.Many2One("clinic.staff.level", "Level",search=True),
'cycle_id': fields.Many2One("clinic.cycle", "Cycle",search=True), 'cycle_id': fields.Many2One("clinic.cycle", "Cycle",search=True),
'qty': fields.Integer("Qty"), 'qty': fields.Integer("#HDCase"),
'rate': fields.Float("Rate",scale=2), 'rate': fields.Float("Rate",scale=2),
'amount': fields.Float("Amount",scale=2), 'amount': fields.Float("Amount",scale=2),
'date': fields.Date("Date",search=True), 'date': fields.Date("Date",search=True),

View File

@ -84,28 +84,28 @@ class ReportStaffFeeDetail(Model):
cycle=item.cycle_id cycle=item.cycle_id
branch=item.branch_id branch=item.branch_id
dpt=item.department_id dpt=item.department_id
for dt in lc.doctor_lines: items=[]
staff=dt.staff_id for dline in lc.doctor_lines:
lines.append({ staff=dline.staff_id
amount=dline.amount or 0
rate=dline.rate or 0
items.append({
'staff_id': staff.id, 'staff_id': staff.id,
'staff_name': staff.name or '', 'type': 'doctor',
'staff_type': staff.type or '', 'rate': rate,
'date': date, 'amount': amount,
'cycle_id': cycle.id,
'branch_id': branch.id,
'department_id': dpt.id,
}) })
for nr in lc.nurse_lines: for nline in lc.nurse_lines:
staff=dt.staff_id staff=nline.staff_id
lines.append({ rate=dline.rate or 0
items.append({
'staff_id': staff.id, 'staff_id': staff.id,
'staff_name': staff.name or '', 'type': 'nurse',
'staff_type': staff.type or '', 'rate': rate,
'date': date, 'amount': amount,
'cycle_id': cycle.id,
'branch_id': branch.id,
'department_id': dpt.id,
}) })
for item in items:
print(item)
month_str=utils.MONTHS['th_TH'][int(month)] month_str=utils.MONTHS['th_TH'][int(month)]
start=int(time_start[8:10]) start=int(time_start[8:10])

View File

@ -54,8 +54,8 @@ class ReportStaffFeeSum(Model):
time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day) time_stop='%s-%s-%s'%(year,str(month).zfill(2),total_day)
staff_id=None staff_id=None
staff_type="nurse" staff_type="nurse"
department_id=None department=None
branch_id=None branch=None
if ids: if ids:
obj=self.browse(ids)[0] obj=self.browse(ids)[0]
staff_type=obj.type staff_type=obj.type
@ -63,8 +63,8 @@ class ReportStaffFeeSum(Model):
month=obj.date_from.split("-")[1] month=obj.date_from.split("-")[1]
time_start=obj.date_from time_start=obj.date_from
time_stop=obj.date_to time_stop=obj.date_to
department_id=obj.department_id.id department=obj.department_id
branch_id=obj.branch_id.id branch=obj.branch_id
# generate list of date # generate list of date
fmt='%Y-%m-%d' fmt='%Y-%m-%d'
@ -85,10 +85,10 @@ class ReportStaffFeeSum(Model):
total_sum=0.0 total_sum=0.0
dom=[] dom=[]
dom.append(['type','=',staff_type]) dom.append(['type','=',staff_type])
if department_id: if department:
dom.append(['department_id','=',department_id]) dom.append(['department_id','=',department.id])
if branch_id: if branch:
dom.append(['branch_id','=',branch_id]) dom.append(['branch_id','=',branch.id])
for staff in get_model("clinic.staff").search_browse(dom): for staff in get_model("clinic.staff").search_browse(dom):
if staff_id: if staff_id:
if staff_id!=staff.id: if staff_id!=staff.id:
@ -149,10 +149,16 @@ class ReportStaffFeeSum(Model):
'is_duration': diff+1 < total_day, 'is_duration': diff+1 < total_day,
'year': year, 'year': year,
} }
if obj.branch_id: data['title']='สรุปค่าธรรมเนียมพยาบาล'
data['branch_name']='(%s)'%obj.branch_id.name or '' if staff_type=='doctor':
if obj.department_id: data['title']='สรุปค่าธรรมเนียมแพทย์'
data['branch_name']='(%s)'%obj.department_id.name or '' elif staff_type=='staff':
data['title']='สรุปค่าธรรมเนียมเจ้าหน้าที่'
if branch:
data['branch_name']='(%s)'%branch.name or ''
if department:
data['branch_name']='(%s)'%department.name or ''
return data return data
def onchange_date(self,context={}): def onchange_date(self,context={}):

View File

@ -1,5 +1,5 @@
<center> <center>
<h2>สรุปค่าธรรมเนียมพยาบาล</h2> <h2>{{title}}</h2>
<h3> <h3>
{{parent_company_name}}&nbsp;{{company_name}} {{branch_name}}<br/> {{parent_company_name}}&nbsp;{{company_name}} {{branch_name}}<br/>
</h3> </h3>