Vijayakrishnan 3 жил өмнө
parent
commit
e0660eb33e

+ 42 - 0
app/Helpers/helpers.php

@@ -364,6 +364,48 @@ if(!function_exists('friendly_month')) {
     }
 }
 
+if(!function_exists('day_part_from_date')) {
+    function day_part_from_date($value) {
+        if(!$value || empty($value)) return "-";
+        try {
+            $result = strtotime($value);
+            $result = date("d", $result);
+            return $result;
+        }
+        catch (Exception $e) {
+            return $value;
+        }
+    }
+}
+
+if(!function_exists('month_part_from_date')) {
+    function month_part_from_date($value) {
+        if(!$value || empty($value)) return "-";
+        try {
+            $result = strtotime($value);
+            $result = date("m", $result);
+            return $result;
+        }
+        catch (Exception $e) {
+            return $value;
+        }
+    }
+}
+
+if(!function_exists('year_part_from_date')) {
+    function year_part_from_date($value) {
+        if(!$value || empty($value)) return "-";
+        try {
+            $result = strtotime($value);
+            $result = date("Y", $result);
+            return $result;
+        }
+        catch (Exception $e) {
+            return $value;
+        }
+    }
+}
+
 if(!function_exists('friendly_money')){
     function friendly_money($value){
         return number_format((float)$value, 2, '.', '');

+ 20 - 0
app/Http/Controllers/HomeController.php

@@ -421,6 +421,26 @@ WHERE
 
         $keyNumbers['naBillableSignedNotes'] = $naBillableSignedNotes;
 
+        $keyNumbers['rmBillsToSign'] = Bill
+            ::where('is_cancelled', false)
+            ->where('cm_or_rm', 'RM')
+            ->where(function ($q) use ($performerProID) {
+                $q
+                    ->where(function ($q2) use ($performerProID) {
+                        $q2->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false);
+                    })
+                    ->orWhere(function ($q2) use ($performerProID) {
+                        $q2->where('rme_pro_id', $performerProID)->where('is_signed_by_rme', false);
+                    })
+                    ->orWhere(function ($q2) use ($performerProID) {
+                        $q2->where('rmm_pro_id', $performerProID)->where('is_signed_by_rmm', false);
+                    })
+                    ->orWhere(function ($q2) use ($performerProID) {
+                        $q2->where('generic_pro_id', $performerProID)->where('is_signed_by_generic_pro', false);
+                    });
+            })
+            ->count();
+
         return view('app/dashboard', compact('keyNumbers', 'reimbursement', 'milliseconds',
             'businessNumbers',
             'incomingReports', 'tickets', 'supplyOrders',

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

@@ -204,6 +204,31 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.bills', compact('bills', 'filter'));
     }
 
+    public function rmBillsToSign(Request $request)
+    {
+        $performerProID = $this->performer()->pro->id;
+        $bills = Bill::where('is_cancelled', false)->where('cm_or_rm', 'RM')
+            ->where(function ($q) use ($performerProID) {
+                $q
+                    ->where(function ($q2) use ($performerProID) {
+                        $q2->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false);
+                    })
+                    ->orWhere(function ($q2) use ($performerProID) {
+                        $q2->where('rme_pro_id', $performerProID)->where('is_signed_by_rme', false);
+                    })
+                    ->orWhere(function ($q2) use ($performerProID) {
+                        $q2->where('rmm_pro_id', $performerProID)->where('is_signed_by_rmm', false);
+                    })
+                    ->orWhere(function ($q2) use ($performerProID) {
+                        $q2->where('generic_pro_id', $performerProID)->where('is_signed_by_generic_pro', false);
+                    });
+            })
+            ->orderBy('effective_date', 'desc')
+            ->get();
+
+        return view('app.practice-management.rm-bills-to-sign', compact('bills'));
+    }
+
     public function unacknowledgedCancelledBills(Request $request)
     {
         $bills = Bill::where('hcp_pro_id', $this->performer()->pro->id)
@@ -700,6 +725,10 @@ class PracticeManagementController extends Controller
                     break;
             }
         }
+        $c = $request->input('c');
+        if($c) {
+            $filters .= ' AND client.uid = \'' . $request->input('c') . '\' ';
+        }
 
         $patients = DB::select(
             DB::raw(

+ 2 - 2
resources/views/app/dashboard.blade.php

@@ -81,9 +81,9 @@
                                     </tr>
                                 @endif
                                 <tr>
-                                    <th class="px-2 text-center">0</th>
+                                    <th class="px-2 text-center">{{$keyNumbers['rmBillsToSign']}}</th>
                                     <th class="pl-2">
-                                        <a native target="_top" href="#">RM Bills to Sign</a>
+                                        <a href="/practice-management/rm-bills-to-sign">RM Bills to Sign</a>
                                     </th>
                                 </tr>
                             </tbody>

+ 148 - 0
resources/views/app/practice-management/rm-bills-to-sign.blade.php

@@ -0,0 +1,148 @@
+@extends ('layouts/template')
+
+@section('content')
+
+    <div class="p-3 mcp-theme-1">
+    <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>
+                RM Bills to Sign
+            </strong>
+        </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 class="px-3 border-0">Eff. Date</th>
+                    <th class="border-0">Patient</th>
+                    <th class="border-0">Context</th>
+                    <th class="border-0">Measurement Days</th>
+                    <th class="border-0">Role</th>
+                    <th class="border-0">Amount</th>
+                    <th class="border-0"></th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach ($bills as $bill)
+                    <tr class="{{ $bill->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+                        <td class="px-3">
+                            {{ friendly_date_time($bill->effective_date, false) }}
+                        </td>
+                        <td class="">
+                            <a href="/patients/view/{{ $bill->client->uid }}">{{ $bill->client->displayName() }}</a>
+                        </td>
+                        <td class="stag-no-wrap-td">
+                            @if($bill->careMonth)
+                                <b>{{ $bill->code }}</b>
+                                -
+                                <a href="/practice-management/remote-monitoring?m={{month_part_from_date($bill->careMonth->start_date)}}&y={{year_part_from_date($bill->careMonth->start_date)}}&c={{$bill->client->uid}}">
+                                    <b>{{ friendly_month($bill->careMonth->start_date) }}</b>
+                                </a>
+                            @endif
+                            @if(!empty($bill->reason1))
+                                <div class="text-secondary text-sm stag-no-wrap" title="{{ $bill->reason1 }}">{{ $bill->reason1 }}</div>
+                            @endif
+                        </td>
+                        <td class="">
+                            <span class="d-inline-block width-30px">{{$bill->careMonth->number_of_days_with_remote_measurements ?: '0'}}</span>
+                            <span class="">
+                                <?php $moreMDNeeded = 16 - $bill->careMonth->number_of_days_with_remote_measurements; ?>
+                                @if($bill->careMonth->number_of_days_with_remote_measurements >= 16)
+                                    <i class="fa fa-check text-success" title="16 measurement days reached"></i>
+                                @elseif($daysRemaining >= $moreMDNeeded)
+                                    <i class="fa fa-exclamation-triangle text-warning-mellow" title="{{$moreMDNeeded}} more measurement day{{$moreMDNeeded > 1 ? 's' : ''}} needed"></i>
+                                @elseif($daysRemaining < $moreMDNeeded)
+                                    <i class="fa fa-exclamation-triangle text-secondary opacity-60" title="Can no longer reach 16 measurement days this month"></i>
+                                @endif
+                                </span>
+                        </td>
+                        <td>
+                            <?php
+                            $roles = [];
+                            if($bill->hcp_pro_id === $pro->id) $roles[] = 'HCP';
+                            if($bill->cm_pro_id === $pro->id) $roles[] = 'CM';
+                            if($bill->rme_pro_id === $pro->id) $roles[] = 'RME';
+                            if($bill->rmm_pro_id === $pro->id) $roles[] = 'RMM';
+                            $roles = implode("<br>", $roles);
+                            ?>
+                            {!! $roles !!}
+                        </td>
+                        <td>
+                            @if($bill->hcp_pro_id === $pro->id)
+                                @if($bill->has_hcp_been_paid)
+                                    <div>
+                                        <span class="text-dark">HCP Received:</span>
+                                        <span class="font-weight-bold text-success ml-2">${{ $bill->hcp_payment_amount }}</span>
+                                    </div>
+                                @else
+                                    <div>
+                                        <span class="text-dark">HCP Expected:</span>
+                                        <span class="font-weight-bold text-dark ml-2">{{ $bill->hcp_expected_payment_amount ? '$' . $bill->hcp_expected_payment_amount : '-' }}</span>
+                                    </div>
+                                @endif
+                            @endif
+                            @if($bill->cm_pro_id === $pro->id)
+                                @if($bill->has_cm_been_paid)
+                                    <div>
+                                        <span class="text-dark">CM Received:</span>
+                                        <span class="font-weight-bold text-success ml-2">${{ $bill->cm_payment_amount }}</span>
+                                    </div>
+                                @else
+                                    <div>
+                                        <span class="text-dark">CM Expected:</span>
+                                        <span class="font-weight-bold text-dark ml-2">{{ $bill->cm_expected_payment_amount ? '$' . $bill->cm_expected_payment_amount : '-' }}</span>
+                                    </div>
+                                @endif
+                            @endif
+                            @if($bill->rmm_pro_id === $pro->id)
+                                @if($bill->has_rmm_been_paid)
+                                    <div>
+                                        <span class="text-dark">RMM Received:</span>
+                                        <span class="font-weight-bold text-success ml-2">${{ $bill->rmm_payment_amount }}</span>
+                                    </div>
+                                @else
+                                    <div>
+                                        <span class="text-dark">RMM Expected:</span>
+                                        <span class="font-weight-bold text-dark ml-2">{{ $bill->rmm_expected_payment_amount ? '$' . $bill->rmm_expected_payment_amount : '-' }}</span>
+                                    </div>
+                                @endif
+                            @endif
+                            @if($bill->rme_pro_id === $pro->id)
+                                @if($bill->has_rme_been_paid)
+                                    <div>
+                                        <span class="text-dark">RME Received:</span>
+                                        <span class="font-weight-bold text-success ml-2">${{ $bill->rme_payment_amount }}</span>
+                                    </div>
+                                @else
+                                    <div>
+                                        <span class="text-dark">RME Expected:</span>
+                                        <span class="font-weight-bold text-dark ml-2">{{ $bill->rme_expected_payment_amount ? '$' . $bill->rme_expected_payment_amount : '-' }}</span>
+                                    </div>
+                                @endif
+                            @endif
+                        </td>
+                        <td>
+                            <div moe="" relative>
+                                <a class="" href="#" show="" start="">Sign Bill</a>
+                                <form url="/api/bill/signGlobal" right="">
+                                    <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                    <p>Sign this bill?</p>
+                                    <div class="mb-0">
+                                        <button class="btn btn-success btn-sm" submit="">Sign</button>
+                                        <button class="btn btn-default border btn-sm" cancel="">Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+        </div>
+    </div>
+    </div>
+
+@endsection

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

@@ -112,6 +112,7 @@
                         <a class="dropdown-item" href="/practice-management/notes/not-yet-signed">Pending Notes to Sign</a>
                         <a class="dropdown-item" href="/practice-management/notes/not-yet-signed-but-ally-signed">Pending Notes to Sign (Ally Signed)</a>
                         <a class="dropdown-item" href="{{ route('practice-management.remote-monitoring') }}">Remote Monitoring</a>
+                        <a class="dropdown-item" href="{{ route('practice-management.rm-bills-to-sign') }}">RM Bills to Sign</a>
                         <a class="dropdown-item" href="{{ route('unmapped-sms') }}">Unmapped SMS</a>
                         <a class="dropdown-item" href="{{ route('practice-management.myTickets') }}">My Tickets</a>
                         <a class="dropdown-item" href="{{ route('practice-management.myTextShortcuts') }}">My Text Shortcuts</a>

+ 1 - 0
routes/web.php

@@ -84,6 +84,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('notes/{filter?}', 'PracticeManagementController@notes')->name('notes');
         Route::get('na-billable-signed-notes/{filter?}', 'PracticeManagementController@naBillableSignedNotes')->name('na-billable-signed-notes');
         Route::get('bills/{filter?}', 'PracticeManagementController@bills')->name('bills');
+        Route::get('rm-bills-to-sign', 'PracticeManagementController@rmBillsToSign')->name('rm-bills-to-sign');
         Route::get('unacknowledged-cancelled-bills', 'PracticeManagementController@unacknowledgedCancelledBills')->name('unacknowledged-cancelled-bills');
         Route::get('my-tickets/{filter?}', 'PracticeManagementController@myTickets')->name('myTickets');
         Route::get('my-text-shortcuts', 'PracticeManagementController@myTextShortcuts')->name('myTextShortcuts');