tracker items
This commit is contained in:
parent
8000f261b6
commit
a52ad0c5ea
@ -28,6 +28,8 @@ class Home extends BaseController
|
||||
// $data['active_category'] = $model->schemes();
|
||||
$data['active_schemes'] = $model->active_schemes();
|
||||
$data['expiring_membership'] = $model->expiring_membership_list();
|
||||
$data['notifications'] = $model->expiring_membership_list();
|
||||
// print_r( $data['expiring_membership']);die;
|
||||
// $data['active_category'] = array_filter($model->schemes(), function ($element) {
|
||||
// return $element['count'] !== '0' ;
|
||||
// });
|
||||
|
||||
@ -835,6 +835,14 @@ $encodedUrl = urlencode($url);
|
||||
}
|
||||
|
||||
}
|
||||
private function calculateTotalBookQuantity(&$reportData)
|
||||
{
|
||||
// Calculate the total book quantity for each publisher
|
||||
foreach ($reportData as &$row) {
|
||||
$totalBookQuantity = array_sum(array_column($row->books, 'quantity'));
|
||||
$row->total_book_quantity = $totalBookQuantity;
|
||||
}
|
||||
}
|
||||
public function book_publishwise_Report()
|
||||
{
|
||||
if($this->request->getmethod() == 'get')
|
||||
|
||||
@ -452,7 +452,7 @@ class Notifications extends BaseController
|
||||
################################################################
|
||||
public function getExpCustomerDetail($window_time = null)
|
||||
{
|
||||
echo "hi";die;
|
||||
echo "hi";
|
||||
# Step 1: add the days to retrive the data//
|
||||
$providedDate = date('Y-m-d');
|
||||
$newDate = date('Y-m-d', strtotime($providedDate . ' + ' . $window_time . ' days'));
|
||||
|
||||
@ -25,6 +25,27 @@ class HomeModel extends Model
|
||||
return $customer;
|
||||
}
|
||||
|
||||
// public function invoice_dtls() {
|
||||
// if ((int)date('m') <= 3) {
|
||||
// $invoice['financial_year'] = (date('Y')-1) . '-' . date('Y');
|
||||
// $start_date = (date('Y')-1).'-04-01';
|
||||
// $end_date = date('Y').'-03-31';
|
||||
// } else {
|
||||
// $invoice['financial_year'] = date('Y') . '-' . (date('Y') + 1);
|
||||
// $start_date = date('Y').'-04-01';
|
||||
// $end_date = (date('Y')+1).'-03-31';
|
||||
// }
|
||||
// $date_where = ['DATE(created_on)' => date('Y-m-d'),'isactive'=>1];
|
||||
// $date_query = $this->db->table('invoice')->where($date_where)->countAllResults();
|
||||
// $month_where = ['MONTH(created_on)' => date('m'),'isactive'=>1];
|
||||
// $month_query = $this->db->table('invoice')->where($month_where)->countAllResults();
|
||||
// $fin_year_where = ['DATE(created_on) >= ' => $start_date , 'DATE(created_on) <= ' => $end_date,'isactive'=>1];
|
||||
// $fin_year_query = $this->db->table('invoice')->where($fin_year_where)->countAllResults();
|
||||
// $invoice['today'] = $date_query;
|
||||
// $invoice['month'] = $month_query;
|
||||
// $invoice['year'] = $fin_year_query;
|
||||
// return $invoice;
|
||||
// }
|
||||
public function invoice_dtls() {
|
||||
if ((int)date('m') <= 3) {
|
||||
$invoice['financial_year'] = (date('Y')-1) . '-' . date('Y');
|
||||
@ -35,17 +56,38 @@ class HomeModel extends Model
|
||||
$start_date = date('Y').'-04-01';
|
||||
$end_date = (date('Y')+1).'-03-31';
|
||||
}
|
||||
$date_where = ['DATE(created_on)' => date('Y-m-d'),'isactive'=>1];
|
||||
|
||||
// Today
|
||||
$date_where = ['DATE(created_on)' => date('Y-m-d'), 'invoice_type' => 1, 'isactive' => 1];
|
||||
$date_query = $this->db->table('invoice')->where($date_where)->countAllResults();
|
||||
$month_where = ['MONTH(created_on)' => date('m'),'isactive'=>1];
|
||||
$date_amount_query = $this->db->table('invoice')->selectSum('total_amount')->where($date_where)->get()->getRowArray();
|
||||
$invoice['today'] = [
|
||||
'count' => $date_query,
|
||||
'total_amount' => $date_amount_query['total_amount'] ?? 0,
|
||||
];
|
||||
|
||||
// Current Month
|
||||
$month_where = ['MONTH(created_on)' => date('m'), 'invoice_type' => 1, 'isactive' => 1];
|
||||
$month_query = $this->db->table('invoice')->where($month_where)->countAllResults();
|
||||
$fin_year_where = ['DATE(created_on) >= ' => $start_date , 'DATE(created_on) <= ' => $end_date,'isactive'=>1];
|
||||
$month_amount_query = $this->db->table('invoice')->selectSum('total_amount')->where($month_where)->get()->getRowArray();
|
||||
$invoice['month'] = [
|
||||
'count' => $month_query,
|
||||
'total_amount' => $month_amount_query['total_amount'] ?? 0,
|
||||
];
|
||||
|
||||
// Current Financial Year
|
||||
$fin_year_where = ['DATE(created_on) >=' => $start_date, 'DATE(created_on) <=' => $end_date, 'invoice_type' => 1, 'isactive' => 1];
|
||||
$fin_year_query = $this->db->table('invoice')->where($fin_year_where)->countAllResults();
|
||||
$invoice['today'] = $date_query;
|
||||
$invoice['month'] = $month_query;
|
||||
$invoice['year'] = $fin_year_query;
|
||||
$fin_year_amount_query = $this->db->table('invoice')->selectSum('total_amount')->where($fin_year_where)->get()->getRowArray();
|
||||
$invoice['year'] = [
|
||||
'count' => $fin_year_query,
|
||||
'total_amount' => $fin_year_amount_query['total_amount'] ?? 0,
|
||||
];
|
||||
|
||||
// print_r($invoice);die;
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
|
||||
// public function schemes(){
|
||||
// $query = $this->db->table('category AS C')
|
||||
@ -60,41 +102,78 @@ class HomeModel extends Model
|
||||
public function active_schemes()
|
||||
{
|
||||
$query = $this->db->table('subscription AS S')
|
||||
->select('S.business_id,BK.title as name,BK.book_id as id,S.scheme_id,LEFT(BK.title, 1) AS first_letter,COUNT(S.customer_id) AS count,BI.wp_img_url')
|
||||
//->select('COUNT(S.customer_id) AS overall,COUNT(IF(S.isactive = 0, S.customer_id, NULL)) AS nonrenewal,COUNT(IF(S.isactive = 1, S.customer_id, NULL)) AS renewal')
|
||||
//->select('COUNT(IF(S.isactive = 1, S.customer_id, NULL)) AS overall,COUNT(IF(S.is_renew = 0 AND S.isactive = 1, S.customer_id, NULL)) AS nonrenewal,COUNT(IF(S.is_renew = 1 AND S.isactive = 1, S.customer_id, NULL)) AS renewal')
|
||||
->select('COUNT(S.customer_id) AS overall,COUNT(IF(S.isactive = 1, S.customer_id, NULL)) AS activeoverall,COUNT(IF(S.is_renew = 0 AND S.isactive = 1, S.customer_id, NULL)) AS nonrenewal,COUNT(IF(S.is_renew = 1 AND S.isactive = 1, S.customer_id, NULL)) AS renewal')
|
||||
->select('S.business_id, BK.title as name, BK.short_code, BK.book_id as id, S.scheme_id, LEFT(BK.title, 1) AS first_letter, COUNT(S.customer_id) AS count, BI.wp_img_url')
|
||||
->select('COUNT(S.customer_id) AS overall, COUNT(IF(S.isactive = 1, S.customer_id, NULL)) AS activeoverall, COUNT(IF(S.is_renew = 0 AND S.isactive = 1, S.customer_id, NULL)) AS nonrenewal, COUNT(IF(S.is_renew = 1 AND S.isactive = 1, S.customer_id, NULL)) AS renewal, SUM(CASE WHEN S.created_on >= NOW() - INTERVAL 30 DAY THEN 1 ELSE 0 END) AS new_subscribers')
|
||||
->join('customers AS C', 'C.customer_id = S.customer_id AND C.isactive = 1', 'left')
|
||||
->join('books AS BK', 'BK.book_id = S.scheme_id', 'left')
|
||||
->join('book_categories AS BC', 'BC.book_id = S.scheme_id AND BC.isactive = 1', 'left')
|
||||
->join('category AS CM', 'CM.id = BC.category_id AND C.isactive = 1', 'left')
|
||||
->join('book_images AS BI', 'BI.book_id = S.scheme_id AND BI.isactive = 1', 'left')
|
||||
// ->where('LOWER(CM.name)', strtolower("Membership"))
|
||||
->where(['S.business_id' => 2,'BK.isactive' => 1])
|
||||
->where(['S.business_id' => 2, 'BK.isactive' => 1])
|
||||
->groupBy('S.scheme_id');
|
||||
// print_r($query);die;
|
||||
// echo $this->db->getLastQuery(); die;
|
||||
$results = $query->get()->getResultArray();
|
||||
// print_r($results);die;
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
// public function expiring_membership_list(){
|
||||
// $now = date('Y-m-d');
|
||||
// $last30days = date('Y-m-d', strtotime('+30 days'));
|
||||
// return $this->db->table('subscription as S')
|
||||
// ->join('customers as C', 'C.customer_id = S.customer_id', 'left')
|
||||
// ->join('books as BK', 'BK.book_id = S.scheme_id', 'left')
|
||||
// ->join('book_categories as BC', 'BC.book_id = S.scheme_id', 'left')
|
||||
// ->join('category as CM', 'CM.id = BC.category_id', 'left')
|
||||
// ->select('CM.name, CONCAT(C.first_name, " ", C.last_name) as customer_name, C.email as customer_email, C.mobile_no as customer_mobile, S.sub_id, S.scheme_id, S.customer_id, S.business_id, S.to_subscription, S.from_subscription, BK.title,BK.short_code, BK.book_id,DATEDIFF(S.to_subscription, CURDATE()) as countdays,DATE_FORMAT(S.to_subscription, "%d/%m/%Y") as to_subscription_date_format')
|
||||
// ->where('S.to_subscription >=', $now)
|
||||
// ->where('S.to_subscription <=', $last30days)
|
||||
// // ->where('BC.category_id', 5)
|
||||
// ->where('LOWER(CM.name)', strtolower("Membership"))
|
||||
// ->orderBy('S.to_subscription', 'ASC')
|
||||
// ->groupBy('S.sub_id')
|
||||
// ->get()
|
||||
// ->getResultArray();
|
||||
// }
|
||||
public function expiring_membership_list(){
|
||||
$now = date('Y-m-d');
|
||||
$last30days = date('Y-m-d', strtotime('+30 days'));
|
||||
return $this->db->table('subscription as S')
|
||||
|
||||
$membershipList = $this->db->table('subscription as S')
|
||||
->join('customers as C', 'C.customer_id = S.customer_id', 'left')
|
||||
->join('books as BK', 'BK.book_id = S.scheme_id', 'left')
|
||||
->join('book_categories as BC', 'BC.book_id = S.scheme_id', 'left')
|
||||
->join('category as CM', 'CM.id = BC.category_id', 'left')
|
||||
->select('CM.name, CONCAT(C.first_name, " ", C.last_name) as customer_name, C.email as customer_email, C.mobile_no as customer_mobile, S.sub_id, S.scheme_id, S.customer_id, S.business_id, S.to_subscription, S.from_subscription, BK.title, BK.book_id,DATEDIFF(S.to_subscription, CURDATE()) as countdays,DATE_FORMAT(S.to_subscription, "%d/%m/%Y") as to_subscription_date_format')
|
||||
->select('CM.name, CONCAT(C.first_name, " ", C.last_name) as customer_name, C.email as customer_email, C.mobile_no as customer_mobile, S.sub_id, S.scheme_id, S.customer_id, S.business_id, S.to_subscription, S.from_subscription, BK.title, BK.short_code, BK.book_id, DATEDIFF(S.to_subscription, CURDATE()) as countdays, DATE_FORMAT(S.to_subscription, "%d/%m/%Y") as to_subscription_date_format')
|
||||
->where('S.to_subscription >=', $now)
|
||||
->where('S.to_subscription <=', $last30days)
|
||||
// ->where('BC.category_id', 5)
|
||||
->where('LOWER(CM.name)', strtolower("Membership"))
|
||||
->orderBy('S.to_subscription', 'ASC')
|
||||
->groupBy('S.sub_id')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
foreach ($membershipList as &$membership) {
|
||||
$notifications = $this->getNotifications($membership['customer_id']);
|
||||
|
||||
$membership['notifications'] = $notifications;
|
||||
}
|
||||
|
||||
return $membershipList;
|
||||
}
|
||||
|
||||
|
||||
private function getNotifications($customerId) {
|
||||
return $this->db->table('notification_campaign as NC')
|
||||
->join('notification_history_parents as NH', 'NH.campaign_id = NC.campaign_id', 'left')
|
||||
->join('notification_history_children as NP', 'NP.fkid = NH.id', 'left')
|
||||
->select('NC.*, NH.*, NP.*')
|
||||
->where('NP.customer_id', $customerId)
|
||||
->get()
|
||||
->getResultArray();
|
||||
}
|
||||
|
||||
public function book_published_dtls(){
|
||||
|
||||
if ((int)date('m') <= 3) {
|
||||
@ -143,5 +222,36 @@ class HomeModel extends Model
|
||||
|
||||
return $book_published;
|
||||
}
|
||||
public function bookSales()
|
||||
{
|
||||
$result = [];
|
||||
|
||||
// Fetch book sales for YTD
|
||||
$result['ytd'] = $this->getBookSalesCount('start_of_current_year');
|
||||
|
||||
// Fetch book sales for MTD
|
||||
$result['mtd'] = $this->getBookSalesCount('start_of_current_month');
|
||||
|
||||
// Fetch book sales for Today
|
||||
$result['today'] = $this->getBookSalesCount('today');
|
||||
// print_r($result);die;
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
private function getBookSalesCount($dateFilter)
|
||||
{
|
||||
return $this->db->table('invoiceitems')
|
||||
->join('invoice', 'invoice.invoice_id = invoiceitems.invoice_id', 'left')
|
||||
->join('books', 'books.book_id = invoiceitems.product', 'left')
|
||||
->select('books.book_id, books.title, COUNT(invoiceitems.invoice_child_id) as sales_count')
|
||||
->where("DATE(invoice.invoice_date) >= '$dateFilter'")
|
||||
->groupBy('books.book_id, books.title')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
}
|
||||
|
||||
// Other existing methods...
|
||||
|
||||
}
|
||||
|
||||
@ -377,29 +377,75 @@ public function get_mem_invoice_data($f_date = null, $t_date = null)
|
||||
|
||||
}
|
||||
|
||||
// public function itemwise_report_data($f_date = null, $t_date = null)
|
||||
// {
|
||||
// // Fetch invoice data
|
||||
// $query = $this->db->table('invoice')
|
||||
// ->select('invoice.*, books.* , COUNT(invoiceitems.product) as item_count , sum(invoiceitems.product * invoiceitems.unit_price) as item_cost')
|
||||
// ->where('invoice.isactive', 1)
|
||||
// ->where('books.isactive', 1);
|
||||
|
||||
// // Add date range filter if provided
|
||||
// if ($f_date !== null && $t_date !== null) {
|
||||
// $query->where('invoice.invoice_date >=', $f_date)
|
||||
// ->where('invoice.invoice_date <=', $t_date);
|
||||
// }
|
||||
|
||||
// $result = $query->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id', 'left')
|
||||
// ->join('books', 'books.book_id = invoiceitems.product', 'left')
|
||||
// ->groupBy('books.book_id')
|
||||
// ->get()
|
||||
// ->getResult();
|
||||
|
||||
// return $result;
|
||||
// }
|
||||
public function itemwise_report_data($f_date = null, $t_date = null)
|
||||
{
|
||||
// Fetch invoice data
|
||||
$query = $this->db->table('invoice')
|
||||
->select('invoice.*, books.* , COUNT(invoiceitems.product) as item_count , sum(invoiceitems.product * invoiceitems.unit_price) as item_cost')
|
||||
->select('books.publishers_code, COUNT(invoiceitems.product) as publisher_item_count, books.title as book_name, COUNT(invoiceitems.product) as item_count, SUM(invoiceitems.quantity * invoiceitems.unit_price) as total_cost')
|
||||
->where('invoice.isactive', 1)
|
||||
->where('books.isactive', 1);
|
||||
|
||||
// Add date range filter if provided
|
||||
if ($f_date !== null && $t_date !== null) {
|
||||
$query->where('invoice.invoice_date >=', $f_date)
|
||||
->where('invoice.invoice_date <=', $t_date);
|
||||
}
|
||||
// Add date range filter if provided
|
||||
if ($f_date !== null && $t_date !== null) {
|
||||
$query->where('invoice.invoice_date >=', $f_date)
|
||||
->where('invoice.invoice_date <=', $t_date);
|
||||
}
|
||||
|
||||
$result = $query->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id', 'left')
|
||||
$result = $query->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id', 'left')
|
||||
->join('books', 'books.book_id = invoiceitems.product', 'left')
|
||||
->groupBy('books.book_id')
|
||||
->groupBy('books.publishers_code, books.title')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
return $result;
|
||||
// Group by publisher_code and include books
|
||||
$groupedResult = [];
|
||||
foreach ($result as $row) {
|
||||
$publisherCode = $row->publishers_code;
|
||||
if (!isset($groupedResult[$publisherCode])) {
|
||||
$groupedResult[$publisherCode] = (object)[
|
||||
'publisher_code' => $publisherCode,
|
||||
'publisher_item_count' => 0,
|
||||
'publisher_total_cost' => 0,
|
||||
'books' => [],
|
||||
];
|
||||
}
|
||||
|
||||
// Add book information to the grouped result
|
||||
$groupedResult[$publisherCode]->publisher_item_count += $row->item_count;
|
||||
$groupedResult[$publisherCode]->publisher_total_cost += $row->total_cost;
|
||||
$groupedResult[$publisherCode]->books[] = (object)[
|
||||
'book_name' => $row->book_name,
|
||||
'item_count' => $row->item_count,
|
||||
'total_cost' => $row->total_cost,
|
||||
];
|
||||
}
|
||||
|
||||
return array_values($groupedResult);
|
||||
}
|
||||
|
||||
|
||||
public function getInvoiceIdByMd5($md5Hash)
|
||||
{
|
||||
$result = $this->db->table($this->table)
|
||||
|
||||
@ -45,87 +45,268 @@
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div class="col-xl-3 col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div style="min-height: 200px !important">
|
||||
<div class="text-primary float-right">
|
||||
<span data-toggle="tooltip" data-placement="bottom" data-original-title="Current Financial Year"> <?= $invoice['financial_year']; ?></span>
|
||||
</div>
|
||||
<div style="padding: 80px 0;">
|
||||
<h3 class="text-center">Today : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Today Invoice Raised" data-plugin="counterup"><?= $invoice['today']; ?></span>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="text-success">
|
||||
<span> MTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Monthly Invoice Raised" data-plugin="counterup"><?= $invoice['month']; ?></span></span>
|
||||
<span class="float-right"> YTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Yearly Invoice Raised" data-plugin="counterup"><?= $invoice['year']; ?></span></span>
|
||||
</div>
|
||||
</div><!-- end min-height-->
|
||||
</div> <!-- end card-body-->
|
||||
</div><!--end card-->
|
||||
</div> <!-- end col -->
|
||||
|
||||
<div class="col-xl-9 col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2">Schemes</h4>
|
||||
<div class="conversation-list"> <!-- default 460px -->
|
||||
<?php foreach ($active_schemes as $i => $a) : ?>
|
||||
<div class="media">
|
||||
<?php if (!empty($a['wp_img_url'])) { ?>
|
||||
<img src="<?= $a['wp_img_url']; ?>" alt="table-user" class="mr-3 rounded avatar-md">
|
||||
<?php } else { ?>
|
||||
<div class="avatar-md mr-3">
|
||||
<div class="avatar-title bg-light rounded text-body font-20 font-weight-semibold">
|
||||
<?= $a['first_letter']; ?>
|
||||
<div class="col-xl-4 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="dropdown float-right">
|
||||
<a href="#" class="dropdown-toggle arrow-none card-drop" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="mdi mdi-dots-horizontal"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Action</a>
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Another action</a>
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Something else</a>
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Separated link</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="media-body">
|
||||
<h5 class="my-1"><?= $a['name']; ?></h5>
|
||||
<p class="text-muted mb-0">
|
||||
<span class="badge badge-soft-success"><i class="mdi mdi-account mr-1"></i> <span data-plugin="counterup"><?= $a['activeoverall']; ?></span> Subscribers </span>
|
||||
<?= ($a['renewal'] ? '( '.$a['renewal'].' Renewal Subscriber )' : ""); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<?php endforeach; ?>
|
||||
<!-- <div class="media">
|
||||
<div class="avatar-md mr-3">
|
||||
<div class="avatar-title bg-light rounded text-body font-20 font-weight-semibold">
|
||||
ச
|
||||
</div>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h5 class="my-1">Samarth Scheme (2years) </h5>
|
||||
<p class="text-muted mb-0">
|
||||
<span class="badge badge-soft-success"><i class="mdi mdi-account mr-1"></i> <span data-plugin="counterup"> 32 </span> Subscribers </span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr> -->
|
||||
|
||||
<!-- <div class="media">
|
||||
<div class="mr-3">
|
||||
<img src="<?= base_url() . "public/assets/images/users/avatar-1.jpg" ?>" alt="user-image" class="rounded avatar-md">
|
||||
<h4 class="header-title mt-0">Sales</h4>
|
||||
|
||||
<div class="mt-3">
|
||||
<div class="media">
|
||||
<div dir="ltr">
|
||||
<h3 class="mt-0 mb-1"><span data-plugin="counterup"><?= $invoice['today']['count']; ?></span></h3>
|
||||
<p class="text-muted mb-0">Books</p>
|
||||
<!-- <input data-plugin="knob" data-width="64" data-height="64" data-fgColor="#675db7"
|
||||
data-bgColor="#e8e7f4" value=""
|
||||
data-skin="tron" data-angleOffset="" data-readOnly=true
|
||||
data-thickness=".15" style="font: bold 18px Arial;"/> -->
|
||||
</div>
|
||||
<div class="media-body text-right align-self-center">
|
||||
<h3 class="mt-0 mb-1">₹<?= $invoice['today']['total_amount']; ?></h3>
|
||||
<p class="text-muted mb-0">Today sale</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="text-success">
|
||||
<span class="float-left"> MTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Monthly Invoice Raised" data-plugin="counterup"><?= $invoice['month']['count']; ?></span>-₹<?= $invoice['month']['total_amount']; ?></span>
|
||||
<span class="float-right"> YTD : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Yearly Invoice Raised" data-plugin="counterup"><?= $invoice['year']['count']; ?></span>-₹<?= $invoice['year']['total_amount']; ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h5 class="my-1">Samarth Scheme (1years) </h5>
|
||||
<p class="text-muted mb-0">
|
||||
<span class="badge badge-soft-success"><i class="mdi mdi-account mr-1"></i> <span data-plugin="counterup"> 32 </span> Subscribers </span>
|
||||
</p>
|
||||
</div><!-- end col -->
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if (!empty($active_schemes) && isset($active_schemes[0])) : ?>
|
||||
<div class="col-xl-4 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php $firstScheme = $active_schemes[0]; ?>
|
||||
<div class="dropdown float-right">
|
||||
<a href="#" class="dropdown-toggle arrow-none card-drop" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="mdi mdi-dots-horizontal"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Action</a>
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Another action</a>
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Something else</a>
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Separated link</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="header-title mt-0"><?= $firstScheme['short_code']; ?></h4>
|
||||
|
||||
<div class="mt-3">
|
||||
<div class="media">
|
||||
<div dir="ltr">
|
||||
<!-- <h3 class="my-2 py-1"><span data-plugin="counterup"><?= $firstScheme['activeoverall']; ?></span></h3> -->
|
||||
<!-- <input data-plugin="knob" data-width="64" data-height="64" data-fgColor="#675db7"
|
||||
data-bgColor="#e8e7f4" value=""
|
||||
data-skin="tron" data-angleOffset="" data-readOnly=true
|
||||
data-thickness=".15" style="font: bold 18px Arial;"/> -->
|
||||
</div>
|
||||
<div class="media-body text-center align-self-center">
|
||||
<h3 class="mt-0 mb-1"><?= $firstScheme['activeoverall']; ?></h3>
|
||||
<p class="text-muted mb-0">Total Subscriber</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="text-success">
|
||||
<span class="float-left"> New : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Monthly Invoice Raised" data-plugin="counterup"><?= $firstScheme['nonrenewal']; ?></span><br></span>
|
||||
<span class="float-right">Renewed: <span data-toggle="tooltip" data-placement="bottom" data-original-title="Yearly Invoice Raised" data-plugin="counterup"><?= $firstScheme['renewal']; ?></span><br></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
|
||||
<!-- <div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-body"style="width:119%;">
|
||||
<div class="media">
|
||||
|
||||
<?php $firstScheme = $active_schemes[0]; ?>
|
||||
<div class="avatar-md mr-3">
|
||||
<div class="">
|
||||
<?php if (!empty($firstScheme['wp_img_url'])) { ?>
|
||||
<img src="<?= $firstScheme['wp_img_url']; ?>" alt="table-user" class="mr-3 rounded avatar-md">
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="avatar-title bg-light rounded text-body font-20 font-weight-semibold">
|
||||
<?= $firstScheme['first_letter']; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h5 class="my-1"><a href="javascript:void(0);" class="text-dark"><?= $firstScheme['short_code']; ?></a></h5>
|
||||
<p class="text-muted mb-0">
|
||||
|
||||
</p>
|
||||
</div> -->
|
||||
<!-- <div class="dropdown">
|
||||
<a class="text-body dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="mdi mdi-dots-vertical font-20"></i>
|
||||
</a>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#">Action</a>
|
||||
<a class="dropdown-item" href="#">Another action</a>
|
||||
<a class="dropdown-item" href="#">Something else here</a>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- </div>
|
||||
<hr>
|
||||
<div class="text-muted">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-6">
|
||||
<div>
|
||||
<p class="mb-0">Total Subscribers</p>
|
||||
<h5 class="mb-sm-0"><?= $firstScheme['activeoverall']; ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4 col-6">
|
||||
<div>
|
||||
<p class="mb-0">New Subscribers</p>
|
||||
<h5 class="mb-sm-0"><?= $firstScheme['nonrenewal']; ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4 col-6">
|
||||
<div class="mt-3 mt-sm-0">
|
||||
<p class="mb-0">Renewed</p>
|
||||
<h5 class="mb-0"><?=$firstScheme['renewal'];?> </h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr> -->
|
||||
-->
|
||||
<?php if (!empty($active_schemes) && isset($active_schemes[1])) : ?>
|
||||
<div class="col-xl-4 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php $firstScheme = $active_schemes[1]; ?>
|
||||
<div class="dropdown float-right">
|
||||
<a href="#" class="dropdown-toggle arrow-none card-drop" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="mdi mdi-dots-horizontal"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Action</a>
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Another action</a>
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Something else</a>
|
||||
<!-- item-->
|
||||
<a href="javascript:void(0);" class="dropdown-item">Separated link</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="header-title mt-0"><?= $firstScheme['short_code']; ?></h4>
|
||||
|
||||
<div class="mt-3">
|
||||
<div class="media">
|
||||
<div dir="ltr">
|
||||
|
||||
</div>
|
||||
<div class="media-body text-center align-self-center">
|
||||
<h3 class="mt-0 mb-1"><?= $firstScheme['activeoverall']; ?></h3>
|
||||
<p class="text-muted mb-0">Total Subscriber</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="text-success">
|
||||
<span class="float-left"> New : <span data-toggle="tooltip" data-placement="bottom" data-original-title="Monthly Invoice Raised" data-plugin="counterup"><?= $firstScheme['nonrenewal']; ?></span><br></span>
|
||||
<span class="float-right">Renewed: <span data-toggle="tooltip" data-placement="bottom" data-original-title="Yearly Invoice Raised" data-plugin="counterup"><?= $firstScheme['renewal']; ?></span><br></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
<?php if (!empty($active_schemes) && isset($active_schemes[9])) : ?>
|
||||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-body" style="width:119%;">
|
||||
<div class="media">
|
||||
<?php $firstScheme = $active_schemes[2]; ?>
|
||||
<div class="avatar-md mr-3">
|
||||
<div>
|
||||
<?php if (!empty($firstScheme['wp_img_url'])) { ?>
|
||||
<img src="<?= $firstScheme['wp_img_url']; ?>" alt="table-user" class="mr-3 rounded avatar-md">
|
||||
<?php } else { ?>
|
||||
<div class="avatar-title bg-light rounded text-body font-20 font-weight-semibold">
|
||||
<?= $firstScheme['first_letter']; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div><!-- end card-body -->
|
||||
</div><!--end card-->
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<h5 class="my-1"><a href="javascript:void(0);" class="text-dark"><?= $firstScheme['short_code']; ?></a></h5>
|
||||
<p class="text-muted mb-0">
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="text-muted">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-6">
|
||||
<div>
|
||||
<p class="mb-0">Total Subscribers</p>
|
||||
<h5 class="mb-sm-0"><?= $firstScheme['activeoverall']; ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4 col-6">
|
||||
<div>
|
||||
<p class="mb-0">New Subscribers</p>
|
||||
<h5 class="mb-sm-0"><?= $firstScheme['nonrenewal']; ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4 col-6">
|
||||
<div class="mt-3 mt-sm-0">
|
||||
<p class="mb-0">Renewed</p>
|
||||
<h5 class="mb-0"><?=$firstScheme['renewal'];?> </h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-4 col-lg-6">
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mt-1">Expiring Membership List</h4>
|
||||
@ -136,8 +317,11 @@
|
||||
<tr>
|
||||
<th style="width: 5%;">#</th>
|
||||
<th style="width: 20%;">Name</th>
|
||||
<th style="width: 20%;">Mobile No</th>
|
||||
<th style="width: 20%;">Email</th>
|
||||
<th style="width: 50%;">Scheme Name</th>
|
||||
<th style="width: 25%;">Expiring In</th>
|
||||
<th style="width: 25%;">Notification On</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -155,10 +339,23 @@
|
||||
<td><?= ++$tempinx; ?></td>
|
||||
<td>
|
||||
<h5 class="mt-0 mb-1"><?= $e['customer_name']; ?></h5>
|
||||
<span class="font-13"><?= $e['customer_mobile']; ?></span>
|
||||
|
||||
</td>
|
||||
<td><?= $e['title']; ?></td>
|
||||
<td><?= $e['customer_mobile'];?></td>
|
||||
<td><?= $e['customer_email'];?></td>
|
||||
<td><?= $e['short_code']; ?></td>
|
||||
<td><span class="badge badge-success badge-pill"><?= $daysincountstring; ?></span> <span class="font-13"><br><?= $e['to_subscription_date_format']; ?></span></td>
|
||||
|
||||
|
||||
<td>
|
||||
<?php
|
||||
$startDateTime = isset($e['notifications'][0]['start_date_time']) ? $e['notifications'][0]['start_date_time'] : '';
|
||||
echo $startDateTime ? date('d-m-Y', strtotime($startDateTime)) : '';
|
||||
?>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<!-- <tr>
|
||||
@ -185,108 +382,5 @@
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
|
||||
<div class="col-xl-4 col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mt-1">Books Published Report</h4>
|
||||
<div class="text-center">
|
||||
<div class="row pt-2">
|
||||
<div class="col-4">
|
||||
<p class="font-15 mb-1 text-truncate text-muted"><span data-toggle="tooltip" data-placement="bottom" data-original-title="Overall Records">Overall</span></p>
|
||||
<h4><?= $book_published['overall']; ?></h4>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<p class="font-15 mb-1 text-truncate text-muted"><span data-toggle="tooltip" data-placement="bottom" data-original-title="<?= $financial_year; ?>">YTD</span></p>
|
||||
<h4><?= $book_published['year']; ?></h4>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<p class="font-15 mb-1 text-truncate text-muted"><span data-toggle="tooltip" data-placement="bottom" data-original-title="<?= $book_published['month_label']; ?>">MTD</span></p>
|
||||
<h4><?= $book_published['month']; ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div dir="ltr">
|
||||
<h4 class="header-title text-muted mt-1"><span data-toggle="tooltip" data-placement="bottom" data-original-title="<?= $book_published['book_published_label']; ?>">Last One Month</span></h4>
|
||||
<div class="row pt-2 conversation-list" data-simplebar style="max-height: 255px !important">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-centered mb-0 font-14">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th style="width: 50%;">Book Details</th>
|
||||
<th style="width: 50%;">Category</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($book_published['book_published']) > 0) : foreach ($book_published['book_published'] as $b) : ?>
|
||||
<tr>
|
||||
<td><?= $b['title']; ?>
|
||||
<?php if (!empty($b['author'])) { ?>
|
||||
<p class="text-muted mb-0" title="Author : <?= $b['author']; ?>">
|
||||
<i class="mdi mdi-account mr-1"></i><?= $b['author']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
<?php if (!empty($b['publisher'])) { ?>
|
||||
<p class="text-muted mb-0" title="Publisher : <?= $b['publisher']; ?>">
|
||||
<i class="mdi mdi-book-open-variant mr-1"></i><?= $b['publisher']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
<?php if (!empty($b['publication_date_format'])) { ?>
|
||||
<p class="text-muted mb-0" title="Publication Date : <?= $b['publication_date_format']; ?>">
|
||||
<i class="mdi mdi-update mr-1"></i><?= $b['publication_date_format']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php // echo $b['categories'];
|
||||
$splitted = explode(', ', $b['categories']);
|
||||
if (!empty($splitted)) {
|
||||
// print_r($splitted);
|
||||
for ($i = 0; $i < count($splitted); $i++) {
|
||||
if ($splitted[$i] !== '') { ?>
|
||||
<span class="badge badge-success badge-pill mr-1"><?= str_replace(',', '', $splitted[$i]); ?></span>
|
||||
<?php }
|
||||
}
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
<!-- <tr>
|
||||
<td>First std English
|
||||
<p class="text-muted mb-0">
|
||||
<i class="mdi mdi-account mr-1"></i> தி. ச. வைகுண்டம்
|
||||
</p>
|
||||
<p class="text-muted mb-0">
|
||||
<i class="mdi mdi-book-open-variant mr-1"></i> விஜயபாரதம் பிரசுரம்
|
||||
</p>
|
||||
<p class="text-muted mb-0">
|
||||
<i class="mdi mdi-update mr-1"></i> 17/10/2023
|
||||
</p>
|
||||
</td>
|
||||
<td><span class="badge badge-success badge-pill mr-1">History</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>First std Science
|
||||
<p class="text-muted mb-0">
|
||||
<i class="mdi mdi-account mr-1"></i> Dr. சரத் ஹேபால்கர்
|
||||
</p>
|
||||
<p class="text-muted mb-0">
|
||||
<i class="mdi mdi-book-open-variant mr-1"></i> அலைகள் வெளியீட்டகம்
|
||||
</p>
|
||||
<p class="text-muted mb-0">
|
||||
<i class="mdi mdi-update mr-1"></i> 17/10/2023
|
||||
</p>
|
||||
</td>
|
||||
<td><span class="badge badge-success badge-pill mr-1">Paperbacks</span></td>
|
||||
</tr> -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
@ -6,7 +6,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="offset-md-3 col-md-5">
|
||||
<form action="<?php echo base_url('general_inv_rp'); ?>" method="post">
|
||||
<form action="<?php echo base_url('book_publishwise_Report'); ?>" method="post">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
@ -43,7 +43,7 @@
|
||||
<th>Book Name</th>
|
||||
<th>Author</th>
|
||||
<th>Cost</th>
|
||||
<th>Published On</th>
|
||||
<th>Published By</th>
|
||||
<th>Inv Date</th>
|
||||
|
||||
</tr>
|
||||
@ -78,42 +78,21 @@
|
||||
<div class="modal-body">
|
||||
<!-- Add checkboxes for each column -->
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="1" checked> Invoice No
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="1" checked> Book Name
|
||||
</div><br>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="2" checked> Invoice Date
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="2" checked> Author
|
||||
</div><br>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="3" checked> Customer Name
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="3" checked> Cost
|
||||
</div><br>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="4" checked> GST
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="4" checked> Published By
|
||||
</div><br>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="5" checked> Discount
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="5" checked> Inv Date
|
||||
</div><br>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="6" checked> Count
|
||||
</div><br>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="7" checked> OT Charges
|
||||
</div><br>
|
||||
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="8" checked> Total
|
||||
</div><br>
|
||||
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="9" checked>Status
|
||||
</div><br>
|
||||
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="10" checked>Type of Invoice
|
||||
</div><br>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="11" checked>Payment
|
||||
</div><br>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Repeat similar blocks for other columns -->
|
||||
@ -133,9 +112,10 @@
|
||||
|
||||
|
||||
<script>
|
||||
var table;
|
||||
$(document).ready(function() {
|
||||
|
||||
var table = $('#datatable-buttons').DataTable({
|
||||
table = $('#datatable-buttons').DataTable({
|
||||
"order": [
|
||||
[0, 'desc']
|
||||
],
|
||||
@ -160,106 +140,85 @@
|
||||
],
|
||||
columnDefs: [{
|
||||
type: 'date',
|
||||
targets: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
targets: [1, 2, 3, 4, 5,],
|
||||
orderable: false
|
||||
} // Specify the column index for date sorting and disable sorting
|
||||
]
|
||||
});
|
||||
});
|
||||
//have to adjust the script coording to this report
|
||||
// $('.show-column-selection-modal').on('click', function() {
|
||||
// // Hide dropdowns when the modal is shown
|
||||
// $('.table-responsive select').hide();
|
||||
// $('#columnSelectionModal').modal('show');
|
||||
// });
|
||||
|
||||
// Handle column visibility toggling
|
||||
|
||||
|
||||
// // Handle column visibility toggling
|
||||
// $('.column-toggle').on('change', function() {
|
||||
// var column = table.column($(this).data('column'));
|
||||
// column.visible(!column.visible());
|
||||
|
||||
// Add date range filter and dropdowns
|
||||
$('#datatable-buttons thead tr').clone(true).appendTo('#datatable-buttons thead');
|
||||
$('#datatable-buttons thead tr:eq(1) th').each(function(i) {
|
||||
var title = $(this).text();
|
||||
|
||||
// // Remove corresponding values when column is removed
|
||||
// if (!column.visible()) {
|
||||
// // Find the index of the column
|
||||
// var columnIndex = $(this).data('column');
|
||||
// // Remove values from the column selection dropdown
|
||||
// $('#datatable-buttons thead tr:eq(1) th:eq(' + columnIndex + ') select').remove();
|
||||
// // Remove the date range filter for the column
|
||||
// if (columnIndex === 2) {
|
||||
// $('#datatable-buttons thead tr:eq(2) th:eq(2) input').daterangepicker('destroy').remove();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
if (i !== 5) { // Assuming 5 is the index of the "Invoice Date" column
|
||||
// For non-"Invoice Date" columns, add a dropdown
|
||||
var uniqueValues = Array.from(new Set(table.column(i).data())).sort();
|
||||
var select = $('<select class="form-control form-control-sm"><option value="">Search ' + title + '</option></select>')
|
||||
.appendTo($(this).empty())
|
||||
.on('change', function() {
|
||||
var val = $.fn.dataTable.util.escapeRegex($(this).val());
|
||||
table.column(i)
|
||||
.search(val ? '^' + val + '$' : '', true, false)
|
||||
.draw();
|
||||
});
|
||||
|
||||
// // Apply Column Selection
|
||||
// $('.apply-column-selection').on('click', function() {
|
||||
// // Show dropdowns when the modal is closed
|
||||
// $('.table-responsive select').show();
|
||||
// $('#columnSelectionModal').modal('hide');
|
||||
// });
|
||||
// // Add date range filter and dropdowns
|
||||
// $('#datatable-buttons thead tr').clone(true).appendTo('#datatable-buttons thead');
|
||||
// $('#datatable-buttons thead tr:eq(1) th').each(function(i) {
|
||||
// var title = $(this).text();
|
||||
// // For non-"Invoice Date" columns, add a dropdown
|
||||
// var uniqueValues = table.column(i).data().unique().sort();
|
||||
// var select = $('<select class="form-control form-control-sm"><option value="">Search ' + title + '</option></select>')
|
||||
// .appendTo($(this).empty())
|
||||
// .on('change', function() {
|
||||
// var val = $.fn.dataTable.util.escapeRegex($(this).val());
|
||||
// table.column(i)
|
||||
// .search(val ? '^' + val + '$' : '', true, false)
|
||||
// .draw();
|
||||
// });
|
||||
uniqueValues.forEach(function(d) {
|
||||
select.append('<option value="' + d + '">' + d + '</option>');
|
||||
});
|
||||
|
||||
// uniqueValues.each(function(d, j) {
|
||||
// select.append('<option value="' + d + '">' + d + '</option>');
|
||||
// });
|
||||
$('input', this).on('keyup change', function() {
|
||||
if (table.column(i).search() !== this.value) {
|
||||
table
|
||||
.column(i)
|
||||
.search(this.value)
|
||||
.draw();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// $('input', this).on('keyup change', function() {
|
||||
// if (table.column(i).search() !== this.value) {
|
||||
// table
|
||||
// .column(i)
|
||||
// .search(this.value)
|
||||
// .draw();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
// // Add date range filter for "Invoice Date" column
|
||||
// var dateRangeFilter = $('input.input-daterange-datepicker')
|
||||
// .daterangepicker({
|
||||
// autoUpdateInput: false,
|
||||
// locale: {
|
||||
// format: 'DD/MM/YYYY',
|
||||
// cancelLabel: 'Clear'
|
||||
// },
|
||||
// ranges: {
|
||||
// 'Today': [moment(), moment()],
|
||||
// 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
// 'This Month': [moment().startOf('month'), moment().endOf('month')]
|
||||
// }
|
||||
// })
|
||||
// .on('apply.daterangepicker', function (ev, picker) {
|
||||
// $(this).val(picker.startDate.format('DD/MM/YYYY') + ' - ' + picker.endDate.format('DD/MM/YYYY'));
|
||||
// })
|
||||
// .on('cancel.daterangepicker', function () {
|
||||
// $(this).val('');
|
||||
// });
|
||||
// Add date range filter for "Invoice Date" column
|
||||
var dateRangeFilter = $('input.input-daterange-datepicker')
|
||||
.daterangepicker({
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
format: 'DD/MM/YYYY',
|
||||
cancelLabel: 'Clear'
|
||||
},
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')]
|
||||
}
|
||||
})
|
||||
.on('apply.daterangepicker', function (ev, picker) {
|
||||
$(this).val(picker.startDate.format('DD/MM/YYYY') + ' - ' + picker.endDate.format('DD/MM/YYYY'));
|
||||
})
|
||||
.on('cancel.daterangepicker', function () {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
// // Add click events for "Today" and "Yesterday" buttons
|
||||
// $('.today-btn').on('click', function () {
|
||||
// var today = moment();
|
||||
// dateRangeFilter.data('daterangepicker').setStartDate(today);
|
||||
// dateRangeFilter.data('daterangepicker').setEndDate(today);
|
||||
// dateRangeFilter.trigger('apply.daterangepicker');
|
||||
// });
|
||||
// Add click events for "Today" and "Yesterday" buttons
|
||||
$('.today-btn').on('click', function () {
|
||||
var today = moment();
|
||||
dateRangeFilter.data('daterangepicker').setStartDate(today);
|
||||
dateRangeFilter.data('daterangepicker').setEndDate(today);
|
||||
dateRangeFilter.trigger('apply.daterangepicker');
|
||||
});
|
||||
|
||||
// $('.yesterday-btn').on('click', function () {
|
||||
// var yesterday = moment().subtract(1, 'days');
|
||||
// dateRangeFilter.data('daterangepicker').setStartDate(yesterday);
|
||||
// dateRangeFilter.data('daterangepicker').setEndDate(yesterday);
|
||||
// dateRangeFilter.trigger('apply.daterangepicker');
|
||||
// });
|
||||
// });
|
||||
$('.yesterday-btn').on('click', function () {
|
||||
var yesterday = moment().subtract(1, 'days');
|
||||
dateRangeFilter.data('daterangepicker').setStartDate(yesterday);
|
||||
dateRangeFilter.data('daterangepicker').setEndDate(yesterday);
|
||||
dateRangeFilter.trigger('apply.daterangepicker');
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -1,90 +1,132 @@
|
||||
<style>
|
||||
|
||||
.custom-thead th,
|
||||
.custom-tbody td {
|
||||
white-space: initial !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
/* Add this style for truncating text */
|
||||
/* .truncate-text {
|
||||
max-width: 20px; /* Adjust the max-width to your preference */
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
cursor: pointer;
|
||||
} */
|
||||
.custom-thead{
|
||||
margin
|
||||
}
|
||||
|
||||
/* Style for the Publisher Code */
|
||||
.publisher-code {
|
||||
color: blue; /* Adjust the color to your preference */
|
||||
}
|
||||
|
||||
/* Style for the nested table data */
|
||||
.nested-table-data {
|
||||
color: green; /* Adjust the color to your preference */
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"><?= $page_name ?></h4>
|
||||
<h4 class="page-title"><?= $page_name ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="offset-md-3 col-md-5">
|
||||
<div class="offset-md-3 col-md-5">
|
||||
<form action="<?php echo base_url('itemwise_report'); ?>" method="post">
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<input class="form-control input-daterange-datepicker" type="text" name="date" value="<?php if(isset($selected_data)) { echo $selected_data; } ?>"/>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="submit" class="btn btn-primary">Generate Report</button>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<input class="form-control input-daterange-datepicker" type="text" name="date"
|
||||
value="<?php if (isset($selected_data)) { echo $selected_data; } ?>" />
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="submit" class="btn btn-primary">Generate Report</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive">
|
||||
<table id="datatable-buttons" class="table table-striped nowrap w-100">
|
||||
<thead class="custom-thead">
|
||||
<tr>
|
||||
<th>Product Name</th>
|
||||
<th>Count</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="custom-tbody">
|
||||
<?php foreach ($report_data as $row)
|
||||
{ ?>
|
||||
<tr>
|
||||
<td><?php echo $row->title;?></td>
|
||||
<td><?php echo $row->item_count;?></td>
|
||||
<td><?php echo $row->item_cost;?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<thead class="custom-thead">
|
||||
<tr>
|
||||
<th>Publisher Code</th>
|
||||
<th style="margin-right:10px;">Publisher Item Count</th>
|
||||
<th>Publisher Total Cost</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="custom-tbody">
|
||||
<?php foreach ($report_data as $row) { ?>
|
||||
<tr>
|
||||
<td><?php echo $row->publisher_code; ?></td>
|
||||
<td><?php echo $row->publisher_item_count; ?></td>
|
||||
<td><?php echo $row->publisher_total_cost; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<!-- Nested Table -->
|
||||
<table class="datatable-buttons"width=100%;>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Book Name</th>
|
||||
<th>Item Count</th>
|
||||
<th>Total Cost</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($row->books as $book) { ?>
|
||||
<tr>
|
||||
<td class="truncate-text"><?php echo $book->book_name; ?></td>
|
||||
<td><?php echo $book->item_count; ?></td>
|
||||
<td><?php echo $book->total_cost; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var table = $('#datatable-buttons').DataTable({
|
||||
// "order": [[0, 'desc']],
|
||||
"dom": 'Bfrtip',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Itemwise Report',
|
||||
text: 'Print',
|
||||
customize: function(win) {}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Itemwise Report',
|
||||
exportOptions: {}
|
||||
}
|
||||
]
|
||||
$(document).ready(function () {
|
||||
var table = $('#datatable-buttons').DataTable({
|
||||
// "order": [[0, 'desc']],
|
||||
"dom": 'Bfrtip',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Itemwise Report',
|
||||
text: 'Print',
|
||||
customize: function (win) { }
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Itemwise Report',
|
||||
exportOptions: {}
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<th>To Subscription</th>
|
||||
<th>Short-Code</th>
|
||||
<th>Expiring Status</th>
|
||||
<th>Invoic Number</th>
|
||||
<th>Invoice Number</th>
|
||||
<th>Invoice Date</th>
|
||||
<th>Total</th>
|
||||
<th>Status</th>
|
||||
|
||||
@ -57,9 +57,11 @@
|
||||
<option value="female" <?= isset($details['gender']) && $details['gender'] === 'female' ? 'selected' : '' ?>>Female</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4"id="eventNameContainer">
|
||||
<label for="event_id" class="col-form-label">Event Name<span class="text-danger">*</span></label>
|
||||
<div class="form-group col-md-4" id="eventNameContainer">
|
||||
<label for="event_id" class="col-form-label">Event Name<span class="text-danger"></span></label>
|
||||
<select id="event_id" name="event_id" class="form-control">
|
||||
<!-- Add a default option -->
|
||||
<option value="">Select Event</option>
|
||||
<!-- Options will be dynamically populated using AJAX -->
|
||||
</select>
|
||||
</div>
|
||||
@ -268,53 +270,48 @@ $(document).ready(function () {
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// Assuming you trigger the AJAX on the change event of the role dropdown
|
||||
$('#role').on('change', function () {
|
||||
var selectedRole = $(this).val();
|
||||
|
||||
$(document).ready(function () {
|
||||
// Assuming you trigger the AJAX on the change event of the role dropdown
|
||||
$('#role').on('change', function () {
|
||||
var selectedRole = $(this).val();
|
||||
// Check if the selected role is "manager" before making the AJAX request
|
||||
if (selectedRole === 'manager') {
|
||||
var storedEventId = '<?= isset($details['event_id']) ? $details['event_id'] : '' ?>';
|
||||
|
||||
// Check if the selected role is "manager" before making the AJAX request
|
||||
if (selectedRole === 'manager') {
|
||||
var storedEventId = '<?= isset($details['event_id']) ? $details['event_id'] : '' ?>';
|
||||
// Perform AJAX request to fetch event names based on the selected role
|
||||
$.ajax({
|
||||
url: "<?= base_url('users/fetch_event_names') ?>",
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
// Assuming your response has an array of event names
|
||||
var eventNames = data.eventNames;
|
||||
|
||||
// Perform AJAX request to fetch event names based on the selected role
|
||||
$.ajax({
|
||||
url: "<?= base_url('users/fetch_event_names') ?>",
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
// Assuming your response has an array of event names
|
||||
var eventNames = data.eventNames;
|
||||
// Clear existing options and add the default option
|
||||
$('#event_id').empty().append('<option value="">Select Event</option>');
|
||||
|
||||
// Clear existing options
|
||||
$('#event_id').empty();
|
||||
// Add new options based on the fetched data
|
||||
for (var i = 0; i < eventNames.length; i++) {
|
||||
$('#event_id').append('<option value="' + eventNames[i].event_id + '">' + eventNames[i].event_name + '</option>');
|
||||
}
|
||||
|
||||
// Add new options based on the fetched data
|
||||
for (var i = 0; i < eventNames.length; i++) {
|
||||
$('#event_id').append('<option value="' + eventNames[i].event_id + '">' + eventNames[i].event_name + '</option>');
|
||||
// Set the selected option based on the stored event ID
|
||||
if (storedEventId) {
|
||||
$('#event_id').val(storedEventId);
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.error(error); // Log any errors to the console
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Clear event names dropdown if the selected role is not "manager"
|
||||
$('#event_id').empty().append('<option value="">Select Event</option>');
|
||||
}
|
||||
});
|
||||
|
||||
// Set the selected option based on the stored event ID
|
||||
if (storedEventId) {
|
||||
$('#event_id').val(storedEventId);
|
||||
}
|
||||
},
|
||||
error: function (error) {
|
||||
console.error(error); // Log any errors to the console
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Clear event names dropdown if the selected role is not "manager"
|
||||
$('#event_id').empty();
|
||||
}
|
||||
// Trigger the change event initially to populate event names on page load
|
||||
$('#role').change();
|
||||
});
|
||||
|
||||
// Trigger the change event initially to populate event names on page load
|
||||
$('#role').change();
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user