report summary filter by company
parent
f30b84c6b7
commit
436dc8f5db
|
@ -35,15 +35,11 @@
|
||||||
<item string="Visit Dialy" action="clinic_visit_dialy"/>
|
<item string="Visit Dialy" action="clinic_visit_dialy"/>
|
||||||
<item string="Generate Visit" action="clinic_gen_visit_form"/>
|
<item string="Generate Visit" action="clinic_gen_visit_form"/>
|
||||||
</item>
|
</item>
|
||||||
<item string="HD Cases">
|
<item string="HD Cases" action="clinic_hd_case"/>
|
||||||
<item string="HD Cases" action="clinic_hd_case"/>
|
<item string="Reports">
|
||||||
<divider/>
|
|
||||||
<header string="REPORTS"/>
|
|
||||||
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/>
|
<item string="HD Case Summary" action="clinic_report_hd_case_summary"/>
|
||||||
<item string="HD Case Detail" action="clinic_report_hd_case_detail"/>
|
<item string="HD Case Detail" action="clinic_report_hd_case_detail"/>
|
||||||
</item>
|
<item string="Report Patient" action="clinic_report_new_patient"/>
|
||||||
<item string="Reports">
|
|
||||||
<item string="TODO" action="clinic_report_hd_case_medical"/>
|
|
||||||
</item>
|
</item>
|
||||||
<item string="Settings">
|
<item string="Settings">
|
||||||
<item string="Departments" action="clinic_department"/>
|
<item string="Departments" action="clinic_department"/>
|
||||||
|
|
|
@ -4,6 +4,7 @@ from datetime import datetime
|
||||||
from calendar import monthrange
|
from calendar import monthrange
|
||||||
from netforce.model import Model, fields, get_model
|
from netforce.model import Model, fields, get_model
|
||||||
from netforce.database import get_connection
|
from netforce.database import get_connection
|
||||||
|
from netforce.access import get_active_company
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
@ -22,8 +23,8 @@ class ReportHDCaseSummary(Model):
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
db=get_connection()
|
db=get_connection()
|
||||||
for item in get_model("company").search_browse([]):
|
company_id=get_active_company()
|
||||||
company_name=item.name
|
company=get_model("company").browse(company_id)
|
||||||
|
|
||||||
date=datetime.now().strftime("%Y-%m-%d")
|
date=datetime.now().strftime("%Y-%m-%d")
|
||||||
if ids:
|
if ids:
|
||||||
|
@ -85,7 +86,7 @@ class ReportHDCaseSummary(Model):
|
||||||
weekday, crr_total_day=monthrange(prev_year, crr_month)
|
weekday, crr_total_day=monthrange(prev_year, crr_month)
|
||||||
time_start='%s-%s-01 00:00:00'%(year,str(crr_month).zfill(2))
|
time_start='%s-%s-01 00:00:00'%(year,str(crr_month).zfill(2))
|
||||||
time_stop='%s-%s-%s 23:59:59'%(year,str(crr_month).zfill(2),crr_total_day)
|
time_stop='%s-%s-%s 23:59:59'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||||
new_patients=db.query("select id, name, note from clinic_patient where active=true and create_time >=%s and create_time <=%s",time_start,time_stop)
|
new_patients=db.query("select id, name, note from clinic_patient where active=true and create_time >=%s and create_time <=%s and company_id=%s",time_start,time_stop,company_id)
|
||||||
items['topic3']={
|
items['topic3']={
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'amount': len(new_patients) or 0.0,
|
'amount': len(new_patients) or 0.0,
|
||||||
|
@ -97,7 +98,7 @@ class ReportHDCaseSummary(Model):
|
||||||
# number for patient who resign for this month
|
# number for patient who resign for this month
|
||||||
time_start='%s-%s-01 00:00:00'%(year,str(crr_month).zfill(2))
|
time_start='%s-%s-01 00:00:00'%(year,str(crr_month).zfill(2))
|
||||||
time_stop='%s-%s-%s 23:59:59'%(year,str(crr_month).zfill(2),crr_total_day)
|
time_stop='%s-%s-%s 23:59:59'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||||
resign_patients=db.query("select id, name, note from clinic_patient where active=false and write_time >=%s and write_time <=%s",time_start,time_stop)
|
resign_patients=db.query("select id, name, note from clinic_patient where active=false and write_time >=%s and write_time <=%s and company_id=%s",time_start,time_stop,company_id)
|
||||||
items['topic4']={
|
items['topic4']={
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'amount': len(resign_patients) or 0.0,
|
'amount': len(resign_patients) or 0.0,
|
||||||
|
@ -109,7 +110,7 @@ class ReportHDCaseSummary(Model):
|
||||||
dom=[]
|
dom=[]
|
||||||
weekday, crr_total_day=monthrange(year, crr_month)
|
weekday, crr_total_day=monthrange(year, crr_month)
|
||||||
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
|
time_stop='%s-%s-%s'%(year,str(crr_month).zfill(2),crr_total_day)
|
||||||
npatients=db.query("select id, name, note from clinic_patient where active=true and reg_date <=%s",time_stop)
|
npatients=db.query("select id, name, note from clinic_patient where active=true and reg_date <=%s and company_id=%s",time_stop,company_id)
|
||||||
items['topic5']={
|
items['topic5']={
|
||||||
'month': next_month_str,
|
'month': next_month_str,
|
||||||
'amount': len(npatients),
|
'amount': len(npatients),
|
||||||
|
@ -181,7 +182,8 @@ class ReportHDCaseSummary(Model):
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
'new_patient_lines': new_patient_lines,
|
'new_patient_lines': new_patient_lines,
|
||||||
'resign_patient_lines': resign_patient_lines,
|
'resign_patient_lines': resign_patient_lines,
|
||||||
'company_name': company_name,
|
'company_name': company.name or "",
|
||||||
|
'parent_company_name': company.parent_id.name or "",
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
ใบสรุปการทำ Hemodialysis
|
ใบสรุปการทำ Hemodialysis
|
||||||
</h2>
|
</h2>
|
||||||
<h3>
|
<h3>
|
||||||
ศูนย์ไตเทียมราชวัตร {{company_name}}<br/>
|
{{parent_company_name}} {{company_name}}<br/>
|
||||||
</h3>
|
</h3>
|
||||||
<h4>
|
<h4>
|
||||||
ประจำเดือน {{month}} {{year}}
|
ประจำเดือน {{month}} {{year}}
|
||||||
|
|
Loading…
Reference in New Issue