فهرست منبع

added data to bm

logicpowerhouse 4 سال پیش
والد
کامیت
f9097421b7

+ 16 - 4
app/Http/Controllers/PracticeManagementController.php

@@ -17,6 +17,7 @@ use App\Models\ProSpecificUnavailability;
 use App\Models\ProTextShortcut;
 use App\Models\ProTransaction;
 use App\Models\Ticket;
+use Illuminate\Support\Facades\DB;
 use PDF;
 use DateTime;
 use DateTimeZone;
@@ -372,14 +373,25 @@ class PracticeManagementController extends Controller
 
     public function billingManager(Request $request, $proUid = null)
     {
-        $pro = Pro::where('uid', $proUid)->first();
+        $proUid = $proUid ? $proUid : $request->get('pro-uid');
+        $performerPro = $this->performer->pro;
+        $pro = null;
+        $allPros = null;
+        $expectedForHcp = null;
+        if($performerPro->pro_type == 'ADMIN'){
+            $allPros = Pro::all();
+            $pro = Pro::where('uid', $proUid)->first();
+        }else{
+            $pro = $performerPro;
+        }
         $notes = [];
         if($pro){
+            $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' => $pro->id])[0]->expected_pay;
             $notes = Note::where('hcp_pro_id', $pro->id)->orderBy('effective_dateest', 'desc')->paginate();
         }else{
             $notes = Note::orderBy('effective_dateest', 'desc')->paginate();
-        }    
-        return view('app.practice-management.billing-manager', compact('notes'));
+        }
+        return view('app.practice-management.billing-manager', compact('notes', 'allPros', 'expectedForHcp'));
     }
 
     public function claims(Request $request)
@@ -392,7 +404,7 @@ class PracticeManagementController extends Controller
     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');

+ 138 - 113
resources/views/app/practice-management/billing-manager.blade.php

@@ -3,47 +3,70 @@
 @section('content')
 
     <div class="p-3 mcp-theme-1">
-    <div class="card">
+        <div class="card">
+            <div class="card-body p-2">
+                <form>
+                    <select name="pro-uid">
+                        <option value="">
+                            --
+                        </option>
+                        @foreach($allPros as $pro)
+                            <option value="{{$pro->uid}}">
+                                {{$pro->name_last}}, {{$pro->name_first}}
+                            </option>
+                        @endforeach
+                    </select>
+                    <button>Filter</button>
+                </form>
+            </div>
+        </div>
+        <div class="card">
 
-        <div class="card-header px-3 py-2 d-flex align-items-center">
-            <strong class="mr-4">
-                <i class="fas fa-user-injured"></i>
-                Notes
-            </strong>
+            <div class="card-header px-3 py-2 d-flex align-items-center">
+                <strong class="mr-4">
+                    <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">
-                <thead class="bg-light">
-                <tr>
-                    <th class="border-0">Patient</th>
-                    <th class="border-0">Note Eff. Date</th>
-                    <th class="border-0">HCP</th>
-                    <th class="border-0">Signed?</th>
-                    <th class="border-0">Bills</th>
-                    <th class="border-0">Assessments</th>
-                    <th class="border-0">Claims</th>
-                    <th class="px-3 border-0">Created</th>
-                </tr>
-                </thead>
-                <tbody>
-                @foreach ($notes as $note)
-                    <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+            </div>
+            <div class="card-body p-0">
+                <table class="table table-sm table-condensed p-0 m-0">
+                    <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Note Eff. Date</th>
+
+
+                        <th class="border-0">HCP</th>
 
-                        <td class="">
-                            <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">{{ $note->client->displayName() }}</a>
-                        </td>
-                        <td class="">
-                            <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">
-                                {{ friendly_date_time($note->effective_dateest, false) }}
-                            </a>
-                            <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
-                        </td>
-                        <td>{{$note->hcpPro->name_first}} {{$note->hcpPro->name_first}}</td>
-                        <td>{{$note->is_signed_by_hcp?'Yes':'No'}}</td>
-                        <td>
-                            <table class="table table-sm table-condensed table-stripe">
-                                <thead>
+                        <th class="border-0">Signed?</th>
+                        <th class="border-0">Bills</th>
+                        <th class="border-0">Assessments</th>
+                        @if($performer->pro->pro_type == 'ADMIN')
+                            <th class="border-0">Claims</th>
+                        @endif
+                        <th class="px-3 border-0">Created</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach ($notes as $note)
+                        <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+
+                            <td class="">
+                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}">{{ $note->client->displayName() }}</a>
+                            </td>
+                            <td class="">
+                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}"
+                                   class="font-weight-bold">
+                                    {{ friendly_date_time($note->effective_dateest, false) }}
+                                </a>
+                                <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                            </td>
+                            <td>{{$note->hcpPro->name_first}} {{$note->hcpPro->name_first}}</td>
+                            <td>{{$note->is_signed_by_hcp?'Yes':'No'}}</td>
+                            <td>
+                                <table class="table table-sm table-condensed table-stripe">
+                                    <thead>
                                     <tr>
                                         <th>Service</th>
                                         <th># of units</th>
@@ -51,91 +74,93 @@
                                         <th>Cancelled?</th>
                                         <th>HCP ex. amount</th>
                                     </tr>
-                                </thead>
-                                <tbody>
+                                    </thead>
+                                    <tbody>
                                     @foreach($note->bills as $bill)
-                                    <tr>
-                                        <td>{{$bill->code}}</td>
-                                        @if($bill->code == 'Treatment Services')
-                                            <td>{{floor($bill->number_of_units*60)}}m</td>
-                                        @else
-                                            <td>{{$bill->number_of_units}}</td>
-                                        @endif
-                                        <td>{{$bill->is_signed_by_hcp?'Yes':'No'}}</td>
-                                        <td>{{ $bill->is_cancelled ?'Yes':'No'}}</td>
-                                        <td>{{ $bill->hcp_expected_payment_amount }}</td>
-                                    </tr>
+                                        <tr>
+                                            <td>{{$bill->code}}</td>
+                                            @if($bill->code == 'Treatment Services')
+                                                <td>{{floor($bill->number_of_units*60)}}m</td>
+                                            @else
+                                                <td>{{$bill->number_of_units}}</td>
+                                            @endif
+                                            <td>{{$bill->is_signed_by_hcp?'Yes':'No'}}</td>
+                                            <td>{{ $bill->is_cancelled ?'Yes':'No'}}</td>
+                                            <td>{{ $bill->hcp_expected_payment_amount }}</td>
+                                        </tr>
                                     @endforeach
-                                </tbody>
-                            </table>
-                        </td>
-                        <td>
-                            <table class="table table-sm table-condensed table-stripe">
-                                <thead>
+                                    </tbody>
+                                </table>
+                            </td>
+                            <td>
+                                <table class="table table-sm table-condensed table-stripe">
+                                    <thead>
                                     <tr>
                                         <th>Code</th>
                                         <th>Description</th>
                                     </tr>
-                                </thead>
-                                <tbody>
+                                    </thead>
+                                    <tbody>
                                     @foreach($note->reasons as $reason)
-                                    <tr>
-                                        <td>{{$reason->code}}</td>
-                                        <td>{{$reason->description}}</td>
-                                    </tr>
-                                    @endforeach
-                                </tbody>
-                            </table>
-                        </td>
-                        <td>
-                            <table class="table table-sm table-condensed table-stripe">
-                                <thead>
-                                    <tr>
-                                        <th>Identifier</th>
-                                        <th>Submitted?</th>
-                                    </tr>
-                                </thead>
-                                <tbody>
-                                    @foreach($note->claims as $claim)
-                                    <tr>
-                                        <td>{{$claim->iid}}</td>
-                                        <td>{{$claim->was_submitted?'Yes':'No'}}</td>
-                                    </tr>
-                                    <tr>
-                                        <td colspan="2">
-                                            <strong>Claim Lines</strong>
-                                            <table class="table table-sm table-condensed table-striped">
-                                                <tr>
-                                                    <th>CPT</th>
-                                                    <th>ICDs</th>
-                                                    <th>Date of Service</th>
-                                                </tr>
-                                                @foreach($claim->lines as $claimLine)
-                                                <tr>
-                                                    <td>{{$claimLine->cpt}}</td>
-                                                    <td>{{$claimLine->icds()}}</td>
-                                                    <td>{{$claimLine->date_of_service}}</td>
-                                                </tr>
-                                                @endforeach
-                                            </table>
-                                        </td>
-                                    </tr>
+                                        <tr>
+                                            <td>{{$reason->code}}</td>
+                                            <td>{{$reason->description}}</td>
+                                        </tr>
                                     @endforeach
-                                </tbody>
-                            </table>
-                        </td>
-                        <td class="px-3">
-                            {{ friendly_date_time($note->created_at, true) }}
-                        </td>
-                    </tr>
-                @endforeach
-                </tbody>
-            </table>
-            <div>
-                {{$notes->links()}}
+                                    </tbody>
+                                </table>
+                            </td>
+                            @if($performer->pro->pro_type == 'ADMIN')
+                                <td>
+                                    <table class="table table-sm table-condensed table-stripe">
+                                        <thead>
+                                        <tr>
+                                            <th>Identifier</th>
+                                            <th>Submitted?</th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                        @foreach($note->claims as $claim)
+                                            <tr>
+                                                <td>{{$claim->iid}}</td>
+                                                <td>{{$claim->was_submitted?'Yes':'No'}}</td>
+                                            </tr>
+                                            <tr>
+                                                <td colspan="2">
+                                                    <strong>Claim Lines</strong>
+                                                    <table class="table table-sm table-condensed table-striped">
+                                                        <tr>
+                                                            <th>CPT</th>
+                                                            <th>ICDs</th>
+                                                            <th>Date of Service</th>
+                                                        </tr>
+                                                        @foreach($claim->lines as $claimLine)
+                                                            <tr>
+                                                                <td>{{$claimLine->cpt}}</td>
+                                                                <td>{{$claimLine->icds()}}</td>
+                                                                <td>{{$claimLine->date_of_service}}</td>
+                                                            </tr>
+                                                        @endforeach
+                                                    </table>
+                                                </td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                </td>
+                            @endif
+                            <td class="px-3">
+                                {{ friendly_date_time($note->created_at, true) }}
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+                <div>
+                    {{$notes->links()}}
+                </div>
             </div>
         </div>
     </div>
-    </div>
 
 @endsection

+ 3 - 1
routes/web.php

@@ -82,8 +82,10 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('pro-availability/{proUid?}', 'PracticeManagementController@proAvailability')->name('proAvailability');
         Route::get('calendar/{proUid?}', 'PracticeManagementController@calendar')->name('proCalendar');
 
+        Route::get('billing-manager/{proUid?}', 'PracticeManagementController@billingManager')->name('billingManager');
+
         Route::middleware('pro.auth.admin')->group(function(){
-            Route::get('billing-manager/{proUid?}', 'PracticeManagementController@billingManager')->name('billingManager');
+
             Route::get('tickets', 'PracticeManagementController@tickets')->name('tickets');
             Route::get('claims', 'PracticeManagementController@claims')->name('claims');
             Route::get('claims-download', 'PracticeManagementController@downloadClaims')->name('download-claims');