diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml
index 3ca2c74..90d0136 100644
--- a/netforce_clinic/layouts/clinic_menu.xml
+++ b/netforce_clinic/layouts/clinic_menu.xml
@@ -45,7 +45,7 @@
-
+
diff --git a/netforce_clinic/layouts/clinic_print_wizard_labor_cost_form.xml b/netforce_clinic/layouts/clinic_print_wizard_labor_cost_form.xml
index 28dcc21..97f5ec9 100644
--- a/netforce_clinic/layouts/clinic_print_wizard_labor_cost_form.xml
+++ b/netforce_clinic/layouts/clinic_print_wizard_labor_cost_form.xml
@@ -8,9 +8,11 @@
+
+
diff --git a/netforce_clinic/layouts/clinic_print_wizard_labor_cost_list.xml b/netforce_clinic/layouts/clinic_print_wizard_labor_cost_list.xml
index 9c9a544..049301f 100644
--- a/netforce_clinic/layouts/clinic_print_wizard_labor_cost_list.xml
+++ b/netforce_clinic/layouts/clinic_print_wizard_labor_cost_list.xml
@@ -1,4 +1,9 @@
+
+
+
+
+
diff --git a/netforce_clinic/models/print_wizard_labor_cost.py b/netforce_clinic/models/print_wizard_labor_cost.py
index 3fa8116..0ccc0c0 100644
--- a/netforce_clinic/models/print_wizard_labor_cost.py
+++ b/netforce_clinic/models/print_wizard_labor_cost.py
@@ -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)
diff --git a/netforce_clinic/models/report_labor_cost_sub_detail.py b/netforce_clinic/models/report_labor_cost_sub_detail.py
index cc9729d..490492d 100644
--- a/netforce_clinic/models/report_labor_cost_sub_detail.py
+++ b/netforce_clinic/models/report_labor_cost_sub_detail.py
@@ -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'])):