Sfoglia il codice sorgente

Processing Bills (RPM) updates

Vijayakrishnan 3 anni fa
parent
commit
cd36611414

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

@@ -1051,9 +1051,9 @@ OFFSET {$offset} LIMIT {$perPage}
             $targetPro = $performerPro;
         }
 
-        $bills = Bill::where('is_cancelled', false);
+        $bills = Bill::where('is_cancelled', false)->whereRaw("(code = 'RM RMM' OR code = 'RM MCP')");
 
-        if(!$request->input('t') || $request->input('t') === 'hcp') {
+        /*if(!$request->input('t') || $request->input('t') === 'hcp') {
             $bills = $bills
                 ->where('hcp_expected_payment_amount', '>', 0)
                 ->where('is_signed_by_hcp', true);
@@ -1074,7 +1074,7 @@ OFFSET {$offset} LIMIT {$perPage}
             if($request->input('c')) {
                 $bills = $bills->whereRaw('(SELECT company_id from company_pro where id = generic_company_pro_id) = ' . $request->input('c'));
             }
-        }
+        }*/
 
         $filter = $request->input('f');
         switch ($filter) {
@@ -1088,12 +1088,12 @@ OFFSET {$offset} LIMIT {$perPage}
 
         $filter = $request->input('bs');
         if ($filter) {
-            $bills = $bills->where('balance_post_date', '>=', $filter);
+            $bills = $bills->where('effective_date', '>=', $filter);
         }
 
         $filter = $request->input('be');
         if ($filter) {
-            $bills = $bills->where('balance_post_date', '<=', $filter);
+            $bills = $bills->where('effective_date', '<=', $filter);
         }
 
         $filter = $request->input('s');
@@ -1101,7 +1101,23 @@ OFFSET {$offset} LIMIT {$perPage}
             $bills = $bills->where('code', '=', $filter);
         }
 
-        $bills = $bills->orderBy('effective_date', 'desc')->paginate();
+        $claimed = $request->input('c');
+        if ($claimed && $claimed == 'has-claims') {
+            $bills = $bills->whereHas('careMonth', function($cmq){
+                return $cmq->whereHas('claims', function($cq){
+                    return $cq->where('status', '<>', 'CANCELLED');
+                });
+            });
+        }
+        if ($claimed && $claimed == 'no-claims') {
+            $bills = $bills->whereHas('careMonth', function($cmq){
+                return $cmq->whereDoesntHave('claims', function($cq){
+                    return $cq->where('status', '<>', 'CANCELLED');
+                });
+            });
+        }
+
+        $bills = $bills->orderBy('id', 'desc')->paginate();
 
         $companies = Company::where('is_active', true)->orderBy('name')->get();
 

+ 80 - 194
resources/views/app/practice-management/processing-bill-matrix2.blade.php

@@ -9,58 +9,55 @@
         <div class="card-header px-2 py-1">
             <div class="font-weight-bold text-nowrap mb-2">
                 <i class="fas fa-user"></i>
-                Processing Bills
+                Processing Bills (RPM)
             </div>
             <div class="d-flex align-items-center mb-2">
-                <div class="width-200px">
+                <div class="max-width-110px">
+                    <label class="text-sm text-secondary mb-1">Pro</label>
                     <select provider-search data-pro-uid="{{ @$targetPro->uid }}" name="proUid" class="form-control form-control-sm mr-auto width-200px min-width-unset" onchange="return billsFilter('', this.value, true)">
                         <option value="" {{!@$targetPro ? 'selected' : ''}}>All Pros</option>
                     </select>
                 </div>
-                <div class="width-300px ml-2 d-inline-flex">
+                <div class="max-width-110px ml-2">
+                    <label class="text-sm text-secondary mb-1">Verification</label>
                     <select name="filter" class="form-control form-control-sm min-width-unset flex-grow-1" onchange="return billsFilter('f', this.value)">
-                        <option {{request()->input('f') === '' ? 'selected' : ''}} value="">All Bills</option>
-                        <option {{request()->input('f') === 'verified' ? 'selected' : ''}} value="verified">Verified
-                            Only
-                        </option>
-                        <option {{request()->input('f') === 'not-verified' ? 'selected' : ''}} value="not-verified">Not
-                            Verified Only
-                        </option>
-                    </select>
-                    <select name="filter" class="form-control form-control-sm min-width-unset flex-grow-1 ml-2" onchange="return billsFilter('t', this.value)">
-                        <option {{!request()->input('t') || request()->input('t') === 'hcp' ? 'selected' : ''}} value="hcp">
-                            HCP Bills
-                        </option>
-                        <option {{request()->input('t') === 'na' ? 'selected' : ''}} value="na">Generic Bills</option>
+                        <option {{request()->input('f') === '' ? 'selected' : ''}} value="">All</option>
+                        <option {{request()->input('f') === 'verified' ? 'selected' : ''}} value="verified">Verified Only</option>
+                        <option {{request()->input('f') === 'not-verified' ? 'selected' : ''}} value="not-verified">Not Verified Only</option>
                     </select>
                 </div>
-                <div class="ml-4 d-inline-flex align-items-center">
-                    <span class="mr-2">Bal Post Date</span>
-                    <input type="date" value="{{request()->input('bs')}}" onchange="return billsFilter('bs', this.value)" class="form-control form-control-sm width-150px" name="bpdFrom">
-                    <span class="mx-2">to</span>
-                    <input type="date" value="{{request()->input('be')}}" onchange="return billsFilter('be', this.value)" class="form-control form-control-sm width-150px" name="bpdTo">
+                <div class="ml-2">
+                    <label class="text-sm text-secondary mb-1">Effective Date</label>
+                    <div class="d-flex align-items-center">
+                        <input type="date" value="{{request()->input('bs')}}" onchange="return billsFilter('bs', this.value)" class="form-control form-control-sm width-150px" name="bpdFrom">
+                        <span class="mx-2">to</span>
+                        <input type="date" value="{{request()->input('be')}}" onchange="return billsFilter('be', this.value)" class="form-control form-control-sm width-150px" name="bpdTo">
+                    </div>
                 </div>
-                <button class="ml-auto btn btn-sm btn-primary pay-selected-pros px-3 font-weight-bold" disabled>Pay Selected</button>
-            </div>
-            <div class="d-flex align-items-center">
-                <select name="filter" class="form-control form-control-sm width-200px" onchange="return billsFilter('c', this.value)">
-                    <option {{!request()->input('c') ? 'selected' : ''}} value="">All Companies</option>
-                    @foreach($companies as $company)
-                    <option {{request()->input('c') == $company->id ? 'selected' : ''}} value="{{$company->id}}">
-                        {{$company->name}}
-                    </option>
-                    @endforeach
-                </select>
-                <select name="filter" class="form-control form-control-sm width-300px ml-2 " onchange="return billsFilter('s', this.value)">
-                    <option {{!request()->input('s') ? 'selected' : ''}} value="">All Services</option>
-                    @foreach($codes as $code)
-                    <option {{request()->input('s') == $code->code ? 'selected' : ''}} value="{{$code->code}}">
-                        {{$code->code}}
-                    </option>
-                    @endforeach
-                </select>
+                <div class="max-width-110px ml-2">
+                    <label class="text-sm text-secondary mb-1">Claims</label>
+                    <select name="filter" class="form-control form-control-sm min-width-unset flex-grow-1" onchange="return billsFilter('c', this.value)">
+                        <option {{request()->input('c') === '' ? 'selected' : ''}} value="">All</option>
+                        <option {{request()->input('c') === 'no-claims' ? 'selected' : ''}} value="no-claims">No Claims</option>
+                        <option {{request()->input('c') === 'has-claims' ? 'selected' : ''}} value="has-claims">Has Claims</option>
+                    </select>
+                </div>
+{{--                <div class="max-width-140px ml-2">--}}
+{{--                    <label class="text-sm text-secondary mb-1">Company</label>--}}
+{{--                    <select name="filter" class="form-control form-control-sm min-width-unset" onchange="return billsFilter('c', this.value)">--}}
+{{--                        <option {{!request()->input('c') ? 'selected' : ''}} value="">All Companies</option>--}}
+{{--                        @foreach($companies as $company)--}}
+{{--                            <option {{request()->input('c') == $company->id ? 'selected' : ''}} value="{{$company->id}}">--}}
+{{--                                {{$company->name}}--}}
+{{--                            </option>--}}
+{{--                        @endforeach--}}
+{{--                    </select>--}}
+{{--                </div>--}}
                 @if(@$targetPro || count(array_filter(request()->all(), function($_x) { return !!$_x && $_x !== 'na' && $_x !== 'hcp';})))
-                <a href="/practice-management/processing-bill-matrix" class="ml-4">Clear Filters</a>
+                    <div class="ml-3">
+                        <label class="text-sm text-secondary mb-1">&nbsp;</label>
+                        <a href="/practice-management/processing-bill-matrix2" class="d-block">Clear Filters</a>
+                    </div>
                 @endif
             </div>
         </div>
@@ -69,14 +66,7 @@
                 <table class="table table-sm table-striped table-hover p-0 m-0">
                     <thead class="bg-light">
                         <tr>
-                            <th class="border-bottom-0 border-top-0">
-                                <label class="d-flex align-items-center m-0">
-                                    <input type="checkbox" class="chk-all-bills" /> <span class="ml-2">All</span>
-                                </label>
-                            </th>
-                            <th class="border-bottom-0 border-top-0">Context</th>
                             <th class="border-bottom-0 border-top-0">Effective Date</th>
-                            <th class="border-bottom-0 border-top-0">Bal Post Date</th>
                             @if(!request()->input('t') || request()->input('t') === 'hcp')
                             <th class="border-bottom-0 border-top-0">Pro</th>
                             @elseif(request()->input('t') === 'na')
@@ -86,7 +76,7 @@
                             <th class="border-bottom-0 border-top-0">Insurance</th>
                             <th class="border-bottom-0 border-top-0">State</th>
                             <th class="border-bottom-0 border-top-0">Company Pro</th>
-                            <th class="border-bottom-0 border-top-0">Code</th>
+{{--                            <th class="border-bottom-0 border-top-0">Code</th>--}}
                             <th class="border-bottom-0 border-top-0">Units</th>
                             <th class="border-bottom-0 border-top-0">Verified?</th>
                             <th class="border-bottom-0 border-top-0">Cancelled?</th>
@@ -102,55 +92,10 @@
                     <tbody>
                         @foreach ($bills as $row)
                         <tr>
-                            <td class="align-top">
-                                @if($row->is_verified)
-                                <input type="checkbox" data-uid="{{$row->uid}}" class="chk-bill align-middle" />
-                                @endif
-                            </td>
-                            <td>
-                                @if($row->note)
-                                <a href="/patients/view/{{ $row->client->uid }}/notes/view/{{ $row->note->uid }}">
-                                    Note
-                                </a>
-                                @elseif($row->careMonth)
-                                    <div>
-                                        <a href="/patients/view/{{$row->client->uid}}/care-months/view/{{$row->careMonth->uid}}">
-                                            Care Month
-                                        </a>
-                                    </div>
-                                    
-                                @elseif($row->client)
-                                <a href="/patients/view/{{ $row->client->uid }}">
-                                    Chart
-                                </a>
-                                @else
-                                    Admin.
-                                @endif
-                               
-                                @if($row->is_verified)
-                                    @if(!request()->input('t') || request()->input('t') === 'hcp')
-                                        @if(!$row->hcp_company_pro_id)
-                                            <div class="mt-1 text-danger text-sm">
-                                                <i class="fa fa-exclamation-triangle"></i>
-                                                <span class="">Company pro not set!</span>
-                                            </div>
-                                        @endif
-                                    @elseif(request()->input('t') === 'na')
-                                        {{-- TODO --}}
-                                    @endif
-                                @endif
-                            </td>
-                           
-                            <td>{{friendly_date($row->effective_date)}}</td>
-                            <td>{{friendly_date($row->balance_post_date)}}</td>
-                            <td>
-
-                                @if(!request()->input('t') || request()->input('t') === 'hcp')
-                                    {{$row->hcp->name_last}}, {{$row->hcp->name_first}}
-                                @elseif(request()->input('t') === 'na')
-                                    {{$row->genericPro->name_last}}, {{$row->genericPro->name_first}}
-                                @endif
 
+                            <td>{{is_null($row->effective_date) ? 'NULL' : friendly_date($row->effective_date)}}</td>
+                            <td>
+                                {{$row->genericPro->name_last}}, {{$row->genericPro->name_first}}
                             </td>
                             <td>
                                 @if($row->client)
@@ -169,33 +114,33 @@
                             </td>
                             <td>
                                     
-                                    @if(!request()->input('t') || request()->input('t') === 'hcp')
-                                        <div class="mt-1 text-secondary">
-                                            @if($row->hcpCompanyPro)
-                                                {{$row->hcpCompanyPro ? $row->hcpCompanyPro->company->name : '-'}}
-                                            @else 
-                                                <i>[company pro is not set]</i>
-                                            @endif
-                                            <div moe class="ml-1">
-                                                <a class="text-primary" href="" show start><i class="fa fa-edit"></i></a>
-                                                <form url="/api/bill/swapHcpCompanyPro">
-                                                    <input type="hidden" name="uid" value="{{$row->uid}}">
-                                                    <div class="mb-2">
-                                                        <select name="hcpCompanyProUid" class="form-control form-control-sm">
-                                                            <option value="">-- select --</option>
-                                                            @foreach($row->hcp->companyPros as $companyPro)
-                                                                <option value="{{$companyPro->uid}}">{{$companyPro->company->name}}</option>
-                                                            @endforeach
-                                                        </select>
-                                                    </div>
-                                                    <div class="mb-0">
-                                                        <button class="btn btn-primary btn-sm" submit>Submit</button>
-                                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
-                                                    </div>
-                                                </form>
-                                            </div>
-                                        </div>
-                                    @elseif(request()->input('t') === 'na')
+{{--                                    @if(!request()->input('t') || request()->input('t') === 'hcp')--}}
+{{--                                        <div class="mt-1 text-secondary">--}}
+{{--                                            @if($row->hcpCompanyPro)--}}
+{{--                                                {{$row->hcpCompanyPro ? $row->hcpCompanyPro->company->name : '-'}}--}}
+{{--                                            @else --}}
+{{--                                                <i>[company pro is not set]</i>--}}
+{{--                                            @endif--}}
+{{--                                            <div moe class="ml-1">--}}
+{{--                                                <a class="text-primary" href="" show start><i class="fa fa-edit"></i></a>--}}
+{{--                                                <form url="/api/bill/swapHcpCompanyPro">--}}
+{{--                                                    <input type="hidden" name="uid" value="{{$row->uid}}">--}}
+{{--                                                    <div class="mb-2">--}}
+{{--                                                        <select name="hcpCompanyProUid" class="form-control form-control-sm">--}}
+{{--                                                            <option value="">-- select --</option>--}}
+{{--                                                            @foreach($row->hcp->companyPros as $companyPro)--}}
+{{--                                                                <option value="{{$companyPro->uid}}">{{$companyPro->company->name}}</option>--}}
+{{--                                                            @endforeach--}}
+{{--                                                        </select>--}}
+{{--                                                    </div>--}}
+{{--                                                    <div class="mb-0">--}}
+{{--                                                        <button class="btn btn-primary btn-sm" submit>Submit</button>--}}
+{{--                                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>--}}
+{{--                                                    </div>--}}
+{{--                                                </form>--}}
+{{--                                            </div>--}}
+{{--                                        </div>--}}
+{{--                                    @elseif(request()->input('t') === 'na')--}}
                                         
                                         <div class="mt-1 text-secondary">
                                             @if($row->genericCompanyPro && $row->genericCompanyPro->company)
@@ -210,9 +155,9 @@
                                                     <div class="mb-2">
                                                         <select name="genericCompanyProUid" class="form-control form-control-sm">
                                                             <option value="">-- select --</option>
-                                                            @foreach($row->genericPro->companyPros as $companyPro)
-                                                                <option value="{{$companyPro->uid}}">{{$companyPro->pro->displayName() . ' / ' . $companyPro->company->name}}</option>
-                                                            @endforeach
+{{--                                                            @foreach($row->genericPro->companyPros as $companyPro)--}}
+{{--                                                                <option value="{{$companyPro->uid}}">{{$companyPro->pro->displayName() . ' / ' . $companyPro->company->name}}</option>--}}
+{{--                                                            @endforeach--}}
                                                         </select>
                                                     </div>
                                                     <div class="mb-0">
@@ -223,20 +168,20 @@
                                             </div>
                                         </div>
                                         
-                                    @endif
+{{--                                    @endif--}}
                                         
                                 </td>
-                            <td>{{$row->code}}
-                                @if($row->generic_target_entity_type && $row->generic_target_entity_uid)
-                                <div class="mt-1 text-sm text-secondary">{{$row->generic_target_entity_type}}</div>
-                                @endif
-                            </td>
+{{--                            <td>{{$row->code}}--}}
+{{--                                @if($row->generic_target_entity_type && $row->generic_target_entity_uid)--}}
+{{--                                <div class="mt-1 text-sm text-secondary">{{$row->generic_target_entity_type}}</div>--}}
+{{--                                @endif--}}
+{{--                            </td>--}}
                             <td>{{str_contains($row->code, 'Treatment Services') || str_contains($row->code, 'Administrative Services') ? ceil((float) $row->number_of_units * 60) . ' mins' : $row->number_of_units}}</td>
                             <td>
                                 {!! $row->is_verified ? '<i class="fa fa-check text-success"></i> ' . friendly_date($row->marked_verified_at, true) : 'No' !!} 
                                 @if(!$row->is_cancelled)
                                     @if(!$row->is_verified)
-                                        <div class="d-block mt-1" moe>
+                                        <div class="d-inline-block ml-1" moe>
                                             <a href="" show start>Mark Verified</a>
                                             <form url="/api/bill/markAsVerified">
                                                 <input type="hidden" name="uid" value="{{$row->uid}}">
@@ -248,7 +193,7 @@
                                             </form>
                                         </div>
                                     @else
-                                        <div class="d-block mt-1" moe>
+                                        <div class="d-inline-block ml-1" moe>
                                             <a class="" href="" show start>Undo</a>
                                             <form url="/api/bill/undoMarkAsVerified">
                                                 <input type="hidden" name="uid" value="{{$row->uid}}">
@@ -373,65 +318,6 @@
 
             return false;
         };
-
-        function init() {
-            $('.pay-bill')
-                .off('click')
-                .on('click', function() {
-                    showMask();
-                    $.post('/api/bill/payUnpaidProsOnBillExpectedAmount', {
-                        uid: $(this).attr('data-uid')
-                    }, _data => {
-                        if (!hasResponseError(_data)) {
-                            toastr.success('Bill paid successfully');
-                            fastReload();
-                        }
-                    }).then(function() {
-                        hideMask();
-                    });
-                    return false;
-                });
-            $('.pay-selected-pros')
-                .off('click')
-                .on('click', function() {
-                    if (!$('.chk-bill:checked').length) return false;
-                    showMask();
-                    let uids = [];
-                    $('.chk-bill:checked').each(function() {
-                        uids.push($(this).attr('data-uid'));
-                    });
-                    $.post('/api/bill/bulkPayUnpaidProsOnBillExpectedAmount', {
-                        billUids: uids.join('|')
-                    }, _data => {
-                        if (!hasResponseError(_data)) {
-                            toastr.success('Selected bills paid successfully');
-                            fastReload();
-                        }
-                    }).then(function() {
-                        hideMask();
-                    });
-                    return false;
-                });
-            $('.chk-bill')
-                .off('change')
-                .on('change', function() {
-                    console.log('123')
-                    $('.pay-selected-pros').prop('disabled', !$('.chk-bill:checked').length);
-                    $('.chk-all-bills').prop('checked', ($('.chk-bill:checked').length === $('.chk-bill').length));
-                    return false;
-                });
-            $('.chk-all-bills')
-                .off('change')
-                .on('change', function() {
-                    console.log('12')
-                    $('.chk-bill')
-                        .prop('checked', this.checked)
-                        .first()
-                        .trigger('change');
-                    return false;
-                });
-        }
-        addMCInitializer('processing-bill-matrix', init, '#processing-bill-matrix');
     }).call(window);
 </script>
 @endsection

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

@@ -220,7 +220,7 @@
                             <a class="dropdown-item" href="{{ route('practice-management.billing-report') }}">Billing Report</a>
 
                             <a class="dropdown-item" href="{{ route('practice-management.processingBillMatrix') }}">Processing Bills</a>
-                            <a class="dropdown-item" href="{{ route('practice-management.processingBillMatrix2') }}">Processing Bills 2</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.processingBillMatrix2') }}">Processing Bills (RPM)</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>