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

@ -639,30 +639,23 @@ class Invoice extends BaseController
} }
public function general_inv_rp() public function general_inv_rp()
{
if($this->request->getmethod() == 'get')
{ {
$model = new InvoiceModel(); $model = new InvoiceModel();
if($this->request->is('get'))
{
$data['report_data'] = $model->get_general_invoice_data(); $data['report_data'] = $model->get_general_invoice_data();
$this->logger->info("Invoice Report "); $data['selected_data'] = "";
$data['page_name'] = 'General Invoice Report';
$this->render_page('report_general_invoice', $data);
} }
else else
{ {
$dateParts = explode(' - ', $this->request->getVar('date') ); $dateParts = explode(' - ', $this->request->getVar('date') );
$fromDate = $dateParts[0]; $fromDate = $dateParts[0];
$toDate = $dateParts[1]; $toDate = $dateParts[1];
$data['report_data'] = $model->get_general_invoice_data( date("Y-m-d", strtotime($fromDate)) , date("Y-m-d", strtotime($toDate)) );
$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['selected_data'] = $this->request->getVar('date'); $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() public function general_membership_inv_rp()

View File

@ -80,29 +80,29 @@
<script> <script>
$(document).ready(function() { $(document).ready(function() {
var table = $('#datatable-buttons').DataTable({ var table = $('#datatable-buttons').DataTable({
"order": [[0, 'desc']], "order": [[0, 'desc']],
"dom": 'Bfrtip', "dom": 'Bfrtip',
buttons: [ buttons: [
{ {
extend: 'pdfHtml5', extend: 'pdfHtml5',
title: 'General Invoice Report',
text: 'PDF', text: 'PDF',
title: 'General Invoice Report',
customize: function(doc) { customize: function(doc) {
// Exclude the first and last columns // Exclude the first and last columns
doc.content[1].table.body.forEach(function(row) { doc.content[1].table.body.forEach(function(row) {
row.splice(0, 1); // Remove the first column row.splice(0, 1); // Remove the first column
row.splice(-1, 1); // Remove the last column
}); });
} }
}, },
{ {
extend: 'print', extend: 'print',
title: 'General Invoice Report',
text: 'Print', text: 'Print',
title: 'General Invoice Report',
customize: function(win) { customize: function(win) {
// Exclude the first and last columns // 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', text: 'CSV',
title: 'General Invoice Report', title: 'General Invoice Report',
exportOptions: { 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').clone(true).appendTo('#datatable-buttons thead');
$('#datatable-buttons thead tr:eq(1) th').each(function (i) { $('#datatable-buttons thead tr:eq(1) th').each(function (i) {
var title = $(this).text(); var title = $(this).text();
if (title != 'Invoice Date') {
// For non-"Invoice Date" columns, add a dropdown // For non-"Invoice Date" columns, add a dropdown
var uniqueValues = table.column(i).data().unique().sort(); var uniqueValues = table.column(i).data().unique().sort();
var select = $('<select class="form-control form-control-sm"><option value="">Search ' + title + '</option></select>') 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) { uniqueValues.each(function (d, j) {
select.append('<option value="' + d + '">' + d + '</option>'); 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 () { $('input', this).on('keyup change', function () {
if (table.column(i).search() !== this.value) { if (table.column(i).search() !== this.value) {

View File

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

View File

@ -40,7 +40,8 @@
<th>Count</th> <th>Count</th>
<th>OT Charges</th> <th>OT Charges</th>
<th>Total</th> <th>Total</th>
<th>payment</th> <th>Status</th>
<th>Payment</th>
</tr> </tr>
</thead> </thead>
@ -59,6 +60,7 @@
<td><?php echo $row->item_count;?></td> <td><?php echo $row->item_count;?></td>
<td><?php echo '₹' . number_format($row->shipping_charge, 2, '.', ','); ?></td> <td><?php echo '₹' . number_format($row->shipping_charge, 2, '.', ','); ?></td>
<td><?php echo '₹' . number_format($row->total_amount, 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> <td><?php echo $row->payment_method;?></td>
</tr> </tr>
<?php } ?> <?php } ?>
@ -81,31 +83,30 @@ $(document).ready(function() {
buttons: [ buttons: [
{ {
extend: 'pdfHtml5', extend: 'pdfHtml5',
title: 'General Invoice Report', title: 'Membership Invoice Report',
text: 'PDF', text: 'PDF',
customize: function(doc) { customize: function(doc) {
// Exclude the first and last columns // Exclude the first and last columns
doc.content[1].table.body.forEach(function(row) { doc.content[1].table.body.forEach(function(row) {
row.splice(0, 1); // Remove the first column row.splice(0, 1); // Remove the first column
row.splice(-1, 1); // Remove the last column
}); });
} }
}, },
{ {
extend: 'print', extend: 'print',
title: 'General Invoice Report', title: 'Membership Invoice Report',
text: 'Print', text: 'Print',
customize: function(win) { customize: function(win) {
// Exclude the first and last columns // 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', extend: 'csv',
text: 'CSV', text: 'CSV',
title: 'General Invoice Report', title: 'Membership Invoice Report',
exportOptions: { 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').clone(true).appendTo('#datatable-buttons thead');
$('#datatable-buttons thead tr:eq(1) th').each(function (i) { $('#datatable-buttons thead tr:eq(1) th').each(function (i) {
var title = $(this).text(); var title = $(this).text();
if (title != 'Invoice Date') {
// For non-"Invoice Date" columns, add a dropdown // For non-"Invoice Date" columns, add a dropdown
var uniqueValues = table.column(i).data().unique().sort(); var uniqueValues = table.column(i).data().unique().sort();
var select = $('<select class="form-control form-control-sm"><option value="">Search ' + title + '</option></select>') 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) { uniqueValues.each(function (d, j) {
select.append('<option value="' + d + '">' + d + '</option>'); 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 () { $('input', this).on('keyup change', function () {
if (table.column(i).search() !== this.value) { if (table.column(i).search() !== this.value) {