report detail

conv_bal
watcha.h 2014-11-24 11:27:20 +07:00
parent 61aac38445
commit 8f5cd8a899
2 changed files with 22 additions and 10 deletions

View File

@ -70,11 +70,12 @@ class ReportNurseFeeDetail(Model):
#if record.date:
#date=record.date[8:10]
date=record.date
personal_id=record.personal_id.id
key=(date,personal_id)
personal=record.personal_id
key=(date,personal.id)
if key not in all_vals.keys():
all_vals[key]={
'qty': 0,
'personal_name': personal.name or "",
'amount': 0,
}
all_vals[key]['qty']+=record.qty or 0
@ -87,9 +88,11 @@ class ReportNurseFeeDetail(Model):
date,personal_id=key
qty=vals['qty'] or 0
amount=vals['amount'] or 0
_personal_name=vals['personal_name'] or ''
lines.append({
'date': date,
'qty': qty,
'personal_name': _personal_name,
'amount': amount or 0.0,
})
total_qty+=qty
@ -103,7 +106,7 @@ class ReportNurseFeeDetail(Model):
'company_name': company.name or "",
'parent_company_name': company.parent_id.name or "",
'personal_name': personal_name,
'lines': lines,
'lines': sorted(lines,key=lambda x: x['date']),
'total_qty': total_qty,
'total_amount': total_amount,
'month': month_str,

View File

@ -18,22 +18,31 @@
<table class="table">
<thead>
<th>วันที่</th>
<th>จำนวนคนไข้</th>
<th>จำนวนเงิน</th>
{{#unless ../personal_name}}
<th>บุคลากร</th>
{{/unless}}
<th style="text-align:right">จำนวนคนไข้</th>
<th style="text-align:right">จำนวนเงิน</th>
</thead>
<tbody>
{{#each lines}}
<tr>
<td>{{date}}</td>
<td>{{qty}}</td>
<td>{{currency amount}}</td>
{{#unless ../personal_name}}
<td>{{personal_name}}</td>
{{/unless}}
<td style="text-align:right">{{qty}}</td>
<td style="text-align:right">{{currency amount}}</td>
</tr>
{{/each}}
</tbody>
<tfoot>
<th>TOTAL</th>
<th>{{total_qty}}</th>
<th>{{currency total_amount}}</th>
{{#unless ../personal_name}}
<th></th>
{{/unless}}
<th>รวม</th>
<th style="text-align:right">{{total_qty}}</th>
<th style="text-align:right">{{currency total_amount}}</th>
</tfoot>
</table>
{{else}}