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/report_hd_case_summary.py b/netforce_clinic/models/report_hd_case_summary.py
index 3c08699..ddb8dfe 100644
--- a/netforce_clinic/models/report_hd_case_summary.py
+++ b/netforce_clinic/models/report_hd_case_summary.py
@@ -260,6 +260,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 +272,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..7501c87 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..ff24b7a 100644
Binary files a/netforce_clinic/reports/report_hd_case_summary.xlsx and b/netforce_clinic/reports/report_hd_case_summary.xlsx differ