export excel
This commit is contained in:
@ -110,16 +110,24 @@ $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 {
|
||||
padding-right:0!important;
|
||||
}
|
||||
.text-bold{
|
||||
font-weight: 900;
|
||||
}
|
||||
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 {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: 900;
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<section class="content">
|
||||
@ -129,7 +137,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<h3 class="card-title mt-1">Cash Flow<?php //echo $pageTitle;
|
||||
?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action=<?php echo base_url('accounts/reports/cash_flow') ;?> id="FilterForm">
|
||||
<form method="post" action=<?php echo base_url('accounts/reports/cash_flow'); ?> id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
|
||||
@ -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>
|
||||
@ -264,14 +276,14 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<h4 class="card-title">Cash Flow</h4>
|
||||
</div> -->
|
||||
<div class="card-body table-responsive p-0">
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart,$fiscalEnd);
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart, $fiscalEnd);
|
||||
// echo "<pre>";print_r($IncomesExpenses); die();
|
||||
?>
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<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 } ?>
|
Reference in New Issue
Block a user