dashboard-report-subscription
This commit is contained in:
parent
a52ad0c5ea
commit
ac56f59350
@ -291,15 +291,33 @@ class Invoice extends BaseController
|
||||
'created_by' =>get_logged_user_id(),
|
||||
'is_renew' => $renewal
|
||||
];
|
||||
|
||||
if ($invoice_status == 'Draft') {
|
||||
$get_subscription_draft_dtl_where = ['S.customer_id'=>$customer_id,'I.status'=>$invoice_status];
|
||||
// $get_subscription_draft_dtl_id = $model->InactiveSubscriptionDraftDetails($get_subscription_draft_dtl_where,get_logged_user_id());
|
||||
// $this->logger->info($msg_flag_name.": has been Inactived. Inv ID = ".implode(", ", $get_subscription_draft_dtl_id));
|
||||
$get_subscription_draft_dtl_id = $model->deleteSubscriptionDraftDetails($get_subscription_draft_dtl_where,get_logged_user_id());
|
||||
$this->logger->info($msg_flag_name.": has been Deleted. Inv ID = ".implode(", ", $get_subscription_draft_dtl_id));
|
||||
$subscriptionModel->insertSubscriptionData($subscription_data);
|
||||
// $subscriptionModel->insertSubscriptionData($subscription_data);
|
||||
}
|
||||
else{
|
||||
// Check if there is a draft entry for the customer_id and scheme_id
|
||||
$get_subscription_draft_dtl_where = [
|
||||
'S.customer_id' => $customer_id,
|
||||
'S.scheme_id' => $scheme_id, // Assuming scheme_id is available here
|
||||
'I.status' => 'Draft'
|
||||
];
|
||||
|
||||
$get_subscription_draft_dtl_id = $model->deleteSubscriptionDraftDetails($get_subscription_draft_dtl_where, get_logged_user_id());
|
||||
|
||||
$this->logger->info($msg_flag_name . ": Draft entry has been deleted. Inv ID = " . implode(", ", $get_subscription_draft_dtl_id));
|
||||
|
||||
// Now insert the new entry
|
||||
|
||||
}
|
||||
}
|
||||
$subscriptionModel->insertSubscriptionData($subscription_data);
|
||||
}
|
||||
|
||||
|
||||
## Notification For Approve..
|
||||
$this->logger->info($msg_flag_name.": ID = " . $invoice_id.", Status =".$invoice_status);
|
||||
@ -735,18 +753,21 @@ $encodedUrl = urlencode($url);
|
||||
$toDate = $dateParts[1];
|
||||
|
||||
// Update date conversion format using the global namespace
|
||||
$fromDate = \DateTime::createFromFormat('d/m/Y', $fromDate)->format('Y-m-d');
|
||||
$toDate = \DateTime::createFromFormat('d/m/Y', $toDate)->format('Y-m-d');
|
||||
|
||||
$fromDate = \DateTime::createFromFormat('d/m/Y', $dateParts[0])->format('Y-m-d');
|
||||
$toDate = \DateTime::createFromFormat('d/m/Y', $dateParts[1])->format('Y-m-d');
|
||||
|
||||
// Debugging statements for date range
|
||||
var_dump($fromDate, $toDate);
|
||||
// var_dump($fromDate, $toDate);die;
|
||||
|
||||
$data['report_data'] = $model->get_general_invoice_data($fromDate, $toDate);
|
||||
$data['selected_data'] = $this->request->getVar('date');
|
||||
$data['selected_data'] = ($this->request->getVar('date')) ? $this->request->getVar('date') : '';
|
||||
// var_dump( $data['selected_data']);die;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Debugging statement for report data
|
||||
// var_dump($data['report_data']);
|
||||
// print_r($data['selected_data']);die;
|
||||
|
||||
$data['page_name'] = 'Sales Report';
|
||||
$this->render_page('report_general_invoice', $data);
|
||||
@ -786,7 +807,7 @@ $encodedUrl = urlencode($url);
|
||||
{
|
||||
$model = new InvoiceModel();
|
||||
$data['expired_customers'] = $model->getExpiredCustomers();
|
||||
|
||||
$data['selected_data'] = "";
|
||||
$this->logger->info("'Membership Renewals Report'");
|
||||
$data['page_name'] = 'Membership Renewals Report';
|
||||
$this->render_page('report_expired_customers', $data);
|
||||
@ -797,10 +818,11 @@ $encodedUrl = urlencode($url);
|
||||
$fromDate = $dateParts[0];
|
||||
$toDate = $dateParts[1];
|
||||
|
||||
$dateTime = \DateTime::createFromFormat('m/d/Y', $fromDate);
|
||||
$dateTime1 = \DateTime::createFromFormat('m/d/Y', $toDate);
|
||||
$dateTime = \DateTime::createFromFormat('d/m/Y', $fromDate);
|
||||
$dateTime1 = \DateTime::createFromFormat('d/m/Y', $toDate);
|
||||
$model = new InvoiceModel();
|
||||
$data['expired_customers'] = $model->getExpiredCustomers( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
|
||||
$data['selected_data'] = $this->request->getVar('date');
|
||||
$this->logger->info("Itemwise Report ");
|
||||
$this->logger->info("'Membership Renewals Report'");
|
||||
$data['page_name'] = 'Membership Renewals Report';
|
||||
@ -808,33 +830,85 @@ $encodedUrl = urlencode($url);
|
||||
}
|
||||
}
|
||||
|
||||
public function itemwise_report()
|
||||
{
|
||||
if($this->request->getmethod() == 'get')
|
||||
{
|
||||
public function itemwise_report()
|
||||
{
|
||||
if ($this->request->getmethod() == 'get')
|
||||
{
|
||||
$model = new InvoiceModel();
|
||||
$data['report_data'] = $model->itemwise_report_data();
|
||||
$this->logger->info("Itemwise Report ");
|
||||
$data['page_name'] = 'Bookswise Report';
|
||||
$this->render_page('report_itemwise', $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->request->getPost('export_csv')) {
|
||||
// Handle CSV export
|
||||
$this->exportCsv();
|
||||
} else {
|
||||
// Handle date range filter
|
||||
|
||||
|
||||
$model = new InvoiceModel();
|
||||
$data['report_data'] = $model->itemwise_report_data();
|
||||
$this->logger->info("Itemwise Report ");
|
||||
$data['page_name'] = 'Bookswise Report';
|
||||
$this->render_page('report_itemwise', $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$dateParts = explode(' - ', $this->request->getVar('date') );
|
||||
$fromDate = $dateParts[0];
|
||||
$toDate = $dateParts[1];
|
||||
|
||||
$dateTime = \DateTime::createFromFormat('m/d/Y', $fromDate);
|
||||
$dateTime1 = \DateTime::createFromFormat('m/d/Y', $toDate);
|
||||
$model = new InvoiceModel();
|
||||
$data['report_data'] = $model->itemwise_report_data( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
|
||||
$this->logger->info("Itemwise Report ");
|
||||
$data['page_name'] = 'Bookswise Report';
|
||||
$data['selected_data'] = $this->request->getVar('date');
|
||||
$this->exportCsv();
|
||||
$this->render_page('report_itemwise', $data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function exportCsv()
|
||||
{
|
||||
$model = new InvoiceModel();
|
||||
$reportData = $model->itemwise_report_data();
|
||||
|
||||
$csvFileName = 'itemwise_report.csv';
|
||||
|
||||
// Set appropriate headers for CSV download
|
||||
header('Content-Type: text/csv; charset=UTF-8');
|
||||
header('Content-Disposition: attachment; filename="' . $csvFileName . '"');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: 0');
|
||||
|
||||
// Open a PHP output stream for writing CSV data
|
||||
$output = fopen('php://output', 'w');
|
||||
|
||||
// Add UTF-8 BOM to the CSV file
|
||||
fprintf($output, chr(0xEF).chr(0xBB).chr(0xBF));
|
||||
|
||||
// Write the CSV headers
|
||||
fputcsv($output, ['Publisher Code', 'Book Name', 'Item Count', 'Total Cost']);
|
||||
|
||||
// Write the CSV data
|
||||
foreach ($reportData as $row) {
|
||||
foreach ($row->books as $book) {
|
||||
$rowData = [
|
||||
$row->publisher_code,
|
||||
$book->book_name,
|
||||
$book->item_count,
|
||||
$book->total_cost,
|
||||
];
|
||||
|
||||
// Convert each field to UTF-8 using iconv
|
||||
$rowData = array_map(function ($field) {
|
||||
return iconv('UTF-8', 'UTF-8//IGNORE', $field);
|
||||
}, $rowData);
|
||||
|
||||
fputcsv($output, $rowData);
|
||||
}
|
||||
}
|
||||
|
||||
// Close the PHP output stream
|
||||
fclose($output);
|
||||
|
||||
// Terminate the script to prevent further output
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function calculateTotalBookQuantity(&$reportData)
|
||||
{
|
||||
// Calculate the total book quantity for each publisher
|
||||
@ -849,8 +923,9 @@ $encodedUrl = urlencode($url);
|
||||
{
|
||||
$model = new InvoiceModel();
|
||||
$data['report_data'] = $model->itemwise_report_data_with_publish_code();
|
||||
$data['selected_data'] = "";
|
||||
$this->logger->info("Itemwise Report ");
|
||||
$data['page_name'] = 'Bookswise Report';
|
||||
$data['page_name'] = 'Books Published';
|
||||
// print_r($data);die;
|
||||
$this->render_page('report_book_publish', $data);
|
||||
}
|
||||
@ -858,14 +933,14 @@ $encodedUrl = urlencode($url);
|
||||
{
|
||||
$dateParts = explode(' - ', $this->request->getVar('date') );
|
||||
$fromDate = $dateParts[0];
|
||||
$toDate = $dateParts[1];
|
||||
|
||||
$dateTime = \DateTime::createFromFormat('m/d/Y', $fromDate);
|
||||
$dateTime1 = \DateTime::createFromFormat('m/d/Y', $toDate);
|
||||
|
||||
$toDate = $dateParts[1];
|
||||
$dateTime = \DateTime::createFromFormat('d/m/Y', $fromDate);
|
||||
$dateTime1 = \DateTime::createFromFormat('d/m/Y', $toDate);
|
||||
$model = new InvoiceModel();
|
||||
$data['report_data'] = $model->itemwise_report_data_with_publish_code( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
|
||||
$this->logger->info("Itemwise Report ");
|
||||
$data['page_name'] = 'Bookswise Report';
|
||||
$data['page_name'] = 'Books Published';
|
||||
$data['selected_data'] = $this->request->getVar('date');
|
||||
$this->render_page('report_book_publish', $data);
|
||||
}
|
||||
|
||||
@ -399,25 +399,24 @@ public function get_mem_invoice_data($f_date = null, $t_date = null)
|
||||
|
||||
// return $result;
|
||||
// }
|
||||
public function itemwise_report_data($f_date = null, $t_date = null)
|
||||
public function itemwise_report_data()
|
||||
{
|
||||
// Fetch invoice data
|
||||
$query = $this->db->table('invoice')
|
||||
->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('invoice.invoice_type',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.publishers_code, books.title')
|
||||
->get()
|
||||
->getResult();
|
||||
// print_r($result);
|
||||
|
||||
// Group by publisher_code and include books
|
||||
$groupedResult = [];
|
||||
|
||||
@ -272,10 +272,12 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($subscriptions as $subscription) :
|
||||
|
||||
<?php foreach ($subscriptions as $subscription) :
|
||||
|
||||
$daysRemaining = (int)$subscription->subscription_in_days;
|
||||
$fromDateTime = (new DateTime($subscription->from_subscription))->format('Y-m-d');
|
||||
$toDateTime = (new DateTime($subscription->to_subscription))->format('Y-m-d');
|
||||
$fromDateTime = (new DateTime($subscription->formatted_from_subscription))->format('Y-m-d');
|
||||
$toDateTime = (new DateTime($subscription->formatted_from_subscription))->format('Y-m-d');
|
||||
$currentDate = (new DateTime())->format('Y-m-d');
|
||||
if ($currentDate === $toDateTime) {
|
||||
$class = 'text-danger';
|
||||
|
||||
@ -1,49 +1,5 @@
|
||||
<?php if ($business_id == 2 && $loggedin_person_role !== 'manager') : ?>
|
||||
<!-- <div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div class="card bg-info border-info">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-6 text-center">
|
||||
<h1 class="display-4"><i class="wi ri-stack-line"></i></h1>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="text-white">
|
||||
<h2 class="text-white"><b>32°</b></h2>
|
||||
<p>Partly cloudy</p>
|
||||
<p class=" mb-0">15km/h - 37%</p>
|
||||
</div>
|
||||
</div
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="row">
|
||||
<div class="col-4 text-center">
|
||||
<h4 class="text-white mt-0">SAT</h4>
|
||||
<h3 class="my-3"><i class="wi wi-night-alt-cloudy text-white"></i></h3>
|
||||
<h4 class="text-white mb-0">30<i class="wi wi-degrees"></i></h4>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<h4 class="text-white mt-0">SUN</h4>
|
||||
<h3 class="my-3"><i class="wi wi-day-sprinkle text-white"></i></h3>
|
||||
<h4 class="text-white mb-0">28<i class="wi wi-degrees"></i></h4>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<h4 class="text-white mt-0">MON</h4>
|
||||
<h3 class="my-3"><i class="wi wi-hot text-white"></i></h3>
|
||||
<h4 class="text-white mb-0">33<i class="wi wi-degrees"></i></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-4 col-md-6">
|
||||
<div class="card">
|
||||
@ -142,72 +98,13 @@
|
||||
</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>
|
||||
-->
|
||||
|
||||
<?php if (!empty($active_schemes) && isset($active_schemes[1])) : ?>
|
||||
<div class="col-xl-4 col-md-6">
|
||||
<div class="card">
|
||||
@ -247,6 +144,7 @@
|
||||
<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>
|
||||
@ -302,7 +200,56 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($active_schemes) && isset($active_schemes[2])) : ?>
|
||||
<div class="col-xl-4 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php $firstScheme = $active_schemes[2]; ?>
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
|
||||
@ -358,22 +305,7 @@
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<!-- <tr>
|
||||
<td>
|
||||
<h5 class="mt-0 mb-1">Sangavi</h5>
|
||||
<span class="font-13">9092279559</span>
|
||||
</td>
|
||||
<td>Samarth Scheme (5years)</td>
|
||||
<td><span class="badge badge-success badge-pill">5 days</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h5 class="mt-0 mb-1">Suganya</h5>
|
||||
<span class="font-13">7128122050</span>
|
||||
</td>
|
||||
<td>Samarth Scheme (5years)</td>
|
||||
<td><span class="badge badge-success badge-pill">5 days</span></td>
|
||||
</tr> -->
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
|
||||
@ -216,7 +216,7 @@ td.invoice-number {
|
||||
<th>Item Name</th>
|
||||
<th>Qty</th>
|
||||
<th>Rate</th>
|
||||
<th>Discount</th>
|
||||
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -251,9 +251,7 @@ td.invoice-number {
|
||||
<td colspan="5" align="right">Subtotal : ₹<?= number_format($value->subtotal, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="5" align="right">Discount : ₹<?= number_format($value->discount, 2, '.', ',') ?></td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
<?php if ($value->shipping_label != '') : ?>
|
||||
<tr>
|
||||
<td colspan="5" align="right"><?= $value->shipping_label?> : ₹<?= number_format($value->shipping_charge, 2, '.', ',') ?></td>
|
||||
|
||||
@ -39,13 +39,12 @@
|
||||
<table id="datatable-buttons" class="table table-striped nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th hidden>id</th>
|
||||
<th hidden>id</th>
|
||||
<th>Book Name</th>
|
||||
<th>Author</th>
|
||||
<th>Cost</th>
|
||||
<th>Published By</th>
|
||||
<th>Inv Date</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@ -53,13 +52,12 @@
|
||||
<tbody>
|
||||
<?php foreach ($report_data as $row) { ?>
|
||||
<tr>
|
||||
<td hidden><?php echo $row->title; ?></td>
|
||||
<td hidden><?php echo $row->invoice_id; ?></td>
|
||||
<td><?php echo $row->title; ?></td>
|
||||
<td><?php echo $row->publisher; ?></td>
|
||||
<td><?php echo $row->price ?></td>
|
||||
<td><?php echo $row->publishers_code?></td>
|
||||
<td><?php echo $row->invoice_date ?></td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
@ -84,15 +82,16 @@
|
||||
<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> Cost
|
||||
</div><br>
|
||||
<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> Published By
|
||||
</div><br>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input column-toggle" data-column="5" checked> Inv Date
|
||||
</div><br>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Repeat similar blocks for other columns -->
|
||||
@ -112,10 +111,9 @@
|
||||
|
||||
|
||||
<script>
|
||||
var table;
|
||||
$(document).ready(function() {
|
||||
|
||||
table = $('#datatable-buttons').DataTable({
|
||||
var table = $('#datatable-buttons').DataTable({
|
||||
"order": [
|
||||
[0, 'desc']
|
||||
],
|
||||
@ -140,85 +138,110 @@
|
||||
],
|
||||
columnDefs: [{
|
||||
type: 'date',
|
||||
targets: [1, 2, 3, 4, 5,],
|
||||
targets: [1, 2, 3, 4, 5],
|
||||
orderable: false
|
||||
} // Specify the column index for date sorting and disable sorting
|
||||
]
|
||||
});
|
||||
$('.show-column-selection-modal').on('click', function() {
|
||||
// Hide dropdowns when the modal is shown
|
||||
$('.table-responsive select').hide();
|
||||
$('#columnSelectionModal').modal('show');
|
||||
});
|
||||
//have to adjust the script coording to this report
|
||||
|
||||
|
||||
// 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.each(function(d, j) {
|
||||
select.append('<option value="' + d + '">' + d + '</option>');
|
||||
});
|
||||
|
||||
uniqueValues.forEach(function(d) {
|
||||
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('');
|
||||
});
|
||||
$(document).ready(function () {
|
||||
var $select_data = '<?php echo $selected_data; ?>';
|
||||
|
||||
// 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');
|
||||
var dateRangeFilter = $('input.input-daterange-datepicker')
|
||||
.daterangepicker({
|
||||
locale: {
|
||||
format: 'DD/MM/YYYY',
|
||||
cancelLabel: 'Clear'
|
||||
},
|
||||
startDate: $select_data ? moment($select_data.split(' - ')[0], 'DD/MM/YYYY') : moment(),
|
||||
endDate: $select_data ? moment($select_data.split(' - ')[1], 'DD/MM/YYYY') : moment(),
|
||||
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) {
|
||||
var formattedStartDate = picker.startDate.format('DD/MM/YYYY');
|
||||
var formattedEndDate = picker.endDate.format('DD/MM/YYYY');
|
||||
var selectedDateRange = formattedStartDate + ' - ' + formattedEndDate;
|
||||
$(this).val(selectedDateRange);
|
||||
})
|
||||
.on('cancel.daterangepicker', function () {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
$('.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');
|
||||
});
|
||||
|
||||
$('.today-btn').on('click', function () {
|
||||
var today = moment();
|
||||
dateRangeFilter.data('daterangepicker').setStartDate(today);
|
||||
dateRangeFilter.data('daterangepicker').setEndDate(today);
|
||||
dateRangeFilter.val(today.format('DD/MM/YYYY') + ' - ' + today.format('DD/MM/YYYY'));
|
||||
dateRangeFilter.trigger('apply.daterangepicker');
|
||||
});
|
||||
|
||||
// Trigger "Today" button click to set it as default if $select_data is empty
|
||||
if ($select_data === '') {
|
||||
$('.today-btn').trigger('click');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -11,7 +11,7 @@
|
||||
<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; } ?>"/>
|
||||
<input class="form-control input-daterange-datepicker" type="text" name="date" value="<?php echo $selected_data; ?>"/>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="submit" class="btn btn-primary">Generate Report</button>
|
||||
@ -73,7 +73,7 @@ $(document).ready(function() {
|
||||
buttons: [
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Experiref\d Invoice Report',
|
||||
title: 'Experired Invoice Report',
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// Exclude the first and last columns
|
||||
@ -127,40 +127,54 @@ $('#datatable-buttons thead tr:eq(1) th').each(function (i) {
|
||||
});
|
||||
|
||||
// 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('');
|
||||
});
|
||||
moment.updateLocale('en', {
|
||||
longDateFormat: {
|
||||
L: 'DD/MM/YYYY',
|
||||
// LTS: 'h:mm:ss A',
|
||||
// LTS: 'h:mm A',
|
||||
}
|
||||
});
|
||||
|
||||
// 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');
|
||||
$(document).ready(function () {
|
||||
var $select_data = '<?php echo $selected_data; ?>';
|
||||
|
||||
var dateRangeFilter = $('input.input-daterange-datepicker')
|
||||
.daterangepicker({
|
||||
locale: {
|
||||
format: 'DD/MM/YYYY',
|
||||
cancelLabel: 'Clear'
|
||||
},
|
||||
startDate: $select_data ? moment($select_data.split(' - ')[0], 'DD/MM/YYYY') : moment(),
|
||||
endDate: $select_data ? moment($select_data.split(' - ')[1], 'DD/MM/YYYY') : moment(),
|
||||
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) {
|
||||
var formattedStartDate = picker.startDate.format('DD/MM/YYYY');
|
||||
var formattedEndDate = picker.endDate.format('DD/MM/YYYY');
|
||||
var selectedDateRange = formattedStartDate + ' - ' + formattedEndDate;
|
||||
$(this).val(selectedDateRange);
|
||||
})
|
||||
.on('cancel.daterangepicker', function () {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
$('.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');
|
||||
});
|
||||
$('.today-btn').on('click', function () {
|
||||
var today = moment();
|
||||
dateRangeFilter.data('daterangepicker').setStartDate(today);
|
||||
dateRangeFilter.data('daterangepicker').setEndDate(today);
|
||||
dateRangeFilter.val(today.format('DD/MM/YYYY') + ' - ' + today.format('DD/MM/YYYY'));
|
||||
dateRangeFilter.trigger('apply.daterangepicker');
|
||||
});
|
||||
|
||||
// Trigger "Today" button click to set it as default if $select_data is empty
|
||||
if ($select_data === '') {
|
||||
$('.today-btn').trigger('click');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control input-daterange-datepicker" name="date" />
|
||||
|
||||
<input type="text" class="form-control input-daterange-datepicker" name="date" value="<?php echo $selected_data?>" />
|
||||
|
||||
</div>
|
||||
<!-- <input class="form-control input-daterange-datepicker" type="text" name="date" value="<?php if (isset($selected_data)) { echo $selected_data; } ?>" /> -->
|
||||
@ -20,6 +21,8 @@
|
||||
<div class="col-md-5">
|
||||
<button type="submit" class="btn btn-primary">Generate Report</button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -235,39 +238,57 @@
|
||||
});
|
||||
|
||||
// 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('');
|
||||
});
|
||||
// Set the default date format for moment.js globally
|
||||
// Set the default date format for moment.js globally
|
||||
moment.updateLocale('en', {
|
||||
longDateFormat: {
|
||||
L: 'DD/MM/YYYY',
|
||||
// LTS: 'h:mm:ss A',
|
||||
// LTS: 'h:mm A',
|
||||
}
|
||||
});
|
||||
|
||||
// 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');
|
||||
$(document).ready(function () {
|
||||
var $select_data = '<?php echo $selected_data; ?>';
|
||||
|
||||
var dateRangeFilter = $('input.input-daterange-datepicker')
|
||||
.daterangepicker({
|
||||
locale: {
|
||||
format: 'DD/MM/YYYY',
|
||||
cancelLabel: 'Clear'
|
||||
},
|
||||
startDate: $select_data ? moment($select_data.split(' - ')[0], 'DD/MM/YYYY') : moment(),
|
||||
endDate: $select_data ? moment($select_data.split(' - ')[1], 'DD/MM/YYYY') : moment(),
|
||||
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) {
|
||||
var formattedStartDate = picker.startDate.format('DD/MM/YYYY');
|
||||
var formattedEndDate = picker.endDate.format('DD/MM/YYYY');
|
||||
var selectedDateRange = formattedStartDate + ' - ' + formattedEndDate;
|
||||
$(this).val(selectedDateRange);
|
||||
})
|
||||
.on('cancel.daterangepicker', function () {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
$('.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');
|
||||
});
|
||||
$('.today-btn').on('click', function () {
|
||||
var today = moment();
|
||||
dateRangeFilter.data('daterangepicker').setStartDate(today);
|
||||
dateRangeFilter.data('daterangepicker').setEndDate(today);
|
||||
dateRangeFilter.val(today.format('DD/MM/YYYY') + ' - ' + today.format('DD/MM/YYYY'));
|
||||
dateRangeFilter.trigger('apply.daterangepicker');
|
||||
});
|
||||
|
||||
// Trigger "Today" button click to set it as default if $select_data is empty
|
||||
if ($select_data === '') {
|
||||
$('.today-btn').trigger('click');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
@ -1,33 +1,26 @@
|
||||
|
||||
<style>
|
||||
|
||||
.custom-thead th,
|
||||
.custom-tbody td {
|
||||
white-space: initial !important;
|
||||
}
|
||||
|
||||
/* 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 th {
|
||||
text-align: center; /* Center-align the main table column headings */
|
||||
} */
|
||||
.custom-thead{
|
||||
margin
|
||||
|
||||
/* .nested-table-data th,
|
||||
.nested-table-data td {
|
||||
text-align: center; /* Center-align the nested table data */
|
||||
} */
|
||||
|
||||
.nested-table-data .truncate-text {
|
||||
max-width: none; /* Remove max-width for the nested table text */
|
||||
white-space: initial;
|
||||
overflow: visible;
|
||||
text-overflow: initial;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* 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 -->
|
||||
@ -41,12 +34,10 @@
|
||||
<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>
|
||||
<button type="submit" class="btn btn-primary" style="margin-left: 387px; margin-top: 12px;" name="export_csv">CSV</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -61,43 +52,44 @@
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="datatable-buttons" class="table table-striped nowrap w-100">
|
||||
<thead class="custom-thead">
|
||||
<thead class="custom-thead" style="font:caption;">
|
||||
<tr>
|
||||
<th>Publisher Code</th>
|
||||
<th style="margin-right:10px;">Publisher Item Count</th>
|
||||
<th>Publisher Total Cost</th>
|
||||
<!-- <td colspan="12"> -->
|
||||
<th><b>Publisher Code</b></th>
|
||||
<th><b>Publisher Item Count</b></th>
|
||||
<th><b>Publisher Total Cost</b></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>
|
||||
<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 nested-table-data" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th hidden style="width:28%" >Book Name</th>
|
||||
<th hidden>Item Count</th>
|
||||
<th hidden>Total Cost</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($row->books as $book) { ?>
|
||||
<tr>
|
||||
<td style="width:28%" class="truncate-text"><?php echo $book->book_name; ?></td>
|
||||
<td style="width:38%"><?php echo $book->item_count; ?></td>
|
||||
<td style="width:34%"><?php echo $book->total_cost; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -108,25 +100,44 @@
|
||||
</div>
|
||||
<!-- 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: {}
|
||||
// }
|
||||
// ]
|
||||
// });
|
||||
// });
|
||||
</script>
|
||||
<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: {}
|
||||
}
|
||||
]
|
||||
// Initially hide all nested tables
|
||||
$('.nested-table-data').hide();
|
||||
|
||||
// Toggle nested table visibility on parent row click
|
||||
$('.custom-tbody tr').click(function () {
|
||||
var nestedTable = $(this).next().find('.nested-table-data');
|
||||
|
||||
// Toggle visibility
|
||||
nestedTable.slideToggle();
|
||||
|
||||
// You can add additional styling or animation here if needed
|
||||
|
||||
// Prevent the parent row from triggering the toggle when nested table row is clicked
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
@ -222,7 +222,7 @@
|
||||
<a href="<?= base_url()."itemwise_report"; ?>">Bookswise Report</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url()."book_publishwise_Report"; ?>">Bookswise Published</a>
|
||||
<a href="<?= base_url()."book_publishwise_Report"; ?>">Books Published</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -315,3 +315,4 @@ $(document).ready(function () {
|
||||
$('#role').change();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user