donation/app/Views/report_itemwise.php

105 lines
3.4 KiB
PHP

<style>
.custom-thead th,
.custom-tbody td {
white-space: initial !important;
}
</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>
</div>
</div>
<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>
</div>
</div>
</form>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<table id="datatable-buttons" class="table table-striped dt-responsive 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> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
<!-- end row-->
<script>
$(document).ready(function() {
var table = $('#datatable-buttons').DataTable({
// "order": [[0, 'desc']],
"dom": 'Bfrtip',
buttons: [
{
extend: 'pdfHtml5',
title: 'General Invoice Report',
text: 'PDF',
customize: function(doc) {
// Exclude the first and last columns
doc.content[1].table.body.forEach(function(row) {
row.splice(0, 1); // Remove the first column
row.splice(-1, 1); // Remove the last column
});
}
},
{
extend: 'print',
title: 'General Invoice Report',
text: 'Print',
customize: function(win) {
// Exclude the first and last columns
$(win.document.body).find('table').find('th:first-child, td:first-child, th:last-child, td:last-child').remove();
}
},
{
extend: 'csv',
text: 'CSV',
title: 'General Invoice Report',
exportOptions: {
columns: ':not(:first-child):not(:last-child)' // Exclude the first and last columns
}
}
]
});
});
</script>