148 lines
10 KiB
PHP
148 lines
10 KiB
PHP
<style>
|
|
.mt-26 {
|
|
margin-top: 26px;
|
|
}
|
|
</style>
|
|
<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">
|
|
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
|
|
<div class="card-tools">
|
|
<form method="post" action="" 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">
|
|
Filters
|
|
</button>
|
|
<div class="dropdown-menu" role="menu">
|
|
<div class="form-group p-2 pb-0">
|
|
<div class="col">
|
|
<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">
|
|
</div>
|
|
<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">
|
|
</div>
|
|
</div>
|
|
<div class="dropdown-divider"></div>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox">
|
|
<label class="form-check-label">Select
|
|
All</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input type="hidden" name="showOB" value="not">
|
|
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
|
|
<!-- <input class="form-check-input" type="checkbox"> -->
|
|
<label class="form-check-label">Opening</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<!-- <input class="form-check-input" type="checkbox"> -->
|
|
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
|
|
<label class="form-check-label">Closing</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<!-- <input class="form-check-input" type="checkbox" checked> -->
|
|
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
|
|
<label class="form-check-label">Period</label>
|
|
</div>
|
|
</div>
|
|
<div class="dropdown-divider"></div>
|
|
<div class="form-group p-2 pb-0">
|
|
<button type="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button>
|
|
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="btn-group">
|
|
<!-- <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>
|
|
<a href="#" class="dropdown-item">Pdf</a>
|
|
<div class="dropdown-divider"></div>
|
|
<a href="#" class="dropdown-item">View calendar</a>
|
|
</div> -->
|
|
</div>
|
|
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
|
|
</form>
|
|
<script>
|
|
function resetForm() {
|
|
document.getElementById("fromDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>";
|
|
document.getElementById("toDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>";
|
|
document.getElementById("showOB").checked = <?php echo "false"; ?>;
|
|
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
|
|
document.getElementById("FilterForm").submit();
|
|
}
|
|
</script>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<form method="GET" action="">
|
|
<div class="row">
|
|
<div class="col-2"><?php createNepaliDateInput("from_date", "Date", "from_date", isset($_GET['from_date']) ? $_GET['from_date'] : ''); ?></div>
|
|
<div class="col-1"><?php createButton("show_voucher", "Show", "show_voucher", "Submit", "mt-26 btn btn-block btn-primary btn-sm "); ?></div>
|
|
</div>
|
|
</form>
|
|
<div id="dataTable_Commands"></div>
|
|
<?php
|
|
$fromDate = isset($_GET['from_date']) ? NepaliToEnglishDate($_GET['from_date']) : Today();
|
|
$toDate = isset($_GET['to_date']) ? NepaliToEnglishDate($_GET['to_date']) : Today();
|
|
// echo $toDate;
|
|
$account_id = isset($_GET['account_id']) ? $_GET['account_id'] : '';
|
|
$vouchertype_id = isset($_GET['vouchertypes']) ? $_GET['vouchertypes'] : '';
|
|
$this->myaccounts->listVouchers($fromDate, $fromDate, $account_id, $vouchertype_id, true, true);
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</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-->
|