changes for print
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
|
||||
<head>
|
||||
|
||||
<title><?php echo myLang($this->config->item("ProjectTitle")); ?> >> <?php echo isset($pageTitle)?$pageTitle:" | Dashboard"; ?></title>
|
||||
<title><?php echo myLang($this->config->item("ProjectTitle")); ?> >> <?php echo isset($pageTitle) ? $pageTitle : " | Dashboard"; ?></title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
@ -39,6 +39,105 @@
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>plugins/bstreeview/css/bstreeview.min.css">
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/bbnepalcustom.css">
|
||||
|
||||
<!-- CSV File create -->
|
||||
<script>
|
||||
// function exportTableToCSVNew(filename) {
|
||||
// const csvRows = [];
|
||||
// const rows = document.querySelectorAll("#dataTable tr");
|
||||
|
||||
// for (const row of rows) {
|
||||
// const cols = row.querySelectorAll("td, th");
|
||||
// const csvRow = [];
|
||||
|
||||
// for (const col of cols) {
|
||||
// // csvRow.push(col.innerText.replace(/,/g, '')); // Remove commas for CSV
|
||||
// csvRow.push(col.innerText); // Include empty cells as ''
|
||||
|
||||
// }
|
||||
// csvRows.push(csvRow.join(",")); // Join cells with commas
|
||||
// }
|
||||
|
||||
// // Create a CSV string
|
||||
// const csvString = csvRows.join("\n");
|
||||
|
||||
// // Create a Blob for the CSV string
|
||||
// const blob = new Blob([csvString], {
|
||||
// type: "text/csv"
|
||||
// });
|
||||
// const url = URL.createObjectURL(blob);
|
||||
// const a = document.createElement("a");
|
||||
// a.href = url;
|
||||
// a.download = filename;
|
||||
// document.body.appendChild(a);
|
||||
// a.click();
|
||||
// document.body.removeChild(a);
|
||||
// }
|
||||
|
||||
function exportTableToCSV(filename) {
|
||||
const csvRows = [];
|
||||
const rows = document.querySelectorAll("#dataTable tr");
|
||||
let rowSpanTracker = {};
|
||||
|
||||
for (const row of rows) {
|
||||
const cols = row.querySelectorAll("td, th");
|
||||
const csvRow = [];
|
||||
let currentRow = [];
|
||||
|
||||
for (const col of cols) {
|
||||
const colSpan = parseInt(col.getAttribute('colspan') || 1);
|
||||
const rowSpan = parseInt(col.getAttribute('rowspan') || 1);
|
||||
const cellValue = col.innerText.replace(/,/g, '').trim() || '';
|
||||
|
||||
// Handle row span by marking the cells
|
||||
if (rowSpan > 1) {
|
||||
for (let r = 0; r < rowSpan; r++) {
|
||||
if (!rowSpanTracker[r]) rowSpanTracker[r] = {};
|
||||
rowSpanTracker[r][currentRow.length] = true; // Mark this position for rowspan
|
||||
}
|
||||
}
|
||||
|
||||
// Fill CSV row with values
|
||||
for (let i = 0; i < colSpan; i++) {
|
||||
if (i === 0 && !rowSpanTracker[currentRow.length]?.[currentRow.length]) {
|
||||
csvRow.push(cellValue); // First instance of the cell value
|
||||
} else {
|
||||
csvRow.push(''); // Other instances as empty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fill the empty spaces due to rowspan
|
||||
if (rowSpanTracker[currentRow.length]) {
|
||||
currentRow.forEach((_, index) => {
|
||||
if (!rowSpanTracker[currentRow.length]?.[index]) {
|
||||
csvRow[index] = ''; // Fill in empty spaces
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
csvRows.push(csvRow.join(",")); // Join cells with commas
|
||||
}
|
||||
|
||||
// Create a CSV string
|
||||
const csvString = csvRows.join("\n");
|
||||
|
||||
// Create a Blob for the CSV string
|
||||
const blob = new Blob([csvString], {
|
||||
type: "text/csv"
|
||||
});
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
</script>
|
||||
<!-- csv printing ends -->
|
||||
|
||||
|
||||
<!-- Override Defaults By Prajwal -->
|
||||
<style>
|
||||
body {
|
||||
@ -299,14 +398,14 @@
|
||||
width: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.narration_display
|
||||
{
|
||||
|
||||
.narration_display {
|
||||
font-style: italic;
|
||||
}
|
||||
.text-bold .currency
|
||||
{
|
||||
|
||||
.text-bold .currency {
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user