export excel
This commit is contained in:
parent
60f4c75eb0
commit
4683fe67a7
@ -630,6 +630,7 @@ class myaccounts
|
||||
window.location = '<?php echo site_url("accounts/accountheads/delete/"); ?>' + id;
|
||||
}
|
||||
}
|
||||
|
||||
function showDetails(id) {
|
||||
$.ajax({
|
||||
url: "<?php echo site_url("accounts/accountheads/getdetails/"); ?>" + id,
|
||||
@ -681,14 +682,19 @@ class myaccounts
|
||||
?>
|
||||
<div class="card-primary card-outline ">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0">Leger for Account : <?php echo $Account->account_name; ?> <a href="<?php echo site_url("accounts/ledger/print/" . $Account->account_id . "/?" . $_SERVER['QUERY_STRING']); ?>" class="btn btn-success btn-sm float-right">Print</a></h5>
|
||||
<h5 class="m-0">Leger for Account : <?php echo $Account->account_name; ?>
|
||||
<!-- <a href="<?php echo site_url("accounts/ledger/print/" . $Account->account_id . "/?" . $_SERVER['QUERY_STRING']); ?>" class="btn btn-success btn-sm float-right">Print</a> -->
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
<div class="card-body p-0 mb-20" id="printableDiv">
|
||||
<h3 class="text-center"><?php echo $ci->session->userdata("CompanyName"); ?></h3>
|
||||
<h5 class="text-center">Ledger Details for <?php echo $Account->account_name; ?> </h5>
|
||||
<?php $TableData = $Transactions; ?>
|
||||
<?php $TotalCols = 7; ?>
|
||||
<table class="table table-bordered table-head-fixed text-nowrap table-striped ">
|
||||
<table id='myTable' class="table table-bordered table-head-fixed text-nowrap table-striped ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-1"><?php myLang("Date"); ?></th>
|
||||
@ -762,6 +768,44 @@ class myaccounts
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
<!-- <div class="container ">
|
||||
<div class="row mt-100 ">
|
||||
<div class="col-2"><span class="underline-text"><?php echo $ci->session->userdata("loggedUser"); ?></span></div>
|
||||
@ -1019,9 +1063,11 @@ class myaccounts
|
||||
<!-- <td><?php echo $TableRow->voucher_state; ?></td> -->
|
||||
<td class="col-1 text-center">
|
||||
<a onClick="javascript:showDetails(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-success btn-xs" title="View Details"><i class="fa fa-eye"></i></a>
|
||||
<!-- <a onClick="javascript:showDetails(<?php //echo $TableRow->voucher_id; ?>);" class="btn btn-info btn-xs" title="View Details"><i class="fas fa-edit"></i></a> -->
|
||||
<!-- <a onClick="javascript:showDetails(<?php //echo $TableRow->voucher_id;
|
||||
?>);" class="btn btn-info btn-xs" title="View Details"><i class="fas fa-edit"></i></a> -->
|
||||
<a onClick="javascript:showPDF(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-primary btn-xs" title="View PDF"><i class="fa fa-file-pdf"></i></a>
|
||||
<?php //print_r($ci->session->userdata());die; ?>
|
||||
<?php //print_r($ci->session->userdata());die;
|
||||
?>
|
||||
<?php if ($ci->session->userdata('LoggedUser') != 'admin'): ?>
|
||||
<a onClick="javascript:deleteVoucher(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-danger btn-xs" title="Delete Voucher"><i class="fa fa-trash"></i></a>
|
||||
<?php endif; ?>
|
||||
@ -1074,6 +1120,7 @@ class myaccounts
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showDetails(id) {
|
||||
$.ajax({
|
||||
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
|
||||
@ -1084,6 +1131,7 @@ class myaccounts
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function reversalEntry() {
|
||||
var id = $("#reversalBtn").data("id");
|
||||
if (confirm("Are you sure you want to post reversal for this voucher?")) {
|
||||
@ -1109,6 +1157,7 @@ class myaccounts
|
||||
row.child(Transactions).show();
|
||||
});
|
||||
});
|
||||
|
||||
function getVoucherDetails(id) {
|
||||
$.data;
|
||||
$.ajax({
|
||||
@ -1120,6 +1169,7 @@ class myaccounts
|
||||
});
|
||||
return ($.data);
|
||||
}
|
||||
|
||||
function deleteVoucher(id) {
|
||||
// Show confirmation dialog
|
||||
if (confirm("Are you sure you want to delete this voucher?")) {
|
||||
|
@ -24,7 +24,7 @@ function buildCategoryTree($categories, $parent_id = 0, $showZero = true)
|
||||
}
|
||||
function displayCategoryTree($tree)
|
||||
{
|
||||
echo '<table class="table table-bordered">';
|
||||
echo '<table id="myTable" class="table table-bordered">';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th>Sn</th>';
|
||||
@ -128,6 +128,41 @@ echo $html;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
</div>
|
||||
<!-- /.content -->
|
||||
|
@ -103,6 +103,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
min-height: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
@ -160,8 +161,11 @@ $BIBAccounts = new BIBAccounts();
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
|
||||
</div>
|
||||
@ -207,7 +211,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
<?php $Side1Total = 0; ?>
|
||||
<div class="col-6 p-0 m-0 gy-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table mb-0 pb-0">
|
||||
<table id='myTable' class="table mb-0 pb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="group-name pl-1">Particulars</th>
|
||||
@ -512,5 +516,42 @@ $BIBAccounts = new BIBAccounts();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
|
||||
<?php
|
||||
}
|
||||
|
@ -110,13 +110,21 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
min-height: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.card-body.p-0 .table tbody>tr>td:last-of-type, .card-body.p-0 .table tbody>tr>th:last-of-type, .card-body.p-0 .table tfoot>tr>td:last-of-type, .card-body.p-0 .table tfoot>tr>th:last-of-type, .card-body.p-0 .table thead>tr>td:last-of-type, .card-body.p-0 .table thead>tr>th:last-of-type {
|
||||
|
||||
.card-body.p-0 .table tbody>tr>td:last-of-type,
|
||||
.card-body.p-0 .table tbody>tr>th:last-of-type,
|
||||
.card-body.p-0 .table tfoot>tr>td:last-of-type,
|
||||
.card-body.p-0 .table tfoot>tr>th:last-of-type,
|
||||
.card-body.p-0 .table thead>tr>td:last-of-type,
|
||||
.card-body.p-0 .table thead>tr>th:last-of-type {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: 900;
|
||||
}
|
||||
@ -178,8 +186,12 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<a href="#" class="dropdown-item">Export</a>
|
||||
@ -271,7 +283,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
|
||||
|
||||
|
||||
<table class="table table-bordered p-0 ">
|
||||
<table id='myTable' class="table table-bordered p-0 ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="" width="30%"><?php myLang("Cash inflow"); ?></th>
|
||||
@ -463,4 +475,40 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
<?php } ?>
|
@ -61,8 +61,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<a href="#" class="dropdown-item">Export</a>
|
||||
@ -107,3 +110,39 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('voucherList1');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
@ -46,6 +46,9 @@
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-success" data-dismiss="modal">Print</button>
|
||||
<!-- <button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -56,3 +59,39 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
@ -56,10 +56,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<!-- <button type="submit" onclick="exportTableToCSVNew('accounts_data.csv')" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
<button class="btn btn-warning btn-sm " onclick="exportTableToCSV('accounts_data.csv')">Export to CSV</button>
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
<!-- <button class="btn btn-warning btn-sm " onclick="exportTableToCSV('accounts_data.csv')">Export to CSV</button> -->
|
||||
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<a href="#" class="dropdown-item">Export</a>
|
||||
@ -108,7 +108,7 @@
|
||||
|
||||
<?php
|
||||
$html = "";
|
||||
$html .= "<table class='table table-bordered table-striped longdataTable'>";
|
||||
$html .= "<table id='myTable'class='table table-bordered table-striped longdataTable'>";
|
||||
$html .= "<thead>";
|
||||
$html .= "<tr><th class='text-center col-1'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1 '>Action</th></tr>";
|
||||
$html .= "</thead><tbody>";
|
||||
@ -234,7 +234,42 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
<?php
|
||||
}
|
||||
?>
|
@ -56,9 +56,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
<!-- <button id="exportButton">Export to Excel</button> -->
|
||||
|
||||
<!-- <button class="btn btn-warning btn-sm " id="downloadBtn">Download CSV</button> -->
|
||||
|
||||
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<a href="#" class="dropdown-item">Export</a>
|
||||
<a href="#" class="dropdown-item">Pdf</a>
|
||||
@ -67,7 +74,7 @@
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
|
||||
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
|
||||
</form>
|
||||
<script>
|
||||
function resetForm() {
|
||||
@ -107,7 +114,7 @@
|
||||
|
||||
<?php
|
||||
$html = "";
|
||||
$html .= "<table class='table table-bordered table-striped longdataTable'>";
|
||||
$html .= "<table id='myTable' class='table table-bordered table-striped longdataTable'>";
|
||||
$html .= "<thead>";
|
||||
$html .= "<tr><th class='text-center' width='25'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1'>Action</th></tr>";
|
||||
$html .= "</thead><tbody>";
|
||||
@ -232,6 +239,44 @@
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
@ -22,6 +22,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php function footerFunctions()
|
||||
{
|
||||
?>
|
||||
|
@ -108,10 +108,12 @@ $BIBAccounts = new BIBAccounts();
|
||||
min-height: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: 900;
|
||||
}
|
||||
@ -173,8 +175,14 @@ $BIBAccounts = new BIBAccounts();
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
<!-- <button type="submit" onclick="exportTableToCSV('accounts_data.csv')" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<a href="#" class="dropdown-item">Export</a>
|
||||
@ -194,7 +202,6 @@ $BIBAccounts = new BIBAccounts();
|
||||
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
|
||||
document.getElementById("FilterForm").submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</div>
|
||||
@ -222,7 +229,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
?>
|
||||
<div class="col-6 p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table ">
|
||||
<table id='myTable' class="table ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="group-name pl-1">Particulars</th>
|
||||
@ -436,6 +443,42 @@ function footerfunctions()
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
<?php
|
||||
}
|
||||
?>
|
@ -153,8 +153,11 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<a href="#" class="dropdown-item">Export</a>
|
||||
@ -183,31 +186,38 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<div class="row align-items-end">
|
||||
<div class="col-2">
|
||||
<div class="form-group">
|
||||
<label for="fromDate"><?php //myLang("Starting Period"); ?></label>
|
||||
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php //echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
|
||||
<label for="fromDate"><?php //myLang("Starting Period");
|
||||
?></label>
|
||||
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php //echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from);
|
||||
?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="form-group">
|
||||
<label for="toDate"><?php //myLang("Ending Period"); ?></label>
|
||||
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php //echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
|
||||
<label for="toDate"><?php //myLang("Ending Period");
|
||||
?></label>
|
||||
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php //echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to);
|
||||
?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1 text-center">
|
||||
<div class="form-group">
|
||||
<label for="showOB"><?php //myLang("Opening"); ?></label>
|
||||
<label for="showOB"><?php //myLang("Opening");
|
||||
?></label>
|
||||
<input type="checkbox" class="form-control " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : "CHECKED"; ?>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1 text-center">
|
||||
<div class="form-group">
|
||||
<label for="showClosing"><?php //myLang("Closing"); ?></label>
|
||||
<label for="showClosing"><?php //myLang("Closing");
|
||||
?></label>
|
||||
<input type="checkbox" class="form-control " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : "CHECKED"; ?>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1 text-center">
|
||||
<div class="form-group">
|
||||
<label for="showPeriod"><?php //myLang("Period"); ?></label>
|
||||
<label for="showPeriod"><?php //myLang("Period");
|
||||
?></label>
|
||||
<input type="checkbox" class="form-control " name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
|
||||
</div>
|
||||
</div>
|
||||
@ -235,7 +245,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<div class="card">
|
||||
<div class="card card-primary card-outline">
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart, $fiscalEnd) ?>
|
||||
<table class="table table-head-fixed table-bordered g-0" id="TrialBalanceTable">
|
||||
<table id='myTable' class="table table-head-fixed table-bordered g-0" id="TrialBalanceTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="" width="30%"><?php myLang("Receipts"); ?></th>
|
||||
@ -422,4 +432,41 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
|
||||
<?php } ?>
|
@ -36,8 +36,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
|
||||
}
|
||||
|
||||
.table t
|
||||
.bg-darker {
|
||||
.table t .bg-darker {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
@ -75,6 +74,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
.underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
padding-right: 5px;
|
||||
}
|
||||
@ -95,6 +95,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
box-shadow: inset 0 0 0 transparent;
|
||||
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
||||
}
|
||||
|
||||
.bg-gray tr th {
|
||||
vertical-align: middle;
|
||||
}
|
||||
@ -158,8 +159,11 @@ $BIBAccounts = new BIBAccounts();
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm" data-toggle="dropdown" data-offset="-52">
|
||||
<!-- <button type="submit" class="btn btn-warning btn-sm" data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
|
||||
|
||||
@ -209,7 +213,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
$showZeroBalances = false;
|
||||
?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(); ?>
|
||||
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
|
||||
<table id='myTable' class="table table-bordered vertical-borders" id="TrialBalanceTable">
|
||||
<thead class="bg-gray">
|
||||
<tr>
|
||||
<th rowspan="2 class="">Particulars</th>
|
||||
@ -391,6 +395,43 @@ function footerfunctions()
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
<?php
|
||||
}
|
||||
?>
|
@ -40,100 +40,75 @@
|
||||
<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
|
||||
|
||||
// document.getElementById('downloadBtn').addEventListener('click', function() {
|
||||
// const table = document.getElementById('myTable');
|
||||
// const csvData = [];
|
||||
// const rowCount = table.rows.length;
|
||||
// const output = [];
|
||||
|
||||
// for (let i = 0; i < rowCount; i++) {
|
||||
// const row = table.rows[i];
|
||||
// const rowArray = [];
|
||||
// let skipCell = 0;
|
||||
|
||||
// for (let j = 0; j < row.cells.length; j++) {
|
||||
// const cell = row.cells[j];
|
||||
|
||||
// if (skipCell > 0) {
|
||||
// skipCell--;
|
||||
// continue; // Skip this cell due to rowspan
|
||||
// }
|
||||
|
||||
// // Create a CSV string
|
||||
// const csvString = csvRows.join("\n");
|
||||
// const cellContent = cell.textContent.trim();
|
||||
// const colspan = cell.colSpan || 1;
|
||||
// const rowspan = cell.rowSpan || 1;
|
||||
|
||||
// // Create a Blob for the CSV string
|
||||
// const blob = new Blob([csvString], {
|
||||
// type: "text/csv"
|
||||
// // Fill the rowArray for the colspan
|
||||
// for (let k = 0; k < colspan; k++) {
|
||||
// if (k === colspan - 1) {
|
||||
// rowArray.push(cellContent); // Last cell of colspan gets content
|
||||
// } else {
|
||||
// rowArray.push(''); // Fill empty for additional colspan cells
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Set skipCell to account for rowspan
|
||||
// skipCell = rowspan - 1;
|
||||
|
||||
// // Ensure that the row length matches the maximum number of columns
|
||||
// while (rowArray.length < output.length) {
|
||||
// rowArray.push(''); // Fill empty cells
|
||||
// }
|
||||
|
||||
// // Fill the output structure
|
||||
// output[i] = rowArray;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Join rows for CSV format
|
||||
// output.forEach(row => {
|
||||
// const filledRow = row.map(cell => cell === undefined ? '' : cell);
|
||||
// csvData.push(filledRow.join(','));
|
||||
// });
|
||||
|
||||
// const csvContent = csvData.join('\n');
|
||||
// const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
||||
// 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);
|
||||
}
|
||||
// const link = document.createElement('a');
|
||||
// link.setAttribute('href', url);
|
||||
// link.setAttribute('download', 'table_with_colspan_rowspan.csv');
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// document.body.removeChild(link);
|
||||
// });
|
||||
</script>
|
||||
<!-- csv printing ends -->
|
||||
|
||||
|
@ -154,7 +154,10 @@
|
||||
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button> -->
|
||||
<button class="btn btn-warning btn-sm " onclick="exportTableToCSV('accounts_data.csv')">Export to CSV</button>
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
<!-- <button class="btn btn-warning btn-sm " onclick="exportTableToCSV('accounts_data.csv')">Export to CSV</button> -->
|
||||
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<a href="#" class="dropdown-item">Export</a>
|
||||
@ -179,7 +182,7 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<table class="table table-bordered table-striped dataTable">
|
||||
<table id='myTable' class="table table-bordered table-striped dataTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" width="40" style="vertical-align: middle;"><?php myLang('S.No.'); ?></th>
|
||||
@ -335,6 +338,43 @@
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- pdf document -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
const rows = Array.from(table.rows);
|
||||
const data = [];
|
||||
|
||||
rows.forEach((row) => {
|
||||
const cells = Array.from(row.cells);
|
||||
const rowData = [];
|
||||
cells.forEach((cell) => {
|
||||
// Handle colspan
|
||||
const colspan = cell.colSpan || 1;
|
||||
for (let i = 0; i < (colspan - 1); i++) {
|
||||
rowData.push(''); // Fill empty cells for merged columns
|
||||
}
|
||||
for (let i = 0; i < 1; i++) {
|
||||
rowData.push(cell.innerText.trim());
|
||||
}
|
||||
// Fill empty cells for colspan
|
||||
});
|
||||
data.push(rowData);
|
||||
});
|
||||
|
||||
// Create a worksheet
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(data);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||
|
||||
// Export to Excel
|
||||
XLSX.writeFile(workbook, 'table.xlsx');
|
||||
});
|
||||
</script>
|
||||
<!-- pdf document ends-->
|
||||
<?php
|
||||
}
|
||||
?>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -75,6 +75,7 @@
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
})
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user