[improve] report hdcase expense summary

dev
SPP 2018-01-15 16:59:59 +07:00
parent 38d1e14840
commit 1da7c956f0
2 changed files with 3 additions and 2 deletions

View File

@ -316,7 +316,8 @@ class ReportHDCaseExpenseSummary(Model):
no+=1 no+=1
types=[] types=[]
total_qty=0 total_qty=0
for name, vals in ptypes.items(): for name in sorted(ptypes.keys()):
vals=ptypes[name]
qty=vals['qty'] or 0 qty=vals['qty'] or 0
total_qty+=qty total_qty+=qty
color=vals['color'] or "default" color=vals['color'] or "default"
@ -332,7 +333,7 @@ class ReportHDCaseExpenseSummary(Model):
'date': date, 'date': date,
'date_from': date_from, 'date_from': date_from,
'date_to': date_to, 'date_to': date_to,
'lines': slines, 'lines': sorted(slines, key=lambda a: (a.get('ptype',''), a.get('epo_name',''))),
'total_fee': total_fee and '{:,}'.format(total_fee) or "", 'total_fee': total_fee and '{:,}'.format(total_fee) or "",
'total_srv': total_srv and '{:,}'.format(total_srv) or "", 'total_srv': total_srv and '{:,}'.format(total_srv) or "",
'total_epo': total_epo and '{:,}'.format(total_epo) or "", 'total_epo': total_epo and '{:,}'.format(total_epo) or "",