Pārlūkot izejas kodu

MCP DB bills pending signature - stat + matrix popup

Vijayakrishnan 3 gadi atpakaļ
vecāks
revīzija
bb90566ef2

+ 19 - 0
app/Http/Controllers/McpController.php

@@ -277,6 +277,25 @@ class McpController extends Controller
         ];
         return view('app.mcp.notes_pending_billing', $data);
     }
+    public function bills_pending_signature(Request $request){
+        $data = [
+            'records' => Bill::where('bill_service_type', '<>', 'CARE_MONTH')->where(function ($query) {
+                $query->where('hcp_pro_id', $this->performer->pro->id)->where('is_signed_by_hcp', false)->where('is_cancelled', false);
+            })
+                ->orWhere(function ($query) {
+                    $query->where('cm_pro_id', $this->performer->pro->id)->where('is_signed_by_cm', false)->where('is_cancelled', false);
+                })->orWhere(function ($query) {
+                    $query->where('rme_pro_id', $this->performer->pro->id)->where('is_signed_by_rme', false)->where('is_cancelled', false);
+                })->orWhere(function ($query) {
+                    $query->where('rmm_pro_id', $this->performer->pro->id)->where('is_signed_by_rmm', false)->where('is_cancelled', false);
+                })->orWhere(function ($query) {
+                    $query->where('generic_pro_id', $this->performer->pro->id)->where('is_signed_by_generic_pro', false)->where('is_cancelled', false);
+                })
+                ->orderBy('created_at', 'DESC')
+                ->get()
+        ];
+        return view('app.mcp.bills_pending_signature', $data);
+    }
     public function reports_pending_signature(Request $request){
         $data = [
             'records' => IncomingReport::where('hcp_pro_id', $this->performer->pro->id)

+ 3 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -251,6 +251,9 @@ class PracticeManagementController extends Controller
                             })
                             ->orWhere(function ($q2) use ($proID) {
                                 $q2->where('rmm_pro_id', $proID)->where('is_signed_by_rmm', false);
+                            })
+                            ->orWhere(function ($q2) use ($proID) {
+                                $q2->where('generic_pro_id', $proID)->where('is_signed_by_generic_pro', false);
                             });
                     });
                 break;

+ 11 - 10
app/Models/Pro.php

@@ -374,19 +374,20 @@ WHERE mcp_pro_id = :pro_id
     }
 
     function get_bills_pending_signature_count_as_mcp(){
-        return;
-        $pendingBillsToSign = Bill::where('bill_service_type', '<>', 'CARE_MONTH')->where(function ($query) use ($performerProID) {
-            $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false);
+        $pendingBillsToSign = Bill::where('bill_service_type', '<>', 'CARE_MONTH')->where(function ($query) {
+            $query->where('hcp_pro_id', $this->id)->where('is_signed_by_hcp', false)->where('is_cancelled', false);
         })
-            ->orWhere(function ($query) use ($performerProID) {
-                $query->where('cm_pro_id', $performerProID)->where('is_signed_by_cm', false)->where('is_cancelled', false);;
-            })->orWhere(function ($query) use ($performerProID) {
-                $query->where('rme_pro_id', $performerProID)->where('is_signed_by_rme', false)->where('is_cancelled', false);;
-            })->orWhere(function ($query) use ($performerProID) {
-                $query->where('rmm_pro_id', $performerProID)->where('is_signed_by_rmm', false)->where('is_cancelled', false);;
+            ->orWhere(function ($query) {
+                $query->where('cm_pro_id', $this->id)->where('is_signed_by_cm', false)->where('is_cancelled', false);
+            })->orWhere(function ($query) {
+                $query->where('rme_pro_id', $this->id)->where('is_signed_by_rme', false)->where('is_cancelled', false);
+            })->orWhere(function ($query) {
+                $query->where('rmm_pro_id', $this->id)->where('is_signed_by_rmm', false)->where('is_cancelled', false);
+            })->orWhere(function ($query) {
+                $query->where('generic_pro_id', $this->id)->where('is_signed_by_generic_pro', false)->where('is_cancelled', false);
             })->count();
 
-        $keyNumbers['pendingBillsToSign'] = $pendingBillsToSign;
+        return $pendingBillsToSign;
     }
 
     function get_incoming_reports_pending_signature_count_as_mcp() {

+ 12 - 0
resources/views/app/dashboard-mcp.blade.php

@@ -75,6 +75,18 @@
                                         </a>
                                     </th>
                                 </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_bills_pending_signature_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.bills_pending_signature') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Bills Pending Signature">
+                                            Bills Pending Signature
+                                        </a>
+                                    </th>
+                                </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
                                     <th class="pl-2">

+ 42 - 0
resources/views/app/mcp/bills_pending_signature.blade.php

@@ -0,0 +1,42 @@
+<div class="p-3 mcp-theme-1">
+    <div class="card border-top-0">
+
+        <div class="card-header px-3 py-2 hide-inside-popup border-bottom-0">
+            <strong class="mr-4">
+                <i class="fas fa-sticky-note"></i>
+                Bills Pending Signature
+            </strong>
+        </div>
+
+        <div class="card-body p-0 border-top-0 pb-0">
+            <table class="table table-sm table-striped mb-0">
+                <thead>
+                <tr>
+                    <th class="border-bottom-0">Date</th>
+                    <th class="border-bottom-0">Patient</th>
+                    <th class="border-bottom-0">Service</th>
+                    <th class="border-bottom-0">Context</th>
+                    <th class="border-bottom-0">Minutes</th>
+                    <th class="border-bottom-0">Amount</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($records as $row)
+                    <tr>
+                        <td>{{ friendly_date_time($row->effective_date, false) }}</td>
+                        <td>
+                            <a target="_blank" native href="{{route('patients.view.dashboard', $row->client)}}">
+                                {{$row->client->displayName()}}
+                            </a>
+                        </td>
+                        <td>{{ $row->code }}</td>
+                        <td>{{ $row->generic_target_entity_type ?: '-' }}</td>
+                        <td>{{ round(floor($row->number_of_units * 60)) }} m</td>
+                        <td>{{ $row->hcp_expected_payment_amount ? '$'.$row->hcp_expected_payment_amount : '' }}</td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+        </div>
+    </div>
+</div>

+ 1 - 0
routes/web.php

@@ -90,6 +90,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('new-patients-awaiting-visit', 'McpController@new_patients_awaiting_visit')->name('new_patients_awaiting_visit');
         Route::get('notes-pending-signature', 'McpController@notes_pending_signature')->name('notes_pending_signature');
         Route::get('notes-pending-billing', 'McpController@notes_pending_billing')->name('notes_pending_billing');
+        Route::get('bills-pending-signature', 'McpController@bills_pending_signature')->name('bills_pending_signature');
         Route::get('reports-pending-signature', 'McpController@reports_pending_signature')->name('reports_pending_signature');
         Route::get('patients-without-appointments', 'McpController@patients_without_appointments')->name('patients_without_appointments');
         Route::get('patients-overdue-for-visit', 'McpController@patients_overdue_for_visit')->name('patients_overdue_for_visit');