report detail
parent
61aac38445
commit
8f5cd8a899
|
@ -70,11 +70,12 @@ class ReportNurseFeeDetail(Model):
|
||||||
#if record.date:
|
#if record.date:
|
||||||
#date=record.date[8:10]
|
#date=record.date[8:10]
|
||||||
date=record.date
|
date=record.date
|
||||||
personal_id=record.personal_id.id
|
personal=record.personal_id
|
||||||
key=(date,personal_id)
|
key=(date,personal.id)
|
||||||
if key not in all_vals.keys():
|
if key not in all_vals.keys():
|
||||||
all_vals[key]={
|
all_vals[key]={
|
||||||
'qty': 0,
|
'qty': 0,
|
||||||
|
'personal_name': personal.name or "",
|
||||||
'amount': 0,
|
'amount': 0,
|
||||||
}
|
}
|
||||||
all_vals[key]['qty']+=record.qty or 0
|
all_vals[key]['qty']+=record.qty or 0
|
||||||
|
@ -87,9 +88,11 @@ class ReportNurseFeeDetail(Model):
|
||||||
date,personal_id=key
|
date,personal_id=key
|
||||||
qty=vals['qty'] or 0
|
qty=vals['qty'] or 0
|
||||||
amount=vals['amount'] or 0
|
amount=vals['amount'] or 0
|
||||||
|
_personal_name=vals['personal_name'] or ''
|
||||||
lines.append({
|
lines.append({
|
||||||
'date': date,
|
'date': date,
|
||||||
'qty': qty,
|
'qty': qty,
|
||||||
|
'personal_name': _personal_name,
|
||||||
'amount': amount or 0.0,
|
'amount': amount or 0.0,
|
||||||
})
|
})
|
||||||
total_qty+=qty
|
total_qty+=qty
|
||||||
|
@ -103,7 +106,7 @@ class ReportNurseFeeDetail(Model):
|
||||||
'company_name': company.name or "",
|
'company_name': company.name or "",
|
||||||
'parent_company_name': company.parent_id.name or "",
|
'parent_company_name': company.parent_id.name or "",
|
||||||
'personal_name': personal_name,
|
'personal_name': personal_name,
|
||||||
'lines': lines,
|
'lines': sorted(lines,key=lambda x: x['date']),
|
||||||
'total_qty': total_qty,
|
'total_qty': total_qty,
|
||||||
'total_amount': total_amount,
|
'total_amount': total_amount,
|
||||||
'month': month_str,
|
'month': month_str,
|
||||||
|
|
|
@ -18,22 +18,31 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<th>วันที่</th>
|
<th>วันที่</th>
|
||||||
<th>จำนวนคนไข้</th>
|
{{#unless ../personal_name}}
|
||||||
<th>จำนวนเงิน</th>
|
<th>บุคลากร</th>
|
||||||
|
{{/unless}}
|
||||||
|
<th style="text-align:right">จำนวนคนไข้</th>
|
||||||
|
<th style="text-align:right">จำนวนเงิน</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each lines}}
|
{{#each lines}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{date}}</td>
|
<td>{{date}}</td>
|
||||||
<td>{{qty}}</td>
|
{{#unless ../personal_name}}
|
||||||
<td>{{currency amount}}</td>
|
<td>{{personal_name}}</td>
|
||||||
|
{{/unless}}
|
||||||
|
<td style="text-align:right">{{qty}}</td>
|
||||||
|
<td style="text-align:right">{{currency amount}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<th>TOTAL</th>
|
{{#unless ../personal_name}}
|
||||||
<th>{{total_qty}}</th>
|
<th></th>
|
||||||
<th>{{currency total_amount}}</th>
|
{{/unless}}
|
||||||
|
<th>รวม</th>
|
||||||
|
<th style="text-align:right">{{total_qty}}</th>
|
||||||
|
<th style="text-align:right">{{currency total_amount}}</th>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
Loading…
Reference in New Issue