diff --git a/netforce_clinic/actions/clinic_report_cycle_item.xml b/netforce_clinic/actions/clinic_report_cycle_item.xml
index 2392ba9..41d944c 100644
--- a/netforce_clinic/actions/clinic_report_cycle_item.xml
+++ b/netforce_clinic/actions/clinic_report_cycle_item.xml
@@ -4,5 +4,6 @@
clinic.report.cycle.item
report_cycle_item
report_cycle_item
+ 1
clinic_menu
diff --git a/netforce_clinic/actions/clinic_report_hd_case_summary.xml b/netforce_clinic/actions/clinic_report_hd_case_summary.xml
index 8ace14b..79241c0 100644
--- a/netforce_clinic/actions/clinic_report_hd_case_summary.xml
+++ b/netforce_clinic/actions/clinic_report_hd_case_summary.xml
@@ -4,5 +4,6 @@
clinic.report.hd.case.summary
report_hd_case_summary
report_hd_case_summary
+ 1
clinic_menu
diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml
index d400c2a..4f3b2e6 100644
--- a/netforce_clinic/layouts/clinic_menu.xml
+++ b/netforce_clinic/layouts/clinic_menu.xml
@@ -37,7 +37,7 @@
-
+
-
diff --git a/netforce_clinic/layouts/clinic_report_hd_case_summary.xml b/netforce_clinic/layouts/clinic_report_hd_case_summary.xml
index 7fe0860..da9f5e0 100644
--- a/netforce_clinic/layouts/clinic_report_hd_case_summary.xml
+++ b/netforce_clinic/layouts/clinic_report_hd_case_summary.xml
@@ -5,7 +5,4 @@
-
-
-
diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py
index 4205754..35a64b8 100644
--- a/netforce_clinic/models/hd_case.py
+++ b/netforce_clinic/models/hd_case.py
@@ -121,8 +121,10 @@ class HDCase(Model):
if categ.parent_id:
if categ.parent_id.code=='MDC':
name=prod.name or ""
- name=name.split("-")
- name=name[0].title()
+ #name=name.split("-")
+ name=name.replace("-SSO","")
+ name=name.title()
+ #name=name[0].title()
if reimbursable_ctx:
if reimbursable_ctx==line.reimbursable:
mdc+=amt
diff --git a/netforce_clinic/models/report_cycle_item.py b/netforce_clinic/models/report_cycle_item.py
index 7b717e6..a0e5f6f 100644
--- a/netforce_clinic/models/report_cycle_item.py
+++ b/netforce_clinic/models/report_cycle_item.py
@@ -140,7 +140,8 @@ class ReportCycleItem(Model):
'pid': patient.id or '',
'hn': patient.hn_no,
'did': doctor.id,
- 'dname': doctor.name or "",
+ #'dname': doctor.name or "",
+ 'dname': '%s %s'%(doctor.first_name or "", doctor.last_name or ""),
'date': hdcase.date,
'epo': hdcase.epo,
'mdc': hdcase.mdc,
@@ -187,7 +188,7 @@ class ReportCycleItem(Model):
if key not in dates.keys():
no=1
count=0
- sub_fee=0
+ sub_fee=1
sub_mdc=0
for x in lines:
if x['cseq']==line['cseq'] and x['date']==date:
@@ -219,6 +220,7 @@ class ReportCycleItem(Model):
if no==count:
nlines.append({
'sub': 'show',
+ 'sub_txt': 'รวม',
'row_color': '#dfdfdf',
'no': count,
'fee': sub_fee,
diff --git a/netforce_clinic/models/report_hd_case_summary.py b/netforce_clinic/models/report_hd_case_summary.py
index 3c08699..0bc4396 100644
--- a/netforce_clinic/models/report_hd_case_summary.py
+++ b/netforce_clinic/models/report_hd_case_summary.py
@@ -105,6 +105,12 @@ class ReportHDCaseSummary(Model):
dom=dom.replace("True","true")
return dom.replace("'","\"")
+ def rzero(n):
+ if not n:
+ return ''
+ n="{0:,.0f}".format(n)
+ return n
+
def set_default(dom=[],topic='topic1'):
dom_txt=''
for f,op,v in dom:
@@ -154,7 +160,7 @@ class ReportHDCaseSummary(Model):
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
item_vals={
'month': month_str,
- 'qty': "{0:,.0f}".format(qty),
+ 'qty': rzero(qty),
'link': 'clinic_report_cycle_item&%s'%dom_txt,
}
if hdcase_type!='completed':
@@ -169,7 +175,7 @@ class ReportHDCaseSummary(Model):
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
items[topic]={
'month': prev_month_str,
- 'qty': "{0:,.0f}".format(qty),
+ 'qty': rzero(qty),
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
}
@@ -180,7 +186,7 @@ class ReportHDCaseSummary(Model):
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
items[topic]={
'month': month_str,
- 'qty': "{0:,.0f}".format(qty),
+ 'qty': rzero(qty),
'action': 'clinic_patient',
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
}
@@ -192,7 +198,7 @@ class ReportHDCaseSummary(Model):
resign_qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
items[topic]={
'month': month_str,
- 'qty': "{0:,.0f}".format(resign_qty),
+ 'qty': rzero(resign_qty),
'action': 'clinic_patient',
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
}
@@ -203,7 +209,7 @@ class ReportHDCaseSummary(Model):
total_qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
items[topic]={
'month': next_month_str,
- 'qty': "{0:,.0f}".format(total_qty),
+ 'qty': rzero(total_qty),
'action': 'clinic_patient',
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
}
@@ -224,7 +230,7 @@ class ReportHDCaseSummary(Model):
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
items[topic]={
'month': '',
- 'qty': "{0:,.0f}".format(qty),
+ 'qty': rzero(qty),
'action': 'clinic_patient',
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
}
@@ -260,6 +266,11 @@ class ReportHDCaseSummary(Model):
elif branch_id:
branch=get_model("clinic.branch").browse(branch_id)
sub_name="(%s)" % branch.name or ""
+ medical_lines=medicals['lines']
+ medical_titles=medicals['titles']
+ plines=medicals['plines']
+ prod_titles=medicals['prod_titles']
+ date_print=time.strftime("%m/%d/%Y %H:%M:%S")
data={
'hdcase_type': hdcase_type,
'branch_id': branch_id,
@@ -267,13 +278,16 @@ class ReportHDCaseSummary(Model):
'date_from': date_from,
'date_to': date_to,
'date': date,
+ 'date_print': date_print,
'month': month_str,
'year': year,
'lines': lines,
'recent_patients': get_model("clinic.report.recent.patient").get_report_data(ids=[],context=context)['lines'],
'resign_patients': get_model("clinic.report.discontinue.patient").get_report_data(ids=[],context=context)['lines'],
- 'medicals': medicals['lines'],
- 'titles': medicals['titles'],
+ 'medicals': medical_lines,
+ 'titles': medical_titles,
+ 'plines': plines,
+ 'prod_titles': prod_titles,
'company_name': '%s %s'% (company.name or "", sub_name),
'parent_company_name': company.parent_id.name or "",
}
diff --git a/netforce_clinic/models/report_medical_summary.py b/netforce_clinic/models/report_medical_summary.py
index 4382ffb..9110b4b 100644
--- a/netforce_clinic/models/report_medical_summary.py
+++ b/netforce_clinic/models/report_medical_summary.py
@@ -131,26 +131,42 @@ class ReportMedicalSummary(Model):
products[prod_code][patient_type_id]['qty']+=line.qty
lines=[]
- limit=25
+ limit_char=25
titles=[{'name': 'ชื่อยา'}]
+ prod_titles={}
for patient_type_id,type_name in sorted(patient_types.items(), key=lambda x: x[0]):
+ prod_titles.update({patient_type_id: type_name})
titles.append({
'name':type_name,
})
- for prod, records in products.items():
- prod_name=records[patient_type_id]['name'] or ""
- prod_name_org=records[patient_type_id]['name'] or ""
- prod_name=len(prod_name) > limit and '%s...' %prod_name[0:limit] or prod_name
+
+ plines=[]
+ def rzero(n):
+ if not n:
+ return ''
+ n="{0:,.0f}".format(n)
+ return n
+ for prod, prod_vals in products.items():
count=1
total=0.0
sub_lines=[]
all_ptypes=""
prod_id=None
+ pvals={}
for patient_type_id,type_name in sorted(patient_types.items(), key=lambda x: x[0]):
all_ptypes+="%s,"%patient_type_id
- qty=records[patient_type_id]['qty'] or 0
- prod_id=records[patient_type_id]['prod_id']
+ qty=prod_vals[patient_type_id]['qty'] or 0
+
+ prod_id=prod_vals[patient_type_id]['prod_id']
+ prod_name=prod_vals[patient_type_id]['name'] or ""
+ prod_name_org=prod_vals[patient_type_id]['name'] or ""
+ prod_name=len(prod_name) > limit_char and '%s...' %prod_name[0:limit_char] or prod_name
+
+ pvals.update({
+ 'prod_name': prod_name,
+ patient_type_id : rzero(qty),
+ })
line={
'prod_name': prod_name,
'prod_name_org': prod_name_org,
@@ -177,11 +193,14 @@ class ReportMedicalSummary(Model):
})
line['sub_lines']=sub_lines
lines.append(line)
+
+ pvals[999]=int(total)
+ plines.append(pvals)
+
for line in lines:
st=""
for x in line['sub_lines']:
st+='%s'%(x['types'])
-
titles.append({'name':'รวม'})
company_id=get_active_company()
@@ -203,11 +222,15 @@ class ReportMedicalSummary(Model):
elif branch_id:
branch=get_model("clinic.branch").browse(branch_id)
sub_name="(%s)" % branch.name or ""
+
+ plines=sorted(plines,key=lambda x:x['prod_name'])
data={
'company_name': '%s %s' % (company.name or "", sub_name),
'parent_company_name': company.parent_id.name or "",
'titles': titles,
'lines': lines,
+ 'plines': plines,
+ 'prod_titles': prod_titles,
'month': month_str,
'year': year,
'report_type': report_type,
diff --git a/netforce_clinic/reports/report_cycle_item.xlsx b/netforce_clinic/reports/report_cycle_item.xlsx
index 742a7e1..9822a05 100644
Binary files a/netforce_clinic/reports/report_cycle_item.xlsx and b/netforce_clinic/reports/report_cycle_item.xlsx differ
diff --git a/netforce_clinic/reports/report_hd_case_summary.xlsx b/netforce_clinic/reports/report_hd_case_summary.xlsx
index cecbfa2..511bf47 100644
Binary files a/netforce_clinic/reports/report_hd_case_summary.xlsx and b/netforce_clinic/reports/report_hd_case_summary.xlsx differ
diff --git a/netforce_clinic/templates/report_cycle_item.hbs b/netforce_clinic/templates/report_cycle_item.hbs
index b2295d7..cae8a03 100644
--- a/netforce_clinic/templates/report_cycle_item.hbs
+++ b/netforce_clinic/templates/report_cycle_item.hbs
@@ -38,9 +38,6 @@
{{pname}} |
{{dname}} |
{{tname}} |
-
{{mdc_name}} |
{{dlz_name}} |
{{dlz_use}} |