conv_bal
watcha.h 2015-05-27 17:03:31 +07:00
parent d60b077e5d
commit 900ed5f683
2 changed files with 12 additions and 6 deletions

View File

@ -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,
} }