This commit is contained in:
Raju Shrestha 2024-08-25 16:19:29 +05:45
commit 78670b1b95
42 changed files with 2285 additions and 428 deletions

View File

@ -241,5 +241,8 @@ class Welcome extends CI_Controller
if ($query->num_rows() == 0) { if ($query->num_rows() == 0) {
$this->db->query("ALTER TABLE tbl_accounts ADD COLUMN account_bank VARCHAR(50)"); $this->db->query("ALTER TABLE tbl_accounts ADD COLUMN account_bank VARCHAR(50)");
} }
$this->db->query("ALTER TABLE tbl_translations MODIFY COLUMN nepali VARCHAR(255) COLLATE utf8_unicode_ci");
} }
} }

View File

@ -40,6 +40,8 @@ class Ledger extends CI_Controller
break; break;
case 'partyledger': case 'partyledger':
$data['pageTitle'] = "View Party Ledger"; $data['pageTitle'] = "View Party Ledger";
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
// $_GET['show_ledger']; // $_GET['show_ledger'];
if (isset($_GET['show_ledger'])) { if (isset($_GET['show_ledger'])) {
$fromDate_Nepali = $_GET['from_date']; $fromDate_Nepali = $_GET['from_date'];
@ -75,15 +77,19 @@ class Ledger extends CI_Controller
loadView("accounts/daybook", $data); loadView("accounts/daybook", $data);
break; break;
case 'bank_book': case 'bank_book':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Bank Book"; $data['pageTitle'] = "Bank Book";
loadView("accounts/ledger_bankbook", $data); loadView("accounts/ledger_bankbook", $data);
break; break;
case 'cash_book': case 'cash_book':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Cash Book"; $data['pageTitle'] = "Cash Book";
loadView("accounts/ledger_cashbook", $data); loadView("accounts/ledger_cashbook", $data);
break; break;
case 'receiveables': case 'receiveables':
$data['pageTitle'] = "Accounts Receiveables"; $data['pageTitle'] = "Accounts Receivables";
loadView("accounts/ledger_receiveables", $data); loadView("accounts/ledger_receiveables", $data);
break; break;
case 'payables': case 'payables':

View File

@ -116,7 +116,7 @@ class Reports extends CI_Controller
break; break;
case 'balance_by_ledger': case 'balance_by_ledger':
$accategory_id = 0; $accategory_id = 0;
$data['pageTitle'] = "Account Balances By Group"; $data['pageTitle'] = "Account Balances By Ledgers";
if (isset($_GET['group'])) { if (isset($_GET['group'])) {
$accategory_id = ($_GET['group']) ? $_GET['group'] : 0; $accategory_id = ($_GET['group']) ? $_GET['group'] : 0;
} }

View File

@ -26,6 +26,8 @@ class Vouchers extends CI_Controller
break; break;
case 'listvouchers': case 'listvouchers':
$data['pageTitle'] = "Vouchers"; $data['pageTitle'] = "Vouchers";
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$fromDate_bs = isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth(); $fromDate_bs = isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth();
$todate_bs = isset($_GET['to_date']) ? $_GET['to_date'] : NepaliDate(Today()); $todate_bs = isset($_GET['to_date']) ? $_GET['to_date'] : NepaliDate(Today());
$fromDate_ad = NepaliToEnglishDate($fromDate_bs); $fromDate_ad = NepaliToEnglishDate($fromDate_bs);

View File

@ -57,6 +57,8 @@ class Stocks extends CI_Controller
loadView("inventory/stocks/add", $data); loadView("inventory/stocks/add", $data);
break; break;
case 'summary': case 'summary':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['StockRecords'] = $this->MStocks->getStockSummary(); $data['StockRecords'] = $this->MStocks->getStockSummary();
// pre($data['StockRecords']); // pre($data['StockRecords']);
loadView("inventory/stocks/summary", $data); loadView("inventory/stocks/summary", $data);

View File

@ -44,8 +44,8 @@ function createNepaliDateInput($name, $display, $id, $default = "", $class = "")
<?php if ($display != "") : ?> <?php if ($display != "") : ?>
<label for="datepicker<?php echo $id; ?>"><?php echo function_exists("myLang") ? myLang($display) : $display; ?></label> <label for="datepicker<?php echo $id; ?>"><?php echo function_exists("myLang") ? myLang($display) : $display; ?></label>
<?php endif; ?> <?php endif; ?>
<div class="input-group" id="ass_date" data-target-input="nearest"> <div class="input-group ass_date" id="ass_date" data-target-input="nearest">
<input id="<?php echo $id; ?>" name="<?php echo $name; ?>" type="text" class="form-control nepaliDatePicker <?php echo $class; ?>" autocomplete="off" value="<?php echo ($default == "") ? NepaliDate() : $default; ?>"> <input id="<?php echo $id; ?>" name="<?php echo $name; ?>" type="text" class="form-control <?php echo $class; ?>" autocomplete="off" value="<?php echo ($default == "") ? NepaliDate() : $default; ?>">
</div> </div>
<?php <?php
} }
@ -95,14 +95,14 @@ function getFieldfromValue($tableName, $fieldName, $lookupField, $referenceValue
return "N/A"; return "N/A";
} }
} }
function fillComboWithValue($fieldName, $displayName, $fieldID, $tableName, $displayField, $valueField, $default = "", $CSSclass = "", $multiple = false, $condition = "") function fillComboWithValue($fieldName, $displayName, $fieldID, $tableName, $displayField, $valueField, $default = "", $CSSclass = "", $multiple = false, $condition = "", $required=false)
{ {
$ci = &get_instance(); $ci = &get_instance();
?> ?>
<?php if ($displayName != "") : ?> <?php if ($displayName != "") : ?>
<label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label> <label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label>
<?php endif; ?> <?php endif; ?>
<select name="<?php echo $fieldName; ?><?php echo ($multiple) ? "[]" : ""; ?>" <?php if ($CSSclass != "none") : ?>class="form-control select2 <?php echo $CSSclass; ?>" <?php else : ?> class="form-control" <?php endif; ?> id="<?php echo $fieldID; ?>" <?php echo ($multiple) ? "multiple" : ""; ?>> <select name="<?php echo $fieldName; ?><?php echo ($multiple) ? "[]" : ""; ?>" <?php if ($CSSclass != "none") : ?>class="form-control select2 <?php echo $CSSclass; ?>" <?php else : ?> class="form-control" <?php endif; ?> id="<?php echo $fieldID; ?>" <?php echo ($multiple) ? "multiple" : ""; ?><?php echo ($required) ? "required" : ""; ?>>
<option value="">Select <?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></option> <option value="">Select <?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></option>
<?php <?php
$q = "select * from $tableName"; $q = "select * from $tableName";

View File

@ -70,6 +70,7 @@ class myaccounts
$crTotal = 0; $crTotal = 0;
$drTotal = 0; $drTotal = 0;
$fields = array(); $fields = array();
// print_r($VoucherDetails);die;
foreach ($VoucherDetails as $VoucherDetail) : foreach ($VoucherDetails as $VoucherDetail) :
$i++; $i++;
$fields['account_name_' . $i] = $VoucherDetail->account_name; $fields['account_name_' . $i] = $VoucherDetail->account_name;
@ -90,6 +91,9 @@ class myaccounts
$fields['amount_in_words'] = trim($CI->numbertoword->nepali_word($crTotal)); $fields['amount_in_words'] = trim($CI->numbertoword->nepali_word($crTotal));
else else
$fields['amount_in_words'] = trim($CI->numbertoword->english_word($crTotal)); $fields['amount_in_words'] = trim($CI->numbertoword->english_word($crTotal));
// $fields['narration_' . $i] = $VoucherDetail->narration;
$file = APPPATH . "/../pdf/e_voucher1.pdf"; $file = APPPATH . "/../pdf/e_voucher1.pdf";
$pdf = new FPDM($file); $pdf = new FPDM($file);
//pre($pdf->getContent($file,"PDF")); //pre($pdf->getContent($file,"PDF"));
@ -205,12 +209,12 @@ class myaccounts
$balance = getBalance($Account->account_id); $balance = getBalance($Account->account_id);
$BalanceTotal += $balance; $BalanceTotal += $balance;
// pre($Account); // 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'></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; endforeach;
$html .= "</tbody><tfoot>"; $html .= "</tbody><tfoot>";
if ($full == "") { // if ($full == "") {
$html .= "<tr><th colspan=2 class='text-right '>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></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 .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\"> $html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\"> <div class=\"modal-dialog modal-xl\" role=\"document\">
@ -660,7 +664,7 @@ class myaccounts
$data['oldBalance'] = $oldBalance; $data['oldBalance'] = $oldBalance;
return $data; return $data;
} }
function showLedger($account_id, $fromDate = "", $toDate = "") function showLedger($account_id, $fromDate = "", $toDate = "", $fiscalStart = "", $fiscalEnd = "" )
{ {
$oldBalance = $this->getOldBalance($account_id, FYStart()); $oldBalance = $this->getOldBalance($account_id, FYStart());
$fromDate = ($fromDate == "") ? NepaliToEnglishDate(FYStart()) : $fromDate; $fromDate = ($fromDate == "") ? NepaliToEnglishDate(FYStart()) : $fromDate;
@ -695,6 +699,7 @@ class myaccounts
<th class="col-1 text-right"><?php myLang("Debit"); ?></th> <th class="col-1 text-right"><?php myLang("Debit"); ?></th>
<th class="col-1 text-right"><?php myLang("Credit"); ?></th> <th class="col-1 text-right"><?php myLang("Credit"); ?></th>
<th class="col-1"><?php myLang("Balance"); ?></th> <th class="col-1"><?php myLang("Balance"); ?></th>
<input type="hidden" id="refdate" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>">
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -772,6 +777,22 @@ class myaccounts
</div> --> </div> -->
</div> </div>
</div> </div>
<?php
function footerfunctions()
{
?>
<script>
$(".ass_date").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#refdate').data('start'),
maxDate: $('#refdate').data('end'),
});
</script>
<?php
}
?>
<?php <?php
} }
function ledgerPDF_FPDM($account_id, $fromDate, $toDate) function ledgerPDF_FPDM($account_id, $fromDate, $toDate)
@ -922,7 +943,7 @@ class myaccounts
// $pdf->Output("F", $OutputFileLocation . $OutputFile); // $pdf->Output("F", $OutputFileLocation . $OutputFile);
// return $OutputFile; // return $OutputFile;
} }
function listVouchers($fromDate = "", $toDate = "", $account_id = "", $vouchertype_id = "", $showAccounts = false, $showVoucherTypes = false) function listVouchers($fromDate = "", $toDate = "", $account_id = "", $vouchertype_id = "", $showAccounts = false, $showVoucherTypes = false, $fiscalStart = "", $fiscalEnd = "")
{ {
// echo $toDate; // echo $toDate;
$ci = &get_instance(); $ci = &get_instance();
@ -997,9 +1018,12 @@ class myaccounts
<!-- <td><?php echo $TableRow->voucher_state; ?></td> --> <!-- <td><?php echo $TableRow->voucher_state; ?></td> -->
<td class="col-1 text-center"> <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-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> <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>
<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 //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; ?>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
@ -1034,6 +1058,7 @@ class myaccounts
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">Revarsal Entry</button> <button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div> </div>
<input type="hidden" id="refdate" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>">
</div> </div>
</div> </div>
</div> </div>
@ -1112,6 +1137,15 @@ class myaccounts
} }
} }
</script> </script>
<script>
$(".ass_date").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#refdate').data('start'),
maxDate: $('#refdate').data('end'),
});
</script>
<?php <?php
} }
?> ?>
@ -1204,7 +1238,7 @@ class myaccounts
<td><?php echo myCurrency($drTotal); ?></td> <td><?php echo myCurrency($drTotal); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="<?php echo $TotalCols; ?>" class="text-left" height=100>Narration: <?php echo $TableRow->narration; ?></td> <td colspan="<?php echo $TotalCols; ?>" class="text-left" height=100><i>Narration: <?php echo $TableRow->narration; ?></i></td>
</tr> </tr>
<tr> <tr>
<td colspan="<?php echo $TotalCols; ?>" class="text-center" height=200> <td colspan="<?php echo $TotalCols; ?>" class="text-center" height=200>
@ -1344,7 +1378,7 @@ class myaccounts
<?php if ($displayName != "") : ?> <?php if ($displayName != "") : ?>
<label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label> <label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label>
<?php endif; ?> <?php endif; ?>
<select name="<?php echo $fieldName; ?>" class="form-control select2 <?php echo $CSSclass; ?>" id="<?php echo $fieldID; ?>"> <select name="<?php echo $fieldName; ?>" class="form-control select2 <?php echo $CSSclass; ?>" id="<?php echo $fieldID; ?> " required>
<option value="">Select </option> <option value="">Select </option>
<!-- <option value="">Select <?php //echo function_exists("myLang") ? myLang($displayName) : $displayName; <!-- <option value="">Select <?php //echo function_exists("myLang") ? myLang($displayName) : $displayName;
?></option> --> ?></option> -->

View File

@ -34,7 +34,7 @@
<div class="col-7"> <div class="col-7">
<div class="form-group"> <div class="form-group">
<?php fillComboWithValue("accategory_id", "Under", "accategory_id", "tbl_accategories", "accategory_name", "accategory_id", $TableData->accategory_id, "", false, "status=1"); ?> <?php fillComboWithValue("accategory_id", "Under", "accategory_id", "tbl_accategories", "accategory_name", "accategory_id", $TableData->accategory_id, "", false, "status=1", $required=true); ?>
</div> </div>
</div> </div>
@ -80,76 +80,152 @@
$category_name = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $TableData->accategory_id); $category_name = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $TableData->accategory_id);
?> ?>
<div id="creditorFields" style="display: none;"> <div id="creditorFields" style="display: none;">
<!-- <?php //if ($category_name == "Sundry Creditors" || $category_name == "Sundry Debtors") : ?> --> <!-- <?php //if ($category_name == "Sundry Creditors" || $category_name == "Sundry Debtors") :
?> -->
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Mailing Details:</b></div>
<div class="row"> <div class="row">
<!--COL START--> <!--COL START-->
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="account_partyname">Party Name</label><input type="text" class="form-control" id="account_partyname" value="<?php echo $TableData->account_partyname; ?>" name="account_partyname"> <label for="account_partyname">Party Name</label><input type="text" class="form-control" id="account_partyname" value="<?php echo $TableData->account_partyname; ?>" name="account_partyname">
</div>
</div> </div>
<!--COL END--> </div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyaddress">Party Address</label><input type="text" class="form-control" id="account_partyaddress" value="<?php echo $TableData->account_partyaddress; ?>" name="account_partyaddress">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_partypan">PAN</label><input type="text" class="form-control" id="account_partypan" value="<?php echo $TableData->account_partypan; ?>" name="account_partypan">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyemail">Party Email</label><input type="email" class="form-control" id="account_partyemail" value="<?php echo $TableData->account_partyemail; ?>" name="account_partyemail">
</div>
</div>
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontact">Party Contact</label><input type="text" class="form-control" id="account_partycontact" value="<?php echo $TableData->account_partycontact; ?>" name="account_partycontact">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactperson">Contact Person</label><input type="text" class="form-control" id="account_partycontactperson" value="<?php echo $TableData->account_partycontactperson; ?>" name="account_partycontactperson">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactpersoncontact">Contact Person Phone</label><input type="text" class="form-control" id="account_partycontactpersoncontact" value="<?php echo $TableData->account_partycontactpersoncontact; ?>" name="account_partycontactpersoncontact">
</div>
</div>
<!--COL END-->
</div>
<!-- <?php //endif; ?> -->
</div>
<div class="row" id="bankFields" >
<!-- <?php //if ($category_name == "Bank Account") : ?> -->
<!--COL START--> <!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyaddress">Party Address</label><input type="text" class="form-control" id="account_partyaddress" value="<?php echo $TableData->account_partyaddress; ?>" name="account_partyaddress">
</div>
</div>
</div>
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Contact Details:</b></div>
<div class="row">
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyemail">Party Email</label><input type="email" class="form-control" id="account_partyemail" value="<?php echo $TableData->account_partyemail; ?>" name="account_partyemail">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontact">Party Contact</label><input type="text" class="form-control" id="account_partycontact" value="<?php echo $TableData->account_partycontact; ?>" name="account_partycontact">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactperson">Contact Person</label><input type="text" class="form-control" id="account_partycontactperson" value="<?php echo $TableData->account_partycontactperson; ?>" name="account_partycontactperson">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactpersoncontact">Contact Person Phone</label><input type="text" class="form-control" id="account_partycontactpersoncontact" value="<?php echo $TableData->account_partycontactpersoncontact; ?>" name="account_partycontactpersoncontact">
</div>
</div>
<!--COL END-->
</div>
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Tax Information:</b></div>
<div class="row">
<div class="col-md-6 col-lg-2">
<div class="form-group">
<label for="account_partypan">PAN</label><input type="text" class="form-control" id="account_partypan" value="<?php echo $TableData->account_partypan; ?>" name="account_partypan">
</div>
</div>
<!-- <?php //endif;
?> -->
</div>
</div>
<div id="bankFields">
<!-- <?php //if ($category_name == "Bank Account") :
?> -->
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Mailing Details:</b></div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyname">Party Name</label><input type="text" class="form-control" id="account_partyname" value="<?php echo $TableData->account_partyname; ?>" name="account_partyname">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyaddress">Party Address</label><input type="text" class="form-control" id="account_partyaddress" value="<?php echo $TableData->account_partyaddress; ?>" name="account_partyaddress">
</div>
</div>
</div>
<!--COL START-->
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Contact Details:</b></div>
<div class="row">
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyemail">Party Email</label><input type="email" class="form-control" id="account_partyemail" value="<?php echo $TableData->account_partyemail; ?>" name="account_partyemail">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontact">Party Contact</label><input type="text" class="form-control" id="account_partycontact" value="<?php echo $TableData->account_partycontact; ?>" name="account_partycontact">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactperson">Contact Person</label><input type="text" class="form-control" id="account_partycontactperson" value="<?php echo $TableData->account_partycontactperson; ?>" name="account_partycontactperson">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactpersoncontact">Contact Person Phone</label><input type="text" class="form-control" id="account_partycontactpersoncontact" value="<?php echo $TableData->account_partycontactpersoncontact; ?>" name="account_partycontactpersoncontact">
</div>
</div>
<!--COL END-->
</div>
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Account Details:</b></div>
<div class="row">
<div class="col"> <div class="col">
@ -179,12 +255,14 @@
</div> </div>
</div> </div>
<!--COL END-->
<!-- <?php //endif; ?> -->
</div> </div>
<!--COL END-->
<!-- <?php //endif;
?> -->
</div>
<hr>
<div class="row"> <div class="row">
<!--COL START--> <!--COL START-->
<div class="col"> <div class="col">
@ -224,28 +302,28 @@
</script> </script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
function updateFields() { function updateFields() {
var category = $('#accategory_id').val(); // Assuming the category select field has this ID var category = $('#accategory_id').val(); // Assuming the category select field has this ID
if (category == 2) { if (category == 2) {
$('#bankFields').show(); $('#bankFields').show();
$('#creditorFields').hide(); $('#creditorFields').hide();
} else if (category == 4 || category == 30) { } else if (category == 4 || category == 30) {
$('#bankFields').hide(); $('#bankFields').hide();
$('#creditorFields').show(); $('#creditorFields').show();
} else { } else {
$('#bankFields').hide(); $('#bankFields').hide();
$('#creditorFields').hide(); $('#creditorFields').hide();
}
} }
}
// On page load // On page load
updateFields();
// On category change
$('#accategory_id').change(function() {
updateFields(); updateFields();
// On category change
$('#accategory_id').change(function() {
updateFields();
});
}); });
});
</script> </script>

View File

@ -26,9 +26,17 @@ function displayCategoryTree($tree)
{ {
echo '<table class="table table-bordered">'; echo '<table class="table table-bordered">';
foreach ($tree as $category) { foreach ($tree as $category) {
// print_r($category);die;
echo '<tr>'; echo '<tr>';
echo '<td class="col-1">' . $category['accategory_id'] . '</td>'; echo '<td class="col-1">' . $category['accategory_id'] . '</td>';
echo '<td class="col-6"><a href="' . site_url("accounts/reports/balance_by_group") . "?category=" . $category['accategory_id'] . '">' . $category['accategory_name'] . '</a></td>'; echo '<td class="col-6">'
. ($category['parent_category_id'] == 0
? "<b><a href='" . site_url("accounts/reports/balance_by_group") . "?category=" . $category['accategory_id'] . "'>"
: "<a href='" . site_url("accounts/reports/balance_by_ledger") . "?group=" . $category['accategory_id'] . "'>")
. $category['accategory_name']
. "</a>"
. ($category['parent_category_id'] == 0 ? "</b>" : "")
. '</td>';
echo '<td class="col-2">' . myCurrency($category['dr']) . '</td>'; echo '<td class="col-2">' . myCurrency($category['dr']) . '</td>';
echo '<td class="col-2">' . myCurrency($category['cr']) . '</td>'; echo '<td class="col-2">' . myCurrency($category['cr']) . '</td>';
echo '</tr>'; echo '</tr>';

View File

@ -1,6 +1,8 @@
<?php <?php
$drWidth = 250; $drWidth = 250;
$crWidth = 250; $crWidth = 250;
$balanceWidth = 250;
$AccountCategories = $this->myaccounts->getChildAccountCategories(); $AccountCategories = $this->myaccounts->getChildAccountCategories();
?> ?>
<style> <style>
@ -34,10 +36,13 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
<?php <?php
$drTotal = 0; $drTotal = 0;
$crTotal = 0; $crTotal = 0;
$balanceTotal = 0;
foreach ($AccountCategories as $AccountCategory) : foreach ($AccountCategories as $AccountCategory) :
$drTotal += $AccountCategory->dr; $drTotal += $AccountCategory->dr;
$crTotal += $AccountCategory->cr; $crTotal += $AccountCategory->cr;
$balanceTotal += $AccountCategory->Balance
?> ?>
<!-- <?php //print_r($AccountCategory);die; ?> -->
<tr> <tr>
<td> <td>
<a href="<?php echo site_url("accounts/reports/balance_by_ledger") . "?group=" . $AccountCategory->accategory_id; ?>"> <a href="<?php echo site_url("accounts/reports/balance_by_ledger") . "?group=" . $AccountCategory->accategory_id; ?>">
@ -45,9 +50,9 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
</a> </a>
</td> </td>
<td width="<?php echo $drWidth; ?>"><?php echo myCurrency($AccountCategory->dr); ?></td> <td width="<?php echo $drWidth; ?>"><?php echo myCurrency($AccountCategory->dr); ?></td>
<td width="<?php echo $crWidth; ?>"><?php echo myCurrency($AccountCategory->cr); ?></td> <td width="<?php echo $crWidth; ?>"><?php echo myCurrency(abs($AccountCategory->cr)); ?></td>
<td class="text-right">Balance</td> <td class="text-right"><?php echo myCurrency($AccountCategory->Balance); ?></td>
<td class="text-center"><a href="#" class="btn btn-info btn-xs"><i class="fas fa-edit"></i> </a></td> <td class="text-center"><a href="<?php echo site_url("accounts/reports/balance_by_ledger") . "?group=" . $AccountCategory->accategory_id; ?>" class="btn btn-info btn-xs"><i class="fas fa-eye"></i> </a></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
@ -55,8 +60,8 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
<tr> <tr>
<th>Total</th> <th>Total</th>
<td width="<?php echo $drWidth; ?>"><?php echo myCurrency($drTotal); ?></td> <td width="<?php echo $drWidth; ?>"><?php echo myCurrency($drTotal); ?></td>
<td width="<?php echo $crWidth; ?>"><?php echo myCurrency($crTotal); ?></td> <td width="<?php echo $crWidth; ?>"><?php echo myCurrency(abs($crTotal)); ?></td>
<td ></td> <td class="text-right"><?php echo myCurrency($balanceTotal); ?></td>
<td ></td> <td ></td>
</tr> </tr>
</thead> </thead>

View File

@ -0,0 +1,133 @@
<?php
$drWidth = 250;
$crWidth = 250;
$Accounts = $this->acc->getAccountsByCategory($accategory_id);
$array = json_decode(json_encode($Accounts), true);
// print_r($array);die;
$tree = buildCategoryTree($array, false);
function buildCategoryTree($categories, $parent_id = 0, $showZero = true)
{
$tree = array();
foreach ($categories as $category) {
// print_r($category);die;
// print_r(myCurrency(getBalance($category['account_id'])));die;
$category['dr'] = getDrTotal('account_id');
$category['cr'] = getCrTotal('account_id');
if ($showZero && ($category['dr'] !== 0 || $category['cr'] !== 0)) {
$tree[] = $category;
} elseif (!$showZero && ($category['dr'] !== 0 && $category['cr'] !== 0)) {
$tree[] = $category;
}
}
return $tree;
}
function displayCategoryTree($tree)
{
echo '<table class="table table-bordered">';
echo '<thead>';
echo '<tr>';
echo '<th>Sn</th>';
echo '<th>Account</th>';
echo '<th class="text-right">Balance</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
$BalanceTotal = 0;
foreach ($tree as $category) {
echo '<tr>';
echo '<td class="col-1">' . $category['account_id'] . '</td>';
echo '<td class="col-9"><a href="#" onClick="showLedger(' . $category['account_id'] . ')">' . $category['account_name'] . '</a></td>';
echo '<td class="col-2">' . myCurrency(getBalance($category['account_id'])) . '</td>';
$BalanceTotal += getBalance($category['account_id']);
echo '</tr>';
if (isset($category['children']) && !empty($category['children'])) {
echo '<tr>';
echo '<td colspan="4 ">';
displayCategoryTree($category['children']);
echo '</td>';
echo '</tr>';
}
}
echo '</tbody>';
echo '<tfoot>';
echo "<tr><th colspan=2 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th></tr>";
echo '</table>';
}
$html = "";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\">
<div class=\"modal-content\">
<div class=\"modal-header\">
<h5 class=\"modal-title\" id=\"exampleModalLabel\">Ledger Details</h5>
<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">
<span aria-hidden=\"true\">&times;</span>
</button>
</div>
<div class=\"modal-body\" id=\"details_container\">
Ledger Details Goes Here
</div>
<!--<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>
</div>-->
</div>
</div>
</div>";
$html .= '<script>function showLedger(id) {$.ajax({url: \'';
$html .= site_url("accounts/reports/ajax/getledgersummary/");
$html .= '\' + id,success: function(data) {$(\'#ledgerdetails_box #details_container\').html(data);$(\'#ledgerdetails_box\').modal(\'show\');}});}</script>';
echo $html;
?>
<style>
.expandable {
text-decoration: underline;
}
</style>
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<?php //pre($tree);
?>
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<input type="checkbox" name="showZero" value="true" id="showZero">
<label for="showZero">
Show Zero Balances
</label>
<?php displayCategoryTree($tree); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<script>
function toggleSubTable(row) {
var subTable = row.nextElementSibling;
subTable.style.display = subTable.style.display === 'none' ? 'table-row' : 'none';
}
function showLedger(id) {
// $("#accountsContainer").html("");
// alert(id);
$.ajax({
url: "<?php echo site_url("accounts/reports/ajax/getledgersummary/"); ?>" + id, //accounts/getledgersummary/
success: function(data) {
$("#ledgerdetails_box #details_container").html(data);
$("#ledgerdetails_box").modal("show");
$('.dataTable').DataTable().clear().destroy();
$(".dataTable").dataTable();
}
});
}
</script>
</div>
<!-- /.content -->

View File

@ -103,40 +103,40 @@ $BIBAccounts = new BIBAccounts();
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <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"> <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> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button> <button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button> <button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div> </div>
</div> </div>
</div> </div>
@ -144,6 +144,8 @@ $BIBAccounts = new BIBAccounts();
<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 Export
</button> </button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle
Collapse</button> -->
<!-- <div class="dropdown-menu" role="menu"> <!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a> <a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a> <a href="#" class="dropdown-item">Pdf</a>
@ -152,7 +154,7 @@ $BIBAccounts = new BIBAccounts();
</div> --> </div> -->
</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> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -226,8 +228,7 @@ $BIBAccounts = new BIBAccounts();
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<!-- <button class="btn btn-secondary toggle-collapse mr-2" id="toggleShowAll">Toggle Collapse</button> --> <!-- <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 card-primary card-outline">
<div class="card-body p-0"> <div class="card-body p-0">
<?php <?php
@ -270,7 +271,7 @@ $BIBAccounts = new BIBAccounts();
</tr> </tr>
<tr> <tr>
<td colspan="7" class="group-details p-0"> <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 $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div> </div>
@ -295,12 +296,12 @@ $BIBAccounts = new BIBAccounts();
?> ?>
<?php foreach ($AccountGroups as $group) : ?> <?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>"> <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> <td class="group-total"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="7" class="group-details p-0"> <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 $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div> </div>
@ -327,12 +328,12 @@ $BIBAccounts = new BIBAccounts();
?> ?>
<?php foreach ($AccountGroups as $group) : ?> <?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>"> <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 == "DR") ? $group->closing_balance : 0); ?></td> <td class="group-total text-right pr-2"><?php echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="7" class="group-details p-0"> <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 $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div> </div>
@ -406,6 +407,14 @@ $BIBAccounts = new BIBAccounts();
function footerfunctions() function footerfunctions()
{ {
?> ?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
document.getElementById("toggleShowAll").click(); document.getElementById("toggleShowAll").click();
@ -461,15 +470,15 @@ function footerfunctions()
minDate: $('#fromDate').data('start'), minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'), maxDate: $('#fromDate').data('end'),
}); });
</script> </script>
<script> <script>
$("#toDate").nepaliDatePicker({ $("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d", dateFormat: "%y-%m-%d",
closeOnDateSelect: true, closeOnDateSelect: true,
minDate: $('#toDate').data('start'), minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'), maxDate: $('#toDate').data('end'),
}); });
</script> </script>
<?php <?php
} }

View File

@ -16,51 +16,64 @@ $PL = $IncomesTotal - $ExpensesTotal;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
.group-name { .group-name {
width: 40%; width: 40%;
} }
.group-total { .group-total {
width: 10%; width: 10%;
} }
.table-gray { .table-gray {
background-color: #eee; background-color: #eee;
} }
.table td, .table td,
.table th { .table th {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
.bg-darker { .bg-darker {
background-color: #ddd; background-color: #ddd;
} }
td .table { td .table {
border: 0px !important; border: 0px !important;
margin-bottom: 0rem; margin-bottom: 0rem;
} }
table td:first-child { table td:first-child {
padding-left: 5px; padding-left: 5px;
} }
.table-bordered.vertical-borders td, .table-bordered.vertical-borders td,
.table-bordered.vertical-borders th { .table-bordered.vertical-borders th {
border-left: 1px solid #dee2e6; border-left: 1px solid #dee2e6;
border-right: 1px solid #dee2e6; border-right: 1px solid #dee2e6;
} }
.table-bordered.vertical-borders thead th { .table-bordered.vertical-borders thead th {
padding: 0.25rem; padding: 0.25rem;
border-top: none; border-top: none;
border-bottom: 2px solid #dee2e6; border-bottom: 2px solid #dee2e6;
} }
.table-bordered.vertical-borders tfoot th { .table-bordered.vertical-borders tfoot th {
padding: 0.25rem; padding: 0.25rem;
border-top: 2px solid #dee2e6; border-top: 2px solid #dee2e6;
border-bottom: none; border-bottom: none;
} }
.currency { .currency {
font-weight: normal !important; font-weight: normal !important;
} }
.underline { .underline {
text-decoration: underline; text-decoration: underline;
} }
.form-control { .form-control {
display: block; display: block;
width: 100%; width: 100%;
@ -84,7 +97,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header "> <div class="card-header ">
<h3 class="card-title mt-1">Cash Flow<?php //echo $pageTitle; <h3 class="card-title mt-1">Cash Flow<?php //echo $pageTitle;
?> </h3> ?> </h3>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action="" id="FilterForm">
<!-- button with a dropdown --> <!-- button with a dropdown -->
@ -97,40 +110,40 @@ $PL = $IncomesTotal - $ExpensesTotal;
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <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"> <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> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button> <button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button> <button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div> </div>
</div> </div>
</div> </div>
@ -145,6 +158,8 @@ $PL = $IncomesTotal - $ExpensesTotal;
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</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 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> </form>
@ -214,7 +229,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
</script> </script>
</div> --> </div> -->
</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> -->
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<!-- <div class="card-header"> <!-- <div class="card-header">
<h4 class="card-title">Cash Flow</h4> <h4 class="card-title">Cash Flow</h4>
@ -237,6 +252,8 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td colspan=3 class="p-0"> <td colspan=3 class="p-0">
<table class="table g-0"> <table class="table g-0">
<?php $total1 = 0; <?php $total1 = 0;
$counter = 0;
$index = 0;
foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?> foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?>
<?php if ($Incomes['account'] == "GROUP TOTAL") : ?> <?php if ($Incomes['account'] == "GROUP TOTAL") : ?>
<!-- <tr> <!-- <tr>
@ -245,19 +262,21 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td class="text-right" width="15%"><u><?php echo myCurrency($Incomes['amount']); ?></u></td> <td class="text-right" width="15%"><u><?php echo myCurrency($Incomes['amount']); ?></u></td>
</tr> --> </tr> -->
<?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?> <?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="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 width="15%"></td>
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
</tr> </tr>
<?php else : ?> <?php else : ?>
<?php $total1 += $Incomes['amount']; ?> <?php $total1 += $Incomes['amount']; ?>
<tr> <tr class="collapse" data-target="#group_<?php echo $index; ?>">
<td class="pr-2" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td> <td class="pr-2" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td>
<td width="15%"></td>
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td> <td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td width="15%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php $counter = $index ?>
<?php }; ?> <?php }; ?>
</table> </table>
</td> </td>
@ -272,17 +291,18 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td class="text-right" width="15%"><u><?php echo myCurrency($Expenses['amount']); ?></u></td> <td class="text-right" width="15%"><u><?php echo myCurrency($Expenses['amount']); ?></u></td>
</tr> --> </tr> -->
<?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?> <?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="" 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 width="15%"></td>
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
</tr> </tr>
<?php else : ?> <?php else : ?>
<?php $total += $Expenses['amount']; ?> <?php $total += $Expenses['amount']; ?>
<tr> <tr class="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td> <td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td>
<td width="15%"></td>
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td width="15%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php }; ?> <?php }; ?>
@ -335,22 +355,79 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div> </div>
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<?php function footerFunctions() <?php function footerFunctions()
{ ?> { ?>
<script> <script>
$("#fromDate").nepaliDatePicker({ $(document).ready(function() {
dateFormat: "%y-%m-%d", // Prevent the dropdown from closing when clicking inside
closeOnDateSelect: true, $('.dropdown-menu').on('click', function(event) {
minDate: $('#fromDate').data('start'), event.stopPropagation();
maxDate: $('#fromDate').data('end'), });
}); });
</script> </script>
<script> <script>
$("#toDate").nepaliDatePicker({ // var exportButton = document.getElementById("exportButton");
dateFormat: "%y-%m-%d", // exportButton.addEventListener("click", function() {
closeOnDateSelect: true, // exportTableToCSV("table.csv");
minDate: $('#toDate').data('start'), // });
maxDate: $('#toDate').data('end'), 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>
<?php } ?> <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>
<?php } ?>

View File

@ -40,7 +40,7 @@
<?php if (isset($account_id) && $account_id != "") { <?php if (isset($account_id) && $account_id != "") {
$fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth()); $fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth());
$toDate = isset($_GET['to_date']) ? $_GET['to_date'] : Today(); $toDate = isset($_GET['to_date']) ? $_GET['to_date'] : Today();
$this->myaccounts->showLedger($account_id, $fromDate, $toDate); $this->myaccounts->showLedger($account_id, $fromDate, $toDate, $fiscalStart, $fiscalEnd);
} ?> } ?>
<div class="modal fade" id="ledgerdetails_box" tabindex="-1" role="dialog" aria-labelledby="ledgerdetails_box" aria-hidden="true"> <div class="modal fade" id="ledgerdetails_box" tabindex="-1" role="dialog" aria-labelledby="ledgerdetails_box" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document"> <div class="modal-dialog modal-xl" role="document">

View File

@ -3,82 +3,82 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header disabled color-palette"> <div class="card-header disabled color-palette">
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3> <h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action="" id="FilterForm">
<!-- button with a dropdown --> <!-- button with a dropdown -->
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52"> <button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters Filters
</button> </button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0">
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <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"> <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> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <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"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="btn-group">
<div class="form-group p-2 pb-0"> <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
<button type="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button> Export
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button> </button>
</div> <!-- <div class="dropdown-menu" role="menu">
</div>
</div>
<div class="btn-group">
<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">Export</a>
<a href="#" class="dropdown-item">Pdf</a> <a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</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> </form>
<script> <script>
function resetForm() { function resetForm() {
document.getElementById("fromDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>"; document.getElementById("fromDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>";
document.getElementById("toDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>"; document.getElementById("toDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>";
document.getElementById("showOB").checked = <?php echo "false"; ?>; document.getElementById("showOB").checked = <?php echo "false"; ?>;
document.getElementById("showClosing").checked = <?php echo "false"; ?>; document.getElementById("showClosing").checked = <?php echo "false"; ?>;
document.getElementById("FilterForm").submit(); document.getElementById("FilterForm").submit();
} }
</script> </script>
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
@ -108,7 +108,7 @@
$html = ""; $html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>"; $html .= "<table class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>"; $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 col-1 '>Action</th></tr>"; $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>"; $html .= "</thead><tbody>";
$sn = 0; $sn = 0;
$BalanceTotal = 0; $BalanceTotal = 0;
@ -116,10 +116,10 @@
$balance = getBalance($Account->account_id); $balance = getBalance($Account->account_id);
$BalanceTotal += $balance; $BalanceTotal += $balance;
// pre($Account); // pre($Account);
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><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-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 class='col-1 text-center'>" . $sn . "</td><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='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; endforeach;
$html .= "</tbody><tfoot>"; $html .= "</tbody><tfoot>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>"; $html .= "<tr><th colspan=3 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 class='text-right'>" . myCurrency($BalanceTotal) . "</th></tr>";
$html .= "</tfoot></table>\n"; $html .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\"> $html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\"> <div class=\"modal-dialog modal-xl\" role=\"document\">
@ -158,6 +158,79 @@
<?php function footerFunctions() <?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>
// 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>
<?php <?php
} }
?> ?>

View File

@ -18,40 +18,40 @@
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <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"> <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> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <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"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div> -->
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox"> <!-- <input type="hidden" name="showOB" value="not"> -->
<label class="form-check-label">Select
All</label>
</div>
<div class="form-check">
<input type="hidden" name="showOB" value="not">
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button> <button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button> <button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div> </div>
</div> </div>
</div> </div>
@ -109,7 +109,7 @@
$html = ""; $html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>"; $html .= "<table class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>"; $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 col-1'>Action</th></tr>"; $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>"; $html .= "</thead><tbody>";
$sn = 0; $sn = 0;
$BalanceTotal = 0; $BalanceTotal = 0;
@ -117,10 +117,10 @@
$balance = getBalance($Account->account_id); $balance = getBalance($Account->account_id);
$BalanceTotal += $balance; $BalanceTotal += $balance;
// pre($Account); // pre($Account);
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><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-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 class='col-1 text-center'>" . $sn . "</td><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='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; endforeach;
$html .= "</tbody><tfoot>"; $html .= "</tbody><tfoot>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>"; $html .= "<tr><th colspan=3 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 class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th></tr>";
$html .= "</tfoot></table>\n"; $html .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\"> $html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\"> <div class=\"modal-dialog modal-xl\" role=\"document\">
@ -159,6 +159,79 @@
<?php function footerFunctions() <?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>
// 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>
<?php <?php
} }
?> ?>

View File

@ -95,7 +95,7 @@ $BIBAccounts = new BIBAccounts();
<div class="card card-primary card-outline "> <div class="card card-primary card-outline ">
<div class="card-header"> <div class="card-header">
<h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report"); <h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report");
?></h2> ?></h2>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action="" id="FilterForm">
<!-- button with a dropdown --> <!-- button with a dropdown -->
@ -108,40 +108,40 @@ $BIBAccounts = new BIBAccounts();
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <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"> <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> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button> <button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button> <button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div> </div>
</div> </div>
</div> </div>
@ -157,7 +157,7 @@ $BIBAccounts = new BIBAccounts();
</div> --> </div> -->
</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> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -177,7 +177,7 @@ $BIBAccounts = new BIBAccounts();
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <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 card-primary card-outline ">
<div class="card-body p-0"> <div class="card-body p-0">
<?php <?php
@ -222,7 +222,7 @@ $BIBAccounts = new BIBAccounts();
</tr> </tr>
<tr> <tr>
<td colspan="7" class="group-details p-0" width="85%"> <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 $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div> </div>
@ -261,7 +261,7 @@ $BIBAccounts = new BIBAccounts();
</tr> </tr>
<tr> <tr>
<td colspan="7" class="group-details p-0"> <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); ?> <i> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</i> </i>
@ -351,6 +351,14 @@ $BIBAccounts = new BIBAccounts();
function footerfunctions() function footerfunctions()
{ {
?> ?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
// Trigger click event on page load // Trigger click event on page load

View File

@ -91,8 +91,10 @@ $PL = $IncomesTotal - $ExpensesTotal;
box-shadow: inset 0 0 0 transparent; box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
} }
.table.table-head-fixed thead tr:nth-child(1) th{
padding-left: 6px;; .table.table-head-fixed thead tr:nth-child(1) th {
padding-left: 6px;
;
} }
</style> </style>
@ -108,7 +110,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
<div class="card-header"> <div class="card-header">
<h3 class="card-title mt-1">Receipts And Payments <?php //echo $pageTitle; <h3 class="card-title mt-1">Receipts And Payments <?php //echo $pageTitle;
?> </h3> ?> </h3>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action="" id="FilterForm">
@ -119,54 +121,49 @@ $PL = $IncomesTotal - $ExpensesTotal;
Filters Filters
</button> </button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0">
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <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"> <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> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button> <button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button> <button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div> </div>
</div> </div>
</div> </div>
<div class="btn-group"> <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 Export
</button> </button>
@ -180,7 +177,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div> </div>
<!-- <button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</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> --> <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form> </form>
<script> <script>
@ -260,7 +257,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?> <?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> <thead>
<tr> <tr>
<th class="" width="35%"><?php myLang("Receipts"); ?></th> <th class="" width="35%"><?php myLang("Receipts"); ?></th>
@ -276,8 +273,9 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td colspan=3 class="p-0"> <td colspan=3 class="p-0">
<table class="table g-0"> <table class="table g-0">
<?php $total1 = 0; <?php $total1 = 0;
$counter = 0;
$index = 0;
foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?> foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?>
<?php if ($Incomes['account'] == "GROUP TOTAL") : ?> <?php if ($Incomes['account'] == "GROUP TOTAL") : ?>
<!--tr> <!--tr>
<td class="" width="70%"><b><?php echo $Incomes['group']; ?></b></td> <td class="" width="70%"><b><?php echo $Incomes['group']; ?></b></td>
@ -286,20 +284,26 @@ $PL = $IncomesTotal - $ExpensesTotal;
</tr--> </tr-->
<?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?> <?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="" 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%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td>
<td width="15%"></td> <td width="15%"></td>
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></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%">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?>
</td>
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td width="15%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php $counter = $index ?>
<?php }; ?> <?php }; ?>
@ -318,19 +322,23 @@ $PL = $IncomesTotal - $ExpensesTotal;
</tr--> </tr-->
<?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?> <?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="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 width="15%"></td>
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
</tr> </tr>
<?php else : ?> <?php else : ?>
<?php $total += $Expenses['amount']; ?> <?php $total += $Expenses['amount']; ?>
<tr> <tr class="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td> <td class="" width="70%">
<td width="15%"></td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo $Expenses['account']; ?>
</td>
<td class="text-right pr-2" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <td class="text-right pr-2" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td width="15%"></td>
</tr> </tr>
@ -387,22 +395,79 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<?php function footerFunctions() <?php function footerFunctions()
{ ?> { ?>
<script> <script>
$("#fromDate").nepaliDatePicker({ $(document).ready(function() {
dateFormat: "%y-%m-%d", // Prevent the dropdown from closing when clicking inside
closeOnDateSelect: true, $('.dropdown-menu').on('click', function(event) {
minDate: $('#fromDate').data('start'), event.stopPropagation();
maxDate: $('#fromDate').data('end'), });
}); });
</script> </script>
<script> <script>
$("#toDate").nepaliDatePicker({ // var exportButton = document.getElementById("exportButton");
dateFormat: "%y-%m-%d", // exportButton.addEventListener("click", function() {
closeOnDateSelect: true, // exportTableToCSV("table.csv");
minDate: $('#toDate').data('start'), // });
maxDate: $('#toDate').data('end'), document.addEventListener("DOMContentLoaded", function() {
}); // Trigger click event on page load
</script> document.getElementById("toggleShowAll").click();
<?php } ?> });
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>
<?php } ?>

View File

@ -34,7 +34,7 @@
<div class="card-body"> <div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_vouchertypes")->result(); ?> <?php $TableData = $this->db->query("select * from tbl_vouchertypes")->result(); ?>
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th class="text-center">Sn</th> <th class="text-center">Sn</th>

View File

@ -94,7 +94,8 @@ $BIBAccounts = new BIBAccounts();
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report"); ?></h2> <h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report");
?></h2>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action="" id="FilterForm">
@ -105,49 +106,44 @@ $BIBAccounts = new BIBAccounts();
Filters Filters
</button> </button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0">
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <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"> <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> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button> <button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button> <button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div> </div>
</div> </div>
</div> </div>
@ -312,6 +308,14 @@ $BIBAccounts = new BIBAccounts();
function footerfunctions() function footerfunctions()
{ {
?> ?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script> <script>
// var exportButton = document.getElementById("exportButton"); // var exportButton = document.getElementById("exportButton");
// exportButton.addEventListener("click", function() { // exportButton.addEventListener("click", function() {
@ -360,23 +364,23 @@ function footerfunctions()
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
} }
</script> </script>
<script> <script>
$("#fromDate").nepaliDatePicker({ $("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d", dateFormat: "%y-%m-%d",
closeOnDateSelect: true, closeOnDateSelect: true,
minDate: $('#fromDate').data('start'), minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'), maxDate: $('#fromDate').data('end'),
}); });
</script> </script>
<script> <script>
$("#toDate").nepaliDatePicker({ $("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d", dateFormat: "%y-%m-%d",
closeOnDateSelect: true, closeOnDateSelect: true,
minDate: $('#toDate').data('start'), minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'), maxDate: $('#toDate').data('end'),
}); });
</script> </script>
<?php <?php
} }
?> ?>

View File

@ -99,7 +99,7 @@ button:hover {
</fieldset> </fieldset>
</div> </div>
<div class="col-8"> <div class="col-8">
<h1 class="text-center"><?php echo $pageTitle; ?> Voucher</h1> <h1 class="text-center"><?php echo $pageTitle; ?></h1>
<!-- <fieldset> <!-- <fieldset>
<legend><span id="selectedAccountName"></span> Balance</legend><span id="selectedAccountBalance" style="padding: 6px 0px; display: inline-block; text-align: right; width: 100%;">Choose A/C First</span> <legend><span id="selectedAccountName"></span> Balance</legend><span id="selectedAccountBalance" style="padding: 6px 0px; display: inline-block; text-align: right; width: 100%;">Choose A/C First</span>
</fieldset> --> </fieldset> -->

View File

@ -34,7 +34,7 @@
// echo $toDate; // echo $toDate;
$account_id = isset($_GET['account_id']) ? $_GET['account_id'] : ''; $account_id = isset($_GET['account_id']) ? $_GET['account_id'] : '';
$vouchertype_id = isset($_GET['vouchertypes']) ? $_GET['vouchertypes'] : ''; $vouchertype_id = isset($_GET['vouchertypes']) ? $_GET['vouchertypes'] : '';
$this->myaccounts->listVouchers($fromDate, $toDate, $account_id, $vouchertype_id, true); $this->myaccounts->listVouchers($fromDate, $toDate, $account_id, $vouchertype_id, true, false, $fiscalStart, $fiscalEnd);
?> ?>
</div> </div>
</div> </div>
@ -43,3 +43,4 @@
</div> </div>
</div> </div>
</div> </div>

View File

@ -100,7 +100,7 @@
<th>From</th> <th>From</th>
<th>To</th> <th>To</th>
<!-- <th>Created By</th> --> <!-- <th>Created By</th> -->
<th class="col-1 text-center">Action</th> <th class="col-2 text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -116,7 +116,7 @@ $subparam2 = $this->uri->segment(4);
<?php if ($LoggedUser == "admin") : ?> <?php if ($LoggedUser == "admin") : ?>
<?php foreach ($VoucherTypes as $VoucherType) : if ($VoucherType->voucher_alias != "sales" && $VoucherType->voucher_alias != "purchase") : ?> <?php foreach ($VoucherTypes as $VoucherType) : if ($VoucherType->voucher_alias != "sales" && $VoucherType->voucher_alias != "purchase") : ?>
<li class="nav-item"><a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="nav-link <?php echo ($subparam == $VoucherType->voucher_alias && $subparam2 == "create") ? "active" : ""; ?>"> <li class="nav-item"><a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="nav-link <?php echo ($subparam == $VoucherType->voucher_alias && $subparam2 == "create") ? "active" : ""; ?>">
<p><?php echo $VoucherType->voucher_name; ?> Voucher</p> <p><?php echo $VoucherType->voucher_name; ?></p>
</a></li> </a></li>
<?php endif; <?php endif;
endforeach; ?> endforeach; ?>
@ -160,7 +160,7 @@ $subparam2 = $this->uri->segment(4);
showMenu("Profit and Loss Statement", "accounts/reports/pl"); showMenu("Profit and Loss Statement", "accounts/reports/pl");
showMenu("Balance Sheet", "accounts/reports/balance_sheet"); showMenu("Balance Sheet", "accounts/reports/balance_sheet");
// showMenu("Balance Sheet (Vertical)", "accounts/reports/balance_sheet_vertical"); // 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("Income And Expenses", "accounts/reports/incomes_and_expenses");
showMenu("Cash Flow", "accounts/reports/cash_flow"); showMenu("Cash Flow", "accounts/reports/cash_flow");
showMenu("Ratio Analysis", "accounts/reports/ratio_analysis"); showMenu("Ratio Analysis", "accounts/reports/ratio_analysis");

View File

@ -38,7 +38,7 @@
<!--COL START--> <!--COL START-->
<div class="col-6"> <div class="col-6">
<div class="form-group"> <div class="form-group">
<?php fillComboWithValue("units_id", "Units <span class='text-danger'>*</span>", "units_id", "tbl_units", "title", "unit_id", isset($item) ? $item->units_id : '',); ?> <?php fillComboWithValue("units_id", "Units <span class='text-danger'>*</span>", "units_id", "tbl_units", "title", "unit_id", isset($item) ? $item->units_id : '', "", false, "", true); ?>
</div> </div>
</div> </div>
<!--COL END--> <!--COL END-->
@ -47,7 +47,7 @@
<!--COL START--> <!--COL START-->
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<?php fillComboWithValue("itemcategories_id", "Group <span class='text-danger'>*</span>", "itemcategories_id", "tbl_itemcategories", "title", "itemcategory_id", isset($item) ? $item->itemcategories_id : ''); ?> <?php fillComboWithValue("itemcategories_id", "Group <span class='text-danger'>*</span>", "itemcategories_id", "tbl_itemcategories", "title", "itemcategory_id", isset($item) ? $item->itemcategories_id : '', "", false, "", true); ?>
</div> </div>
</div> </div>
<!--COL END--> <!--COL END-->

View File

@ -441,10 +441,8 @@
}); });
if(type=='amount'){ if(type=='amount'){
alert("amount");
discountamount = parseFloat($("input[name='discount']").val()); discountamount = parseFloat($("input[name='discount']").val());
discountpercent = (discountamount * 100) / subtotal; discountpercent = (discountamount * 100) / subtotal;
alert(discountamount);
$("#discountpercentage").val(discountpercent.toFixed(2)); $("#discountpercentage").val(discountpercent.toFixed(2));
}else{ }else{
discountpercent = parseFloat($("input[name='discountpercentage']").val()); discountpercent = parseFloat($("input[name='discountpercentage']").val());

View File

@ -7,11 +7,11 @@
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<!-- <button class="btn btn-primary btn-xs float-right" style="margin-left: 2px;" onclick="printDiv('printableArea')"><i class="fas fa-print"></i></button> -->
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5> <h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5>
</div> </div>
<div id="printableArea">
<div class="card-body"> <div class="card-body">
<div class="row bill-header"> <div class="row bill-header">
@ -88,7 +88,7 @@
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -96,3 +96,16 @@
</div> </div>
</div> </div>
</div> </div>
<script>
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
</script>

View File

@ -240,10 +240,8 @@
var discountamount = 0; var discountamount = 0;
var discountpercent = 0; var discountpercent = 0;
if(type=='amount'){ if(type=='amount'){
alert("amount");
discountamount = parseFloat($("input[name='discount']").val()); discountamount = parseFloat($("input[name='discount']").val());
discountpercent = (discountamount * 100) / subtotal; discountpercent = (discountamount * 100) / subtotal;
alert(discountamount);
$("#discountpercentage").val(discountpercent.toFixed(2)); $("#discountpercentage").val(discountpercent.toFixed(2));
}else{ }else{
discountpercent = parseFloat($("input[name='discountpercentage']").val()); discountpercent = parseFloat($("input[name='discountpercentage']").val());

View File

@ -7,11 +7,11 @@
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<!-- <button class="btn btn-primary btn-xs float-right" style="margin-left: 2px;" onclick="printDiv('printableArea')"><i class="fas fa-print"></i></button> -->
<h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5> <h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
</div> </div>
<div id="printableArea">
<div class="card-body"> <div class="card-body">
<div class="row bill-header"> <div class="row bill-header">
@ -86,7 +86,7 @@
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -94,69 +94,85 @@
?></a> --> ?></a> -->
</h5> </h5>
<div class="card-tools"> <div class="card-tools">
<!-- button with a dropdown --> <form method="post" action="" id="FilterForm">
<div class="btn-group"> <!-- button with a dropdown -->
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52"> <div class="btn-group">
Filters <button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
</button> Filters
<div class="dropdown-menu" role="menu"> </button>
<div class="form-group p-2 pb-0"> <div class="dropdown-menu" role="menu">
<div class="col"> <div class="form-group p-2 pb-0">
<div class="form-group"> <div class="col">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <div class="form-group">
<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 " 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>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div> </div>
<div class="form-group"> <div class="dropdown-divider"></div>
<label for="toDate"><?php myLang("Ending Period"); ?></label> <!-- <div class="form-check">
<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"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div> -->
<div class="form-check">
<!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label" for="showOB">Opening</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label" for="showClosing">Closing</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <div class="form-group p-2 pb-0 text-right">
<input class="form-check-input" type="checkbox"> <button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<label class="form-check-label">Select <button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
All</label>
</div> </div>
<div class="form-check">
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0">
<button type="submit" class="btn btn-primary btn-sm mr-2 text-center">Search Now</button>
</div> </div>
</div> </div>
</div> <div class="btn-group">
<div class="btn-group"> <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
<button type="button" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52"> Export
Export </button>
</button> <!-- <div class="dropdown-menu" role="menu">
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a> <a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a> <a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</div> </div>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>";
document.getElementById("toDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>";
document.getElementById("showOB").checked = <?php echo "false"; ?>;
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
document.getElementById("FilterForm").submit();
}
</script>
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped dataTable">
<thead> <thead>
<tr> <tr>
<th rowspan="2" width="40" style="vertical-align: middle;"><?php myLang('S.No.'); ?></th> <th rowspan="2" width="40" style="vertical-align: middle;"><?php myLang('S.No.'); ?></th>
<th rowspan="2" style="vertical-align: middle;"> <?php myLang('Item'); ?></th> <th rowspan="2" style="vertical-align: middle;"> <?php myLang('Item'); ?></th>
<th rowspan="2" width="80" style="vertical-align: middle;"><?php myLang('Units'); ?></th> <th rowspan="2" width="80" style="vertical-align: middle;"><?php myLang('Units'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Opening'); ?></th> <th colspan="3" class="text-center"><?php myLang('Opening'); ?></th>
@ -180,12 +196,14 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $Total = 0;$PTotal=0;$STotal=0;$CTotal=0; <?php $Total = 0;
foreach ($StockRecords as $TableRow) : ?> $PTotal = 0;
$STotal = 0;
$CTotal = 0;
foreach ($StockRecords as $index => $TableRow) : ?>
<tr> <tr>
<td><?php echo $index + 1; ?></td>
<td></td> <td><?php echo ($TableRow->Item) ? $TableRow->Item->title : "N/A"; ?></td>
<td><?php echo ($TableRow->Item)?$TableRow->Item->title:"N/A"; ?></td>
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->Item->units_id); ?></td> <td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->Item->units_id); ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Opening->qty; ?></td> <td class="text-right"><?php echo $TableRow->Summary->Opening->qty; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Opening->rate; ?></td> <td class="text-right"><?php echo $TableRow->Summary->Opening->rate; ?></td>
@ -227,3 +245,84 @@
</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();
});
});
</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");
}
}
});
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>
<?php
}
?>

View File

@ -27,8 +27,8 @@
<td class="text-center"><?php echo $TableRow->translation_id; ?></td> <td class="text-center"><?php echo $TableRow->translation_id; ?></td>
<td><?php echo $TableRow->english; ?></td> <td><?php echo $TableRow->english; ?></td>
<td><?php echo $TableRow->nepali; ?></td> <td><?php echo $TableRow->nepali; ?></td>
<td class="text-center"><a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>" class="btn btn-info btn-xs"><i class="fas fa-edit"></i> Edit</a> <td class="text-center"><a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>" class="btn btn-info btn-xs"><i class="fas fa-edit"></i></a>
<a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs"><i class="fas fa-trash"></i> Delete</a> <a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs"><i class="fas fa-trash"></i></a>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long