2014-10-09 10:53:01 +00:00
|
|
|
import time
|
|
|
|
|
2014-10-13 08:10:20 +00:00
|
|
|
from netforce.model import Model, fields, get_model
|
2014-10-09 10:53:01 +00:00
|
|
|
|
|
|
|
class HDReport(Model):
|
|
|
|
_name="clinic.hd.report"
|
|
|
|
_string="HD Report"
|
|
|
|
_transient=True
|
|
|
|
|
|
|
|
_fields={
|
|
|
|
"date": fields.Date("Date"),
|
2014-10-13 08:10:20 +00:00
|
|
|
"cycle_id": fields.Many2One("clinic.cycle","Cycle"),
|
2014-10-09 10:53:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_defaults={
|
|
|
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
|
|
|
}
|
2014-10-13 08:10:20 +00:00
|
|
|
|
|
|
|
_order="cycle_id desc"
|
2014-10-09 10:53:01 +00:00
|
|
|
|
|
|
|
def get_report_data(self,ids,context={}):
|
2014-10-13 08:10:20 +00:00
|
|
|
lines=[]
|
|
|
|
hd_case_ids=get_model("clinic.dialyzer").search([["state","=","completed"]])
|
|
|
|
hd_cases=get_model("clinic.hd.case").search_browse([])
|
|
|
|
for hd_case_ids in hd_cases:
|
|
|
|
lines.append({
|
|
|
|
'cycle' : hd_case_ids.cycle_id.name,
|
|
|
|
'patient': hd_case_ids.patient_id.name,
|
|
|
|
'doctor' : hd_case_ids.doctor_id.name,
|
|
|
|
'total' : hd_case_ids.fee,
|
|
|
|
'rc_no' : hd_case_ids.number,
|
|
|
|
'nurse' : hd_case_ids.nurse_id.name,
|
|
|
|
})
|
|
|
|
|
2014-10-09 10:53:01 +00:00
|
|
|
data={
|
2014-10-13 08:10:20 +00:00
|
|
|
'cycle_id': hd_case_ids.cycle or "Empty Cyle",
|
|
|
|
'lines': lines,
|
2014-10-09 10:53:01 +00:00
|
|
|
}
|
|
|
|
return data
|
|
|
|
|
|
|
|
HDReport.register()
|