Pārlūkot izejas kodu

updated cellular device matrix

logicpowerhouse 4 gadi atpakaļ
vecāks
revīzija
886d90fdba

+ 27 - 24
app/Http/Controllers/PracticeManagementController.php

@@ -88,7 +88,7 @@ class PracticeManagementController extends Controller
                 $query = $query->where('is_signed_by_hcp', false);
                 break;
 
-                // more cases can be added as needed
+            // more cases can be added as needed
             default:
                 break;
         }
@@ -137,7 +137,7 @@ class PracticeManagementController extends Controller
                     });
                 break;
 
-                // more cases can be added as needed
+            // more cases can be added as needed
             default:
                 break;
         }
@@ -244,7 +244,7 @@ class PracticeManagementController extends Controller
         $startDate = date('Y-m-d', strtotime("sunday -1 week"));
         $endDateTime = new DateTime($startDate);
         $endDateTime->modify('+6 day');
-        $endDate =  $endDateTime->format("Y-m-d");
+        $endDate = $endDateTime->format("Y-m-d");
 
         $eventsData = $pro->getAvailabilityEvents($startDate, $endDate);
         $events = json_encode($eventsData);
@@ -294,14 +294,16 @@ class PracticeManagementController extends Controller
     }
 
     // check video page
-    public function checkVideo(Request $request, $uid) {
+    public function checkVideo(Request $request, $uid)
+    {
         $session = AppSession::where('session_key', $request->cookie('sessionKey'))->first();
         $client = !empty($uid) ? Client::where('uid', $uid)->first() : null;
         $publish = false;
         return view('app.video.check-video-minimal', compact('session', 'client'));
     }
 
-    public function getParticipantInfo(Request $request) {
+    public function getParticipantInfo(Request $request)
+    {
         $sid = intval($request->get('uid')) - 1000000;
         $session = AppSession::where('id', $sid)->first();
         $result = [
@@ -371,22 +373,23 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.calendar');
     }
 
-    public function cellularDeviceManager(Request $request, $proUid = null){
+    public function cellularDeviceManager(Request $request, $proUid = null)
+    {
         $proUid = $proUid ? $proUid : $request->get('pro-uid');
         $performerPro = $this->performer->pro;
         $targetPro = null;
         $allPros = [];
         $expectedForHcp = null;
-        if($performerPro->pro_type == 'ADMIN'){
+        if ($performerPro->pro_type == 'ADMIN') {
             $allPros = Pro::all();
             $targetPro = Pro::where('uid', $proUid)->first();
-        }else{
+        } else {
             $targetPro = $performerPro;
         }
         $clients = [];
-        if($targetPro){
+        if ($targetPro) {
             $clients = Client::where('mcp_pro_id', $targetPro->id)->orderBy('created_at', 'desc')->paginate(100);
-        }else{
+        } else {
             $clients = Client::orderBy('created_at', 'desc')->paginate(100);
         }
         return view('app.practice-management.cellular-device-manager', compact('clients', 'allPros', 'targetPro'));
@@ -399,20 +402,19 @@ class PracticeManagementController extends Controller
         $targetPro = null;
         $allPros = [];
         $expectedForHcp = null;
-        if($performerPro->pro_type == 'ADMIN'){
+        if ($performerPro->pro_type == 'ADMIN') {
             $allPros = Pro::all();
             $targetPro = Pro::where('uid', $proUid)->first();
-        }else{
+        } else {
             $targetPro = $performerPro;
         }
         $bills = [];
-        if($targetPro){
-            $expectedForHcp = DB::select(DB::raw("SELECT coalesce(SUM(hcp_expected_payment_amount),0) as expected_pay FROM bill WHERE hcp_pro_id = :targetProID  AND is_signed_by_hcp IS TRUE AND is_cancelled = false"), ['targetProID' => $targetPro->id])[0]->expected_pay;
-            $bills = Bill::where('hcp_pro_id', $targetPro->id)->orderBy('created_at', 'desc')->paginate(500);
-        }else{
-            $bills = Bill::orderBy('created_at', 'desc')->paginate(500);
+        if ($targetPro) {
+            $rows = DB::select(DB::raw("SELECT * FROM aemish_bill_report WHERE hcp_pro_id = :targetProID"), ['targetProID' => $targetPro->id]);
+        } else {
+            $rows = DB::select(DB::raw("SELECT * FROM aemish_bill_report"));
         }
-        return view('app.practice-management.hcp-bill-matrix', compact('bills', 'allPros', 'expectedForHcp', 'targetPro'));
+        return view('app.practice-management.hcp-bill-matrix', compact('rows', 'allPros', 'targetPro'));
     }
 
     public function billingManager(Request $request, $proUid = null)
@@ -422,17 +424,17 @@ class PracticeManagementController extends Controller
         $targetPro = null;
         $allPros = [];
         $expectedForHcp = null;
-        if($performerPro->pro_type == 'ADMIN'){
+        if ($performerPro->pro_type == 'ADMIN') {
             $allPros = Pro::all();
             $targetPro = Pro::where('uid', $proUid)->first();
-        }else{
+        } else {
             $targetPro = $performerPro;
         }
         $notes = [];
-        if($targetPro){
+        if ($targetPro) {
             $expectedForHcp = DB::select(DB::raw("SELECT coalesce(SUM(hcp_expected_payment_amount),0) as expected_pay FROM bill WHERE hcp_pro_id = :targetProID  AND is_signed_by_hcp IS TRUE AND is_cancelled = false"), ['targetProID' => $targetPro->id])[0]->expected_pay;
             $notes = Note::where('hcp_pro_id', $targetPro->id)->orderBy('effective_dateest', 'desc')->paginate();
-        }else{
+        } else {
             $notes = Note::orderBy('effective_dateest', 'desc')->paginate();
         }
         return view('app.practice-management.billing-manager', compact('notes', 'allPros', 'expectedForHcp', 'targetPro'));
@@ -445,14 +447,15 @@ class PracticeManagementController extends Controller
     }
 
     // Generate PDF
-    public function downloadClaims() {
+    public function downloadClaims()
+    {
         $claims = Claim::where('was_submitted', false)->orWhere('was_submitted', null)->orderBy('created_at', 'desc')->limit(100)->get();
         view()->share('claims', $claims);
 
         $pdf = PDF::loadView('app.practice-management.claims-pdf', $claims);
 
         return $pdf->download('pdf_file.pdf');
-      }
+    }
 
     public function tickets(Request $request, $proUid = null)
     {

+ 8 - 10
resources/views/app/practice-management/hcp-bill-matrix.blade.php

@@ -23,7 +23,6 @@
                     <i class="fas fa-user-injured"></i>
                     Notes
                 </strong>
-
             </div>
             <div class="card-body p-0">
                 <table class="table table-sm table-condensed p-0 m-0">
@@ -54,22 +53,21 @@
                     </tr>
                     </thead>
                     <tbody>
-                    @foreach ($bills as $bill)
-                        <?php $note = $bill->note; ?>
-                        <?php if(!$note) { continue; } ?>
+                    @foreach ($rows as $row)
                         <tr class="">
-
                             <td class="">
-                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">{{ $note->client->displayName() }}</a>
+                                <a href="/patients/view/{{ $row->client_uid }}/notes/view/{{ $row->note_uid }}">
+                                    {{ $row->client->name_last . ', ', $row->name_first }}
+                                </a>
                             </td>
                             <td class="">
-                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}"
+                                <a href="/patients/view/{{ $row->client_uid }}/notes/view/{{ $row->note_uid }}"
                                    class="font-weight-bold">
-                                    {{ friendly_date_time($note->effective_dateest, false) }}
+                                    {{ friendly_date_time($row->effective_dateest, false) }}
                                 </a>
-                                <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                                <span class="ml-1">{{ $row->is_note_cancelled ? '[cancelled]' : '' }}</span>
                             </td>
-                            <td>{{$note->hcpPro->name_first}} {{$note->hcpPro->name_first}}</td>
+                            <td>{{$row->hcpPro->name_first}} {{$note->hcpPro->name_first}}</td>
                             <td>{{$note->is_signed_by_hcp?'Yes':'No'}}</td>