report_wizard_labor_cost merge file to pdf (3)
parent
6babde4800
commit
12e81bfd71
|
@ -45,7 +45,7 @@
|
|||
<item string="Report Cycle Setting" action="clinic_report_cycle_setting"/>
|
||||
<item string="Cycle Item Summary" action="clinic_report_cycle_item"/>
|
||||
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/>
|
||||
<item string="HD Case Expense" action="clinic_report_claim"/>
|
||||
<item string="HD Case Expense" action="report_hdcase_expense_summary"/>
|
||||
<item string="RD Shop Expense" action="clinic_report_shop"/>
|
||||
<divider/>
|
||||
<item string="Receipt Summary" action="clinic_report_receipt_summary"/>
|
||||
|
|
|
@ -8,9 +8,11 @@
|
|||
<field name="date_to" span="2"/>
|
||||
<field name="branch_id" onchange='onchange_branch' span="2"/>
|
||||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
||||
<field name="staff_type" span="2"/>
|
||||
<field name="file_pdf1" span="4"/>
|
||||
<field name="file_pdf2" span="4"/>
|
||||
<field name="file_pdf3" span="4"/>
|
||||
<!--<field name="file_pdf4" span="4"/>-->
|
||||
</group>
|
||||
<group span="12" columns="1">
|
||||
<template>
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<list model="clinic.print.wizard.labor.cost">
|
||||
<field name="period_id"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<field name="staff_type"/>
|
||||
<field name="branch_id"/>
|
||||
<field name="department_id"/>
|
||||
<field name="state"/>
|
||||
</list>
|
||||
|
|
|
@ -21,13 +21,14 @@ class PrintLaborCost(Model):
|
|||
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
||||
"branch_id": fields.Many2One("clinic.branch","Branch"),
|
||||
"department_id": fields.Many2One("clinic.department","Department"),
|
||||
"staff_type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"]],"Type"),
|
||||
"staff_type": fields.Selection([["doctor","Doctor"],["nurse","Nurse"],["staff","Staff"]],"Type", required=True),
|
||||
'staff_id': fields.Many2One("clinic.staff","Staff"),
|
||||
'state': fields.Selection([['draft','Draft'],['waiting_doc','Waiting Document'],['done','Done']],'State',search=True),
|
||||
'company_id': fields.Many2One('company','Company'),
|
||||
'file_pdf1': fields.File("File_Labor_cost_sunmary"),
|
||||
'file_pdf2': fields.File("File_Labor_cost_details"),
|
||||
'file_pdf3': fields.File("File_Labor_cost_Sub_Deatils(Doctor)"),
|
||||
'file_pdf4': fields.File("File_Labor_cost_Sub_Deatils(Nurse)"),
|
||||
}
|
||||
|
||||
def _get_date_from(self,context={}):
|
||||
|
@ -77,6 +78,7 @@ class PrintLaborCost(Model):
|
|||
'file_pdf1': None,
|
||||
'file_pdf2': None,
|
||||
'file_pdf3': None,
|
||||
#'file_pdf4': None,
|
||||
})
|
||||
db.commit()
|
||||
|
||||
|
@ -99,8 +101,10 @@ class PrintLaborCost(Model):
|
|||
#Create File Name
|
||||
fname1='%s_wizard_sunmary_%s_to_%s.pdf'%(obj.id,obj.date_from,obj.date_to)
|
||||
fname2='%s_wizard_details_%s_to_%s.pdf'%(obj.id,obj.date_from,obj.date_to)
|
||||
fname3='%s_wizard_sub_details_%s_to_%s.pdf'%(obj.id,obj.date_from,obj.date_to)
|
||||
defaults='&data=%s&period_id=%s&date_from=%s&date_to=%s&cycle_id=%s&branch_id=%s&department_id=%s'%(obj.date_from,obj.period_id.id,obj.date_from,obj.date_to,obj.cycle_id.id or None,obj.branch_id.id or None,obj.department_id.id or None,)
|
||||
fname3='%s_wizard_sub_details_%s_to_%s(%s).pdf'%(obj.id,obj.date_from,obj.date_to,obj.staff_type)
|
||||
#fname3='%s_wizard_sub_details_%s_to_%s(docter).pdf'%(obj.id,obj.date_from,obj.date_to)
|
||||
#fname4='%s_wizard_sub_details_%s_to_%s(nurse).pdf'%(obj.id,obj.date_from,obj.date_to)
|
||||
defaults='&data=%s&period_id=%s&date_from=%s&date_to=%s&cycle_id=%s&branch_id=%s&department_id=%s&staff_type=%s'%(obj.date_from,obj.period_id.id,obj.date_from,obj.date_to,obj.cycle_id.id or None,obj.branch_id.id or None,obj.department_id.id or None,obj.staff_type or None)
|
||||
lc_id=get_model('clinic.report.wizard.labor.cost').create({})
|
||||
link1="report?convert=pdf&refer_id=%s&template=report_wizard_labor_cost_summary&model=clinic.report.wizard.labor.cost&type=report_odt2&method=get_report_wizard_summary%s&type_report=wizard&user=admin" % (lc_id,defaults)
|
||||
load_report(fname1,link1)
|
||||
|
@ -108,11 +112,14 @@ class PrintLaborCost(Model):
|
|||
load_report(fname2,link2)
|
||||
link3="report?convert=pdf&refer_id=%s&template=report_wizard_labor_cost_sub_details&model=clinic.report.wizard.labor.cost&type=report_odt2&method=get_report_wizard_sub_details%s&type_report=wizard&user=admin" % (lc_id,defaults)
|
||||
load_report(fname3,link3)
|
||||
#link4="report?convert=pdf&refer_id=%s&template=report_wizard_labor_cost_sub_details&model=clinic.report.wizard.labor.cost&type=report_odt2&method=get_report_wizard_sub_details%s&type_report=wizard&user=admin" % (lc_id,defaults+'&staff_type=nurse')
|
||||
#load_report(fname4,link4)
|
||||
|
||||
obj.write({
|
||||
'file_pdf1': '%s' % (fname1),
|
||||
'file_pdf2': '%s' % (fname2),
|
||||
'file_pdf3': '%s' % (fname3),
|
||||
#'file_pdf4': '%s' % (fname4),
|
||||
'state': 'done',
|
||||
})
|
||||
os.chdir('%s'%fdir)
|
||||
|
|
|
@ -93,7 +93,7 @@ class ReportLaborCostSubDetail(Model):
|
|||
if staff_id and staff_type=='doctor':
|
||||
dom.append(['staff_id','=',staff_id])
|
||||
elif staff_id and staff_type=='nurse':
|
||||
pass
|
||||
dom.append(['staff_id','=',staff_id])
|
||||
if staff_type:
|
||||
dom.append(['type','=',staff_type])
|
||||
if department_id:
|
||||
|
@ -115,25 +115,35 @@ class ReportLaborCostSubDetail(Model):
|
|||
qty=line.qty or 0
|
||||
if qty:
|
||||
amount=amount/qty
|
||||
for hdcase in citem.hd_cases:
|
||||
if hdcase.state not in ("waiting_payment","paid"):
|
||||
continue
|
||||
patient=hdcase.patient_id
|
||||
doctor=hdcase.doctor_id
|
||||
if staff_type=='nurse':
|
||||
vals={
|
||||
'date': date,
|
||||
'patient_name': patient.name or "",
|
||||
'patient_name': line.staff_id.name or "",
|
||||
'department_name': dpt.name or "",
|
||||
'amount': amount,
|
||||
}
|
||||
if staff_type=='doctor' and doctor.id==staff_id:
|
||||
lines.append(vals)
|
||||
amount_total+=amount
|
||||
elif staff_type=='nurse':
|
||||
lines.append(vals)
|
||||
amount_total+=amount
|
||||
else:
|
||||
pass
|
||||
lines.append(vals)
|
||||
amount_total+=amount
|
||||
if staff_type=='doctor':
|
||||
for hdcase in citem.hd_cases:
|
||||
if hdcase.state not in ("waiting_payment","paid"):
|
||||
continue
|
||||
patient=hdcase.patient_id
|
||||
doctor=hdcase.doctor_id
|
||||
vals={
|
||||
'date': date,
|
||||
'patient_name': patient.name or "",
|
||||
'department_name': dpt.name or "",
|
||||
'amount': amount,
|
||||
}
|
||||
if staff_type=='doctor' and doctor.id==staff_id:
|
||||
lines.append(vals)
|
||||
amount_total+=amount
|
||||
elif staff_type=='nurse':
|
||||
lines.append(vals)
|
||||
amount_total+=amount
|
||||
else:
|
||||
pass
|
||||
slines=[]
|
||||
no=1
|
||||
for line in sorted(lines,key=lambda x: (x['date'], x['department_name'])):
|
||||
|
|
Loading…
Reference in New Issue