|
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|
|
use App\Lib\Backend;
|
|
|
use App\Models\Appointment;
|
|
|
use App\Models\AppSession;
|
|
|
+use App\Models\ClientProChange;
|
|
|
use App\Models\ClientSMS;
|
|
|
use App\Models\Facility;
|
|
|
use App\Models\IncomingReport;
|
|
@@ -377,10 +378,49 @@ class HomeController extends Controller
|
|
|
->whereRaw('created_by_session_id IN (SELECT id FROM app_session where pro_id = ?)', [$performer->pro->id])
|
|
|
->count();
|
|
|
|
|
|
+ $newMCPAssociations = ClientProChange
|
|
|
+ ::where('new_pro_id', $performerProID)
|
|
|
+ ->where('responsibility_type', 'MCP')
|
|
|
+ ->whereNull('current_client_pro_change_decision_id')
|
|
|
+ ->get();
|
|
|
+
|
|
|
+ $newNAAssociations = ClientProChange
|
|
|
+ ::where('new_pro_id', $performerProID)
|
|
|
+ ->where('responsibility_type', 'DEFAULT_NA')
|
|
|
+ ->whereNull('current_client_pro_change_decision_id')
|
|
|
+ ->get();
|
|
|
+
|
|
|
+ $naBillableSignedNotes = DB::select(DB::raw("
|
|
|
+SELECT count(note.id) as na_billable_notes
|
|
|
+FROM note
|
|
|
+WHERE
|
|
|
+ note.is_signed_by_hcp = TRUE AND
|
|
|
+ note.ally_pro_id = :pro_id AND
|
|
|
+ note.is_cancelled = FALSE AND
|
|
|
+ (
|
|
|
+ SELECT count(bill.id)
|
|
|
+ FROM bill
|
|
|
+ WHERE
|
|
|
+ bill.is_cancelled = FALSE AND
|
|
|
+ bill.generic_pro_id = :pro_id AND
|
|
|
+ bill.note_id = note.id
|
|
|
+ ) = 0
|
|
|
+ "), ["pro_id" => $performerProID]);
|
|
|
+
|
|
|
+ if(!$naBillableSignedNotes || !count($naBillableSignedNotes)) {
|
|
|
+ $naBillableSignedNotes = 0;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $naBillableSignedNotes = $naBillableSignedNotes[0]->na_billable_notes;
|
|
|
+ }
|
|
|
+
|
|
|
+ $keyNumbers['naBillableSignedNotes'] = $naBillableSignedNotes;
|
|
|
+
|
|
|
return view('app/dashboard', compact('keyNumbers', 'reimbursement', 'milliseconds',
|
|
|
'businessNumbers',
|
|
|
'incomingReports', 'tickets', 'supplyOrders',
|
|
|
- 'numERx', 'numLabs', 'numImaging', 'numSupplyOrders'));
|
|
|
+ 'numERx', 'numLabs', 'numImaging', 'numSupplyOrders',
|
|
|
+ 'newMCPAssociations', 'newNAAssociations'));
|
|
|
}
|
|
|
|
|
|
public function dashboardMeasurementsTab(Request $request, $page = 1) {
|