changes for filter and print
This commit is contained in:
@ -115,7 +115,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="" 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">
|
||||
@ -203,7 +203,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
'showPeriod' => false,
|
||||
);
|
||||
?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php $Side1Total = 0; ?>
|
||||
<div class="col-6 p-0 m-0 gy-0">
|
||||
<div class="table-responsive">
|
||||
@ -216,7 +216,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php $Side1Total = 0; ?>
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
@ -245,7 +245,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
$Side1Total += $group->closing_balance;
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(5); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(5,$fiscalStart,$fiscalEnd); ?>
|
||||
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
@ -291,7 +291,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(1); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(1,$fiscalStart,$fiscalEnd); ?>
|
||||
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
@ -328,14 +328,14 @@ $BIBAccounts = new BIBAccounts();
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
|
||||
$TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance;
|
||||
$TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance;
|
||||
$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;
|
||||
?>
|
||||
|
@ -129,7 +129,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<h3 class="card-title mt-1">Cash Flow<?php //echo $pageTitle;
|
||||
?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" 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">
|
||||
@ -264,7 +264,9 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<h4 class="card-title">Cash Flow</h4>
|
||||
</div> -->
|
||||
<div class="card-body table-responsive p-0">
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart,$fiscalEnd);
|
||||
// echo "<pre>";print_r($IncomesExpenses); die();
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
<div class="card-header disabled color-palette">
|
||||
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<form method="post" action="<?php echo base_url('accounts/ledger/bank_book'); ?>" 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
|
||||
@ -56,7 +56,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
<button type="submit" onclick="exportTableToCSV('table_data.csv')" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button>
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
@ -90,7 +90,7 @@
|
||||
$accategory_id = 3;
|
||||
$CI = &get_instance();
|
||||
|
||||
$CI->db->where("status", 1)->where("accategory_id = 2");
|
||||
$CI->db->where("status", 1)->where("accategory_id = 2")->where('created_on >=', date('Y-m-d', (strtotime($fiscalStart))))->where('created_on <=', date('Y-m-d', (strtotime($fiscalEnd))));
|
||||
$CI->db->order_by("account_name ASC");
|
||||
$Accounts = $CI->db->get("tbl_accounts")->result();
|
||||
|
||||
@ -231,6 +231,101 @@
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- csv printing -->
|
||||
<!-- <script type="text/javascript">
|
||||
function tableToCSV() {
|
||||
|
||||
// Variable to store the final csv data
|
||||
let csv_data = [];
|
||||
|
||||
// Get each row data
|
||||
let rows = document.getElementsByTagName('tr');
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
|
||||
// Get each column data
|
||||
let cols = rows[i].querySelectorAll('td,th,span,a');
|
||||
|
||||
// Stores each csv row data
|
||||
let csvrow = [];
|
||||
for (let j = 0; j < cols.length; j++) {
|
||||
|
||||
// Get the text data of each cell
|
||||
// of a row and push it to csvrow
|
||||
csvrow.push(cols[j].innerText);
|
||||
}
|
||||
|
||||
// Combine each column value with comma
|
||||
csv_data.push(csvrow.join(","));
|
||||
}
|
||||
|
||||
// Combine each row data with new line character
|
||||
csv_data = csv_data.join('\n');
|
||||
|
||||
// Call this function to download csv file
|
||||
downloadCSVFile(csv_data);
|
||||
|
||||
}
|
||||
|
||||
function downloadCSVFile(csv_data) {
|
||||
|
||||
// Create CSV file object and feed
|
||||
// our csv_data into it
|
||||
CSVFile = new Blob([csv_data], {
|
||||
type: "text/csv"
|
||||
});
|
||||
|
||||
// Create to temporary link to initiate
|
||||
// download process
|
||||
let temp_link = document.createElement('a');
|
||||
|
||||
// Download csv file
|
||||
temp_link.download = "GfG.csv";
|
||||
let url = window.URL.createObjectURL(CSVFile);
|
||||
temp_link.href = url;
|
||||
|
||||
// This link should not be displayed
|
||||
temp_link.style.display = "none";
|
||||
document.body.appendChild(temp_link);
|
||||
|
||||
// Automatically click the link to
|
||||
// trigger download
|
||||
temp_link.click();
|
||||
document.body.removeChild(temp_link);
|
||||
} -->
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function exportTableToCSV(filename) {
|
||||
const csvRows = [];
|
||||
const rows = document.querySelectorAll(".longdataTable tr"); // Use the specific class
|
||||
|
||||
for (const row of rows) {
|
||||
const cols = row.querySelectorAll("td, th");
|
||||
const csvRow = [];
|
||||
|
||||
for (const col of cols) {
|
||||
csvRow.push(col.innerText); // Get text content of each cell
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
</script>
|
||||
<!-- csv printing ends -->
|
||||
<?php
|
||||
}
|
||||
?>
|
@ -91,7 +91,7 @@
|
||||
$CI = &get_instance();
|
||||
|
||||
// $CI->db->where("status", 1)->where("(accategory_id = 2 OR accategory_id = 3)");
|
||||
$CI->db->where("status", 1)->where("accategory_id = 3");
|
||||
$CI->db->where("status", 1)->where("accategory_id = 3")->where("created_on >= '$fiscalStart'")->where("created_on >= '$fiscalEnd'");
|
||||
$CI->db->order_by("account_name ASC");
|
||||
$Accounts = $CI->db->get("tbl_accounts")->result();
|
||||
|
||||
|
@ -124,7 +124,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
<h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report");
|
||||
?></h2>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<form method="post" action="<?php echo base_url('accounts/reports/pl'); ?>" 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">
|
||||
@ -194,7 +194,9 @@ $BIBAccounts = new BIBAccounts();
|
||||
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
|
||||
document.getElementById("FilterForm").submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -228,7 +230,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(3); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(3,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
$incomes_totalOpeningDr = 0;
|
||||
@ -290,7 +292,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(4); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(4,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
$totalOpeningDr = 0;
|
||||
|
@ -104,7 +104,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<h3 class="card-title mt-1">Receipts And Payments <?php //echo $pageTitle;
|
||||
?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<form method="post" action=<?php echo base_url('accounts/reports/receipt_and_payment'); ?> 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">
|
||||
@ -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>
|
||||
@ -234,7 +234,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card card-primary card-outline">
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart,$fiscalEnd) ?>
|
||||
<table class="table table-head-fixed table-bordered g-0" id="TrialBalanceTable">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$this->load->library("BIBAccounts");
|
||||
$BIBAccounts = new BIBAccounts();
|
||||
|
||||
?>
|
||||
<!-- Include jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
||||
@ -26,7 +27,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
|
||||
.table-gray {
|
||||
background-color: #eee;
|
||||
}
|
||||
}
|
||||
|
||||
.table td,
|
||||
.table th {
|
||||
@ -107,7 +108,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
?></h2>
|
||||
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<form method="post" action=<?php echo site_url('/Accounts/Reports/trialbalance'); ?> id="FilterForm">
|
||||
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
@ -207,7 +208,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
);
|
||||
$showZeroBalances = false;
|
||||
?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances();?>
|
||||
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
|
||||
<thead class="bg-gray">
|
||||
<tr>
|
||||
|
Reference in New Issue
Block a user