merge
commit
0cea376105
|
@ -4,5 +4,6 @@
|
||||||
<field name="model">clinic.report.cycle.item</field>
|
<field name="model">clinic.report.cycle.item</field>
|
||||||
<field name="report_template">report_cycle_item</field>
|
<field name="report_template">report_cycle_item</field>
|
||||||
<field name="report_template_xls">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>
|
<field name="menu">clinic_menu</field>
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
<field name="model">clinic.report.hd.case.summary</field>
|
<field name="model">clinic.report.hd.case.summary</field>
|
||||||
<field name="report_template">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="report_template_xls">report_hd_case_summary</field>
|
||||||
|
<field name="export_pdf">1</field>
|
||||||
<field name="menu">clinic_menu</field>
|
<field name="menu">clinic_menu</field>
|
||||||
</action>
|
</action>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<item string="Visit Board" action="clinic_visit_board"/>
|
<item string="Visit Board" action="clinic_visit_board"/>
|
||||||
<divider/>
|
<divider/>
|
||||||
<item string="New Visit" action="clinic_visit" action_options="mode=form"/>
|
<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>
|
||||||
<item string="HD Cases" perm="clinic_hdcase">
|
<item string="HD Cases" perm="clinic_hdcase">
|
||||||
<item string="HD Cases" action="clinic_hd_case"/>
|
<item string="HD Cases" action="clinic_hd_case"/>
|
||||||
|
|
|
@ -5,7 +5,4 @@
|
||||||
<field name="hdcase_type" required="1" span="2"/>
|
<field name="hdcase_type" required="1" span="2"/>
|
||||||
<field name="branch_id" onchange="onchange_branch" span="2"/>
|
<field name="branch_id" onchange="onchange_branch" span="2"/>
|
||||||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
||||||
<foot>
|
|
||||||
<button string="Export PDF" method="export_pdf"/>
|
|
||||||
</foot>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -121,8 +121,10 @@ class HDCase(Model):
|
||||||
if categ.parent_id:
|
if categ.parent_id:
|
||||||
if categ.parent_id.code=='MDC':
|
if categ.parent_id.code=='MDC':
|
||||||
name=prod.name or ""
|
name=prod.name or ""
|
||||||
name=name.split("-")
|
#name=name.split("-")
|
||||||
name=name[0].title()
|
name=name.replace("-SSO","")
|
||||||
|
name=name.title()
|
||||||
|
#name=name[0].title()
|
||||||
if reimbursable_ctx:
|
if reimbursable_ctx:
|
||||||
if reimbursable_ctx==line.reimbursable:
|
if reimbursable_ctx==line.reimbursable:
|
||||||
mdc+=amt
|
mdc+=amt
|
||||||
|
|
|
@ -140,7 +140,8 @@ class ReportCycleItem(Model):
|
||||||
'pid': patient.id or '',
|
'pid': patient.id or '',
|
||||||
'hn': patient.hn_no,
|
'hn': patient.hn_no,
|
||||||
'did': doctor.id,
|
'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,
|
'date': hdcase.date,
|
||||||
'epo': hdcase.epo,
|
'epo': hdcase.epo,
|
||||||
'mdc': hdcase.mdc,
|
'mdc': hdcase.mdc,
|
||||||
|
@ -187,7 +188,7 @@ class ReportCycleItem(Model):
|
||||||
if key not in dates.keys():
|
if key not in dates.keys():
|
||||||
no=1
|
no=1
|
||||||
count=0
|
count=0
|
||||||
sub_fee=0
|
sub_fee=1
|
||||||
sub_mdc=0
|
sub_mdc=0
|
||||||
for x in lines:
|
for x in lines:
|
||||||
if x['cseq']==line['cseq'] and x['date']==date:
|
if x['cseq']==line['cseq'] and x['date']==date:
|
||||||
|
@ -219,6 +220,7 @@ class ReportCycleItem(Model):
|
||||||
if no==count:
|
if no==count:
|
||||||
nlines.append({
|
nlines.append({
|
||||||
'sub': 'show',
|
'sub': 'show',
|
||||||
|
'sub_txt': 'รวม',
|
||||||
'row_color': '#dfdfdf',
|
'row_color': '#dfdfdf',
|
||||||
'no': count,
|
'no': count,
|
||||||
'fee': sub_fee,
|
'fee': sub_fee,
|
||||||
|
|
|
@ -105,6 +105,12 @@ class ReportHDCaseSummary(Model):
|
||||||
dom=dom.replace("True","true")
|
dom=dom.replace("True","true")
|
||||||
return dom.replace("'","\"")
|
return dom.replace("'","\"")
|
||||||
|
|
||||||
|
def rzero(n):
|
||||||
|
if not n:
|
||||||
|
return ''
|
||||||
|
n="{0:,.0f}".format(n)
|
||||||
|
return n
|
||||||
|
|
||||||
def set_default(dom=[],topic='topic1'):
|
def set_default(dom=[],topic='topic1'):
|
||||||
dom_txt=''
|
dom_txt=''
|
||||||
for f,op,v in dom:
|
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']
|
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
|
||||||
item_vals={
|
item_vals={
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'qty': "{0:,.0f}".format(qty),
|
'qty': rzero(qty),
|
||||||
'link': 'clinic_report_cycle_item&%s'%dom_txt,
|
'link': 'clinic_report_cycle_item&%s'%dom_txt,
|
||||||
}
|
}
|
||||||
if hdcase_type!='completed':
|
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']
|
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
|
||||||
items[topic]={
|
items[topic]={
|
||||||
'month': prev_month_str,
|
'month': prev_month_str,
|
||||||
'qty': "{0:,.0f}".format(qty),
|
'qty': rzero(qty),
|
||||||
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
|
'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']
|
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
|
||||||
items[topic]={
|
items[topic]={
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'qty': "{0:,.0f}".format(qty),
|
'qty': rzero(qty),
|
||||||
'action': 'clinic_patient',
|
'action': 'clinic_patient',
|
||||||
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
|
'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']
|
resign_qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
|
||||||
items[topic]={
|
items[topic]={
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'qty': "{0:,.0f}".format(resign_qty),
|
'qty': rzero(resign_qty),
|
||||||
'action': 'clinic_patient',
|
'action': 'clinic_patient',
|
||||||
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
|
'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']
|
total_qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
|
||||||
items[topic]={
|
items[topic]={
|
||||||
'month': next_month_str,
|
'month': next_month_str,
|
||||||
'qty': "{0:,.0f}".format(total_qty),
|
'qty': rzero(total_qty),
|
||||||
'action': 'clinic_patient',
|
'action': 'clinic_patient',
|
||||||
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
|
'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']
|
qty=get_model("clinic.report.hd.case.detail").get_report_data(ids=[],context=ctx)['total']
|
||||||
items[topic]={
|
items[topic]={
|
||||||
'month': '',
|
'month': '',
|
||||||
'qty': "{0:,.0f}".format(qty),
|
'qty': rzero(qty),
|
||||||
'action': 'clinic_patient',
|
'action': 'clinic_patient',
|
||||||
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
|
'link': 'clinic_report_hd_case_detail&%s'%dom_txt,
|
||||||
}
|
}
|
||||||
|
@ -260,6 +266,11 @@ class ReportHDCaseSummary(Model):
|
||||||
elif branch_id:
|
elif branch_id:
|
||||||
branch=get_model("clinic.branch").browse(branch_id)
|
branch=get_model("clinic.branch").browse(branch_id)
|
||||||
sub_name="(%s)" % branch.name or ""
|
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={
|
data={
|
||||||
'hdcase_type': hdcase_type,
|
'hdcase_type': hdcase_type,
|
||||||
'branch_id': branch_id,
|
'branch_id': branch_id,
|
||||||
|
@ -267,13 +278,16 @@ class ReportHDCaseSummary(Model):
|
||||||
'date_from': date_from,
|
'date_from': date_from,
|
||||||
'date_to': date_to,
|
'date_to': date_to,
|
||||||
'date': date,
|
'date': date,
|
||||||
|
'date_print': date_print,
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'year': year,
|
'year': year,
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
'recent_patients': get_model("clinic.report.recent.patient").get_report_data(ids=[],context=context)['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'],
|
'resign_patients': get_model("clinic.report.discontinue.patient").get_report_data(ids=[],context=context)['lines'],
|
||||||
'medicals': medicals['lines'],
|
'medicals': medical_lines,
|
||||||
'titles': medicals['titles'],
|
'titles': medical_titles,
|
||||||
|
'plines': plines,
|
||||||
|
'prod_titles': prod_titles,
|
||||||
'company_name': '%s %s'% (company.name or "", sub_name),
|
'company_name': '%s %s'% (company.name or "", sub_name),
|
||||||
'parent_company_name': company.parent_id.name or "",
|
'parent_company_name': company.parent_id.name or "",
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,26 +131,42 @@ class ReportMedicalSummary(Model):
|
||||||
products[prod_code][patient_type_id]['qty']+=line.qty
|
products[prod_code][patient_type_id]['qty']+=line.qty
|
||||||
|
|
||||||
lines=[]
|
lines=[]
|
||||||
limit=25
|
limit_char=25
|
||||||
titles=[{'name': 'ชื่อยา'}]
|
titles=[{'name': 'ชื่อยา'}]
|
||||||
|
prod_titles={}
|
||||||
for patient_type_id,type_name in sorted(patient_types.items(), key=lambda x: x[0]):
|
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({
|
titles.append({
|
||||||
'name':type_name,
|
'name':type_name,
|
||||||
})
|
})
|
||||||
for prod, records in products.items():
|
|
||||||
prod_name=records[patient_type_id]['name'] or ""
|
plines=[]
|
||||||
prod_name_org=records[patient_type_id]['name'] or ""
|
def rzero(n):
|
||||||
prod_name=len(prod_name) > limit and '%s...' %prod_name[0:limit] or prod_name
|
if not n:
|
||||||
|
return ''
|
||||||
|
n="{0:,.0f}".format(n)
|
||||||
|
return n
|
||||||
|
|
||||||
|
for prod, prod_vals in products.items():
|
||||||
count=1
|
count=1
|
||||||
total=0.0
|
total=0.0
|
||||||
sub_lines=[]
|
sub_lines=[]
|
||||||
all_ptypes=""
|
all_ptypes=""
|
||||||
prod_id=None
|
prod_id=None
|
||||||
|
pvals={}
|
||||||
for patient_type_id,type_name in sorted(patient_types.items(), key=lambda x: x[0]):
|
for patient_type_id,type_name in sorted(patient_types.items(), key=lambda x: x[0]):
|
||||||
all_ptypes+="%s,"%patient_type_id
|
all_ptypes+="%s,"%patient_type_id
|
||||||
qty=records[patient_type_id]['qty'] or 0
|
qty=prod_vals[patient_type_id]['qty'] or 0
|
||||||
prod_id=records[patient_type_id]['prod_id']
|
|
||||||
|
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={
|
line={
|
||||||
'prod_name': prod_name,
|
'prod_name': prod_name,
|
||||||
'prod_name_org': prod_name_org,
|
'prod_name_org': prod_name_org,
|
||||||
|
@ -177,11 +193,14 @@ class ReportMedicalSummary(Model):
|
||||||
})
|
})
|
||||||
line['sub_lines']=sub_lines
|
line['sub_lines']=sub_lines
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
|
|
||||||
|
pvals[999]=int(total)
|
||||||
|
plines.append(pvals)
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
st=""
|
st=""
|
||||||
for x in line['sub_lines']:
|
for x in line['sub_lines']:
|
||||||
st+='%s'%(x['types'])
|
st+='%s'%(x['types'])
|
||||||
|
|
||||||
titles.append({'name':'รวม'})
|
titles.append({'name':'รวม'})
|
||||||
|
|
||||||
company_id=get_active_company()
|
company_id=get_active_company()
|
||||||
|
@ -203,11 +222,15 @@ class ReportMedicalSummary(Model):
|
||||||
elif branch_id:
|
elif branch_id:
|
||||||
branch=get_model("clinic.branch").browse(branch_id)
|
branch=get_model("clinic.branch").browse(branch_id)
|
||||||
sub_name="(%s)" % branch.name or ""
|
sub_name="(%s)" % branch.name or ""
|
||||||
|
|
||||||
|
plines=sorted(plines,key=lambda x:x['prod_name'])
|
||||||
data={
|
data={
|
||||||
'company_name': '%s %s' % (company.name or "", sub_name),
|
'company_name': '%s %s' % (company.name or "", sub_name),
|
||||||
'parent_company_name': company.parent_id.name or "",
|
'parent_company_name': company.parent_id.name or "",
|
||||||
'titles': titles,
|
'titles': titles,
|
||||||
'lines': lines,
|
'lines': lines,
|
||||||
|
'plines': plines,
|
||||||
|
'prod_titles': prod_titles,
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
'year': year,
|
'year': year,
|
||||||
'report_type': report_type,
|
'report_type': report_type,
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -38,9 +38,6 @@
|
||||||
<td><a href="/ui#name=clinic_patient&active_id={{pid}}&mode=form">{{pname}}</a></td>
|
<td><a href="/ui#name=clinic_patient&active_id={{pid}}&mode=form">{{pname}}</a></td>
|
||||||
<td><a href="/ui#name=clinic_staff&active_id={{did}}&mode=form">{{dname}}</a></td>
|
<td><a href="/ui#name=clinic_staff&active_id={{did}}&mode=form">{{dname}}</a></td>
|
||||||
<td><a href="/ui#name=clinic_patient_type&active_id={{tid}}&mode=form">{{tname}}</a></td>
|
<td><a href="/ui#name=clinic_patient_type&active_id={{tid}}&mode=form">{{tname}}</a></td>
|
||||||
<!--
|
|
||||||
<td style="text-align:right">{{currency fee zero=""}}</td>
|
|
||||||
-->
|
|
||||||
<td style="text-align:left">{{mdc_name}}</td>
|
<td style="text-align:left">{{mdc_name}}</td>
|
||||||
<td><a href="/ui#name=clinic_dialyzer&active_id={{dlz_id}}&mode=form">{{dlz_name}}</a></td>
|
<td><a href="/ui#name=clinic_dialyzer&active_id={{dlz_id}}&mode=form">{{dlz_name}}</a></td>
|
||||||
<td>{{dlz_use}}</td>
|
<td>{{dlz_use}}</td>
|
||||||
|
|
Loading…
Reference in New Issue