|
@@ -13,6 +13,22 @@ use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
{
|
|
|
+
|
|
|
+ public function confirmSmsAuthToken(Request $request)
|
|
|
+ {
|
|
|
+ return view('app/confirm_sms_auth_token');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setPassword(Request $request)
|
|
|
+ {
|
|
|
+ return view('app/set_password');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setSecurityQuestions(Request $request)
|
|
|
+ {
|
|
|
+ return view('app/set_security_questions');
|
|
|
+ }
|
|
|
+
|
|
|
public function dashboard(Request $request)
|
|
|
{
|
|
|
|
|
@@ -56,43 +72,43 @@ class HomeController extends Controller
|
|
|
$keyNumbers['pendingNotesToSign'] = $pendingNotesToSign;
|
|
|
|
|
|
$reimbursement = [];
|
|
|
- $reimbursement["currentBalance"] = '$'.$performer->pro->balance;
|
|
|
+ $reimbursement["currentBalance"] = '$' . $performer->pro->balance;
|
|
|
$reimbursement["nextPaymentDate"] = '--';
|
|
|
$lastPayment = ProTransaction::where('pro_id', $performerProID)->where('plus_or_minus', 'PLUS')->orderBy('created_at', 'DESC')->first();
|
|
|
if ($lastPayment) {
|
|
|
- $reimbursement["lastPayment"] = '$'.$lastPayment->amount;
|
|
|
+ $reimbursement["lastPayment"] = '$' . $lastPayment->amount;
|
|
|
$reimbursement["lastPaymentDate"] = $lastPayment->created_at;
|
|
|
} else {
|
|
|
$reimbursement["lastPayment"] = '--';
|
|
|
$reimbursement["lastPaymentDate"] = '--';
|
|
|
}
|
|
|
|
|
|
- //if today is < 15th, next payment is 15th, else nextPayment is
|
|
|
- $today = strtotime(date('Y-m-d'));
|
|
|
- $todayDate = date('j', $today);
|
|
|
-
|
|
|
- $todayMonth = date('m', $today);
|
|
|
- $todayYear = date('Y', $today);
|
|
|
- if($todayDate < 15){
|
|
|
- $nextPaymentDate = new DateTime();
|
|
|
- $nextPaymentDate->setDate($todayYear, $todayMonth, 15);
|
|
|
- $reimbursement['nextPaymentDate'] = $nextPaymentDate->format('m/d/Y');
|
|
|
- }else{
|
|
|
- $nextPaymentDate = new \DateTime();
|
|
|
- $lastDayOfMonth = date('t', $today);
|
|
|
- $nextPaymentDate->setDate($todayYear, $todayMonth, $lastDayOfMonth);
|
|
|
- $reimbursement['nextPaymentDate'] = $nextPaymentDate->format('m/d/Y');
|
|
|
- }
|
|
|
-
|
|
|
- //expectedPay
|
|
|
- $expectedForHcp = DB::select(DB::raw("SELECT coalesce(SUM(hcp_expected_payment_amount),0) as expected_pay FROM bill WHERE hcp_pro_id = :performerProID AND has_hcp_been_paid = false AND is_cancelled = false"), ['performerProID'=>$performerProID])[0]->expected_pay;
|
|
|
- $expectedForCm = DB::select(DB::raw("SELECT coalesce(SUM(cm_expected_payment_amount),0) as expected_pay FROM bill WHERE cm_pro_id = :performerProID AND has_cm_been_paid = false AND is_cancelled = false"), ['performerProID'=>$performerProID])[0]->expected_pay;
|
|
|
- $expectedForRme = DB::select(DB::raw("SELECT coalesce(SUM(rme_expected_payment_amount),0) as expected_pay FROM bill WHERE rme_pro_id = :performerProID AND has_rme_been_paid = false AND is_cancelled = false"), ['performerProID'=>$performerProID])[0]->expected_pay;
|
|
|
- $expectedForRmm = DB::select(DB::raw("SELECT coalesce(SUM(rmm_expected_payment_amount),0) as expected_pay FROM bill WHERE rmm_pro_id = :performerProID AND has_rmm_been_paid = false AND is_cancelled = false"), ['performerProID'=>$performerProID])[0]->expected_pay;
|
|
|
- $expectedForNa = DB::select(DB::raw("SELECT coalesce(SUM(na_expected_payment_amount),0) as expected_pay FROM bill WHERE na_pro_id = :performerProID AND has_na_been_paid = false AND is_cancelled = false"), ['performerProID'=>$performerProID])[0]->expected_pay;
|
|
|
+ //if today is < 15th, next payment is 15th, else nextPayment is
|
|
|
+ $today = strtotime(date('Y-m-d'));
|
|
|
+ $todayDate = date('j', $today);
|
|
|
+
|
|
|
+ $todayMonth = date('m', $today);
|
|
|
+ $todayYear = date('Y', $today);
|
|
|
+ if ($todayDate < 15) {
|
|
|
+ $nextPaymentDate = new DateTime();
|
|
|
+ $nextPaymentDate->setDate($todayYear, $todayMonth, 15);
|
|
|
+ $reimbursement['nextPaymentDate'] = $nextPaymentDate->format('m/d/Y');
|
|
|
+ } else {
|
|
|
+ $nextPaymentDate = new \DateTime();
|
|
|
+ $lastDayOfMonth = date('t', $today);
|
|
|
+ $nextPaymentDate->setDate($todayYear, $todayMonth, $lastDayOfMonth);
|
|
|
+ $reimbursement['nextPaymentDate'] = $nextPaymentDate->format('m/d/Y');
|
|
|
+ }
|
|
|
+
|
|
|
+ //expectedPay
|
|
|
+ $expectedForHcp = DB::select(DB::raw("SELECT coalesce(SUM(hcp_expected_payment_amount),0) as expected_pay FROM bill WHERE hcp_pro_id = :performerProID AND has_hcp_been_paid = false AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
|
|
|
+ $expectedForCm = DB::select(DB::raw("SELECT coalesce(SUM(cm_expected_payment_amount),0) as expected_pay FROM bill WHERE cm_pro_id = :performerProID AND has_cm_been_paid = false AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
|
|
|
+ $expectedForRme = DB::select(DB::raw("SELECT coalesce(SUM(rme_expected_payment_amount),0) as expected_pay FROM bill WHERE rme_pro_id = :performerProID AND has_rme_been_paid = false AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
|
|
|
+ $expectedForRmm = DB::select(DB::raw("SELECT coalesce(SUM(rmm_expected_payment_amount),0) as expected_pay FROM bill WHERE rmm_pro_id = :performerProID AND has_rmm_been_paid = false AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
|
|
|
+ $expectedForNa = DB::select(DB::raw("SELECT coalesce(SUM(na_expected_payment_amount),0) as expected_pay FROM bill WHERE na_pro_id = :performerProID AND has_na_been_paid = false AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
|
|
|
|
|
|
$totalExpectedAmount = $expectedForHcp + $expectedForCm + $expectedForRme + $expectedForRmm + $expectedForNa;
|
|
|
- $reimbursement['nextPaymentAmount'] = '$'.$totalExpectedAmount;
|
|
|
+ $reimbursement['nextPaymentAmount'] = '$' . $totalExpectedAmount;
|
|
|
|
|
|
$clientsWithAppointments = Client::where("mcp_pro_id", $performerProID)
|
|
|
->whereNotNull('next_mcp_appointment')->get();
|
|
@@ -113,13 +129,13 @@ class HomeController extends Controller
|
|
|
public function patients(Request $request)
|
|
|
{
|
|
|
$proID = $this->performer()->pro->id;
|
|
|
- $patients = Client::where(function ($q) use($proID) {
|
|
|
- $q->where('mcp_pro_id', $proID)
|
|
|
- ->orWhere('cm_pro_id', $proID)
|
|
|
- ->orWhere('rmm_pro_id', $proID)
|
|
|
- ->orWhere('rme_pro_id', $proID)
|
|
|
- ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID]);
|
|
|
- })
|
|
|
+ $patients = Client::where(function ($q) use ($proID) {
|
|
|
+ $q->where('mcp_pro_id', $proID)
|
|
|
+ ->orWhere('cm_pro_id', $proID)
|
|
|
+ ->orWhere('rmm_pro_id', $proID)
|
|
|
+ ->orWhere('rme_pro_id', $proID)
|
|
|
+ ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID]);
|
|
|
+ })
|
|
|
->orderBy('name_last', 'asc')
|
|
|
->orderBy('name_first', 'asc')
|
|
|
->get();
|
|
@@ -140,7 +156,8 @@ class HomeController extends Controller
|
|
|
return view('app/mc', compact('page'));
|
|
|
}
|
|
|
|
|
|
- public function blank(Request $request) {
|
|
|
+ public function blank(Request $request)
|
|
|
+ {
|
|
|
return view('app/blank');
|
|
|
}
|
|
|
}
|