|
@@ -479,41 +479,27 @@ OFFSET {$offset} LIMIT {$perPage}
|
|
{
|
|
{
|
|
$proID = $this->performer()->pro->id;
|
|
$proID = $this->performer()->pro->id;
|
|
$isAdmin = $this->performer()->pro->pro_type === 'ADMIN';
|
|
$isAdmin = $this->performer()->pro->pro_type === 'ADMIN';
|
|
- $query = Bill::where('is_cancelled', false)->where('bill_service_type', 'NOTE');
|
|
|
|
|
|
+ $query = Bill::where('is_cancelled', false)->whereRaw("(bill_service_type = 'NOTE' OR bill_service_type = 'GENERIC')");
|
|
switch ($filter) {
|
|
switch ($filter) {
|
|
case 'not-yet-signed':
|
|
case 'not-yet-signed':
|
|
$query = $query
|
|
$query = $query
|
|
->where(function ($q) use ($proID, $isAdmin) {
|
|
->where(function ($q) use ($proID, $isAdmin) {
|
|
$q->where(function ($q2) use ($proID, $isAdmin) {
|
|
$q->where(function ($q2) use ($proID, $isAdmin) {
|
|
$q2->where('is_signed_by_hcp', false);
|
|
$q2->where('is_signed_by_hcp', false);
|
|
- if(!$isAdmin) {
|
|
|
|
|
|
+ if (!$isAdmin) {
|
|
$q2->where('hcp_pro_id', $proID);
|
|
$q2->where('hcp_pro_id', $proID);
|
|
|
|
+ } else {
|
|
|
|
+ $q2->whereNotNull('hcp_pro_id');
|
|
}
|
|
}
|
|
- })/*
|
|
|
|
- ->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
- $q2->where('is_signed_by_cm', false);
|
|
|
|
- if(!$isAdmin) {
|
|
|
|
- $q2->where('cm_pro_id', $proID);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- ->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
- $q2->where('is_signed_by_rme', false);
|
|
|
|
- if(!$isAdmin) {
|
|
|
|
- $q2->where('rme_pro_id', $proID);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- ->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
- $q2->where('is_signed_by_rmm', false);
|
|
|
|
- if(!$isAdmin) {
|
|
|
|
- $q2->where('rmm_pro_id', $proID);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- ->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
|
|
+ })->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
$q2->where('is_signed_by_generic_pro', false);
|
|
$q2->where('is_signed_by_generic_pro', false);
|
|
- if(!$isAdmin) {
|
|
|
|
|
|
+ if (!$isAdmin) {
|
|
$q2->where('generic_pro_id', $proID);
|
|
$q2->where('generic_pro_id', $proID);
|
|
}
|
|
}
|
|
- })*/;
|
|
|
|
|
|
+ else {
|
|
|
|
+ $q2->whereNotNull('generic_pro_id');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
});
|
|
});
|
|
break;
|
|
break;
|
|
|
|
|
|
@@ -522,56 +508,42 @@ OFFSET {$offset} LIMIT {$perPage}
|
|
->where(function ($q) use ($proID, $isAdmin) {
|
|
->where(function ($q) use ($proID, $isAdmin) {
|
|
$q->where(function ($q2) use ($proID, $isAdmin) {
|
|
$q->where(function ($q2) use ($proID, $isAdmin) {
|
|
$q2->where('is_signed_by_hcp', true);
|
|
$q2->where('is_signed_by_hcp', true);
|
|
- if(!$isAdmin) {
|
|
|
|
|
|
+ if (!$isAdmin) {
|
|
$q2->where('hcp_pro_id', $proID);
|
|
$q2->where('hcp_pro_id', $proID);
|
|
|
|
+ } else {
|
|
|
|
+ $q2->whereNotNull('hcp_pro_id');
|
|
}
|
|
}
|
|
- })/*
|
|
|
|
- ->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
- $q2->where('is_signed_by_cm', true);
|
|
|
|
- if(!$isAdmin) {
|
|
|
|
- $q2->where('cm_pro_id', $proID);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- ->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
- $q2->where('is_signed_by_rme', true);
|
|
|
|
- if(!$isAdmin) {
|
|
|
|
- $q2->where('rme_pro_id', $proID);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- ->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
- $q2->where('is_signed_by_rmm', true);
|
|
|
|
- if(!$isAdmin) {
|
|
|
|
- $q2->where('rmm_pro_id', $proID);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- ->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
- $q2->where('is_signed_by_generic_pro', true);
|
|
|
|
- if(!$isAdmin) {
|
|
|
|
- $q2->where('generic_pro_id', $proID);
|
|
|
|
- }
|
|
|
|
- })*/;
|
|
|
|
|
|
+ })->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
+ $q2->where('is_signed_by_generic_pro', true);
|
|
|
|
+ if (!$isAdmin) {
|
|
|
|
+ $q2->where('generic_pro_id', $proID);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $q2->whereNotNull('generic_pro_id');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
});
|
|
});
|
|
break;
|
|
break;
|
|
|
|
|
|
// more cases can be added as needed
|
|
// more cases can be added as needed
|
|
default:
|
|
default:
|
|
- if(!$isAdmin) {
|
|
|
|
- $query = $query
|
|
|
|
- ->where(function ($q) use ($proID) {
|
|
|
|
- $q->where(function ($q2) use ($proID) {
|
|
|
|
|
|
+ $query = $query
|
|
|
|
+ ->where(function ($q) use ($proID, $isAdmin) {
|
|
|
|
+ $q->where(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
+ if (!$isAdmin) {
|
|
$q2->where('hcp_pro_id', $proID);
|
|
$q2->where('hcp_pro_id', $proID);
|
|
- })/*
|
|
|
|
- ->orWhere(function ($q2) use ($proID) {
|
|
|
|
- $q2->where('cm_pro_id', $proID);
|
|
|
|
- })
|
|
|
|
- ->orWhere(function ($q2) use ($proID) {
|
|
|
|
- $q2->where('rme_pro_id', $proID);
|
|
|
|
- })
|
|
|
|
- ->orWhere(function ($q2) use ($proID) {
|
|
|
|
- $q2->where('rmm_pro_id', $proID);
|
|
|
|
- })*/;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ $q2->whereNotNull('hcp_pro_id');
|
|
|
|
+ }
|
|
|
|
+ })->orWhere(function ($q2) use ($proID, $isAdmin) {
|
|
|
|
+ if (!$isAdmin) {
|
|
|
|
+ $q2->where('generic_pro_id', $proID);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $q2->whereNotNull('generic_pro_id');
|
|
|
|
+ }
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ });
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
$bills = $query->orderBy('created_at', 'desc')->paginate(50);
|
|
$bills = $query->orderBy('created_at', 'desc')->paginate(50);
|