stock module - 17-03-2025
This commit is contained in:
parent
89fac94fa3
commit
da11189e6b
@ -332,7 +332,7 @@ $timeOtions[] = "12:00 AM";
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#bs-example-modal-lg">Navigation</a>
|
||||
<a style="cursor:pointer"
|
||||
class="dropdown-item" id="gasStockDetailsExport" href="#">Export</a>
|
||||
class="dropdown-item" id="trpProductionDetailsExport" href="#">Export</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1304,7 +1304,25 @@ $timeOtions[] = "12:00 AM";
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<h4 style="text-align:center">Abstract for the month <?=$month?></h4>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
||||
<div class="dropdown float-right">
|
||||
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-dots-vertical m-0 text-muted h3"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a style="cursor:pointer"
|
||||
class="dropdown-item" id="trpAbstractDetailsExport" href="#">Export
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 style="text-align:center">Abstract for the month <?=$month?></h4>
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
@ -2213,6 +2231,7 @@ $timeOtions[] = "12:00 AM";
|
||||
|
||||
|
||||
<script>
|
||||
//excel export for trp production sheet
|
||||
$(document).ready(function() {
|
||||
|
||||
function exportTableToExcel(tableID, filename = '') {
|
||||
@ -2234,7 +2253,17 @@ $timeOtions[] = "12:00 AM";
|
||||
|
||||
$(cloneTable).find('tbody tr').each(function() {
|
||||
let firstTd = $(this).find('td').eq(0); // Get the first column (Date)
|
||||
|
||||
let openingTimeTd = $(this).find('td').eq(1);
|
||||
|
||||
let closingTimeTd = $(this).find('td').eq(2);
|
||||
|
||||
let openingTime = $(this).find('td select.trp_on_time').val(); // No space before `.trp_on_time`
|
||||
let closingTime = $(this).find('td select.trp_off_time').val(); // No space before `.trp_off_time`
|
||||
|
||||
|
||||
|
||||
|
||||
// Convert Date Format (Assuming it's in YYYY-MM-DD format)
|
||||
let originalDate = firstTd.text().trim(); // Get the text value
|
||||
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
|
||||
@ -2246,6 +2275,8 @@ $timeOtions[] = "12:00 AM";
|
||||
|
||||
// Apply left alignment to the date column
|
||||
firstTd.css("text-align", "left");
|
||||
openingTimeTd.text(openingTime);
|
||||
closingTimeTd.text(closingTime);
|
||||
});
|
||||
|
||||
|
||||
@ -2257,9 +2288,49 @@ $timeOtions[] = "12:00 AM";
|
||||
|
||||
let tableId = 'trpProductionStockDetailsTableId';
|
||||
|
||||
document.getElementById('gasStockDetailsExport').addEventListener('click', function() {
|
||||
document.getElementById('trpProductionDetailsExport').addEventListener('click', function() {
|
||||
|
||||
exportTableToExcel(tableId, 'Gas Stock Details<?= $month ?>.xlsx');
|
||||
exportTableToExcel(tableId, 'Trp Production Details<?= $month ?>.xlsx');
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
//excel export for trp abstract sheet
|
||||
$(document).ready(function() {
|
||||
|
||||
function exportTableToExcel(tableID, filename = '') {
|
||||
let table = document.getElementById(tableID);
|
||||
|
||||
let cloneTable = table.cloneNode(true); // Clone the table to modify
|
||||
|
||||
// Remove hidden rows
|
||||
$(cloneTable).find('tr').filter(function () {
|
||||
return $(this).css('display') === 'none';
|
||||
}).remove();
|
||||
|
||||
// Remove hidden columns
|
||||
$(cloneTable).find('th, td').each(function () {
|
||||
if ($(this).css('display') === 'none') {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
|
||||
let wb = XLSX.utils.book_new(); // Create a new workbook
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
|
||||
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
|
||||
}
|
||||
|
||||
let tableId = 'abstractTableId';
|
||||
|
||||
document.getElementById('trpAbstractDetailsExport').addEventListener('click', function() {
|
||||
|
||||
exportTableToExcel(tableId, 'Trp Abstract Details<?= $month ?>.xlsx');
|
||||
|
||||
})
|
||||
|
||||
@ -2330,6 +2401,5 @@ $timeOtions[] = "12:00 AM";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user