print pdf
parent
a4787dc4d3
commit
d60b077e5d
|
@ -4,5 +4,6 @@
|
|||
<field name="model">clinic.report.cycle.item</field>
|
||||
<field name="report_template">report_cycle_item</field>
|
||||
<field name="report_template_xls">report_cycle_item</field>
|
||||
<field name="export_pdf">1</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
<field name="model">clinic.report.hd.case.summary</field>
|
||||
<field name="report_template">report_hd_case_summary</field>
|
||||
<field name="report_template_xls">report_hd_case_summary</field>
|
||||
<field name="export_pdf">1</field>
|
||||
<field name="menu">clinic_menu</field>
|
||||
</action>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<item string="Visit Board" action="clinic_visit_board"/>
|
||||
<divider/>
|
||||
<item string="New Visit" action="clinic_visit" action_options="mode=form"/>
|
||||
<item string="Make An Appointment" action="clinic_make_apt"/>
|
||||
<!--<item string="Make An Appointment" action="clinic_make_apt"/>-->
|
||||
</item>
|
||||
<item string="HD Cases" perm="clinic_hdcase">
|
||||
<item string="HD Cases" action="clinic_hd_case"/>
|
||||
|
|
|
@ -5,7 +5,4 @@
|
|||
<field name="hdcase_type" required="1" span="2"/>
|
||||
<field name="branch_id" onchange="onchange_branch" span="2"/>
|
||||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
||||
<foot>
|
||||
<button string="Export PDF" method="export_pdf"/>
|
||||
</foot>
|
||||
</form>
|
||||
|
|
|
@ -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 "",
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue