diff --git a/netforce_clinic/models/report_nurse_fee_detail.py b/netforce_clinic/models/report_nurse_fee_detail.py index 0c9f1ed..bd484d0 100644 --- a/netforce_clinic/models/report_nurse_fee_detail.py +++ b/netforce_clinic/models/report_nurse_fee_detail.py @@ -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, diff --git a/netforce_clinic/templates/report_nurse_fee_detail.hbs b/netforce_clinic/templates/report_nurse_fee_detail.hbs index 4f4d0d1..0c93acc 100644 --- a/netforce_clinic/templates/report_nurse_fee_detail.hbs +++ b/netforce_clinic/templates/report_nurse_fee_detail.hbs @@ -18,22 +18,31 @@ - - + {{#unless ../personal_name}} + + {{/unless}} + + {{#each lines}} - - + {{#unless ../personal_name}} + + {{/unless}} + + {{/each}} - - - + {{#unless ../personal_name}} + + {{/unless}} + + +
วันที่จำนวนคนไข้จำนวนเงินบุคลากรจำนวนคนไข้จำนวนเงิน
{{date}}{{qty}}{{currency amount}}{{personal_name}}{{qty}}{{currency amount}}
TOTAL{{total_qty}}{{currency total_amount}}รวม{{total_qty}}{{currency total_amount}}
{{else}}