This commit is contained in:
Raju Shrestha
2024-08-08 18:24:25 +05:45
parent 9f5ba32db2
commit c30c5ddcb2
16 changed files with 233 additions and 239 deletions

View File

@ -2,7 +2,6 @@
$this->load->library("BIBAccounts");
$BIBAccounts = new BIBAccounts();
?>
<style>
table,
td,
@ -86,34 +85,26 @@ $BIBAccounts = new BIBAccounts();
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
</style>
<div class="content-wrapper">
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title"><?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 -->
<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">
@ -121,7 +112,6 @@ $BIBAccounts = new BIBAccounts();
</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>
@ -144,15 +134,16 @@ $BIBAccounts = new BIBAccounts();
</div>
</div>
<div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button>
<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-danger 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>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
@ -160,10 +151,8 @@ $BIBAccounts = new BIBAccounts();
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</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> -->
</form>
<script>
function resetForm() {
@ -177,8 +166,6 @@ $BIBAccounts = new BIBAccounts();
</div>
<!-- /.card-tools -->
</div>
<!-- <div class="card-body">
<form method="post" action="" id="FilterForm">
<div class="row align-items-end">
@ -214,16 +201,13 @@ $BIBAccounts = new BIBAccounts();
</div>
<div class="col">
<div class="form-group d-flex justify-content-end">
<button type="submit" class="btn btn-primary mr-2">Filter</button>
<button type="submit" class="btn btn-success mr-2">Export</button>
<button type="button" class="btn btn-warning" onclick="resetForm()">Reset</button>
</div>
</div>
</div>
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "2078-4-1";
@ -233,26 +217,20 @@ $BIBAccounts = new BIBAccounts();
document.getElementById("FilterForm").submit();
}
</script>
</div> -->
</div>
</div><!-- /.container-fluid -->
</section>
<div class="content">
<div class="container-fluid">
<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>
<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
// echo $_POST['showClosing'];
$ReportOptions = array(
'showZeroBalances' => false,
@ -261,7 +239,6 @@ $BIBAccounts = new BIBAccounts();
'showPeriod' => false,
);
?>
<table class="table table-bordered">
<thead>
<tr>
@ -269,10 +246,7 @@ $BIBAccounts = new BIBAccounts();
<td class="group-total text-right pr-2 "><b>Amount</b></td>
<td class="group-name"><b>Particulars</b></td>
<td class="group-total text-right pr-2"><b>Amount</b></td>
</tr>
</thead>
<tbody>
<tr>
@ -280,7 +254,6 @@ $BIBAccounts = new BIBAccounts();
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
<?php $Side1Total = 0; ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals
$incomes_totalOpeningDr = 0;
@ -293,7 +266,6 @@ $BIBAccounts = new BIBAccounts();
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td><b><?php echo $group->acgroup_name; ?></b></td>
<td width="20%"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td>
</tr>
<tr>
@ -310,11 +282,8 @@ $BIBAccounts = new BIBAccounts();
?>
<?php endforeach; ?>
</table>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(5); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals
$incomes_totalOpeningDr = 0;
@ -327,7 +296,6 @@ $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 == "CR") ? $group->closing_balance : 0); ?></td>
</tr>
<tr>
@ -347,9 +315,7 @@ $BIBAccounts = new BIBAccounts();
</td>
<td colspan="2" class="p-0">
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(1); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals
$totalOpeningDr = 0;
@ -382,21 +348,16 @@ $BIBAccounts = new BIBAccounts();
$totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?>
<?php endforeach; ?>
</table>
</td>
</tr>
<?php
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
$TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance;
$TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance;
$PL = $TotalIncomes - $TotalExpenses;
$Side1Total += $PL;
?>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
@ -405,54 +366,36 @@ $BIBAccounts = new BIBAccounts();
<td class="cr closing-cr"><?php echo myCurrency($PL); ?></td>
</tr>
</table>
</td>
<td colspan="2" class="p-0">
</td>
</tr>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Amount</th>
<th class="cr closing-cr">
<?php echo myCurrency($Side1Total); ?>
</th>
</tr>
</table>
</td>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Amount</th>
<th class="dr closing-dr">
<?php echo myCurrency($totalClosingDr); ?>
</th>
</tr>
</table>
</td>
</tr>
</table>
<?php //pre($BIBAccounts->getAccountGroupsWithBalances($acgroup_id = null));
?>
</div>
</div>
</div>
</div>
@ -466,11 +409,7 @@ function footerfunctions()
<script>
$(document).ready(function() {
document.getElementById("toggleShowAll").click();
});
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
e.preventDefault();
var nestedRows = document.getElementsByClassName("collapse");
@ -490,27 +429,21 @@ function footerfunctions()
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);
@ -521,6 +454,5 @@ function footerfunctions()
link.click();
}
</script>
<?php
}