BBnepal-Accounts/account/application/views/accounts/ledger/partywise.php

97 lines
5.1 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header bg-primary disabled color-palette">
<h3 class="card-title m-0"><?php echo $pageTitle; ?></h3>
</div>
<div class="card-body">
<form method="GET" action="#">
<div class="row">
<div class="col"><?php createNepaliDateInput("from_date", "", "from_date", isset($fromDate_Nepali) ? $fromDate_Nepali : firstDayOfNepaliMonth()); ?></div>
<div class="col"><?php createNepaliDateInput("to_date", "", "to_date", isset($toDate_Nepali) ? $toDate_Nepali : ''); ?></div>
2024-07-12 12:12:29 +00:00
<div class="col"><?php $this->myaccounts->showAccountsCombo("account_id", "", "account_id", "status=1", isset($_GET['account_id']) ? $_GET['account_id'] : 1, $CSSclass = ""); ?> </div>
2024-08-25 12:52:52 +00:00
<div class="col"><?php createButton("show_ledger", "Show Ledger", "show_ledger", "Submit", "btn btn-primary"); ?></div>
2024-07-10 12:43:19 +00:00
</div>
</form>
</div>
</div>
<div class="card">
2024-08-25 12:52:52 +00:00
<div id="dataTable_Commands">
</div>
<?php
if (!isset($account_id)) {
$account_id = 1;
}
?>
<?php if (isset($account_id) && $account_id != "") {
$fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth());
$toDate = isset($_GET['to_date']) ? $_GET['to_date'] : Today();
$this->myaccounts->showLedger($account_id, $fromDate, $toDate, $fiscalStart, $fiscalEnd);
} ?>
<div class="modal fade" id="ledgerdetails_box" tabindex="-1" role="dialog" aria-labelledby="ledgerdetails_box" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Ledger Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" id="details_container">
Ledger Details Goes Here
</div>
<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>
2024-09-30 10:24:29 +00:00
<!-- <button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button> -->
2024-07-10 12:43:19 +00:00
</div>
</div>
</div>
2024-08-25 12:52:52 +00:00
</div>
2024-07-10 12:43:19 +00:00
</div>
</div>
</div>
</div>
</div>
2024-09-30 10:24:29 +00:00
</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-->