translate Topic in Report Summary
parent
40f66dc7a2
commit
e5be77bb4d
|
@ -1,4 +1,4 @@
|
||||||
<form model="clinic.translate">
|
<form model="clinic.translate">
|
||||||
<field name="original_string"/>
|
<field name="org"/>
|
||||||
<field name="translate"/>
|
<field name="tr"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<list model="clinic.translate">
|
<list model="clinic.translate">
|
||||||
<field name="original_string"/>
|
<field name="org"/>
|
||||||
<field name="translate"/>
|
<field name="tr"/>
|
||||||
</list>
|
</list>
|
||||||
|
|
|
@ -34,4 +34,4 @@ from . import report_hd_summary
|
||||||
from . import report_hd_madical
|
from . import report_hd_madical
|
||||||
from . import payment
|
from . import payment
|
||||||
from . import input_data
|
from . import input_data
|
||||||
#from . import translate
|
from . import translate
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from netforce.model import Model, fields, get_model
|
from netforce.model import Model, fields, get_model
|
||||||
|
#from netforce.access import get_active_company
|
||||||
|
|
||||||
class ReportHDDetail(Model):
|
class ReportHDDetail(Model):
|
||||||
_name="clinic.report.hd.detail"
|
_name="clinic.report.hd.detail"
|
||||||
|
@ -25,10 +26,16 @@ class ReportHDDetail(Model):
|
||||||
|
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
|
|
||||||
|
# company_id=get_active_company
|
||||||
|
# comp=get_model("company").browse(company_id)
|
||||||
# context=> dict
|
# context=> dict
|
||||||
# inside context => keys => defaults => type => dict
|
# inside context => keys => defaults => type => dict
|
||||||
# dict => key: value => '', 1, [], {}
|
# dict => key: value => '', 1, [], {}
|
||||||
# context['default'] => defaults(dict) => key => inside key => value => '2014-10-22'
|
# context['default'] => defaults(dict) => key => inside key => value => '2014-10-22'
|
||||||
|
for item in get_model("company").search_browse([]):
|
||||||
|
company_name=item.name
|
||||||
|
|
||||||
date_from=time.strftime("%Y-%m-%d")
|
date_from=time.strftime("%Y-%m-%d")
|
||||||
date_to=time.strftime("%Y-%m-%d")
|
date_to=time.strftime("%Y-%m-%d")
|
||||||
# print('date_from ',date_from)
|
# print('date_from ',date_from)
|
||||||
|
@ -149,6 +156,7 @@ class ReportHDDetail(Model):
|
||||||
'same_date': date_from==date_to,
|
'same_date': date_from==date_to,
|
||||||
'date_from': date_from,
|
'date_from': date_from,
|
||||||
'date_to': date_to,
|
'date_to': date_to,
|
||||||
|
'company_name': company_name,
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import time
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from calendar import monthrange
|
from calendar import monthrange
|
||||||
from netforce.model import Model,fields
|
from netforce.model import Model,fields,get_model
|
||||||
|
|
||||||
class ReportHDMadical(Model):
|
class ReportHDMadical(Model):
|
||||||
_name="clinic.report.hd.madical"
|
_name="clinic.report.hd.madical"
|
||||||
|
@ -18,6 +18,10 @@ class ReportHDMadical(Model):
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
|
|
||||||
|
for item in get_model("company").search_browse([]):
|
||||||
|
company_name=item.name
|
||||||
|
|
||||||
date=datetime.now().strftime("%Y-%m-%d")
|
date=datetime.now().strftime("%Y-%m-%d")
|
||||||
#datemonth=datetime.now().strftime("%m")
|
#datemonth=datetime.now().strftime("%m")
|
||||||
if ids:
|
if ids:
|
||||||
|
@ -147,6 +151,7 @@ class ReportHDMadical(Model):
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'year': year,
|
'year': year,
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
|
'company_name': company_name,
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import time
|
||||||
from datetime import datetime
|
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.access import get_active_company
|
||||||
|
|
||||||
class ReportHDSummary(Model):
|
class ReportHDSummary(Model):
|
||||||
_name="clinic.report.hd.summary"
|
_name="clinic.report.hd.summary"
|
||||||
|
@ -14,10 +15,16 @@ class ReportHDSummary(Model):
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults={
|
_defaults={
|
||||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_report_data(self,ids,context={}):
|
def get_report_data(self,ids,context={}):
|
||||||
|
# company_id=get_active_company
|
||||||
|
# company_name=get_model("company").search("name")
|
||||||
|
# company_name=get_model("company").search_browse()
|
||||||
|
for item in get_model("company").search_browse([]):
|
||||||
|
company_name=item.name
|
||||||
|
|
||||||
date=datetime.now().strftime("%Y-%m-%d")
|
date=datetime.now().strftime("%Y-%m-%d")
|
||||||
dom=[]
|
dom=[]
|
||||||
if ids:
|
if ids:
|
||||||
|
@ -40,8 +47,7 @@ class ReportHDSummary(Model):
|
||||||
previous_month = 12
|
previous_month = 12
|
||||||
#tip previous_month=str(month-1 == 0 and 12 or month)
|
#tip previous_month=str(month-1 == 0 and 12 or month)
|
||||||
previous_month_str=datetime.strptime('%s'%previous_month,'%m').strftime("%B")
|
previous_month_str=datetime.strptime('%s'%previous_month,'%m').strftime("%B")
|
||||||
|
|
||||||
|
|
||||||
time_start='2014-%s-01'%(month) # 2014-10-20
|
time_start='2014-%s-01'%(month) # 2014-10-20
|
||||||
time_stop='2014-%s-%s'%(month,total_day)
|
time_stop='2014-%s-%s'%(month,total_day)
|
||||||
|
|
||||||
|
@ -51,11 +57,12 @@ class ReportHDSummary(Model):
|
||||||
|
|
||||||
patients=get_model("clinic.patient").search_browse(['type','=','All'])
|
patients=get_model("clinic.patient").search_browse(['type','=','All'])
|
||||||
new_patients=len(patients)
|
new_patients=len(patients)
|
||||||
|
|
||||||
patients_mg=get_model("clinic.patient").search_browse(['type','=','mg'])
|
patients_mg=get_model("clinic.patient").search_browse(['type','=','mg'])
|
||||||
patients_sc=get_model("clinic.patient").search_browse(['type','=','sc'])
|
patients_sc=get_model("clinic.patient").search_browse(['type','=','sc'])
|
||||||
patients_nhso=get_model("clinic.patient").search_browse(['type','=','nhso'])
|
patients_nhso=get_model("clinic.patient").search_browse(['type','=','nhso'])
|
||||||
patients_pn=get_model("clinic.patient").search_browse(['type','=','personal'])
|
patients_pn=get_model("clinic.patient").search_browse(['type','=','personal'])
|
||||||
|
|
||||||
dom=[]
|
dom=[]
|
||||||
dom.append(['state','=','completed'])
|
dom.append(['state','=','completed'])
|
||||||
dom.append(['time_start','>=',time_start])
|
dom.append(['time_start','>=',time_start])
|
||||||
|
@ -66,84 +73,91 @@ class ReportHDSummary(Model):
|
||||||
time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20
|
time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20
|
||||||
time_stop_pre='2014-%s-%s'%(previous_month,prev_total_day)
|
time_stop_pre='2014-%s-%s'%(previous_month,prev_total_day)
|
||||||
|
|
||||||
dom=[]
|
dom=[]
|
||||||
dom.append(['state','=','completed'])
|
dom.append(['state','=','completed'])
|
||||||
dom.append(['time_start','>=',time_start_pre])
|
dom.append(['time_start','>=',time_start_pre])
|
||||||
dom.append(['time_stop','<=',time_stop_pre])
|
dom.append(['time_stop','<=',time_stop_pre])
|
||||||
prev_total_case=len(get_model("clinic.hd.case").search(dom))
|
prev_total_case=len(get_model("clinic.hd.case").search(dom))
|
||||||
|
items={
|
||||||
lines=[
|
'topic1': {
|
||||||
{
|
|
||||||
'topic': 'The number of times the Hemodialysis',
|
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'amount': cur_total_case,
|
'amount': cur_total_case,
|
||||||
'date_from': time_start,
|
'date_from': time_start,
|
||||||
'date_to': time_stop,
|
'date_to': time_stop,
|
||||||
},
|
},
|
||||||
|
'topic2':
|
||||||
{
|
{
|
||||||
'topic':'The number of cases brought',
|
|
||||||
'month': previous_month_str,
|
'month': previous_month_str,
|
||||||
'amount': prev_total_case,
|
'amount': prev_total_case,
|
||||||
'date_from': time_start_pre,
|
'date_from': time_start_pre,
|
||||||
'date_to': time_stop_pre,
|
'date_to': time_stop_pre,
|
||||||
},
|
},
|
||||||
|
'topic3':
|
||||||
{
|
{
|
||||||
'topic':'Number of new patients',
|
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'amount': new_patients,
|
'amount': new_patients,
|
||||||
'date_from': time_start,
|
'date_from': time_start,
|
||||||
'date_to': time_stop,
|
'date_to': time_stop,
|
||||||
},
|
},
|
||||||
|
'topic4':
|
||||||
{
|
{
|
||||||
'topic':'Number of patients discharged',
|
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'amount': 'N/A',
|
'amount': 'N/A',
|
||||||
'date_from': time_start,
|
'date_from': time_start,
|
||||||
'date_to': time_stop,
|
'date_to': time_stop,
|
||||||
},
|
},
|
||||||
|
'topic5':
|
||||||
{
|
{
|
||||||
'topic':'The number of cases brought',
|
|
||||||
'month': next_month_str,
|
'month': next_month_str,
|
||||||
'amount': 'N/A',
|
'amount': 'N/A',
|
||||||
'date_from': time_start,
|
'date_from': time_start,
|
||||||
'date_to': time_stop,
|
'date_to': time_stop,
|
||||||
},
|
},
|
||||||
|
'topic6':
|
||||||
{
|
{
|
||||||
'topic':'Number of patients withdrawn Social Security',
|
|
||||||
'month': '',
|
'month': '',
|
||||||
'amount': len(patients_sc),
|
'amount': len(patients_sc),
|
||||||
'date_from': "",
|
'date_from': "",
|
||||||
'date_to': "",
|
'date_to': "",
|
||||||
},
|
},
|
||||||
|
'topic7':
|
||||||
{
|
{
|
||||||
'topic':'Number of patients withdrawn Medical Government',
|
|
||||||
'month':'',
|
'month':'',
|
||||||
'amount': len(patients_mg),
|
'amount': len(patients_mg),
|
||||||
'date_from': "",
|
'date_from': "",
|
||||||
'date_to': "",
|
'date_to': "",
|
||||||
},
|
},
|
||||||
|
'topic8':
|
||||||
{
|
{
|
||||||
'topic':'Number of patients withdrawn NHSO(30B)',
|
|
||||||
'month':'',
|
'month':'',
|
||||||
'amount': len(patients_nhso),
|
'amount': len(patients_nhso),
|
||||||
'date_from': "",
|
'date_from': "",
|
||||||
'date_to': "",
|
'date_to': "",
|
||||||
},
|
},
|
||||||
|
'topic9':
|
||||||
{
|
{
|
||||||
'topic':'Many patients pay themselves',
|
|
||||||
'month': '',
|
'month': '',
|
||||||
'amount': len(patients_pn),
|
'amount': len(patients_pn),
|
||||||
'date_from': "",
|
'date_from': "",
|
||||||
'date_to': "",
|
'date_to': "",
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
|
lines=[]
|
||||||
|
for item in get_model("clinic.translate").search_browse([]):
|
||||||
|
topic=item.org
|
||||||
|
line=items.get(topic,{})
|
||||||
|
line['topic']=item.tr
|
||||||
|
lines.append(line)
|
||||||
|
|
||||||
data={
|
data={
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'year': year,
|
'year': year,
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
|
'company_name': company_name,
|
||||||
}
|
}
|
||||||
#print("data", data)
|
print("data", data)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
ReportHDSummary.register()
|
ReportHDSummary.register()
|
||||||
|
|
|
@ -3,10 +3,10 @@ from netforce.model import Model, fields
|
||||||
class Translate(Model):
|
class Translate(Model):
|
||||||
_name="clinic.translate"
|
_name="clinic.translate"
|
||||||
_string="Translate"
|
_string="Translate"
|
||||||
|
_field_name="org"
|
||||||
_fields={
|
_fields={
|
||||||
"original_string": fields.Char("original_string","Original String",required=True,search=True),
|
"org": fields.Char("Original String",required=True,search=True),
|
||||||
"translate": fields.Char("translate","Translate"),
|
"tr": fields.Char("Translate"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
<center>
|
<center>
|
||||||
<h2>Detail of the Hemodialysis</h2>
|
<h2>Detail of the Hemodialysis</h2>
|
||||||
<h3>Clinic [Ratchawat]</h3>
|
<h3>[{{company_name}}]</h3>
|
||||||
<h4>
|
<h4>
|
||||||
{{#if same_date}}
|
{{#if same_date}}
|
||||||
As at {{fmt_date date_from}}
|
As at {{fmt_date date_from}}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Summary of the Madical
|
Summary of the Madical
|
||||||
</h2>
|
</h2>
|
||||||
<h3>
|
<h3>
|
||||||
[Ratchawat : Saamsan4]<br/>
|
[{{company_name}}]<br/>
|
||||||
As at {{month}} {{year}}
|
As at {{month}} {{year}}
|
||||||
</h3>
|
</h3>
|
||||||
</center>
|
</center>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Summary of the Hemodialysis
|
Summary of the Hemodialysis
|
||||||
</h2>
|
</h2>
|
||||||
<h3>
|
<h3>
|
||||||
[Ratchawat : Saamsan4]<br/>
|
[{{company_name}}]<br/>
|
||||||
As at {{month}} {{year}}
|
As at {{month}} {{year}}
|
||||||
</h3>
|
</h3>
|
||||||
</center>
|
</center>
|
||||||
|
|
Loading…
Reference in New Issue