diff --git a/netforce_clinic/layouts/clinic_translate_form.xml b/netforce_clinic/layouts/clinic_translate_form.xml index 27c8779..1a87471 100644 --- a/netforce_clinic/layouts/clinic_translate_form.xml +++ b/netforce_clinic/layouts/clinic_translate_form.xml @@ -1,4 +1,4 @@
- - + + diff --git a/netforce_clinic/layouts/clinic_translate_list.xml b/netforce_clinic/layouts/clinic_translate_list.xml index 38a44f2..44ae2b1 100644 --- a/netforce_clinic/layouts/clinic_translate_list.xml +++ b/netforce_clinic/layouts/clinic_translate_list.xml @@ -1,4 +1,4 @@ - - + + diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py index 05178af..bd10678 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -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 diff --git a/netforce_clinic/models/report_hd_detail.py b/netforce_clinic/models/report_hd_detail.py index 7d9c63c..d218e18 100644 --- a/netforce_clinic/models/report_hd_detail.py +++ b/netforce_clinic/models/report_hd_detail.py @@ -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 diff --git a/netforce_clinic/models/report_hd_madical.py b/netforce_clinic/models/report_hd_madical.py index b316a13..c2de473 100644 --- a/netforce_clinic/models/report_hd_madical.py +++ b/netforce_clinic/models/report_hd_madical.py @@ -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 diff --git a/netforce_clinic/models/report_hd_summary.py b/netforce_clinic/models/report_hd_summary.py index ca0412e..3cbfdb5 100644 --- a/netforce_clinic/models/report_hd_summary.py +++ b/netforce_clinic/models/report_hd_summary.py @@ -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() diff --git a/netforce_clinic/models/translate.py b/netforce_clinic/models/translate.py index 9ad41b1..716185c 100644 --- a/netforce_clinic/models/translate.py +++ b/netforce_clinic/models/translate.py @@ -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"), } diff --git a/netforce_clinic/reports/report_hd_madical.xlsx b/netforce_clinic/reports/report_hd_madical.xlsx index a802b45..65c30fd 100644 Binary files a/netforce_clinic/reports/report_hd_madical.xlsx and b/netforce_clinic/reports/report_hd_madical.xlsx differ diff --git a/netforce_clinic/templates/report_hd_detail.hbs b/netforce_clinic/templates/report_hd_detail.hbs index f1907a5..19b18ad 100644 --- a/netforce_clinic/templates/report_hd_detail.hbs +++ b/netforce_clinic/templates/report_hd_detail.hbs @@ -1,6 +1,6 @@

Detail of the Hemodialysis

-

Clinic [Ratchawat]

+

[{{company_name}}]

{{#if same_date}} As at {{fmt_date date_from}} diff --git a/netforce_clinic/templates/report_hd_madical.hbs b/netforce_clinic/templates/report_hd_madical.hbs index dabd546..43c24b7 100644 --- a/netforce_clinic/templates/report_hd_madical.hbs +++ b/netforce_clinic/templates/report_hd_madical.hbs @@ -3,7 +3,7 @@ Summary of the Madical

- [Ratchawat : Saamsan4]
+ [{{company_name}}]
As at {{month}} {{year}}

diff --git a/netforce_clinic/templates/report_hd_summary.hbs b/netforce_clinic/templates/report_hd_summary.hbs index 665c8b1..af2deb1 100644 --- a/netforce_clinic/templates/report_hd_summary.hbs +++ b/netforce_clinic/templates/report_hd_summary.hbs @@ -3,7 +3,7 @@ Summary of the Hemodialysis

- [Ratchawat : Saamsan4]
+ [{{company_name}}]
As at {{month}} {{year}}