|
@@ -808,73 +808,16 @@ class PracticeManagementController extends Controller
|
|
|
$query->where('uid', $proUid)->first();
|
|
|
}
|
|
|
|
|
|
- $bills = Bill::where('is_cancelled', false);
|
|
|
+ $rows = DB::table('pro')
|
|
|
+ ->selectRaw(" *,
|
|
|
+ (SELECT id FROM note WHERE hcp_pro_id = p.id AND is_cancelled = false ORDER BY created_at DESC LIMIT 1) as last_note_id,
|
|
|
+ (SELECT created_at FROM note WHERE hcp_pro_id = p.id AND is_cancelled = false ORDER BY created_at DESC LIMIT 1) as last_note_created_at,
|
|
|
+ (SELECT COUNT(*) FROM note WHERE hcp_pro_id = p.id AND is_cancelled = false ) AS note_count ")
|
|
|
+ ->orderBy('name_first')
|
|
|
+ ->paginate(50);
|
|
|
|
|
|
- if(!$request->input('t') || $request->input('t') === 'hcp') {
|
|
|
- $bills = $bills
|
|
|
- ->where('has_hcp_been_paid', false)
|
|
|
- ->where('hcp_expected_payment_amount', '>', 0)
|
|
|
- ->where('is_signed_by_hcp', true);
|
|
|
- if ($targetPro) {
|
|
|
- $bills = $bills->where('hcp_pro_id', $targetPro->id);
|
|
|
- }
|
|
|
- if($request->input('c')) {
|
|
|
- $bills = $bills->whereRaw('(SELECT company_id from company_pro where id = hcp_company_pro_id) = ' . $request->input('c'));
|
|
|
- }
|
|
|
- }
|
|
|
- else if($request->input('t') === 'na') {
|
|
|
- $bills = $bills
|
|
|
- ->where('has_generic_pro_been_paid', false)
|
|
|
- ->where('generic_pro_expected_payment_amount', '>', 0)
|
|
|
- ->where('is_signed_by_generic_pro', true);
|
|
|
- if ($targetPro) {
|
|
|
- $bills = $bills->where('generic_pro_id', $targetPro->id);
|
|
|
- }
|
|
|
- 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) {
|
|
|
- case 'verified':
|
|
|
- $bills = $bills->where('is_verified', true);
|
|
|
- break;
|
|
|
- case 'not-verified':
|
|
|
- $bills = $bills->where('is_verified', false);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- $filter = $request->input('bs');
|
|
|
- if ($filter) {
|
|
|
- $bills = $bills->where('balance_post_date', '>=', $filter);
|
|
|
- }
|
|
|
-
|
|
|
- $filter = $request->input('be');
|
|
|
- if ($filter) {
|
|
|
- $bills = $bills->where('balance_post_date', '<=', $filter);
|
|
|
- }
|
|
|
-
|
|
|
- $filter = $request->input('s');
|
|
|
- if ($filter) {
|
|
|
- $bills = $bills->where('code', '=', $filter);
|
|
|
- }
|
|
|
-
|
|
|
- $bills = $bills->orderBy('effective_date', 'desc')->paginate();
|
|
|
-
|
|
|
- $companies = Company::where('is_active', true)->orderBy('name')->get();
|
|
|
-
|
|
|
- $codes = DB::select(DB::raw("SELECT code, count(*) as count FROM bill WHERE is_cancelled IS FALSE GROUP BY code ORDER BY code"));
|
|
|
-
|
|
|
- $viewData = [
|
|
|
- 'bills' => $bills,
|
|
|
- 'targetPro' => $targetPro,
|
|
|
- 'performerPro' => $performerPro,
|
|
|
- 'proUid' => $proUid,
|
|
|
- 'companies' => $companies,
|
|
|
- 'codes' => $codes
|
|
|
- ];
|
|
|
- return view('app.practice-management.processing-bill-matrix', $viewData);
|
|
|
+ return view('app.practice-management.hcp-note-activity', compact('rows'));
|
|
|
}
|
|
|
|
|
|
|