diff --git a/app/Domains/Virtual/Services/CardService.php b/app/Domains/Virtual/Services/CardService.php index 09ec21e0..2bbf18ab 100644 --- a/app/Domains/Virtual/Services/CardService.php +++ b/app/Domains/Virtual/Services/CardService.php @@ -62,19 +62,19 @@ class CardService extends Service { switch ($card_status) { case 0: - $res = OrderCardPartition::selectRaw('DISTINCT(sim) sim, created_at')->whereNull('service_start_at')->whereHas('card', function ($relation) { + $res = OrderCardPartition::selectRaw('DISTINCT(sim) sim, created_at')->whereIn('type', [0, 1, 2])->whereNull('service_start_at')->whereHas('card', function ($relation) { $relation->whereNull('cancelled_at'); })->where('created_at', '<', Carbon::now()->subMonths(6))->orderBy('created_at', 'desc')->paginate($limit); break; case 1: - $res = OrderCardPartition::selectRaw('DISTINCT(sim) sim, created_at')->whereNull('service_start_at')->whereHas('card', function ($relation) { + $res = OrderCardPartition::selectRaw('DISTINCT(sim) sim, created_at')->whereIn('type', [0, 1, 2])->whereNull('service_start_at')->whereHas('card', function ($relation) { $relation->whereNull('cancelled_at'); })->where('created_at', '>=', Carbon::now()->subMonths(6))->orderBy('created_at', 'desc')->paginate($limit); break; case 2: - $res = OrderCardPartition::selectRaw('DISTINCT(sim) sim, created_at')->whereNotNull('service_start_at') + $res = OrderCardPartition::selectRaw('DISTINCT(sim) sim, created_at')->whereIn('type', [0, 1, 2])->whereNotNull('service_start_at') ->where('service_start_at', '<=', date('Y-m-d H:i:s')) ->where('service_end_at', '>=', date('Y-m-d H:i:s')) ->whereHas('card', function ($relation) { @@ -83,7 +83,7 @@ class CardService extends Service break; case 3: - $res = OrderCardPartition::selectRaw('DISTINCT(sim) sim, created_at')->whereNotNull('service_start_at') + $res = OrderCardPartition::selectRaw('DISTINCT(sim) sim, created_at')->whereIn('type', [0, 1, 2])->whereNotNull('service_start_at') ->where('service_start_at', '<=', date('Y-m-d H:i:s')) ->where('service_end_at', '>=', date('Y-m-d H:i:s')) ->whereHas('card', function ($relation) {