export excel
This commit is contained in:
parent
60f4c75eb0
commit
4683fe67a7
@ -272,7 +272,7 @@ class Reports extends CI_Controller
|
||||
|
||||
break;
|
||||
case 'default':
|
||||
//show_404();
|
||||
//show_404();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class myaccounts
|
||||
$i = 0;
|
||||
$crTotal = 0;
|
||||
$drTotal = 0;
|
||||
$fields = array();
|
||||
$fields = array();
|
||||
// print_r($VoucherDetails);die;
|
||||
foreach ($VoucherDetails as $VoucherDetail) :
|
||||
$i++;
|
||||
@ -91,7 +91,7 @@ class myaccounts
|
||||
$fields['amount_in_words'] = trim($CI->numbertoword->nepali_word($crTotal));
|
||||
else
|
||||
$fields['amount_in_words'] = trim($CI->numbertoword->english_word($crTotal));
|
||||
|
||||
|
||||
// $fields['narration_' . $i] = $VoucherDetail->narration;
|
||||
|
||||
$file = APPPATH . "/../pdf/e_voucher1.pdf";
|
||||
@ -199,7 +199,7 @@ class myaccounts
|
||||
</div>
|
||||
<?php
|
||||
$html = "";
|
||||
$html .= "<table class='table table-bordered table-striped longdataTable'>";
|
||||
$html .= "<table class='table table-bordered table-striped longdataTable'>";
|
||||
$html .= "<thead>";
|
||||
$html .= "<tr><th>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>";
|
||||
@ -209,11 +209,11 @@ class myaccounts
|
||||
$balance = getBalance($Account->account_id);
|
||||
$BalanceTotal += $balance;
|
||||
// pre($Account);
|
||||
$html .= "<tr><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='text-right col-1'>". myCurrency($balance) ."</td><td class='text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
|
||||
$html .= "<tr><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='text-right col-1'>" . myCurrency($balance) . "</td><td class='text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
|
||||
endforeach;
|
||||
$html .= "</tbody><tfoot>";
|
||||
// if ($full == "") {
|
||||
$html .= "<tr><th colspan=2 class='text-right '>Total</th><th class='text-right'>" . (($BalanceTotal > 0) ? myCurrency(abs($BalanceTotal )) : "") . "</th><th class='text-right'>" . (($BalanceTotal < 0) ? myCurrency(abs($BalanceTotal )) : "") . "</th><th>" . myCurrency($BalanceTotal) . "</th><th></th></tr>";
|
||||
$html .= "<tr><th colspan=2 class='text-right '>Total</th><th class='text-right'>" . (($BalanceTotal > 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th class='text-right'>" . (($BalanceTotal < 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th>" . myCurrency($BalanceTotal) . "</th><th></th></tr>";
|
||||
// }
|
||||
$html .= "</tfoot></table>\n";
|
||||
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
|
||||
@ -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,
|
||||
@ -664,7 +665,7 @@ class myaccounts
|
||||
$data['oldBalance'] = $oldBalance;
|
||||
return $data;
|
||||
}
|
||||
function showLedger($account_id, $fromDate = "", $toDate = "", $fiscalStart = "", $fiscalEnd = "" )
|
||||
function showLedger($account_id, $fromDate = "", $toDate = "", $fiscalStart = "", $fiscalEnd = "")
|
||||
{
|
||||
$oldBalance = $this->getOldBalance($account_id, FYStart());
|
||||
$fromDate = ($fromDate == "") ? NepaliToEnglishDate(FYStart()) : $fromDate;
|
||||
@ -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>
|
||||
@ -783,12 +827,12 @@ class myaccounts
|
||||
?>
|
||||
<script>
|
||||
$(".ass_date").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#refdate').data('start'),
|
||||
maxDate: $('#refdate').data('end'),
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#refdate').data('start'),
|
||||
maxDate: $('#refdate').data('end'),
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
@ -845,7 +889,7 @@ class myaccounts
|
||||
$OutputFile = "Ledger_" . $ledgerData['Account']->account_id . ".pdf";
|
||||
$pdf->Output("F", $OutputFileLocation . $OutputFile);
|
||||
return $OutputFile;
|
||||
}
|
||||
}
|
||||
function ledgerPDF($account_id, $fromDate, $toDate)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
@ -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?")) {
|
||||
@ -1140,12 +1190,12 @@ class myaccounts
|
||||
</script>
|
||||
<script>
|
||||
$(".ass_date").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#refdate').data('start'),
|
||||
maxDate: $('#refdate').data('end'),
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#refdate').data('start'),
|
||||
maxDate: $('#refdate').data('end'),
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
@ -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,10 +103,11 @@ $BIBAccounts = new BIBAccounts();
|
||||
min-height: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
border: 1px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<section class="content">
|
||||
@ -115,7 +116,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action=<?php echo base_url('accounts/reports/balance_sheet') ;?> id="FilterForm">
|
||||
<form method="post" action=<?php echo base_url('accounts/reports/balance_sheet'); ?> 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">
|
||||
@ -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>
|
||||
@ -194,20 +198,20 @@ $BIBAccounts = new BIBAccounts();
|
||||
<div class="card-body pl-2 ">
|
||||
|
||||
<div class="row">
|
||||
<?php
|
||||
// echo $_POST['showClosing'];
|
||||
$ReportOptions = array(
|
||||
'showZeroBalances' => false,
|
||||
'showOB' => false,
|
||||
'showClosing' => true,
|
||||
'showPeriod' => false,
|
||||
);
|
||||
?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php $Side1Total = 0; ?>
|
||||
<?php
|
||||
// echo $_POST['showClosing'];
|
||||
$ReportOptions = array(
|
||||
'showZeroBalances' => false,
|
||||
'showOB' => false,
|
||||
'showClosing' => true,
|
||||
'showPeriod' => false,
|
||||
);
|
||||
?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2, $fiscalStart, $fiscalEnd); ?>
|
||||
<?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>
|
||||
@ -215,10 +219,10 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php $Side1Total = 0; ?>
|
||||
<?php
|
||||
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2, $fiscalStart, $fiscalEnd); ?>
|
||||
<?php $Side1Total = 0; ?>
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
$incomes_totalOpeningDr = 0;
|
||||
$incomes_totalOpeningCr = 0;
|
||||
@ -245,8 +249,8 @@ $BIBAccounts = new BIBAccounts();
|
||||
$Side1Total += $group->closing_balance;
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(5,$fiscalStart,$fiscalEnd); ?>
|
||||
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(5, $fiscalStart, $fiscalEnd); ?>
|
||||
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
$incomes_totalOpeningDr = 0;
|
||||
@ -274,10 +278,10 @@ $BIBAccounts = new BIBAccounts();
|
||||
$Side1Total += $group->closing_balance;
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@ -291,8 +295,8 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(1,$fiscalStart,$fiscalEnd); ?>
|
||||
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(1, $fiscalStart, $fiscalEnd); ?>
|
||||
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
$totalOpeningDr = 0;
|
||||
@ -325,40 +329,40 @@ $BIBAccounts = new BIBAccounts();
|
||||
$totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
|
||||
$TotalIncomes = ($BIBAccounts->getAccountGroupsWithBalancesNew(3,$fiscalStart,$fiscalEnd)[0]->closing_balance) ?? 0;
|
||||
$TotalExpenses = ($BIBAccounts->getAccountGroupsWithBalancesNew(4,$fiscalStart,$fiscalEnd)[0]->closing_balance) ?? 0;
|
||||
$PL = $TotalIncomes - $TotalExpenses;
|
||||
$Side1Total += $PL;
|
||||
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
|
||||
$TotalIncomes = ($BIBAccounts->getAccountGroupsWithBalancesNew(3, $fiscalStart, $fiscalEnd)[0]->closing_balance) ?? 0;
|
||||
$TotalExpenses = ($BIBAccounts->getAccountGroupsWithBalancesNew(4, $fiscalStart, $fiscalEnd)[0]->closing_balance) ?? 0;
|
||||
$PL = $TotalIncomes - $TotalExpenses;
|
||||
$Side1Total += $PL;
|
||||
?>
|
||||
|
||||
<div class="col-6 p-0 m-0 gy-0">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td><b> Profit/Loss</b></td>
|
||||
<td class="cr closing-cr"><?php echo myCurrency($PL); ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="p-0">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th class="pl-1">Total Amount</th>
|
||||
<th class="cr closing-cr">
|
||||
<?php echo myCurrency($Side1Total); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td><b> Profit/Loss</b></td>
|
||||
<td class="cr closing-cr"><?php echo myCurrency($PL); ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="p-0">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th class="pl-1">Total Amount</th>
|
||||
<th class="cr closing-cr">
|
||||
<?php echo myCurrency($Side1Total); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
@ -423,94 +427,131 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</table>
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
function footerfunctions()
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Prevent the dropdown from closing when clicking inside
|
||||
$('.dropdown-menu').on('click', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
</div>
|
||||
<?php
|
||||
function footerfunctions()
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Prevent the dropdown from closing when clicking inside
|
||||
$('.dropdown-menu').on('click', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
document.getElementById("toggleShowAll").click();
|
||||
});
|
||||
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
|
||||
e.preventDefault();
|
||||
var nestedRows = document.getElementsByClassName("collapse");
|
||||
for (var i = 0; i < nestedRows.length; i++) {
|
||||
if (nestedRows[i].classList.contains("show")) {
|
||||
nestedRows[i].classList.remove("show");
|
||||
} else {
|
||||
nestedRows[i].classList.add("show");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
document.getElementById("toggleShowAll").click();
|
||||
});
|
||||
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
|
||||
e.preventDefault();
|
||||
var nestedRows = document.getElementsByClassName("collapse");
|
||||
for (var i = 0; i < nestedRows.length; i++) {
|
||||
if (nestedRows[i].classList.contains("show")) {
|
||||
nestedRows[i].classList.remove("show");
|
||||
} else {
|
||||
nestedRows[i].classList.add("show");
|
||||
}
|
||||
});
|
||||
var exportButton = document.getElementById("exportButton");
|
||||
exportButton.addEventListener("click", function() {
|
||||
exportTableToCSV("table.csv");
|
||||
});
|
||||
|
||||
function exportTableToCSV(filename) {
|
||||
var csv = [];
|
||||
var rows = document.querySelectorAll("table tr:not(.hide)");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = [];
|
||||
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
|
||||
// Check if the parent row is collapsed or hidden
|
||||
var parentRow = rows[i].closest(".collapse");
|
||||
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
|
||||
if (isParentCollapsed) {
|
||||
continue; // Skip child table rows if parent is collapsed
|
||||
}
|
||||
for (var j = 0; j < cols.length; j++) {
|
||||
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
|
||||
row.push(cellValue);
|
||||
}
|
||||
csv.push(row.join(","));
|
||||
}
|
||||
// Create a CSV file
|
||||
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
|
||||
var encodedUri = encodeURI(csvContent);
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("href", encodedUri);
|
||||
link.setAttribute("download", filename);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$("#fromDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#fromDate').data('start'),
|
||||
maxDate: $('#fromDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$("#toDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#toDate').data('start'),
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
});
|
||||
var exportButton = document.getElementById("exportButton");
|
||||
exportButton.addEventListener("click", function() {
|
||||
exportTableToCSV("table.csv");
|
||||
});
|
||||
|
||||
<?php
|
||||
}
|
||||
function exportTableToCSV(filename) {
|
||||
var csv = [];
|
||||
var rows = document.querySelectorAll("table tr:not(.hide)");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = [];
|
||||
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
|
||||
// Check if the parent row is collapsed or hidden
|
||||
var parentRow = rows[i].closest(".collapse");
|
||||
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
|
||||
if (isParentCollapsed) {
|
||||
continue; // Skip child table rows if parent is collapsed
|
||||
}
|
||||
for (var j = 0; j < cols.length; j++) {
|
||||
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
|
||||
row.push(cellValue);
|
||||
}
|
||||
csv.push(row.join(","));
|
||||
}
|
||||
// Create a CSV file
|
||||
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
|
||||
var encodedUri = encodeURI(csvContent);
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("href", encodedUri);
|
||||
link.setAttribute("download", filename);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$("#fromDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#fromDate').data('start'),
|
||||
maxDate: $('#fromDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$("#toDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#toDate').data('start'),
|
||||
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
|
||||
}
|
||||
|
@ -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 } ?>
|
@ -2,7 +2,7 @@
|
||||
.mt-26 {
|
||||
margin-top: 26px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<div class="content">
|
||||
<div class="container-fluid">
|
||||
@ -10,7 +10,7 @@
|
||||
<div class="col">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
|
||||
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
@ -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>
|
||||
@ -106,4 +109,40 @@
|
||||
</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-->
|
@ -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>
|
||||
@ -55,4 +58,40 @@
|
||||
</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('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-->
|
@ -8,7 +8,7 @@
|
||||
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="<?php echo base_url('accounts/ledger/bank_book'); ?>" id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<!-- 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
|
||||
@ -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>";
|
||||
@ -167,71 +174,109 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// var exportButton = document.getElementById("exportButton");
|
||||
// exportButton.addEventListener("click", function() {
|
||||
// exportTableToCSV("table.csv");
|
||||
// });
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// Trigger click event on page load
|
||||
document.getElementById("toggleShowAll").click();
|
||||
});
|
||||
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
|
||||
e.preventDefault();
|
||||
var nestedRows = document.getElementsByClassName("collapse");
|
||||
for (var i = 0; i < nestedRows.length; i++) {
|
||||
if (nestedRows[i].classList.contains("show")) {
|
||||
nestedRows[i].classList.remove("show");
|
||||
} else {
|
||||
nestedRows[i].classList.add("show");
|
||||
}
|
||||
<script>
|
||||
// var exportButton = document.getElementById("exportButton");
|
||||
// exportButton.addEventListener("click", function() {
|
||||
// exportTableToCSV("table.csv");
|
||||
// });
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// Trigger click event on page load
|
||||
document.getElementById("toggleShowAll").click();
|
||||
});
|
||||
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
|
||||
e.preventDefault();
|
||||
var nestedRows = document.getElementsByClassName("collapse");
|
||||
for (var i = 0; i < nestedRows.length; i++) {
|
||||
if (nestedRows[i].classList.contains("show")) {
|
||||
nestedRows[i].classList.remove("show");
|
||||
} else {
|
||||
nestedRows[i].classList.add("show");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function exportTableToCSV(filename) {
|
||||
var csv = [];
|
||||
var rows = document.querySelectorAll("table tr:not(.hide)");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = [];
|
||||
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
|
||||
// Check if the parent row is collapsed or hidden
|
||||
var parentRow = rows[i].closest(".collapse");
|
||||
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
|
||||
if (isParentCollapsed) {
|
||||
continue; // Skip child table rows if parent is collapsed
|
||||
}
|
||||
for (var j = 0; j < cols.length; j++) {
|
||||
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
|
||||
row.push(cellValue);
|
||||
}
|
||||
csv.push(row.join(","));
|
||||
}
|
||||
// Create a CSV file
|
||||
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
|
||||
var encodedUri = encodeURI(csvContent);
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("href", encodedUri);
|
||||
link.setAttribute("download", filename);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$("#fromDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#fromDate').data('start'),
|
||||
maxDate: $('#fromDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$("#toDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#toDate').data('start'),
|
||||
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);
|
||||
});
|
||||
|
||||
function exportTableToCSV(filename) {
|
||||
var csv = [];
|
||||
var rows = document.querySelectorAll("table tr:not(.hide)");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = [];
|
||||
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
|
||||
// Check if the parent row is collapsed or hidden
|
||||
var parentRow = rows[i].closest(".collapse");
|
||||
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
|
||||
if (isParentCollapsed) {
|
||||
continue; // Skip child table rows if parent is collapsed
|
||||
}
|
||||
for (var j = 0; j < cols.length; j++) {
|
||||
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
|
||||
row.push(cellValue);
|
||||
}
|
||||
csv.push(row.join(","));
|
||||
}
|
||||
// Create a CSV file
|
||||
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
|
||||
var encodedUri = encodeURI(csvContent);
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("href", encodedUri);
|
||||
link.setAttribute("download", filename);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$("#fromDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#fromDate').data('start'),
|
||||
maxDate: $('#fromDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$("#toDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#toDate').data('start'),
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
// 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,13 +108,15 @@ $BIBAccounts = new BIBAccounts();
|
||||
min-height: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.text-bold{
|
||||
font-weight: 900;
|
||||
}
|
||||
border: 1px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: 900;
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<div class="content">
|
||||
@ -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,9 +202,8 @@ $BIBAccounts = new BIBAccounts();
|
||||
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
|
||||
document.getElementById("FilterForm").submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
@ -230,8 +237,8 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(3,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(3, $fiscalStart, $fiscalEnd); ?>
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
$incomes_totalOpeningDr = 0;
|
||||
$incomes_totalOpeningCr = 0;
|
||||
@ -241,16 +248,16 @@ $BIBAccounts = new BIBAccounts();
|
||||
$incomes_totalClosingCr = 0;
|
||||
?>
|
||||
<?php foreach ($AccountGroups as $group) : ?>
|
||||
<tr>
|
||||
<td colspan="2" class="p-0">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
|
||||
<tr>
|
||||
<td colspan="2" class="p-0">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
|
||||
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
|
||||
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
// Update column totals
|
||||
$incomes_totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0;
|
||||
$incomes_totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0;
|
||||
@ -258,15 +265,15 @@ $BIBAccounts = new BIBAccounts();
|
||||
$incomes_totalThisYearCr += ($group->posting_side == "CR") ? $group->regular_balance : 0;
|
||||
$incomes_totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0;
|
||||
$incomes_totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
|
||||
?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<?php $PL = $incomes_totalClosingCr - $incomes_totalClosingDr; ?>
|
||||
<?php $PL = $incomes_totalClosingCr - $incomes_totalClosingDr; ?>
|
||||
<tr>
|
||||
<th class="p-1">Total Incomes</th>
|
||||
<th class="cr closing-cr text-bold">
|
||||
@ -275,7 +282,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
<?php else : ?>
|
||||
<?php echo myCurrency($incomes_totalClosingCr + abs($PL)); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@ -292,8 +299,8 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(4,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(4, $fiscalStart, $fiscalEnd); ?>
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
$totalOpeningDr = 0;
|
||||
$totalOpeningCr = 0;
|
||||
@ -303,16 +310,16 @@ $BIBAccounts = new BIBAccounts();
|
||||
$totalClosingCr = 0;
|
||||
?>
|
||||
<?php foreach ($AccountGroups as $group) : ?>
|
||||
<tr>
|
||||
<td colspan="2" class="p-0">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
|
||||
<tr>
|
||||
<td colspan="2" class="p-0">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
|
||||
<i> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
|
||||
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
|
||||
</i>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
// Update column totals
|
||||
$totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0;
|
||||
$totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0;
|
||||
@ -323,28 +330,28 @@ $BIBAccounts = new BIBAccounts();
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<?php $PL = $incomes_totalClosingCr - $totalClosingDr; ?>
|
||||
<?php if ($incomes_totalClosingCr > $totalClosingDr) : ?>
|
||||
<tr>
|
||||
<!-- <th></th>
|
||||
<?php if ($incomes_totalClosingCr > $totalClosingDr) : ?>
|
||||
<tr>
|
||||
<!-- <th></th>
|
||||
<th></th> -->
|
||||
<th class="pl-1">Total Profit</th>
|
||||
<th class="cr closing-cr text-right text-bold"><?php echo myCurrency($PL); ?></th>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php endif; ?>
|
||||
<th class="pl-1">Total Profit</th>
|
||||
<th class="cr closing-cr text-right text-bold"><?php echo myCurrency($PL); ?></th>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<th class="pl-1">Total Expenses</th>
|
||||
<th class="dr closing-dr text-bold">
|
||||
<?php if ($PL > 0) : ?>
|
||||
<?php echo myCurrency($totalClosingDr + abs($PL)); ?>
|
||||
<th class="pl-1">Total Expenses</th>
|
||||
<th class="dr closing-dr text-bold">
|
||||
<?php if ($PL > 0) : ?>
|
||||
<?php echo myCurrency($totalClosingDr + abs($PL)); ?>
|
||||
|
||||
<?php else : ?>
|
||||
<?php echo myCurrency($totalClosingDr); ?>
|
||||
<?php else : ?>
|
||||
<?php echo myCurrency($totalClosingDr); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
@ -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
|
||||
}
|
||||
?>
|
@ -113,7 +113,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<div class="dropdown-menu" role="menu">
|
||||
<div class="form-group p-2 pb-0">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
|
||||
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
|
||||
</div>
|
||||
@ -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>
|
||||
@ -234,8 +244,8 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
</div>
|
||||
<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">
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart, $fiscalEnd) ?>
|
||||
<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 } ?>
|
@ -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
|
||||
}
|
||||
?>
|
@ -39,101 +39,76 @@
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
|
||||
<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 = [];
|
||||
// document.getElementById('downloadBtn').addEventListener('click', function() {
|
||||
// const table = document.getElementById('myTable');
|
||||
// const csvData = [];
|
||||
// const rowCount = table.rows.length;
|
||||
// const output = [];
|
||||
|
||||
// for (const col of cols) {
|
||||
// // csvRow.push(col.innerText.replace(/,/g, '')); // Remove commas for CSV
|
||||
// csvRow.push(col.innerText); // Include empty cells as ''
|
||||
// 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
|
||||
// }
|
||||
|
||||
// const cellContent = cell.textContent.trim();
|
||||
// const colspan = cell.colSpan || 1;
|
||||
// const rowspan = cell.rowSpan || 1;
|
||||
|
||||
// // 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;
|
||||
// }
|
||||
// }
|
||||
// csvRows.push(csvRow.join(",")); // Join cells with commas
|
||||
// }
|
||||
|
||||
// // Create a CSV string
|
||||
// const csvString = csvRows.join("\n");
|
||||
// // Join rows for CSV format
|
||||
// output.forEach(row => {
|
||||
// const filledRow = row.map(cell => cell === undefined ? '' : cell);
|
||||
// csvData.push(filledRow.join(','));
|
||||
// });
|
||||
|
||||
// // 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 csvContent = csvData.join('\n');
|
||||
// const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
||||
// const url = URL.createObjectURL(blob);
|
||||
|
||||
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…
Reference in New Issue
Block a user