improve report cycle item

conv_bal
watcha.h@almacom.co.th 2015-05-06 16:53:47 +07:00
parent fdb109df0d
commit 9716398d93
3 changed files with 11 additions and 14 deletions

View File

@ -225,12 +225,15 @@ class ReportCycleItem(Model):
}) })
ptype_lines=[] ptype_lines=[]
total_pt=0 total_pt=0
for pname,qty in ptypes.items(): pkeys=list(ptypes.keys())
for pname in sorted(pkeys):
qty=ptypes[pname]
ptype_lines.append({ ptype_lines.append({
'name': pname, 'name': pname,
'qty': qty, 'qty': qty,
}) })
total_pt+=qty total_pt+=qty
ptype_txt=' '.join(['%s: %s'%(x['name'],x['qty']) for x in ptype_lines])
vscl_lines2=[{}] vscl_lines2=[{}]
index=1 index=1
for vscl_line in vscl_lines: for vscl_line in vscl_lines:
@ -239,14 +242,13 @@ class ReportCycleItem(Model):
'v%s_1'%index: vscl_line['qty'], 'v%s_1'%index: vscl_line['qty'],
}) })
index+=1 index+=1
#for nline in nlines:
#print(nline.get('date'), nline.get('nfirst_name'))
data={ data={
'company_name': company_name or "", 'company_name': company_name or "",
'lines': nlines, 'lines': nlines,
'vscl_lines': vscl_lines, 'vscl_lines': vscl_lines,
'vscl_lines2': vscl_lines2, 'vscl_lines2': vscl_lines2,
'ptype_lines': ptype_lines, 'ptype_lines': ptype_lines,
'ptype_txt': ptype_txt,
'month': month_str, 'month': month_str,
'date_from': date_from, 'date_from': date_from,
'date_to': date_to, 'date_to': date_to,

View File

@ -71,19 +71,14 @@
<th class="active">รวมผู้ป่วยทั้งหมด</th> <th class="active">รวมผู้ป่วยทั้งหมด</th>
<th class="active"></th> <th class="active"></th>
<th class="active">{{total_pt}}</th> <th class="active">{{total_pt}}</th>
<th class="active"></th> <th colspan="7" class="active">
<th class="active"></th> {{#each ptype_lines}}
<th class="active"></th> {{name}} : {{qty}} &nbsp;&nbsp;&nbsp;
<!-- {{/each}}
<th class="active" style="text-align:right">{{currency total_fee zero=""}}</th> </th>
-->
<th class="active" style="text-align:left"></th>
<th class="active"></th>
<th class="active"></th>
<th class="active"></th>
</tfoot> </tfoot>
</table> </table>
<table class="table table-condensed table-striped"> <table class="table table-condensed table-striped" style="margin-bottom:0px;">
<tbody> <tbody>
<tr> <tr>
{{#each vscl_lines}} {{#each vscl_lines}}