export excel
This commit is contained in:
@ -22,22 +22,21 @@ $BIBAccounts = new BIBAccounts();
|
||||
|
||||
.group-total {
|
||||
width: 10%;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.table-gray {
|
||||
background-color: #eee;
|
||||
}
|
||||
}
|
||||
|
||||
.table td,
|
||||
.table th {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.table t
|
||||
.bg-darker {
|
||||
.table t .bg-darker {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
@ -75,7 +74,8 @@ $BIBAccounts = new BIBAccounts();
|
||||
.underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.text-right{
|
||||
|
||||
.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>
|
||||
|
||||
|
||||
@ -208,8 +212,8 @@ $BIBAccounts = new BIBAccounts();
|
||||
);
|
||||
$showZeroBalances = false;
|
||||
?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances();?>
|
||||
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(); ?>
|
||||
<table id='myTable' class="table table-bordered vertical-borders" id="TrialBalanceTable">
|
||||
<thead class="bg-gray">
|
||||
<tr>
|
||||
<th rowspan="2 class="">Particulars</th>
|
||||
@ -256,7 +260,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
<td class="group-total"><?php // echo myCurrency(($group->posting_side == "DR") ? $group->opening_balance : 0);
|
||||
?></td>
|
||||
<td class="group-total "><?php // echo myCurrency(($group->posting_side == "CR") ? $group->opening_balance : 0);
|
||||
?></td>
|
||||
?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($ReportOptions['showPeriod']) : ?>
|
||||
<td class="group-total"><?php // echo myCurrency(($group->posting_side == "DR") ? $group->regular_balance : 0);
|
||||
@ -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
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user