customer edit status : ps
This commit is contained in:
parent
f155314d1f
commit
c20ac1caff
@ -100,20 +100,33 @@ class CustomerModel extends Model
|
||||
->getResult();
|
||||
// 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)
|
||||
{
|
||||
// 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->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('books', 'books.book_id = subscription.scheme_id', 'left');
|
||||
$builder->join('invoice', 'subscription.invoice_id = invoice.invoice_id', 'left');
|
||||
$builder->where($where);
|
||||
$builder->groupBy('subscription.sub_id');
|
||||
// Execute the query and return the result as an array of objects.
|
||||
// $builder->groupBy('subscription.sub_id');
|
||||
return $builder->get()->getResult();
|
||||
// print_r($this->db->getLastQuery());die;
|
||||
}
|
||||
|
||||
@ -265,7 +265,10 @@
|
||||
<th>Subscription Name</th>
|
||||
<th>From Subscription</th>
|
||||
<th>To Subscription</th>
|
||||
<th>Invoice Number</th>
|
||||
<th>Invoice Status</th>
|
||||
<th>Expiring Status</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -286,6 +289,8 @@
|
||||
<td><?= $subscription->title ?></td>
|
||||
<td><?= $subscription->formatted_from_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>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user