|
@@ -821,13 +821,15 @@ class PracticeManagementController extends Controller
|
|
|
|
|
|
$now = Carbon::now();
|
|
|
$startOfCurrentMonth = $now->startOfMonth('Y-m-d');
|
|
|
- $endOfCurrentMonth = $now->endOfMonth()->format('Y-m-d');
|
|
|
+ $startOfCurrentMonth = $startOfCurrentMonth->toDateString();
|
|
|
+
|
|
|
+ $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::DATE >= '${startOfCurrentMonth}'::DATE AND created_at::DATE <= '${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');
|