improvement
							parent
							
								
									61f4bbb266
								
							
						
					
					
						commit
						ea76cdc423
					
				| 
						 | 
					@ -273,6 +273,7 @@ class ReportCycleItem(Model):
 | 
				
			||||||
                'description': v['description'],
 | 
					                'description': v['description'],
 | 
				
			||||||
                'qty': v['qty'],
 | 
					                'qty': v['qty'],
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
 | 
					        vscl_lines=sorted(vscl_lines,key=lambda x: x['description'])
 | 
				
			||||||
        ptype_lines=[]
 | 
					        ptype_lines=[]
 | 
				
			||||||
        total_pt=0
 | 
					        total_pt=0
 | 
				
			||||||
        pkeys=list(ptypes.keys())
 | 
					        pkeys=list(ptypes.keys())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -229,8 +229,17 @@ class VisitBoard(Model):
 | 
				
			||||||
            visit_color=''
 | 
					            visit_color=''
 | 
				
			||||||
            sickbed_name='N/A'
 | 
					            sickbed_name='N/A'
 | 
				
			||||||
            sickbed_id=None
 | 
					            sickbed_id=None
 | 
				
			||||||
 | 
					            found_hdcase=False
 | 
				
			||||||
 | 
					            is_paid=False
 | 
				
			||||||
 | 
					            is_waiting=False
 | 
				
			||||||
            if visit.hd_cases:
 | 
					            if visit.hd_cases:
 | 
				
			||||||
                hd_case=visit.hd_cases[0]
 | 
					                hd_case=visit.hd_cases[0]
 | 
				
			||||||
 | 
					                if hd_case.state in ('waiting_payment', 'paid'):
 | 
				
			||||||
 | 
					                    found_hdcase=True
 | 
				
			||||||
 | 
					                if hd_case.state=='waiting_payment':
 | 
				
			||||||
 | 
					                    is_waiting=True
 | 
				
			||||||
 | 
					                elif hd_case.state=='paid':
 | 
				
			||||||
 | 
					                    is_paid=True
 | 
				
			||||||
                sickbed_name=hd_case.sickbed_id.name or "N/A"
 | 
					                sickbed_name=hd_case.sickbed_id.name or "N/A"
 | 
				
			||||||
                sickbed_id=hd_case.sickbed_id.id
 | 
					                sickbed_id=hd_case.sickbed_id.id
 | 
				
			||||||
                hd_case_id=hd_case.id,
 | 
					                hd_case_id=hd_case.id,
 | 
				
			||||||
| 
						 | 
					@ -288,7 +297,7 @@ class VisitBoard(Model):
 | 
				
			||||||
                'patient_type_id': patient.type_id.id or None,
 | 
					                'patient_type_id': patient.type_id.id or None,
 | 
				
			||||||
                'doctor_name': visit.doctor_id.name,
 | 
					                'doctor_name': visit.doctor_id.name,
 | 
				
			||||||
                'doctor_id': visit.doctor_id.id,
 | 
					                'doctor_id': visit.doctor_id.id,
 | 
				
			||||||
                'hd_case_number': hd_case_number,
 | 
					                'hd_case_number': (hd_case_number or '').replace('HDC/',''),
 | 
				
			||||||
                'hd_case_state': hd_case_state,
 | 
					                'hd_case_state': hd_case_state,
 | 
				
			||||||
                'hd_case_state_txt':HD_STATE.get(hd_case_state,''),
 | 
					                'hd_case_state_txt':HD_STATE.get(hd_case_state,''),
 | 
				
			||||||
                'hd_case_id': hd_case_id,
 | 
					                'hd_case_id': hd_case_id,
 | 
				
			||||||
| 
						 | 
					@ -304,7 +313,12 @@ class VisitBoard(Model):
 | 
				
			||||||
                'details5':'',
 | 
					                'details5':'',
 | 
				
			||||||
                'no': no,
 | 
					                'no': no,
 | 
				
			||||||
                'note': visit.note,
 | 
					                'note': visit.note,
 | 
				
			||||||
 | 
					                'cost': 0,
 | 
				
			||||||
 | 
					                'is_paid': is_paid,
 | 
				
			||||||
 | 
					                'is_waiting': is_waiting,
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            if found_hdcase:
 | 
				
			||||||
 | 
					                line['cost']=hd_case.total_amount or 0
 | 
				
			||||||
            lines.append(line)
 | 
					            lines.append(line)
 | 
				
			||||||
            no+=1
 | 
					            no+=1
 | 
				
			||||||
            if not types.get(visit_date):
 | 
					            if not types.get(visit_date):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,8 +8,8 @@
 | 
				
			||||||
    <thead class="scroll-header">
 | 
					    <thead class="scroll-header">
 | 
				
			||||||
        <th>วันที่</th>
 | 
					        <th>วันที่</th>
 | 
				
			||||||
        <th>รอบ</th>
 | 
					        <th>รอบ</th>
 | 
				
			||||||
        <th>No</th>
 | 
					        <th>No.</th>
 | 
				
			||||||
        <th>HDC#</th>
 | 
					        <th>HDC/</th>
 | 
				
			||||||
        <th>ชื่อ-สกุล</th>
 | 
					        <th>ชื่อ-สกุล</th>
 | 
				
			||||||
        <th>แพทย์</th>
 | 
					        <th>แพทย์</th>
 | 
				
			||||||
        <th>สิทธ์</th>
 | 
					        <th>สิทธ์</th>
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@
 | 
				
			||||||
            {{/ifeq}}
 | 
					            {{/ifeq}}
 | 
				
			||||||
                {{#if cseq_txt}}
 | 
					                {{#if cseq_txt}}
 | 
				
			||||||
                    <th>{{date_txt}}</th>
 | 
					                    <th>{{date_txt}}</th>
 | 
				
			||||||
                    <th>{{cseq_txt}}</th>
 | 
					                    <th style="width:2%;text-align:center">{{cseq_txt}}</th>
 | 
				
			||||||
                    <td style="text-align:center">{{no}}</td>
 | 
					                    <td style="text-align:center">{{no}}</td>
 | 
				
			||||||
                    <td style="width:6%"><a href="/ui#name=clinic_hd_case&active_id={{hdcase_id}}&mode=form">{{hdcase_number}}</a></td>
 | 
					                    <td style="width:6%"><a href="/ui#name=clinic_hd_case&active_id={{hdcase_id}}&mode=form">{{hdcase_number}}</a></td>
 | 
				
			||||||
                    <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>
 | 
				
			||||||
| 
						 | 
					@ -49,7 +49,7 @@
 | 
				
			||||||
                        <td>รวม</td>
 | 
					                        <td>รวม</td>
 | 
				
			||||||
                        <td></td>
 | 
					                        <td></td>
 | 
				
			||||||
                        <td style="text-align:center">{{no}}</td>
 | 
					                        <td style="text-align:center">{{no}}</td>
 | 
				
			||||||
                        <td colspan="10">
 | 
					                        <td colspan="10" style="text-align:right">
 | 
				
			||||||
                            {{#each epo_items}}
 | 
					                            {{#each epo_items}}
 | 
				
			||||||
                                {{name}} = {{qty}}    
 | 
					                                {{name}} = {{qty}}    
 | 
				
			||||||
                            {{/each}}
 | 
					                            {{/each}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,8 +11,8 @@
 | 
				
			||||||
        <th style="text-align:center">สิทธ์</th>
 | 
					        <th style="text-align:center">สิทธ์</th>
 | 
				
			||||||
        <th style="text-align:center">แพทย์</th>
 | 
					        <th style="text-align:center">แพทย์</th>
 | 
				
			||||||
        <th style="text-align:center">ชั้น</th>
 | 
					        <th style="text-align:center">ชั้น</th>
 | 
				
			||||||
        <th style="text-align:center">เตียง</th>
 | 
					        <th style="text-align:center">HDC/</th>
 | 
				
			||||||
        <th style="text-align:center">บันทึกการรักษา</th>
 | 
					        <!--<th style="text-align:center">ค่าตอบแทน</th>-->
 | 
				
			||||||
    </thead>
 | 
					    </thead>
 | 
				
			||||||
    <tbody>
 | 
					    <tbody>
 | 
				
			||||||
        {{#each lines }}
 | 
					        {{#each lines }}
 | 
				
			||||||
| 
						 | 
					@ -49,11 +49,6 @@
 | 
				
			||||||
                        <td style="background-color:{{visit_color}}">{{patient_type}}</td>
 | 
					                        <td style="background-color:{{visit_color}}">{{patient_type}}</td>
 | 
				
			||||||
                        <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_staff&active_id={{doctor_id}}&mode=form">{{doctor_name}}</a></td>
 | 
					                        <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_staff&active_id={{doctor_id}}&mode=form">{{doctor_name}}</a></td>
 | 
				
			||||||
                        <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_department&active_id={{department_id}}&mode=form">{{department_name}}</a></td>
 | 
					                        <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_department&active_id={{department_id}}&mode=form">{{department_name}}</a></td>
 | 
				
			||||||
                        {{#if sickbed_id}}
 | 
					 | 
				
			||||||
                            <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_sickbed&active_id={{sickbed_id}}&mode=form">{{sickbed_name}}</a></td>
 | 
					 | 
				
			||||||
                        {{else}}
 | 
					 | 
				
			||||||
                            <td style="background-color:{{visit_color}}">{{sickbed_name}}</td>
 | 
					 | 
				
			||||||
                        {{/if}}
 | 
					 | 
				
			||||||
                        <td style="background-color:{{visit_color}}">
 | 
					                        <td style="background-color:{{visit_color}}">
 | 
				
			||||||
                            <a href="/ui#name=clinic_hd_case&active_id={{hd_case_id}}&mode=form">
 | 
					                            <a href="/ui#name=clinic_hd_case&active_id={{hd_case_id}}&mode=form">
 | 
				
			||||||
                                {{#ifeq number "Waiting"}}
 | 
					                                {{#ifeq number "Waiting"}}
 | 
				
			||||||
| 
						 | 
					@ -83,6 +78,17 @@
 | 
				
			||||||
                                </span>
 | 
					                                </span>
 | 
				
			||||||
                            </a>
 | 
					                            </a>
 | 
				
			||||||
                        </td>
 | 
					                        </td>
 | 
				
			||||||
 | 
					                        <!--
 | 
				
			||||||
 | 
					                        {{#if is_paid}}
 | 
				
			||||||
 | 
					                            <td style="background-color:{{visit_color}};text-align:right;color:green">{{currency cost}}</td>
 | 
				
			||||||
 | 
					                        {{else}}
 | 
				
			||||||
 | 
					                            {{#if is_waiting}}
 | 
				
			||||||
 | 
					                                    <td style="background-color:{{visit_color}};text-align:right;color:blue">{{currency cost}}</td>
 | 
				
			||||||
 | 
					                                {{else}}
 | 
				
			||||||
 | 
					                                    <td style="background-color:{{visit_color}};text-align:right">{{currency cost}}</td>
 | 
				
			||||||
 | 
					                            {{/if}}
 | 
				
			||||||
 | 
					                        {{/if}}
 | 
				
			||||||
 | 
					                        -->
 | 
				
			||||||
                    {{/if}}
 | 
					                    {{/if}}
 | 
				
			||||||
                </tr>
 | 
					                </tr>
 | 
				
			||||||
            {{/if}}
 | 
					            {{/if}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue