Pārlūkot izejas kodu

New page pro-financials

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

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

@@ -599,6 +599,28 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.processing-bill-matrix', $viewData);
     }
 
+    public function proFinancials(Request $request, $proUid = null)
+    {
+        $proUid = $proUid ? $proUid : $request->get('pro-uid');
+        $performerPro = $this->performer->pro;
+        $targetPro = null;
+        if ($performerPro->pro_type == 'ADMIN') {
+            $targetPro = Pro::where('uid', $proUid)->first();
+        } else {
+            $targetPro = $performerPro;
+        }
+        $fPros = Pro::whereNotNull('balance');
+        if($targetPro) {
+            $fPros = $fPros->where('uid', $targetPro->uid);
+        }
+        $fPros = $fPros
+            ->where('balance', '>', 0)
+            ->orderBy('name_last')
+            ->orderBy('name_first')
+            ->paginate();
+        return view('app.practice-management.pro-financials', compact('fPros', 'targetPro'));
+    }
+
     public function hcpBillMatrix(Request $request, $proUid = null)
     {
         $proUid = $proUid ? $proUid : $request->get('pro-uid');

+ 8 - 0
app/Models/Pro.php

@@ -90,6 +90,14 @@ class Pro extends Model
             ->get();
     }
 
+    public function recentDebits() {
+        return ProTransaction
+            ::where('pro_id', $this->id)
+            ->where('plus_or_minus', 'PLUS')
+            ->orderBy('created_at', 'desc')
+            ->skip(0)->take(4)->get();
+    }
+
     public function shortcuts() {
         return $this->hasMany(ProTextShortcut::class, 'pro_id')->where('is_removed', false);
     }

+ 58 - 0
resources/views/app/practice-management/pro-financials.blade.php

@@ -0,0 +1,58 @@
+@extends ('layouts/template')
+
+@section('content')
+
+    <div class="p-3 mcp-theme-1" id="processing-bill-matrix">
+
+        <div class="card">
+
+            <div class="card-header px-3 py-2 d-flex align-items-center">
+                <strong class="text-nowrap">
+                    <i class="fas fa-user-injured"></i>
+                    Pro Financials
+                </strong>
+                <span class="mx-2">for</span>
+                <div class="width-200px">
+                    <select provider-search data-pro-uid="{{ @$targetPro->uid }}"
+                            name="proUid" class="form-control form-control-sm mr-auto width-200px min-width-unset"
+                            onchange="fastLoad('/practice-management/pro-financials/' + this.value)">
+                        <option value="" {{!@$targetPro ? 'selected' : ''}}>All Pros</option>
+                    </select>
+                </div>
+                @if(@$targetPro)
+                    <a href="/practice-management/pro-financials" class="ml-2">Clear Filter</a>
+                @endif
+            </div>
+            <div class="card-body p-0">
+                <table class="table table-sm table-condensed table-hover p-0 m-0">
+                    <thead class="bg-light">
+                    <tr>
+                        <th>Pro</th>
+                        <th>Balance Owed</th>
+                        <th class="w-75">Recent Debits</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach ($fPros as $row)
+                        <tr>
+                            <td>{{$row->displayName()}}</td>
+                            <td><b>${{friendly_money($row->balance)}}</b></td>
+                            <td>
+                                @foreach($row->recentDebits() as $debit)
+                                    <div class="d-flex align-items-center mb-1">
+                                        <span class="width-90px">{{'$' . $debit->amount}}</span>
+                                        <span class="text-secondary">{{friendly_date_time($debit->created_at, false)}}</span>
+                                    </div>
+                                @endforeach
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+            </div>
+        </div>
+        <div class="mt-3">
+            {{$fPros->withQueryString()->links()}}
+        </div>
+    </div>
+@endsection

+ 1 - 0
resources/views/layouts/template.blade.php

@@ -126,6 +126,7 @@
 
                         @if($pro && $pro->pro_type == 'ADMIN')
                             <a class="dropdown-item" href="{{ route('practice-management.processingBillMatrix') }}">Processing Bills</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.pro-financials') }}">Pro Financials</a>
                             <a class="dropdown-item" href="{{ route('practice-management.cellularMeasurements') }}">Cellular Measurements</a>
                             <a class="dropdown-item" href="{{ route('practice-management.cellularDeviceManager') }}">Cellular Device Manager</a>
                             <a class="dropdown-item" href="{{ route('practice-management.medicarePartBClaims') }}">Medicare Part B Claims</a>

+ 2 - 0
routes/web.php

@@ -115,6 +115,8 @@ Route::middleware('pro.auth')->group(function () {
 
             Route::get('processing-bill-matrix/{proUid?}/{filter?}', 'PracticeManagementController@processingBillMatrix')->name('processingBillMatrix');
 
+            Route::get('pro-financials/{proUid?}', 'PracticeManagementController@proFinancials')->name('pro-financials');
+
             //Route::get('hcp-bill-matrix/{proUid?}', 'PracticeManagementController@hcpBillMatrix')->name('hcpBillMatrix');
             Route::get('bill-matrix/{proUid?}', 'PracticeManagementController@billMatrix')->name('billMatrix');