|
@@ -1398,6 +1398,16 @@ WHERE
|
|
|
return $totalExpectedAmount;
|
|
|
}
|
|
|
|
|
|
+ public function getProcessingAmountAsRd(){
|
|
|
+ $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_signed_by_cm IS TRUE AND is_cancelled = false"), ['performerProID' => $this->id])[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_signed_by_rme IS TRUE AND is_cancelled = false"), ['performerProID' => $this->id])[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_signed_by_rmm IS TRUE AND is_cancelled = false"), ['performerProID' => $this->id])[0]->expected_pay;
|
|
|
+ $expectedForNa = DB::select(DB::raw("SELECT coalesce(SUM(generic_pro_expected_payment_amount),0) as expected_pay FROM bill WHERE generic_pro_id = :performerProID AND has_generic_pro_been_paid = false AND is_signed_by_generic_pro IS TRUE AND is_cancelled = false"), ['performerProID' => $this->id])[0]->expected_pay;
|
|
|
+ $totalExpectedAmount = $expectedForCm + $expectedForRme + $expectedForRmm + $expectedForNa;
|
|
|
+
|
|
|
+ return $totalExpectedAmount;
|
|
|
+ }
|
|
|
+
|
|
|
public function getNextPaymentDateAsDna(){
|
|
|
$nextPaymentDate = '--';
|
|
|
//if today is < 15th, next payment is 15th, else nextPayment is
|
|
@@ -1418,7 +1428,29 @@ WHERE
|
|
|
}
|
|
|
|
|
|
return $nextPaymentDate;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getNextPaymentDateAsRd(){
|
|
|
+ $nextPaymentDate = '--';
|
|
|
+ //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);
|
|
|
+ $nextPaymentDate = $nextPaymentDate->format('m/d/Y');
|
|
|
+ } else {
|
|
|
+ $nextPaymentDate = new \DateTime();
|
|
|
+ $lastDayOfMonth = date('t', $today);
|
|
|
+ $nextPaymentDate->setDate($todayYear, $todayMonth, $lastDayOfMonth);
|
|
|
+ $nextPaymentDate = $nextPaymentDate->format('m/d/Y');
|
|
|
+ }
|
|
|
+
|
|
|
+ return $nextPaymentDate;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
public function clientSmsesAsDna(){
|
|
@@ -1430,6 +1462,15 @@ WHERE
|
|
|
->paginate(15);
|
|
|
}
|
|
|
|
|
|
+ public function clientSmsesAsrd(){
|
|
|
+ $myId = $this->id;
|
|
|
+ return ClientSMS::whereHas('client', function($clientQuery) use ($myId){
|
|
|
+ return $clientQuery->where('rd_pro_id', $myId);
|
|
|
+ })
|
|
|
+ ->orderBy('created_at', 'DESC')
|
|
|
+ ->paginate(15);
|
|
|
+ }
|
|
|
+
|
|
|
public function clientMemosAsDna(){
|
|
|
$naClientMemos = DB::select(
|
|
|
DB::raw("
|