translate Topic in Report Summary

conv_bal
chayut.s 2014-10-21 18:22:48 +07:00
parent 40f66dc7a2
commit e5be77bb4d
11 changed files with 58 additions and 31 deletions

View File

@ -1,4 +1,4 @@
<form model="clinic.translate">
<field name="original_string"/>
<field name="translate"/>
<field name="org"/>
<field name="tr"/>
</form>

View File

@ -1,4 +1,4 @@
<list model="clinic.translate">
<field name="original_string"/>
<field name="translate"/>
<field name="org"/>
<field name="tr"/>
</list>

View File

@ -34,4 +34,4 @@ from . import report_hd_summary
from . import report_hd_madical
from . import payment
from . import input_data
#from . import translate
from . import translate

View File

@ -1,6 +1,7 @@
import time
from netforce.model import Model, fields, get_model
#from netforce.access import get_active_company
class ReportHDDetail(Model):
_name="clinic.report.hd.detail"
@ -25,10 +26,16 @@ class ReportHDDetail(Model):
def get_report_data(self,ids,context={}):
# company_id=get_active_company
# comp=get_model("company").browse(company_id)
# context=> dict
# inside context => keys => defaults => type => dict
# dict => key: value => '', 1, [], {}
# 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_to=time.strftime("%Y-%m-%d")
# print('date_from ',date_from)
@ -149,6 +156,7 @@ class ReportHDDetail(Model):
'same_date': date_from==date_to,
'date_from': date_from,
'date_to': date_to,
'company_name': company_name,
}
return data

View File

@ -2,7 +2,7 @@ import time
from datetime import datetime
from calendar import monthrange
from netforce.model import Model,fields
from netforce.model import Model,fields,get_model
class ReportHDMadical(Model):
_name="clinic.report.hd.madical"
@ -18,6 +18,10 @@ class ReportHDMadical(Model):
}
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")
#datemonth=datetime.now().strftime("%m")
if ids:
@ -147,6 +151,7 @@ class ReportHDMadical(Model):
'month': month_str,
'year': year,
'lines': lines,
'company_name': company_name,
}
return data

View File

@ -3,6 +3,7 @@ import time
from datetime import datetime
from calendar import monthrange
from netforce.model import Model, fields, get_model
#from netforce.access import get_active_company
class ReportHDSummary(Model):
_name="clinic.report.hd.summary"
@ -14,10 +15,16 @@ class ReportHDSummary(Model):
}
_defaults={
'date': lambda *a: time.strftime("%Y-%m-%d"),
'date': lambda *a: time.strftime("%Y-%m-%d"),
}
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")
dom=[]
if ids:
@ -40,8 +47,7 @@ class ReportHDSummary(Model):
previous_month = 12
#tip previous_month=str(month-1 == 0 and 12 or month)
previous_month_str=datetime.strptime('%s'%previous_month,'%m').strftime("%B")
time_start='2014-%s-01'%(month) # 2014-10-20
time_stop='2014-%s-%s'%(month,total_day)
@ -51,11 +57,12 @@ class ReportHDSummary(Model):
patients=get_model("clinic.patient").search_browse(['type','=','All'])
new_patients=len(patients)
patients_mg=get_model("clinic.patient").search_browse(['type','=','mg'])
patients_sc=get_model("clinic.patient").search_browse(['type','=','sc'])
patients_nhso=get_model("clinic.patient").search_browse(['type','=','nhso'])
patients_pn=get_model("clinic.patient").search_browse(['type','=','personal'])
dom=[]
dom.append(['state','=','completed'])
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_stop_pre='2014-%s-%s'%(previous_month,prev_total_day)
dom=[]
dom=[]
dom.append(['state','=','completed'])
dom.append(['time_start','>=',time_start_pre])
dom.append(['time_stop','<=',time_stop_pre])
prev_total_case=len(get_model("clinic.hd.case").search(dom))
lines=[
{
'topic': 'The number of times the Hemodialysis',
items={
'topic1': {
'month': month_str,
'amount': cur_total_case,
'date_from': time_start,
'date_to': time_stop,
},
'topic2':
{
'topic':'The number of cases brought',
'month': previous_month_str,
'amount': prev_total_case,
'date_from': time_start_pre,
'date_to': time_stop_pre,
},
'topic3':
{
'topic':'Number of new patients',
'month': month_str,
'amount': new_patients,
'date_from': time_start,
'date_to': time_stop,
},
'topic4':
{
'topic':'Number of patients discharged',
'month': month_str,
'amount': 'N/A',
'date_from': time_start,
'date_to': time_stop,
},
'topic5':
{
'topic':'The number of cases brought',
'month': next_month_str,
'amount': 'N/A',
'date_from': time_start,
'date_to': time_stop,
},
'topic6':
{
'topic':'Number of patients withdrawn Social Security',
'month': '',
'amount': len(patients_sc),
'date_from': "",
'date_to': "",
},
'topic7':
{
'topic':'Number of patients withdrawn Medical Government',
'month':'',
'amount': len(patients_mg),
'date_from': "",
'date_to': "",
},
'topic8':
{
'topic':'Number of patients withdrawn NHSO(30B)',
'month':'',
'amount': len(patients_nhso),
'date_from': "",
'date_to': "",
},
'topic9':
{
'topic':'Many patients pay themselves',
'month': '',
'amount': len(patients_pn),
'date_from': "",
'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={
'month': month_str,
'year': year,
'lines': lines,
'company_name': company_name,
}
#print("data", data)
print("data", data)
return data
ReportHDSummary.register()

View File

@ -3,10 +3,10 @@ from netforce.model import Model, fields
class Translate(Model):
_name="clinic.translate"
_string="Translate"
_field_name="org"
_fields={
"original_string": fields.Char("original_string","Original String",required=True,search=True),
"translate": fields.Char("translate","Translate"),
"org": fields.Char("Original String",required=True,search=True),
"tr": fields.Char("Translate"),
}

View File

@ -1,6 +1,6 @@
<center>
<h2>Detail of the Hemodialysis</h2>
<h3>Clinic [Ratchawat]</h3>
<h3>[{{company_name}}]</h3>
<h4>
{{#if same_date}}
As at {{fmt_date date_from}}

View File

@ -3,7 +3,7 @@
Summary of the Madical
</h2>
<h3>
[Ratchawat : Saamsan4]<br/>
[{{company_name}}]<br/>
As at {{month}} {{year}}
</h3>
</center>

View File

@ -3,7 +3,7 @@
Summary of the Hemodialysis
</h2>
<h3>
[Ratchawat : Saamsan4]<br/>
[{{company_name}}]<br/>
As at {{month}} {{year}}
</h3>
</center>