improve report cycle item
							parent
							
								
									deea486556
								
							
						
					
					
						commit
						80520d8f71
					
				| 
						 | 
					@ -109,7 +109,7 @@ class ReportCycleItem(Model):
 | 
				
			||||||
                   'dname': doctor.name or "",
 | 
					                   'dname': doctor.name or "",
 | 
				
			||||||
                   'date': hdcase.date,
 | 
					                   'date': hdcase.date,
 | 
				
			||||||
                   'epo': hdcase.epo,
 | 
					                   'epo': hdcase.epo,
 | 
				
			||||||
                   'fee': hdcase.fee,
 | 
					                   'fee': abs(hdcase.fee), #XXX
 | 
				
			||||||
                   'dlz_name': hdcase.dlz_name,
 | 
					                   'dlz_name': hdcase.dlz_name,
 | 
				
			||||||
                   'dlz_use': dlz_use,
 | 
					                   'dlz_use': dlz_use,
 | 
				
			||||||
                   'dlz_id': hdcase.dlz_id,
 | 
					                   'dlz_id': hdcase.dlz_id,
 | 
				
			||||||
| 
						 | 
					@ -137,7 +137,9 @@ class ReportCycleItem(Model):
 | 
				
			||||||
        nlines=[]
 | 
					        nlines=[]
 | 
				
			||||||
        index=0
 | 
					        index=0
 | 
				
			||||||
        old=[]
 | 
					        old=[]
 | 
				
			||||||
 | 
					        total_fee=0
 | 
				
			||||||
        for line in sorted(lines,key=lambda x:(x['date'],x['cseq'])):
 | 
					        for line in sorted(lines,key=lambda x:(x['date'],x['cseq'])):
 | 
				
			||||||
 | 
					            total_fee+=line.get("fee",0)
 | 
				
			||||||
            cid=line['cid']
 | 
					            cid=line['cid']
 | 
				
			||||||
            if not cid in old:
 | 
					            if not cid in old:
 | 
				
			||||||
                old.append(cid)
 | 
					                old.append(cid)
 | 
				
			||||||
| 
						 | 
					@ -157,6 +159,7 @@ class ReportCycleItem(Model):
 | 
				
			||||||
            'month': month_str,
 | 
					            'month': month_str,
 | 
				
			||||||
            'date_from': date_from,
 | 
					            'date_from': date_from,
 | 
				
			||||||
            'date_to': date_to,
 | 
					            'date_to': date_to,
 | 
				
			||||||
 | 
					            'total_fee': total_fee,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return data
 | 
					        return data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@
 | 
				
			||||||
        <th>ชื่อ-สกุล</th>
 | 
					        <th>ชื่อ-สกุล</th>
 | 
				
			||||||
        <th>แพทย์</th>
 | 
					        <th>แพทย์</th>
 | 
				
			||||||
        <th>สิทธ์</th>
 | 
					        <th>สิทธ์</th>
 | 
				
			||||||
        <th>จ.น.เงิน</th>
 | 
					        <th style="text-align:right">จ.น.เงิน</th>
 | 
				
			||||||
        <th>ยาฉีด</th>
 | 
					        <th>ยาฉีด</th>
 | 
				
			||||||
        <th>DZ</th>
 | 
					        <th>DZ</th>
 | 
				
			||||||
        <th>N/U</th>
 | 
					        <th>N/U</th>
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@
 | 
				
			||||||
                    <td><a href="/ui#name=clinic_patient&active_id={{pid}}&mode=form">{{pname}}</a></td>
 | 
					                    <td><a href="/ui#name=clinic_patient&active_id={{pid}}&mode=form">{{pname}}</a></td>
 | 
				
			||||||
                    <td><a href="/ui#name=clinic_staff&active_id={{did}}&mode=form">{{dname}}</a></td>
 | 
					                    <td><a href="/ui#name=clinic_staff&active_id={{did}}&mode=form">{{dname}}</a></td>
 | 
				
			||||||
                    <td><a href="/ui#name=clinic_patient_type&active_id={{tid}}&mode=form">{{tname}}</a></td>
 | 
					                    <td><a href="/ui#name=clinic_patient_type&active_id={{tid}}&mode=form">{{tname}}</a></td>
 | 
				
			||||||
                    <td>{{fee}}</td>
 | 
					                    <td style="text-align:right">{{fee}}</td>
 | 
				
			||||||
                    <td>{{epo}}</td>
 | 
					                    <td>{{epo}}</td>
 | 
				
			||||||
                    <td><a href="/ui#name=clinic_dialyzer&active_id={{dlz_id}}&mode=form">{{dlz_name}}</a></td>
 | 
					                    <td><a href="/ui#name=clinic_dialyzer&active_id={{dlz_id}}&mode=form">{{dlz_name}}</a></td>
 | 
				
			||||||
                    <td>{{dlz_use}}</td>
 | 
					                    <td>{{dlz_use}}</td>
 | 
				
			||||||
| 
						 | 
					@ -42,5 +42,16 @@
 | 
				
			||||||
        {{/each}}
 | 
					        {{/each}}
 | 
				
			||||||
    </tbody>
 | 
					    </tbody>
 | 
				
			||||||
    <tfoot>
 | 
					    <tfoot>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th style="text-align:right">{{currency total_fee zero=""}}</th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
 | 
					        <th></th>
 | 
				
			||||||
    </tfoot>
 | 
					    </tfoot>
 | 
				
			||||||
</table>
 | 
					</table>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue