toggle
This commit is contained in:
parent
fe8786f03f
commit
ee30970d1f
@ -144,6 +144,8 @@ $BIBAccounts = new BIBAccounts();
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button>
|
||||
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle
|
||||
Collapse</button> -->
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<a href="#" class="dropdown-item">Export</a>
|
||||
<a href="#" class="dropdown-item">Pdf</a>
|
||||
@ -152,7 +154,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</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() {
|
||||
@ -226,8 +228,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<!-- <button class="btn btn-secondary toggle-collapse mr-2" id="toggleShowAll">Toggle Collapse</button> -->
|
||||
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle
|
||||
Collapse</button>
|
||||
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body p-0">
|
||||
<?php
|
||||
@ -270,7 +271,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7" class="group-details p-0">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
|
||||
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
|
||||
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
|
||||
</div>
|
||||
@ -295,12 +296,12 @@ $BIBAccounts = new BIBAccounts();
|
||||
?>
|
||||
<?php foreach ($AccountGroups as $group) : ?>
|
||||
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
|
||||
<td class="group-name"><?php echo $group->acgroup_name; ?></td>
|
||||
<td class="group-name"><b><?php echo $group->acgroup_name; ?></b></td>
|
||||
<td class="group-total"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7" class="group-details p-0">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
|
||||
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
|
||||
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
|
||||
</div>
|
||||
@ -327,12 +328,12 @@ $BIBAccounts = new BIBAccounts();
|
||||
?>
|
||||
<?php foreach ($AccountGroups as $group) : ?>
|
||||
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
|
||||
<td class="group-name"><?php echo $group->acgroup_name; ?></td>
|
||||
<td class="group-total"><?php echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0); ?></td>
|
||||
<td class="group-name"><b><?php echo $group->acgroup_name; ?></b></td>
|
||||
<td class="group-total text-right pr-2"><?php echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7" class="group-details p-0">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
|
||||
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
|
||||
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
|
||||
</div>
|
||||
|
@ -145,6 +145,8 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<a href="#" class="dropdown-item">View calendar</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
|
||||
|
||||
<!-- <button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> -->
|
||||
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
|
||||
</form>
|
||||
@ -237,6 +239,8 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<td colspan=3 class="p-0">
|
||||
<table class="table g-0">
|
||||
<?php $total1 = 0;
|
||||
$counter=0;
|
||||
$index=0;
|
||||
foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?>
|
||||
<?php if ($Incomes['account'] == "GROUP TOTAL") : ?>
|
||||
<!-- <tr>
|
||||
@ -245,19 +249,21 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<td class="text-right" width="15%"><u><?php echo myCurrency($Incomes['amount']); ?></u></td>
|
||||
</tr> -->
|
||||
<?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?>
|
||||
<tr>
|
||||
<tr class="parent-row" class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $index; ?>">
|
||||
<td class="pr-2" width="70%"><b><?php echo $Incomes['category']; ?></b></td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
|
||||
<td width="15%"></td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
|
||||
</tr>
|
||||
<?php else : ?>
|
||||
<?php $total1 += $Incomes['amount']; ?>
|
||||
<tr>
|
||||
<tr class="collapse" data-target="#group_<?php echo $index; ?>">
|
||||
<td class="pr-2" width="70%"> <?php echo $Incomes['account']; ?></td>
|
||||
<td width="15%"></td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
|
||||
<td width="15%"></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php $counter = $index ?>
|
||||
|
||||
<?php }; ?>
|
||||
</table>
|
||||
</td>
|
||||
@ -272,17 +278,18 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<td class="text-right" width="15%"><u><?php echo myCurrency($Expenses['amount']); ?></u></td>
|
||||
</tr> -->
|
||||
<?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?>
|
||||
<tr>
|
||||
<tr data-toggle="collapse" data-target="#group_<?php echo $counter; ?>">
|
||||
<td class="" width="70%"><b><?php echo $Expenses['category']; ?></b></td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
|
||||
<td width="15%"></td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
|
||||
|
||||
</tr>
|
||||
<?php else : ?>
|
||||
<?php $total += $Expenses['amount']; ?>
|
||||
<tr>
|
||||
<tr class="collapse" data-target="#group_<?php echo $counter; ?>">
|
||||
<td class="" width="70%"> <?php echo $Expenses['account']; ?></td>
|
||||
<td width="15%"></td>
|
||||
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
|
||||
<td width="15%"></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php }; ?>
|
||||
@ -337,6 +344,55 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
</section>
|
||||
<?php function footerFunctions()
|
||||
{ ?>
|
||||
<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",
|
||||
|
@ -88,6 +88,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
box-shadow: inset 0 0 0 transparent;
|
||||
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<div class="content">
|
||||
@ -157,7 +158,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</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() {
|
||||
@ -177,7 +178,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<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> -->
|
||||
<div class="card card-primary card-outline ">
|
||||
<div class="card-body p-0">
|
||||
<?php
|
||||
@ -222,7 +223,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7" class="group-details p-0" width="85%">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
|
||||
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
|
||||
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
|
||||
</div>
|
||||
@ -261,7 +262,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7" class="group-details p-0">
|
||||
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
|
||||
<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>
|
||||
|
@ -180,7 +180,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
</div>
|
||||
<!-- <button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> -->
|
||||
|
||||
<!-- <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>
|
||||
@ -260,7 +260,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
|
||||
<div class="card card-primary card-outline">
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
|
||||
<table class="table table-head-fixed table-bordered g-0">
|
||||
<table class="table table-head-fixed table-bordered g-0" id="TrialBalanceTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="" width="35%"><?php myLang("Receipts"); ?></th>
|
||||
@ -276,8 +276,9 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<td colspan=3 class="p-0">
|
||||
<table class="table g-0">
|
||||
<?php $total1 = 0;
|
||||
$counter=0;
|
||||
$index=0;
|
||||
foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?>
|
||||
|
||||
<?php if ($Incomes['account'] == "GROUP TOTAL") : ?>
|
||||
<!--tr>
|
||||
<td class="" width="70%"><b><?php echo $Incomes['group']; ?></b></td>
|
||||
@ -286,20 +287,28 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
|
||||
</tr-->
|
||||
<?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?>
|
||||
<tr>
|
||||
<?php $index++; ?>
|
||||
<tr class="parent-row" class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $index; ?>">
|
||||
<td class="" width="70%"><b><?php echo $Incomes['category']; ?></b></td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
|
||||
<td width="15%"></td>
|
||||
</tr>
|
||||
<?php else : ?>
|
||||
<?php $total1 += $Incomes['amount']; ?>
|
||||
<tr>
|
||||
<td class="pr-2" width="70%"> <?php echo $Incomes['account']; ?></td>
|
||||
<td width="15%"></td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
|
||||
|
||||
</tr>
|
||||
<?php else : ?>
|
||||
<?php $total1 += $Incomes['amount']; ?>
|
||||
<tr class="collapse" data-target="#group_<?php echo $index; ?>">
|
||||
<td class="pr-2" width="70%">
|
||||
<div id="group_<?php echo $index; ?>" class="">
|
||||
<?php echo $Incomes['account']; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
|
||||
|
||||
<td width="15%"></td>
|
||||
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php $counter = $index ?>
|
||||
|
||||
<?php }; ?>
|
||||
|
||||
@ -318,19 +327,25 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
|
||||
</tr-->
|
||||
<?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?>
|
||||
<tr>
|
||||
<?php $counter++; ?>
|
||||
<tr data-toggle="collapse" data-target="#group_<?php echo $counter; ?>">
|
||||
<td class="pr-2" width="70%"><b><?php echo $Expenses['category']; ?></b></td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
|
||||
<td width="15%"></td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php else : ?>
|
||||
<?php $total += $Expenses['amount']; ?>
|
||||
<tr>
|
||||
<td class="" width="70%"> <?php echo $Expenses['account']; ?></td>
|
||||
<td width="15%"></td>
|
||||
<tr class="collapse" data-target="#group_<?php echo $counter; ?>">
|
||||
<td class="" width="70%">
|
||||
<div id="group_<?php echo $counter; ?>" class="">
|
||||
|
||||
<?php echo $Expenses['account']; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
|
||||
<td width="15%"></td>
|
||||
|
||||
|
||||
</tr>
|
||||
@ -389,6 +404,55 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
|
||||
<?php function footerFunctions()
|
||||
{ ?>
|
||||
<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",
|
||||
|
@ -160,7 +160,7 @@ $subparam2 = $this->uri->segment(4);
|
||||
showMenu("Profit and Loss Statement", "accounts/reports/pl");
|
||||
showMenu("Balance Sheet", "accounts/reports/balance_sheet");
|
||||
// showMenu("Balance Sheet (Vertical)", "accounts/reports/balance_sheet_vertical");
|
||||
showMenu("Receipt And Payment", "accounts/reports/receipt_and_payment");
|
||||
showMenu("Receipt and Payment", "accounts/reports/receipt_and_payment");
|
||||
// showMenu("Income And Expenses", "accounts/reports/incomes_and_expenses");
|
||||
showMenu("Cash Flow", "accounts/reports/cash_flow");
|
||||
showMenu("Ratio Analysis", "accounts/reports/ratio_analysis");
|
||||
|
Loading…
x
Reference in New Issue
Block a user