Report Fixes

This commit is contained in:
VE10-Sanjeev 2023-12-20 17:13:49 +05:30
parent 015047d086
commit 9bafaf921d
4 changed files with 27 additions and 54 deletions

View File

@ -640,29 +640,22 @@ class Invoice extends BaseController
public function general_inv_rp()
{
if($this->request->getmethod() == 'get')
$model = new InvoiceModel();
if($this->request->is('get'))
{
$model = new InvoiceModel();
$data['report_data'] = $model->get_general_invoice_data();
$this->logger->info("Invoice Report ");
$data['page_name'] = 'General Invoice Report';
$this->render_page('report_general_invoice', $data);
$data['selected_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->get_general_invoice_data( $dateTime->format('Y-m-d') , $dateTime1->format('Y-m-d') );
$this->logger->info("Invoice Report ");
$data['page_name'] = 'General Invoice Report';
$data['report_data'] = $model->get_general_invoice_data( date("Y-m-d", strtotime($fromDate)) , date("Y-m-d", strtotime($toDate)) );
$data['selected_data'] = $this->request->getVar('date');
$this->render_page('report_general_invoice', $data);
}
$data['page_name'] = 'General Invoice Report';
$this->render_page('report_general_invoice', $data);
}
public function general_membership_inv_rp()

View File

@ -80,29 +80,29 @@
<script>
$(document).ready(function() {
var table = $('#datatable-buttons').DataTable({
"order": [[0, 'desc']],
"dom": 'Bfrtip',
buttons: [
{
extend: 'pdfHtml5',
title: 'General Invoice Report',
text: 'PDF',
title: 'General Invoice Report',
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',
title: 'General Invoice Report',
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();
$(win.document.body).find('table').find('th:first-child, td:first-child').remove();
}
},
{
@ -110,7 +110,7 @@ $(document).ready(function() {
text: 'CSV',
title: 'General Invoice Report',
exportOptions: {
columns: ':not(:first-child):not(:last-child)' // Exclude the first and last columns
columns: ':not(:first-child)'
}
}
],
@ -123,7 +123,6 @@ $(document).ready(function() {
$('#datatable-buttons thead tr').clone(true).appendTo('#datatable-buttons thead');
$('#datatable-buttons thead tr:eq(1) th').each(function (i) {
var title = $(this).text();
if (title != 'Invoice Date') {
// 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>')
@ -138,11 +137,6 @@ $(document).ready(function() {
uniqueValues.each(function (d, j) {
select.append('<option value="' + d + '">' + d + '</option>');
});
} else {
// For "Invoice Date" column, add a date input
if (title != 'GST')
$(this).html('<input type="date" class="form-control form-control-sm" placeholder="Search ' + title + '" />');
}
$('input', this).on('keyup change', function () {
if (table.column(i).search() !== this.value) {

View File

@ -70,32 +70,21 @@ $(document).ready(function() {
buttons: [
{
extend: 'pdfHtml5',
title: 'General Invoice Report',
title: 'Itemwise 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
});
}
customize: function(doc) {}
},
{
extend: 'print',
title: 'General Invoice Report',
title: 'Itemwise 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();
}
customize: function(win) {}
},
{
extend: 'csv',
text: 'CSV',
title: 'General Invoice Report',
exportOptions: {
columns: ':not(:first-child):not(:last-child)' // Exclude the first and last columns
}
title: 'Itemwise Report',
exportOptions: {}
}
]
});

View File

@ -40,7 +40,8 @@
<th>Count</th>
<th>OT Charges</th>
<th>Total</th>
<th>payment</th>
<th>Status</th>
<th>Payment</th>
</tr>
</thead>
@ -59,6 +60,7 @@
<td><?php echo $row->item_count;?></td>
<td><?php echo '₹' . number_format($row->shipping_charge, 2, '.', ','); ?></td>
<td><?php echo '₹' . number_format($row->total_amount, 2, '.', ','); ?></td>
<td><?php echo $row->status;?></td>
<td><?php echo $row->payment_method;?></td>
</tr>
<?php } ?>
@ -81,31 +83,30 @@ $(document).ready(function() {
buttons: [
{
extend: 'pdfHtml5',
title: 'General Invoice Report',
title: 'Membership 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',
title: 'Membership 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();
$(win.document.body).find('table').find('th:first-child, td:first-child').remove();
}
},
{
extend: 'csv',
text: 'CSV',
title: 'General Invoice Report',
title: 'Membership Invoice Report',
exportOptions: {
columns: ':not(:first-child):not(:last-child)' // Exclude the first and last columns
columns: ':not(:first-child)'
}
}
],
@ -118,7 +119,7 @@ $(document).ready(function() {
$('#datatable-buttons thead tr').clone(true).appendTo('#datatable-buttons thead');
$('#datatable-buttons thead tr:eq(1) th').each(function (i) {
var title = $(this).text();
if (title != 'Invoice Date') {
// 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>')
@ -133,11 +134,7 @@ $('#datatable-buttons thead tr:eq(1) th').each(function (i) {
uniqueValues.each(function (d, j) {
select.append('<option value="' + d + '">' + d + '</option>');
});
} else {
// For "Invoice Date" column, add a date input
if (title != 'GST')
$(this).html('<input type="date" class="form-control form-control-sm" placeholder="Search ' + title + '" />');
}
$('input', this).on('keyup change', function () {
if (table.column(i).search() !== this.value) {