FIX_Subscription membership Issues : ps
This commit is contained in:
parent
35ee49eb96
commit
c4f86a1534
@ -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 "<pre>";print_r($result);echo "</pre>";
|
||||
// echo "<pre>";print_r($result);echo "</pre>";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) {
|
||||
|
||||
@ -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');
|
||||
|
||||
|
||||
@ -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 @@
|
||||
<label>Select Subscription Type:</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="download_type" id="activeOption" value="active">
|
||||
<label class="form-check-label" for="activeOption">Active Customers</label>
|
||||
<label class="form-check-label" for="activeOption">Active Membership Customer</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="download_type" id="expiredOption" value="expired">
|
||||
<label class="form-check-label" for="expiredOption">Expired Customers</label>
|
||||
<label class="form-check-label" for="expiredOption">Expired Membership Customer</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="download_type" id="bothOption" value="both" checked>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user