Pārlūkot izejas kodu

Daily treatment services matrix

Vijayakrishnan 3 gadi atpakaļ
vecāks
revīzija
47eeee914f

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

@@ -89,6 +89,27 @@ class PracticeManagementController extends Controller
         return view ('app.practice-management.remote-monitoring-report', compact('rows', 'isAdmin'));
 	}
 
+    public function dailyTreatmentServices(Request $request) {
+        $type = $request->input('t');
+        $fPro = null;
+        if($type === 'pro') {
+            $fPro = Pro::where('uid', $request->input('p'))->first();
+            $rows = DB::select(DB::raw("
+SELECT effective_date, hcp_pro_id, p.name_first, p.name_last, count(*), sum(number_of_units) as units 
+FROM bill JOIN pro p on p.id = bill.hcp_pro_id 
+WHERE code = 'Treatment Services' 
+GROUP BY effective_date, hcp_pro_id, p.name_first, p.name_last 
+ORDER BY effective_date DESC, p.name_first ASC, p.name_last ASC
+"));
+        }
+        else {
+            $rows = DB::select(DB::raw("
+SELECT effective_date, count(*), sum(number_of_units) as units FROM bill WHERE code = 'Treatment Services' GROUP BY effective_date ORDER BY effective_date DESC
+"));
+        }
+        return view ('app.practice-management.daily-treatment-services', compact('rows'));
+    }
+
     public function billingReport(Request $request)
     {
 

+ 71 - 0
resources/views/app/practice-management/daily-treatment-services.blade.php

@@ -0,0 +1,71 @@
+@extends ('layouts/template')
+
+@section('content')
+    <div class="p-3 mcp-theme-1" id="daily-treatment-services">
+        <div class="card">
+            <div class="card-header px-2 py-2 d-flex align-items-center">
+                <strong class="">
+                    <i class="fas fa-user"></i>
+                    Daily Treatment Services
+                </strong>
+                <form class="ml-3" id="dts-form">
+                    <select name="t" class="form-control form-control-sm width-200px">
+                        <option {{!request()->input('t') ? 'selected' : ''}} value="">Overall</option>
+                        <option {{request()->input('t') === 'pro' ? 'selected' : ''}} value="pro">By Pro</option>
+                    </select>
+                </form>
+            </div>
+            <?php
+            // dump($rows);
+            ?>
+            <div class="card-body p-0">
+                <table class="table table-sm table-striped p-0 m-0">
+                    <thead class="bg-light">
+                        <tr>
+                            <th class="px-3 border-0 width-150px">Date</th>
+                            @if(request()->input('t') === 'pro')
+                                <th class="border-0 width-300px">HCP</th>
+                            @endif
+                            <th class="border-0 width-100px">#Bills</th>
+                            <th class="border-0">$Hours Total</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        @foreach($rows as $row)
+                            <tr>
+                                <td class="px-3">
+                                    {{ friendly_date($row->effective_date) }}
+                                </td>
+                                @if(request()->input('t') === 'pro')
+                                <td>
+                                    {{ $row->name_first }}
+                                    {{ $row->name_last }}
+                                </td>
+                                @endif
+                                <td>
+                                    {{ $row->count }}
+                                </td>
+                                <td>
+                                    {{ $row->units }}
+                                </td>
+                            </tr>
+                        @endforeach
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+    <script>
+        (function() {
+            function init() {
+                $('#dts-form [name="t"]')
+                    .off('change')
+                    .on('change', function() {
+                        fastLoad('{{route('practice-management.daily-treatment-services')}}?' + $('#dts-form').serialize());
+                        return false;
+                    });
+            }
+            addMCInitializer('daily-treatment-services', init, '#daily-treatment-services');
+        }).call(window);
+    </script>
+@endsection

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

@@ -128,6 +128,7 @@
                             <a class="dropdown-item" href="{{ route('practice-management.client-ccm-rm-status') }}">Client RM Status</a>
                         @else
                             <a class="dropdown-item" href="{{ route('practice-management.remote-monitoring-admin') }}">Remote Monitoring (admin)</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.daily-treatment-services') }}">Daily Treatment Services</a>
                         @endif
                         @if($pro->pro_type == 'ADMIN')
                             <a class="dropdown-item" href="{{ route('practice-management.rpmMatrix') }}">RPM Matrix</a>

+ 1 - 0
routes/web.php

@@ -266,6 +266,7 @@ Route::middleware('pro.auth')->group(function () {
             Route::get('rm-action-report', 'PracticeManagementController@rmActionReport')->name('rmActionReport');
         	
 		    Route::get('remote-monitoring-report', 'PracticeManagementController@remoteMonitoringReport')->name('remoteMonitoringReport');
+            Route::get('daily-treatment-services', 'PracticeManagementController@dailyTreatmentServices')->name('daily-treatment-services');
 
             // BILLING REPORT
             Route::get('billing-report', 'PracticeManagementController@billingReport')->name('billing-report');