|
@@ -36,6 +36,7 @@ use App\Models\AccountInvite;
|
|
use App\Models\ClientMeasurementDaysPerMonth;
|
|
use App\Models\ClientMeasurementDaysPerMonth;
|
|
use App\Models\ClientBDTDevice;
|
|
use App\Models\ClientBDTDevice;
|
|
use App\Models\ClientMemo;
|
|
use App\Models\ClientMemo;
|
|
|
|
+use Carbon\Carbon;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Http;
|
|
use Illuminate\Support\Facades\Http;
|
|
use PDF;
|
|
use PDF;
|
|
@@ -100,7 +101,7 @@ class PracticeManagementController extends Controller
|
|
return $clientQuery->where('client_engagement_status_category','<>' ,'DUMMY');
|
|
return $clientQuery->where('client_engagement_status_category','<>' ,'DUMMY');
|
|
})->paginate(50);
|
|
})->paginate(50);
|
|
}else{
|
|
}else{
|
|
- $rows = BillingReport::whereHas('note', function($noteQuery) use ($claimStatus){
|
|
|
|
|
|
+ $rows = BillingReport::whereHas('note', function($noteQuery) use ($claimStatus){
|
|
return $noteQuery->whereHas('claims', function($claimQuery) use ($claimStatus) {
|
|
return $noteQuery->whereHas('claims', function($claimQuery) use ($claimStatus) {
|
|
return $claimQuery->where('status', $claimStatus);
|
|
return $claimQuery->where('status', $claimStatus);
|
|
});
|
|
});
|
|
@@ -108,12 +109,12 @@ class PracticeManagementController extends Controller
|
|
return $clientQuery->where('client_engagement_status_category','<>' ,'DUMMY');
|
|
return $clientQuery->where('client_engagement_status_category','<>' ,'DUMMY');
|
|
})->paginate(50);
|
|
})->paginate(50);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ }else {
|
|
|
|
+ $rows = BillingReport::whereHas('client', function($clientQuery){
|
|
|
|
+ return $clientQuery->where('client_engagement_status_category','<>' ,'DUMMY');
|
|
|
|
+ })->paginate(50);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
$claimStatuses = DB::select('SELECT distinct status FROM claim ORDER BY status DESC');
|
|
$claimStatuses = DB::select('SELECT distinct status FROM claim ORDER BY status DESC');
|
|
|
|
|
|
return view('app.practice-management.billing-report', compact('rows', 'claimStatuses'));
|
|
return view('app.practice-management.billing-report', compact('rows', 'claimStatuses'));
|
|
@@ -799,6 +800,50 @@ class PracticeManagementController extends Controller
|
|
return view('app.practice-management.processing-bill-matrix', $viewData);
|
|
return view('app.practice-management.processing-bill-matrix', $viewData);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function hcpNoteActivity(Request $request)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ $filters = $request->all();
|
|
|
|
+
|
|
|
|
+ $from_date = $request->get('from_date');
|
|
|
|
+ if(!$from_date) {
|
|
|
|
+ $from_date = '2010-01-01';
|
|
|
|
+ }
|
|
|
|
+ $to_date = $request->get('to_date');
|
|
|
|
+ if(!$to_date){
|
|
|
|
+ $to_date = '2900-12-31';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //TODO sanitize inputs
|
|
|
|
+
|
|
|
|
+ $proUid = $request->get('pro-uid');
|
|
|
|
+
|
|
|
|
+ $now = Carbon::now();
|
|
|
|
+ $startOfCurrentMonth = $now->startOfMonth('Y-m-d');
|
|
|
|
+ $endOfCurrentMonth = $now->endOfMonth()->format('Y-m-d');
|
|
|
|
+
|
|
|
|
+ $rows = DB::table('pro')
|
|
|
|
+ ->selectRaw(" *,
|
|
|
|
+ (SELECT id FROM note WHERE note.hcp_pro_id = pro.id AND is_cancelled = false ORDER BY created_at DESC LIMIT 1) as last_note_id,
|
|
|
|
+ (SELECT note.created_at FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false ORDER BY note.created_at DESC LIMIT 1) as last_note_created_at,
|
|
|
|
+ (SELECT COUNT(*) FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false AND created_at >= '${startOfCurrentMonth}'::DATE AND created_at <= '${endOfCurrentMonth}'::DATE ) AS notes_this_month,
|
|
|
|
+ (SELECT COUNT(*) FROM note WHERE note.hcp_pro_id = pro.id AND note.is_cancelled = false AND created_at >= '${from_date}'::DATE AND created_at <= '${to_date}'::DATE ) AS notes_this_period");
|
|
|
|
+
|
|
|
|
+ $prosIDs = $request->get('pros_ids');
|
|
|
|
+ if($prosIDs){
|
|
|
|
+ $pros =
|
|
|
|
+ $rows = $rows->whereIn('pro.id', $prosIDs);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $rows = $rows->orderBy('name_first');
|
|
|
|
+ $rows = $rows->paginate(50);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return view('app.practice-management.hcp-note-activity', compact('rows', 'filters'));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
public function proFinancials(Request $request, $proUid = null)
|
|
public function proFinancials(Request $request, $proUid = null)
|
|
{
|
|
{
|
|
$proUid = $proUid ? $proUid : $request->get('pro-uid');
|
|
$proUid = $proUid ? $proUid : $request->get('pro-uid');
|