customer edit status : ps
This commit is contained in:
parent
f155314d1f
commit
c20ac1caff
@ -100,20 +100,33 @@ class CustomerModel extends Model
|
|||||||
->getResult();
|
->getResult();
|
||||||
// print_r($this->db->getLastQuery());die;
|
// print_r($this->db->getLastQuery());die;
|
||||||
}
|
}
|
||||||
|
// public function getSubscriberDataByCustomerId($customerId)
|
||||||
|
// {
|
||||||
|
// // Default invoice type is 2 (subscription).
|
||||||
|
// $where = ['subscription.customer_id'=> $customerId,'invoice.invoice_type' => 2,'subscription.isactive' => 1];
|
||||||
|
// // Assuming 'subscription' is the table name where subscriber data is stored.
|
||||||
|
// $builder = $this->db->table('subscription');
|
||||||
|
// $builder->join('books', 'books.book_id = subscription.scheme_id');
|
||||||
|
// $builder->join('invoice', 'subscription.customer_id = invoice.customer_id', 'left');
|
||||||
|
// // Define the columns you want to select from the subscription table.
|
||||||
|
// $builder->select('subscription.*,books.title,DATE_FORMAT(subscription.from_subscription, "%d/%m/%Y") AS formatted_from_subscription,DATE_FORMAT(subscription.to_subscription, "%d/%m/%Y") AS formatted_to_subscription,DATEDIFF(subscription.to_subscription, subscription.from_subscription) as subscription_in_days');
|
||||||
|
// // Add a where condition to filter results based on customer ID.
|
||||||
|
// $builder->where($where);
|
||||||
|
// $builder->groupBy('subscription.sub_id');
|
||||||
|
// // Execute the query and return the result as an array of objects.
|
||||||
|
// return $builder->get()->getResult();
|
||||||
|
// }
|
||||||
|
|
||||||
public function getSubscriberDataByCustomerId($customerId)
|
public function getSubscriberDataByCustomerId($customerId)
|
||||||
{
|
{
|
||||||
// Default invoice type is 2 (subscription).
|
// Default invoice type is 2 (subscription).
|
||||||
$where = ['subscription.customer_id'=> $customerId,'invoice.invoice_type' => 2,'subscription.isactive' => 1];
|
$where = ['subscription.customer_id'=> $customerId,'invoice.invoice_type' => 2,'subscription.isactive' => 1];
|
||||||
// Assuming 'subscription' is the table name where subscriber data is stored.
|
|
||||||
$builder = $this->db->table('subscription');
|
$builder = $this->db->table('subscription');
|
||||||
$builder->join('books', 'books.book_id = subscription.scheme_id');
|
$builder->select('subscription.sub_id,subscription.scheme_id,subscription.customer_id,subscription.invoice_id,subscription.isactive,invoice.invoice_number,invoice.status,books.title, DATE_FORMAT(subscription.from_subscription, "%d/%m/%Y") AS formatted_from_subscription, DATE_FORMAT(subscription.to_subscription, "%d/%m/%Y") AS formatted_to_subscription, DATEDIFF(subscription.to_subscription, subscription.from_subscription) as subscription_in_days');
|
||||||
$builder->join('invoice', 'subscription.customer_id = invoice.customer_id', 'left');
|
$builder->join('books', 'books.book_id = subscription.scheme_id', 'left');
|
||||||
// Define the columns you want to select from the subscription table.
|
$builder->join('invoice', 'subscription.invoice_id = invoice.invoice_id', 'left');
|
||||||
$builder->select('subscription.*,books.title,DATE_FORMAT(subscription.from_subscription, "%d/%m/%Y") AS formatted_from_subscription,DATE_FORMAT(subscription.to_subscription, "%d/%m/%Y") AS formatted_to_subscription,DATEDIFF(subscription.to_subscription, subscription.from_subscription) as subscription_in_days');
|
|
||||||
// Add a where condition to filter results based on customer ID.
|
|
||||||
$builder->where($where);
|
$builder->where($where);
|
||||||
$builder->groupBy('subscription.sub_id');
|
// $builder->groupBy('subscription.sub_id');
|
||||||
// Execute the query and return the result as an array of objects.
|
|
||||||
return $builder->get()->getResult();
|
return $builder->get()->getResult();
|
||||||
// print_r($this->db->getLastQuery());die;
|
// print_r($this->db->getLastQuery());die;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -265,7 +265,10 @@
|
|||||||
<th>Subscription Name</th>
|
<th>Subscription Name</th>
|
||||||
<th>From Subscription</th>
|
<th>From Subscription</th>
|
||||||
<th>To Subscription</th>
|
<th>To Subscription</th>
|
||||||
|
<th>Invoice Number</th>
|
||||||
|
<th>Invoice Status</th>
|
||||||
<th>Expiring Status</th>
|
<th>Expiring Status</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -286,6 +289,8 @@
|
|||||||
<td><?= $subscription->title ?></td>
|
<td><?= $subscription->title ?></td>
|
||||||
<td><?= $subscription->formatted_from_subscription ?></td>
|
<td><?= $subscription->formatted_from_subscription ?></td>
|
||||||
<td><?= $subscription->formatted_to_subscription ?></td>
|
<td><?= $subscription->formatted_to_subscription ?></td>
|
||||||
|
<td><?= $subscription->invoice_number ?></td>
|
||||||
|
<td><?= $subscription->status ?></td>
|
||||||
<td><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
|
<td><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user