diff --git a/app/Models/InvoiceModel.php b/app/Models/InvoiceModel.php index 2f512ab2..f65b07b8 100644 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -157,14 +157,14 @@ public function getJoinedData($where, $orderby = []) $result = $this->db->table('subscription as S') ->select('S.sub_id, S.scheme_id, S.customer_id, S.business_id,S.invoice_id,S.mode,S.from_subscription, S.to_subscription, S.is_renew, S.isactive') ->where("S.isactive",1) - ->where("S.to_subscription <= ",$now) + ->where("S.to_subscription < ",$now) ->get() ->getResultArray(); - // echo "
";print_r($result);echo ""; + // echo "
";print_r($result);echo "";die; $returnMessages = [];$i = 0 ;$j = 0; if (!empty($result)) { foreach ($result as $row) { - $this->db->table('invoiceitems')->where(['invoice_id' => $row['invoice_id']])->update(['from_subscription' => NULL,'to_subscription' => NULL]);//first child + // $this->db->table('invoiceitems')->where(['invoice_id' => $row['invoice_id']])->update(['from_subscription' => NULL,'to_subscription' => NULL]);//first child $this->db->table('subscription')->where(['sub_id' => $row['sub_id']])->update(['isactive' => 0]);//second child $affectedRows = $this->db->affectedRows(); if ($affectedRows) { diff --git a/app/Models/SubscriptionModel.php b/app/Models/SubscriptionModel.php index 279470ed..5d65f560 100644 --- a/app/Models/SubscriptionModel.php +++ b/app/Models/SubscriptionModel.php @@ -313,11 +313,11 @@ public function getSubscriptionDetailsBySchemeName($selectedScheme, $downloadTyp if ($downloadType === 'active') { $builder->where('s.isactive', 1); - // $builder->where('s.to_subscription >=', $currentDate); + $builder->where('s.to_subscription >=', $currentDate); } elseif ($downloadType === 'expired') { $builder->where('s.isactive', 0); // $builder->where('s.to_subscription <', $currentDate); - } + } $builder->orderBy('s.to_subscription', 'asc'); diff --git a/app/Views/subscribers_list.php b/app/Views/subscribers_list.php index 4755c270..b4bf024b 100644 --- a/app/Views/subscribers_list.php +++ b/app/Views/subscribers_list.php @@ -68,11 +68,16 @@ // Calculate days remaining $interval = $currentDate->diff($toDateTime); $daysRemaining = $interval->days; - + if ($currentDate > $toDateTime) { + $daysRemaining = -$daysRemaining; + } - if ($daysRemaining <= 0) { + if ($daysRemaining < 0) { $class = 'text-danger'; $message = "Expired"; + } elseif ($daysRemaining == 0) { + $class = 'text-danger'; + $message = "Expires Today"; } elseif ($daysRemaining == 1) { $class = 'text-warning'; $message = "Expires Tomorrow"; @@ -150,11 +155,11 @@