diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index 9faba75..74810d1 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -28,6 +28,7 @@ + diff --git a/netforce_clinic/layouts/clinic_report_hd_monthly.xml b/netforce_clinic/layouts/clinic_report_hd_monthly.xml deleted file mode 100644 index 7249176..0000000 --- a/netforce_clinic/layouts/clinic_report_hd_monthly.xml +++ /dev/null @@ -1,3 +0,0 @@ -
- - 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 c78517a..ae82cb7 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -36,3 +36,4 @@ from . import fin_setting from . import import_data_mg from . import import_data_nhso from . import import_data_sc +from . import translate diff --git a/netforce_clinic/models/clinic_round.py b/netforce_clinic/models/clinic_round.py deleted file mode 100644 index 40854ec..0000000 --- a/netforce_clinic/models/clinic_round.py +++ /dev/null @@ -1,27 +0,0 @@ -from netforce.model import Model, fields - -class ClinicRound(Model): - _name="clinic.round" - _string="Round" - - _fields={ - "name": fields.Char("Name",required=True,search=True), - } - - def get_data(self,context={}): - lines=[] - for i in range(10): - line={ - 'no': i, - 'doctor': 'Doctor %s'%i, - #...... - } - lines.append(line) - - data={ - 'lines': lines, - } - print('data ', data) - return data - -ClinicRound.register() diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 334b67b..a05c526 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -356,7 +356,7 @@ class HDcase(Model): # XXX if obj.fee_partner_id.account_receivable_id: account_id=obj.fee_partner_id.account_receivable_id.id or account_receivable_id - if not account_receivable_id: + if not account_id: raise Exception("%s not found account recievable %s"%obj.fee_partner_id.name) for line in obj.gm_lines: prod=line.product_id 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..bcbf3d0 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,22 +47,30 @@ 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) dom=[] dom.append(['time_start','>=',time_start]) dom.append(['time_stop','<=',time_stop]) - - 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(['type','=','mg']) + patients_mg=len(get_model("clinic.patient").search(dom)) + dom.append(['type','=','sc']) + patients_sc=len(get_model("clinic.patient").search(dom)) + dom.append(['type','=','nhso']) + patients_nhso=len(get_model("clinic.patient").search(dom)) + dom.append(['type','=','nhso']) + patients_nhso=len(get_model("clinic.patient").search(dom)) + dom.append(['type','=','pn']) + patients_pn=len(get_model("clinic.patient").search(dom)) + + patients=len(get_model("clinic.patient").search_browse(['type','=','All'])) + #new_patients=len(patients) + dom=[] dom.append(['state','=','completed']) dom.append(['time_start','>=',time_start]) @@ -66,84 +81,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, + 'amount': 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': "", + 'amount': patients_sc, + 'date_from': time_start, + 'date_to': time_stop, }, + 'topic7': { - 'topic':'Number of patients withdrawn Medical Government', 'month':'', - 'amount': len(patients_mg), - 'date_from': "", - 'date_to': "", + 'amount': patients_mg, + 'date_from': time_start, + 'date_to': time_stop, }, + 'topic8': { - 'topic':'Number of patients withdrawn NHSO(30B)', 'month':'', - 'amount': len(patients_nhso), - 'date_from': "", - 'date_to': "", + 'amount': patients_nhso, + 'date_from': time_start, + 'date_to': time_stop, }, + 'topic9': { - 'topic':'Many patients pay themselves', 'month': '', - 'amount': len(patients_pn), - 'date_from': "", - 'date_to': "", + 'amount': patients_pn, + 'date_from': time_start, + 'date_to': time_stop, }, - ] + } + + 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_dialy.hbs b/netforce_clinic/templates/report_hd_dialy.hbs deleted file mode 100644 index 5056fd3..0000000 --- a/netforce_clinic/templates/report_hd_dialy.hbs +++ /dev/null @@ -1,84 +0,0 @@ -
-

Summary of the Hemodialysis

-

Clinic [Ratchawat]

-

- {{#if same_date}} - As at {{fmt_date date_from}} - {{else}} - From {{fmt_date date_from}} to {{fmt_date date_to}} - {{/if}} -

-
- - - - - - - - - - - - - - - {{#each lines context=context}} - {{#if show_cycle}} - - - - {{/if}} - - {{#if no_patient}} - - - {{else}} - - - {{/if}} - - - - - - - - {{/each}} - - - - - - -
- Cycle - - Patient - - Doctor - - Patient Type - - HD Fee - - RC.No - - Dialyzer - - Nurse -
- {{cycle}} -
TOTAL{{no_patient}}{{patient}} - {{doctor}} - - {{patient_type}} - - {{total}} - - {{rc_no}} - - {{dialyzer_name}} - - {{nurse}} -
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}}