Compare commits

...

30 Commits

Author SHA1 Message Date
497f567cba balancesheet 2024-08-26 17:17:43 +05:45
31e7f8de87 edit 2024-08-26 13:39:34 +05:45
a5d29a202e Merge branch 'main' of http://bibgit.com/sampanna/BBnepal-Accounts 2024-08-26 13:37:02 +05:45
4109787bc4 cash flow 2024-08-26 13:36:59 +05:45
b1c6bad445 profitloss 2024-08-26 13:08:50 +05:45
15b3e542a3 edit balance sheet 2024-08-26 13:04:47 +05:45
cd361f79aa edit profit and loss 2024-08-26 12:35:45 +05:45
759b97e1f0 edit profti and loss 2024-08-26 12:29:38 +05:45
161703be17 edit css 2024-08-25 18:37:52 +05:45
78670b1b95 edit 2024-08-25 16:19:29 +05:45
8c5bfd147b edit css 2024-08-25 16:17:28 +05:45
f488c286bd daterangefix and vouchertextremove 2024-08-21 13:47:09 +05:45
5df46f007d voucher 2024-08-18 12:32:21 +05:45
c9e54804c8 toggle change in randp 2024-08-15 16:14:22 +05:45
cb443cd551 datepicker and toggle buttons changes 2024-08-14 21:39:12 +05:45
ee30970d1f toggle 2024-08-14 13:56:37 +05:45
fe8786f03f changes 2024-08-12 16:21:46 +05:45
16246fbdeb changes 2024-08-11 17:29:32 +05:45
0f5bafdf3e byledger 2024-08-09 17:57:49 +05:45
c64472a21e changes 2024-08-09 15:37:11 +05:45
2ebd3a2ea9 edit 2024-08-09 15:07:46 +05:45
c08ed22b78 edit action column 2024-08-09 14:22:36 +05:45
9ebdd5a858 edit 2024-08-09 12:41:25 +05:45
213be12e2a edit css 2024-08-09 11:53:11 +05:45
e9fc0b8270 edit css and table 2024-08-09 10:00:40 +05:45
169a49c376 edit css 2024-08-09 09:39:49 +05:45
b06ce0569a edit css 2024-08-08 19:07:57 +05:45
e47ff3321d edit css 2024-08-08 18:41:24 +05:45
114e7aa4c2 css edit 2024-08-08 18:27:34 +05:45
c30c5ddcb2 edit css 2024-08-08 18:24:25 +05:45
65 changed files with 3888 additions and 1297 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

@ -5,7 +5,6 @@ function generateACCategoryCode($group_id)
$acgroup_code = $ci->db->where("acgroup_id=$group_id")->get("tbl_acgroups")->row()->acgroup_code; $acgroup_code = $ci->db->where("acgroup_id=$group_id")->get("tbl_acgroups")->row()->acgroup_code;
$lastACCategoryCode = $ci->db->select_max("accategory_code")->where("acgroup_id=$group_id")->get("tbl_accategories")->row()->accategory_code; $lastACCategoryCode = $ci->db->select_max("accategory_code")->where("acgroup_id=$group_id")->get("tbl_accategories")->row()->accategory_code;
$category_part = substr($lastACCategoryCode, 1); $category_part = substr($lastACCategoryCode, 1);
$category_part = (float)$category_part + 1; $category_part = (float)$category_part + 1;
//if($category_part<10)$category_part="00".$category_part; //if($category_part<10)$category_part="00".$category_part;
if ($category_part < 10) $category_part = "00" . $category_part; if ($category_part < 10) $category_part = "00" . $category_part;
@ -18,7 +17,6 @@ function generateAccountCode($category_id)
$accategory_code = $ci->db->where("accategory_id=$category_id")->get("tbl_accategories")->row()->accategory_code; $accategory_code = $ci->db->where("accategory_id=$category_id")->get("tbl_accategories")->row()->accategory_code;
$lastAccountCode = $ci->db->select_max("account_code")->where("accategory_id=$category_id")->get("tbl_accounts")->row()->account_code; $lastAccountCode = $ci->db->select_max("account_code")->where("accategory_id=$category_id")->get("tbl_accounts")->row()->account_code;
$account_part = substr($lastAccountCode, 4); $account_part = substr($lastAccountCode, 4);
$account_part = (float)$account_part + 1; $account_part = (float)$account_part + 1;
//if($category_part<10)$category_part="00".$category_part; //if($category_part<10)$category_part="00".$category_part;
if ($account_part < 10) $account_part = "00" . $account_part; if ($account_part < 10) $account_part = "00" . $account_part;
@ -54,13 +52,10 @@ function showAccountCategoriesSelector($fieldName, $fieldID, $condition = "1=1",
$html .= " required"; $html .= " required";
} }
$html .= ">"; $html .= ">";
$html .= "<option value='' " . (($selectedID == '') ? "SELECTED" : "") . ">Select Account Category</option>"; $html .= "<option value='' " . (($selectedID == '') ? "SELECTED" : "") . ">Select Account Category</option>";
foreach ($AccountCategories as $AccountCategory) { foreach ($AccountCategories as $AccountCategory) {
$html .= "<option value='$AccountCategory->accategory_id'" . (($selectedID == $AccountCategory->accategory_id) ? "selected" : "") . ">" . getFieldfromValue("tbl_acgroups", "acgroup_name", "acgroup_id", $AccountCategory->acgroup_id) . " >> $AccountCategory->accategory_name</option>"; $html .= "<option value='$AccountCategory->accategory_id'" . (($selectedID == $AccountCategory->accategory_id) ? "selected" : "") . ">" . getFieldfromValue("tbl_acgroups", "acgroup_name", "acgroup_id", $AccountCategory->acgroup_id) . " >> $AccountCategory->accategory_name</option>";
} }
$html .= "</select>"; $html .= "</select>";
echo $html; echo $html;
} }
@ -68,7 +63,6 @@ function showAccountCategoriesByIds($AccountCategories = array())
{ {
// pre($AccountCategories); //die; // pre($AccountCategories); //die;
$ci = &get_instance(); $ci = &get_instance();
if ($AccountCategories) { if ($AccountCategories) {
$AccountCategories_a = $ci->db->where("status", 1); $AccountCategories_a = $ci->db->where("status", 1);
$AccountCategories_a = $AccountCategories_a->where_in("accategory_id", $AccountCategories); $AccountCategories_a = $AccountCategories_a->where_in("accategory_id", $AccountCategories);
@ -80,22 +74,19 @@ function showAccountCategoriesByIds($AccountCategories = array())
echo implode(", ", $html); echo implode(", ", $html);
} }
} }
function linkVoucher($voucher_id) function linkVoucher($voucher_id)
{ {
if($voucher_id!=0) { if ($voucher_id != 0) {
$ci = &get_instance(); $ci = &get_instance();
$Voucher = $ci->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row(); $Voucher = $ci->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
$Name = $ci->db->where("vouchertype_id", $Voucher->voucher_type)->get("tbl_vouchertypes")->row()->voucher_type . " Voucher # " . $Voucher->voucher_no; $Name = $ci->db->where("vouchertype_id", $Voucher->voucher_type)->get("tbl_vouchertypes")->row()->voucher_type . " Voucher # " . $Voucher->voucher_no;
echo "<a class='link' target='_blank' href='" . site_url("accounts/vouchers/show_voucher/" . $voucher_id) . "'>$Name</a>"; echo "<a class='link' target='_blank' href='" . site_url("accounts/vouchers/show_voucher/" . $voucher_id) . "'>$Name</a>";
} else { } else {
echo ""; echo "";
} }
} }
function linkLedger($Account) function linkLedger($Account)
{ {
$ci = &get_instance(); $ci = &get_instance();
echo "<a class='link' target='_blank' href='" . site_url("accounts/ledger/partyledger?from_date=" . FYStart() . "&to_date=" . FYEnd() . "&account_id=" . $Account->account_id . "&show_ledger=true") . "'>$Account->account_name</a>"; echo "<a class='link' target='_blank' href='" . site_url("accounts/ledger/partyledger?from_date=" . FYStart() . "&to_date=" . FYEnd() . "&account_id=" . $Account->account_id . "&show_ledger=true") . "'>$Account->account_name</a>";
} }
@ -143,15 +134,11 @@ function generateVoucherNo($vouchertype_id = "")
{ {
$ci = &get_instance(); $ci = &get_instance();
$voucherTypeCondition = ($vouchertype_id != "") ? " WHERE voucher_type = '$vouchertype_id'" : ""; $voucherTypeCondition = ($vouchertype_id != "") ? " WHERE voucher_type = '$vouchertype_id'" : "";
$query = $ci->db->query("SELECT MAX(voucher_no) AS voucher_no FROM tbl_vouchers" . $voucherTypeCondition); $query = $ci->db->query("SELECT MAX(voucher_no) AS voucher_no FROM tbl_vouchers" . $voucherTypeCondition);
$row = $query->row(); $row = $query->row();
$newVoucherNo = ($row->voucher_no !== null) ? $row->voucher_no + 1 : 1; $newVoucherNo = ($row->voucher_no !== null) ? $row->voucher_no + 1 : 1;
return $newVoucherNo; return $newVoucherNo;
} }
function countChildCategories($acgroup_id) function countChildCategories($acgroup_id)
{ {
$ci = &get_instance(); $ci = &get_instance();

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

@ -766,17 +766,16 @@ class bibaccounts
<tr> <tr>
<td class="group-name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i><?php echo $Account->account_name; ?></i></td> <td class="group-name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i><?php echo $Account->account_name; ?></i></td>
<?php if ($ReportOptions['showOB']) : ?> <?php if ($ReportOptions['showOB']) : ?>
<td class="group-total "><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->opening_balance : 0); ?></td> <td class="group-total"><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->opening_balance : 0); ?></td>
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->opening_balance : 0); ?></td> <td class="group-total "><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->opening_balance : 0); ?></td>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showPeriod']) : ?> <?php if ($ReportOptions['showPeriod']) : ?>
<td class="group-total"><i><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->regular_balance : 0); ?></i></td>
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->regular_balance : 0); ?><?php //pre($Account); <td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->regular_balance : 0); ?><?php //pre($Account);
?></td> ?></td>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showClosing']) : ?> <?php if ($ReportOptions['showClosing']) : ?>
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->closing_balance : 0); ?></td> <td class="group-total col-2"><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->closing_balance : 0); ?></td>
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->closing_balance : 0); ?></td> <td class="group-total col-2"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->closing_balance : 0); ?></td>
<?php endif; ?> <?php endif; ?>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -69,7 +69,8 @@ class myaccounts
$i = 0; $i = 0;
$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"));
@ -182,11 +186,11 @@ class myaccounts
<div class="col"> <div class="col">
<form method="get"> <form method="get">
<div class="row"> <div class="row">
<div class="col-5"> <div class="col-3">
<?php $this->showAccountsCategoriesCombo("accategory_id", "", "accategory_id"); ?> <?php $this->showAccountsCategoriesCombo("accategory_id", "", "accategory_id"); ?>
</div> </div>
<div class="col-3"> <div class="col-3">
<input type="submit" value="Show Accounts" class="form-control btn btn-success"> <input type="submit" value="Show Accounts" class=" btn btn-success btn-sm">
</div> </div>
</div> </div>
</form> </form>
@ -197,7 +201,7 @@ class myaccounts
$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>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'>Action</th></tr>"; $html .= "<tr><th>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1'>Action</th></tr>";
$html .= "</thead><tbody>"; $html .= "</thead><tbody>";
$sn = 0; $sn = 0;
$BalanceTotal = 0; $BalanceTotal = 0;
@ -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='col-2 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\">
@ -543,7 +547,6 @@ class myaccounts
<tr> <tr>
<!-- <th class="col-1.5" rowspan="2"><?php //myLang(" Category"); <!-- <th class="col-1.5" rowspan="2"><?php //myLang(" Category");
?></th> --> ?></th> -->
<th class="col-1.5" rowspan="2"><?php myLang("Ledger"); ?></th> <th class="col-1.5" rowspan="2"><?php myLang("Ledger"); ?></th>
<th class="col-1.5" rowspan="2"><?php myLang(" Group"); ?></th> <th class="col-1.5" rowspan="2"><?php myLang(" Group"); ?></th>
<th colspan="2" class="col-3 text-center">Opening Balance</th> <th colspan="2" class="col-3 text-center">Opening Balance</th>
@ -627,7 +630,6 @@ class myaccounts
window.location = '<?php echo site_url("accounts/accountheads/delete/"); ?>' + id; window.location = '<?php echo site_url("accounts/accountheads/delete/"); ?>' + id;
} }
} }
function showDetails(id) { function showDetails(id) {
$.ajax({ $.ajax({
url: "<?php echo site_url("accounts/accountheads/getdetails/"); ?>" + id, url: "<?php echo site_url("accounts/accountheads/getdetails/"); ?>" + id,
@ -662,15 +664,13 @@ 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;
$toDate = ($toDate == "") ? Today() : $toDate; $toDate = ($toDate == "") ? Today() : $toDate;
$ci = &get_instance(); $ci = &get_instance();
$Transactions = $ci->db->where("transaction_date between '$fromDate' AND '$toDate'")->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result(); $Transactions = $ci->db->where("transaction_date between '$fromDate' AND '$toDate'")->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
$Account = $ci->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row(); $Account = $ci->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
foreach ($Transactions as $T) { foreach ($Transactions as $T) {
$T->Voucher = $ci->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row(); $T->Voucher = $ci->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
@ -699,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>
@ -706,12 +707,10 @@ class myaccounts
$drTotal = 0; $drTotal = 0;
$crTotal = 0; $crTotal = 0;
$balance = 0; $balance = 0;
foreach ($TableData as $TableRow) : $r++; foreach ($TableData as $TableRow) : $r++;
?> ?>
<tr> <tr>
<td><?php echo NepaliDate(($TableRow->transaction_date)); ?></td> <td><?php echo NepaliDate(($TableRow->transaction_date)); ?></td>
<td> <td>
<?php <?php
if ($TableRow->voucher_id != 0) : if ($TableRow->voucher_id != 0) :
@ -721,9 +720,7 @@ class myaccounts
echo $T->account_name; echo $T->account_name;
break; break;
} }
endforeach; endforeach;
// pre($Tr); // pre($Tr);
else : else :
echo "Opening Balance"; echo "Opening Balance";
@ -733,7 +730,6 @@ class myaccounts
?></td> --> ?></td> -->
<td> <td>
<?php linkVoucher($TableRow->voucher_id); ?> <?php linkVoucher($TableRow->voucher_id); ?>
</td> </td>
<td><?php echo myCurrency($TableRow->dr); <td><?php echo myCurrency($TableRow->dr);
$drTotal += $TableRow->dr; ?></td> $drTotal += $TableRow->dr; ?></td>
@ -781,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)
@ -931,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();
@ -967,13 +979,14 @@ class myaccounts
<th width="90"><?php myLang("Dr"); ?></th> <th width="90"><?php myLang("Dr"); ?></th>
<th width="90"><?php myLang("Cr"); ?></th> <th width="90"><?php myLang("Cr"); ?></th>
<!--<th><?php myLang("Voucher State"); ?></th> --> <!--<th><?php myLang("Voucher State"); ?></th> -->
<th class="table-col col-2">Action</th> <th class="table-col col-1 text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $a = 0; $drTotal=0;$crTotal=0; <?php $a = 0;
$drTotal = 0;
$crTotal = 0;
foreach ($TableData as $TableRow) : $a++; ?> foreach ($TableData as $TableRow) : $a++; ?>
<tr data-id="<?php echo $TableRow->voucher_id; ?>" class="<?php echo ($TableRow->voucher_state == "Reversed") ? "table-danger" : ""; ?>"> <tr data-id="<?php echo $TableRow->voucher_id; ?>" class="<?php echo ($TableRow->voucher_state == "Reversed") ? "table-danger" : ""; ?>">
<!-- <td><?php echo $TableRow->voucher_id; ?></td> --> <!-- <td><?php echo $TableRow->voucher_id; ?></td> -->
<td><?php echo $TableRow->voucher_no; ?></td> <td><?php echo $TableRow->voucher_no; ?></td>
@ -982,33 +995,35 @@ class myaccounts
<?php foreach ($TableRow->Transactions as $Transaction) : ?> <?php foreach ($TableRow->Transactions as $Transaction) : ?>
<div><?php echo (($Transaction->cr) ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "") . $this->getAccountDetails($Transaction->account_id)->account_name; ?></div> <div><?php echo (($Transaction->cr) ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "") . $this->getAccountDetails($Transaction->account_id)->account_name; ?></div>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($TableRow->narration): ?> <?php if ($TableRow->narration): ?>
(<span class="narration_display"><?php echo $TableRow->narration; ?></span>) (<span class="narration_display"><?php echo $TableRow->narration; ?></span>)
<?php endif; ?> <?php endif; ?>
</td> </td>
<?php if ($showVoucherTypes) : ?> <?php if ($showVoucherTypes) : ?>
<td> <td>
<?php echo $TableRow->VoucherType->voucher_name; ?> <?php echo $TableRow->VoucherType->voucher_name; ?>
</td> </td>
<?php endif; ?> <?php endif; ?>
<td> <td>
<?php foreach ($TableRow->Transactions as $Transaction) : $drTotal+=$Transaction->dr; ?> <?php foreach ($TableRow->Transactions as $Transaction) : $drTotal += $Transaction->dr; ?>
<?php echo myCurrency($Transaction->dr); ?> <?php echo myCurrency($Transaction->dr); ?>
<?php endforeach; ?> <?php endforeach; ?>
</td> </td>
<td> <td>
<?php foreach ($TableRow->Transactions as $Transaction) : $crTotal+=$Transaction->cr; ?> <?php foreach ($TableRow->Transactions as $Transaction) : $crTotal += $Transaction->cr; ?>
<?php echo myCurrency($Transaction->cr); ?> <?php echo myCurrency($Transaction->cr); ?>
<?php endforeach; ?> <?php endforeach; ?>
</td> </td>
<!-- <td><?php echo $TableRow->voucher_type; ?></td> --> <!-- <td><?php echo $TableRow->voucher_type; ?></td> -->
<!-- <td><?php echo $TableRow->voucher_state; ?></td> --> <!-- <td><?php echo $TableRow->voucher_state; ?></td> -->
<td class="col-1"> <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: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; ?>
@ -1043,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>
@ -1057,7 +1073,6 @@ class myaccounts
} }
}); });
} }
function showDetails(id) { function showDetails(id) {
$.ajax({ $.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id, url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
@ -1068,7 +1083,6 @@ class myaccounts
} }
}); });
} }
function reversalEntry() { function reversalEntry() {
var id = $("#reversalBtn").data("id"); var id = $("#reversalBtn").data("id");
if (confirm("Are you sure you want to post reversal for this voucher?")) { if (confirm("Are you sure you want to post reversal for this voucher?")) {
@ -1094,7 +1108,6 @@ class myaccounts
row.child(Transactions).show(); row.child(Transactions).show();
}); });
}); });
function getVoucherDetails(id) { function getVoucherDetails(id) {
$.data; $.data;
$.ajax({ $.ajax({
@ -1106,7 +1119,6 @@ class myaccounts
}); });
return ($.data); return ($.data);
} }
function deleteVoucher(id) { function deleteVoucher(id) {
// Show confirmation dialog // Show confirmation dialog
if (confirm("Are you sure you want to delete this voucher?")) { if (confirm("Are you sure you want to delete this voucher?")) {
@ -1125,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
} }
?> ?>
@ -1217,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>
@ -1303,13 +1324,8 @@ class myaccounts
</option> </option>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<button type="button" class="btn input-group-text addplus" data-toggle="modal" data-target="#exampleModal"><i class="fas fa-plus"></i></button> <button type="button" class="btn input-group-text addplus" data-toggle="modal" data-target="#exampleModal"><i class="fas fa-plus"></i></button>
<?php <?php
} }
function showAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "") function showAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "")
@ -1321,7 +1337,8 @@ class myaccounts
<?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; ?>">
<option value="">Select </option> <option value="">Select </option>
<!-- <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 *,(select acgroup_name from tbl_acgroups where tbl_accategories.acgroup_id=tbl_acgroups.acgroup_id) as acgroup_name from tbl_accategories"; $q = "select *,(select acgroup_name from tbl_acgroups where tbl_accategories.acgroup_id=tbl_acgroups.acgroup_id) as acgroup_name from tbl_accategories";
$q .= ($condition != "") ? " where $condition" : " where status=1"; $q .= ($condition != "") ? " where $condition" : " where status=1";
@ -1343,21 +1360,15 @@ class myaccounts
<?php $current_acgroup = $value->acgroup_name; <?php $current_acgroup = $value->acgroup_name;
endif; endif;
endforeach; endforeach;
*/ */
foreach ($Values as $value) : ?> foreach ($Values as $value) : ?>
<option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>> <option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>>
<?php echo $value->accategory_name; ?> <?php echo $value->accategory_name; ?>
</option> </option>
<?php <?php
endforeach; endforeach;
?> ?>
</select> </select>
<?php <?php
} }
function showFixedAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "") function showFixedAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "")
@ -1367,9 +1378,10 @@ 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> --> <!-- <option value="">Select <?php //echo function_exists("myLang") ? myLang($displayName) : $displayName;
?></option> -->
<?php <?php
$q = "select *,(select acgroup_name from tbl_acgroups where tbl_accategories.acgroup_id=tbl_acgroups.acgroup_id) as acgroup_name from tbl_accategories"; $q = "select *,(select acgroup_name from tbl_acgroups where tbl_accategories.acgroup_id=tbl_acgroups.acgroup_id) as acgroup_name from tbl_accategories";
$q .= ($condition != "") ? " where $condition" : " where status=1"; $q .= ($condition != "") ? " where $condition" : " where status=1";
@ -1392,21 +1404,15 @@ class myaccounts
<?php $current_acgroup = $value->acgroup_name; <?php $current_acgroup = $value->acgroup_name;
endif; endif;
endforeach; endforeach;
*/ */
foreach ($Values as $value) : ?> foreach ($Values as $value) : ?>
<option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>> <option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>>
<?php echo $value->accategory_name; ?> <?php echo $value->accategory_name; ?>
</option> </option>
<?php <?php
endforeach; endforeach;
?> ?>
</select> </select>
<?php <?php
} }
function showAccountsCategoriesWithParentsCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "", $extras = "") function showAccountsCategoriesWithParentsCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "", $extras = "")
@ -1428,11 +1434,11 @@ class myaccounts
foreach ($Values as $value) : ?> foreach ($Values as $value) : ?>
<?php if ($current_acgroup != $value->acgroup_name) : ?> <?php if ($current_acgroup != $value->acgroup_name) : ?>
<!--optgroup label="<?php echo $value->acgroup_name; ?>"--> <!--optgroup label="<?php echo $value->acgroup_name; ?>"-->
<?php endif; ?> <?php endif; ?>
<option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>><?php echo $value->accategory_name; ?></option> <option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>><?php echo $value->accategory_name; ?></option>
<?php if ($current_acgroup != $value->acgroup_name) : ?><!--/optgroup--> <?php if ($current_acgroup != $value->acgroup_name) : ?><!--/optgroup-->
<?php $current_acgroup = $value->acgroup_name; <?php $current_acgroup = $value->acgroup_name;
endif; ?> endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<?php <?php
@ -1549,7 +1555,6 @@ class myaccounts
$ci->dbforge->add_column('tbl_vouchertypes', array('default_debits' => array('type' => 'VARCHAR', 'constraint' => 255))); $ci->dbforge->add_column('tbl_vouchertypes', array('default_debits' => array('type' => 'VARCHAR', 'constraint' => 255)));
} }
} }
function hasTransaction($type, $id) function hasTransaction($type, $id)
{ {
switch ($type) { switch ($type) {

View File

@ -5,7 +5,7 @@
<div class="col-3"> <div class="col-3">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"><?php echo isset($AccountCategory) ? 'Edit' : 'Create'; ?> <h5 class="m-0 card-title"><?php echo isset($AccountCategory) ? 'Edit' : 'Create'; ?>
<?php echo $pageTitle; ?> <?php echo $pageTitle; ?>
<!-- <a href="<?php //echo site_url("master/accategories/list"); <!-- <a href="<?php //echo site_url("master/accategories/list");
?>" class="btn btn-sm btn-primary float-right">List <?php //echo $pageTitle; ?>" class="btn btn-sm btn-primary float-right">List <?php //echo $pageTitle;
@ -34,7 +34,7 @@
<div class="form-group"> <div class="form-group">
<?php <?php
// $this->myaccounts->showFixedAccountsCategoriesCombo("parent_category_id", " Under", "parent_category_id", "status=1", $default = "", $CSSclass = ""); // $this->myaccounts->showFixedAccountsCategoriesCombo("parent_category_id", " Under", "parent_category_id", "status=1", $default = "", $CSSclass = "");
echo isset($AccountCategory) ? fillComboWithValue("parent_category_id", "Under", "parent_category_id", "tbl_accategories", "accategory_name", "accategory_id", $default = $AccountCategory->parent_category_id, $CSSclass = "", $multiple = false, $condition = "status=1") : $this->myaccounts->showFixedAccountsCategoriesCombo("parent_category_id", " Under", "parent_category_id", "status=1", $default = "", $CSSclass = ""); echo isset($AccountCategory) ? fillComboWithValue("parent_category_id", "Under", "parent_category_id", "tbl_accategories", "accategory_name", "accategory_id", $default = $AccountCategory->parent_category_id, $CSSclass = "", $multiple = false, $condition = "status=1") : $this->myaccounts->showFixedAccountsCategoriesCombo("parent_category_id", " Under <span style='color:#ff0000'>*</span>", "parent_category_id", "status=1", $default = "", $CSSclass = "");
?> ?>
@ -62,7 +62,7 @@
<div class="col-9"> <div class="col-9">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"><?php echo $pageTitle . 's'; ?> <h5 class="m-0 card-title"><?php echo $pageTitle . 's'; ?>
<!-- <a href="<?php //echo site_url("master/accategories/add_child"); <!-- <a href="<?php //echo site_url("master/accategories/add_child");
?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle; ?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle;
?></a> --> ?></a> -->
@ -77,8 +77,8 @@
<!-- <th class="col-3">Category</th> --> <!-- <th class="col-3">Category</th> -->
<th class="col-3"><?php myLang("Group Name"); ?></th> <th class="col-3"><?php myLang("Group Name"); ?></th>
<th class="col-3"><?php myLang("Under"); ?></th> <th class="col-3"><?php myLang("Under"); ?></th>
<th class="col-3"><?php myLang('Remarks');?></th> <th class="col-4"><?php myLang('Remarks');?></th>
<th class="col-2 text-center">Action</th> <th class="col-1 text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -14,9 +14,9 @@
<table class="table table-bordered table-striped longdataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th class="col-2">Type</th> <th class="col-1">Type</th>
<th>Category Name</th> <th>Category Name</th>
<td class="col-1">Action</th> <th class="col-1 text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -26,7 +26,7 @@
break; break;
endforeach; ?> endforeach; ?>
<?php if ($TableRow->parent_category_id == 0) : ?> <?php if ($TableRow->parent_category_id == 0) : ?>
<tr> <tr class="text-center">
<td><?php echo $TableRow->AccountGroup->acgroup_name; ?></td> <td><?php echo $TableRow->AccountGroup->acgroup_name; ?></td>
<td><?php echo $TableRow->accategory_name; ?></td> <td><?php echo $TableRow->accategory_name; ?></td>
<td><a href="<?php echo site_url("master/accategories/edit_parents/$id"); ?>" class="btn btn-info btn-xs"><i class="fas fa-edit"></i> </a> <td><a href="<?php echo site_url("master/accategories/edit_parents/$id"); ?>" class="btn btn-info btn-xs"><i class="fas fa-edit"></i> </a>

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-->
<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 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_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>
<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

@ -7,7 +7,7 @@
<div class="col-3"> <div class="col-3">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"><?php myLang('Create Account'); ?> <h5 class="m-0 card-title"><?php myLang('Create Account'); ?>
<?php //echo $pageTitle; <?php //echo $pageTitle;
?> ?>
@ -31,7 +31,7 @@
<div class="form-group"> <div class="form-group">
<?php <?php
// Assuming this PHP function shows a dropdown for account categories // Assuming this PHP function shows a dropdown for account categories
$this->myaccounts->showAccountsCategoriesWithParentsCombo("accategory_id", "Under", "accategory_id", "status=1", "", "select2", "required"); $this->myaccounts->showAccountsCategoriesWithParentsCombo("accategory_id", "Under <span class='text-danger'>*</span>", "accategory_id", "status=1", "", "select2", "required");
?> ?>
</div> </div>
</div> </div>
@ -135,7 +135,7 @@
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"> <h5 class="m-0 card-title">
<?php echo myLang('List Accounts'); ?> <?php echo myLang('List Accounts'); ?>
<?php //myLang($pageTitle); <?php //myLang($pageTitle);
?> ?>
@ -164,10 +164,10 @@
<tr> <tr>
<th class="col-1.5" rowspan="2"><?php myLang("Ledger"); ?></th> <th class="col-1.5 vm" rowspan="2"><?php myLang("Ledger"); ?></th>
<th class="col-1.5" rowspan="2"><?php myLang(" Group"); ?></th> <th class="col-1.5 vm" rowspan="2"><?php myLang(" Group"); ?></th>
<th colspan="2" class="col-3 text-center">Opening Balance</th> <th colspan="2" class="col-3 text-center">Opening Balance</th>
<th class="col-2 text-center" rowspan="2"><?php myLang("Action"); ?></th> <th class="col-1 text-center" rowspan="2"><?php myLang("Action"); ?></th>
</tr> </tr>
<tr> <tr>
@ -191,7 +191,7 @@
echo ($TableRow->cr_opening_balance > 0) ? myCurrency($TableRow->cr_opening_balance) : ""; ?></td> echo ($TableRow->cr_opening_balance > 0) ? myCurrency($TableRow->cr_opening_balance) : ""; ?></td>
<td class="text-center"> <td class="text-center">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-primary btn-xs" title="View"><i class="fas fa-eye"></i> </a> <!-- <a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-primary btn-xs" title="View"><i class="fas fa-eye"></i> </a> -->
<a href="<?php echo site_url("accounts/accountheads/edit/$id"); ?>" class="btn btn-info btn-xs" title="Edit"><i class="fas fa-edit"></i> </a> <a href="<?php echo site_url("accounts/accountheads/edit/$id"); ?>" class="btn btn-info btn-xs" title="Edit"><i class="fas fa-edit"></i> </a>
<a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs" title="Delete"><i class="fas fa-trash"></i> </a> <a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs" title="Delete"><i class="fas fa-trash"></i> </a>
</td> </td>

View File

@ -3,19 +3,16 @@ $drWidth = 250;
$crWidth = 250; $crWidth = 250;
$AccountCategories = $this->acc->getAccountCategories($acgroup_id); $AccountCategories = $this->acc->getAccountCategories($acgroup_id);
$array = json_decode(json_encode($AccountCategories), true); $array = json_decode(json_encode($AccountCategories), true);
$tree=buildCategoryTree($array, false); $tree = buildCategoryTree($array, false);
function buildCategoryTree($categories, $parent_id = 0, $showZero = true) function buildCategoryTree($categories, $parent_id = 0, $showZero = true)
{ {
$tree = array(); $tree = array();
foreach ($categories as $category) { foreach ($categories as $category) {
if ($category['parent_category_id'] == $parent_id) { if ($category['parent_category_id'] == $parent_id) {
$children = buildCategoryTree($categories, $category['accategory_id'], $showZero); $children = buildCategoryTree($categories, $category['accategory_id'], $showZero);
if (!empty($children)) { if (!empty($children)) {
$category['children'] = $children; $category['children'] = $children;
} }
if ($showZero && ($category['dr'] !== 0 || $category['cr'] !== 0)) { if ($showZero && ($category['dr'] !== 0 || $category['cr'] !== 0)) {
$tree[] = $category; $tree[] = $category;
} elseif (!$showZero && ($category['dr'] !== 0 && $category['cr'] !== 0)) { } elseif (!$showZero && ($category['dr'] !== 0 && $category['cr'] !== 0)) {
@ -23,24 +20,29 @@ function buildCategoryTree($categories, $parent_id = 0, $showZero = true)
} }
} }
} }
return $tree; return $tree;
} }
function displayCategoryTree($tree)
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><a href="'.site_url("accounts/reports/balance_by_group") . "?category=" . $category['accategory_id'] .'">' . $category['accategory_name'] . '</a></td>'; echo '<td class="col-6">'
echo '<td width="250">' . myCurrency($category['dr']) . '</td>'; . ($category['parent_category_id'] == 0
echo '<td>' . myCurrency($category['cr']) . '</td>'; ? "<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['cr']) . '</td>';
echo '</tr>'; echo '</tr>';
if (isset($category['children']) && !empty($category['children'])) { if (isset($category['children']) && !empty($category['children'])) {
echo '<tr>'; echo '<tr>';
echo '<td colspan="4">'; echo '<td colspan="4 ">';
displayCategoryTree($category['children']); displayCategoryTree($category['children']);
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
@ -55,10 +57,10 @@ function displayCategoryTree($tree) {
} }
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<?php //pre($tree); ?> <?php //pre($tree);
?>
<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">
@ -68,8 +70,8 @@ function displayCategoryTree($tree) {
<div class="card-body"> <div class="card-body">
<input type="checkbox" name="showZero" value="true" id="showZero"> <input type="checkbox" name="showZero" value="true" id="showZero">
<label for="showZero"> <label for="showZero">
Show Zero Balances Show Zero Balances
</label> </label>
<?php displayCategoryTree($tree); ?> <?php displayCategoryTree($tree); ?>
</div> </div>
</div> </div>
@ -77,8 +79,6 @@ function displayCategoryTree($tree) {
</div> </div>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<script> <script>
function toggleSubTable(row) { function toggleSubTable(row) {
@ -86,9 +86,5 @@ function displayCategoryTree($tree) {
subTable.style.display = subTable.style.display === 'none' ? 'table-row' : 'none'; subTable.style.display = subTable.style.display === 'none' ? 'table-row' : 'none';
} }
</script> </script>
</div> </div>
<!-- /.content -->
<!-- /.content -->

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>
@ -9,9 +11,8 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
} }
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="container-fluid"> <div class="container-fluid">
</div>
</div>
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
@ -27,16 +28,21 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
<th>Account</th> <th>Account</th>
<th width="<?php echo $drWidth; ?>">Dr</th> <th width="<?php echo $drWidth; ?>">Dr</th>
<th width="<?php echo $crWidth; ?>">Cr</th> <th width="<?php echo $crWidth; ?>">Cr</th>
<th class="col-1 text-center">Balance</th>
<th class="col-1 text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?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; ?>">
@ -44,7 +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"><?php echo myCurrency($AccountCategory->Balance); ?></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>
@ -52,20 +60,18 @@ $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 class="text-right"><?php echo myCurrency($balanceTotal); ?></td>
<td ></td>
</tr> </tr>
</thead> </thead>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<script> <script>
function toggleSubTable(row) { function toggleSubTable(row) {
@ -73,5 +79,4 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
subTable.style.display = subTable.style.display === 'none' ? 'table-row' : 'none'; subTable.style.display = subTable.style.display === 'none' ? 'table-row' : 'none';
} }
</script> </script>
</div> </div>

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

@ -1,5 +1,5 @@
<?php <?php
$t="INSERT INTO tbl_acgroups (acgroup_id, acgroup_code, acgroup_name, posting_side, created_on, created_by, remarks, status, display_order) $t = "INSERT INTO tbl_acgroups (acgroup_id, acgroup_code, acgroup_name, posting_side, created_on, created_by, remarks, status, display_order)
SELECT 5, '5', 'Equity', 'CR', '2023-05-22', 'admin', '', 1, 2 SELECT 5, '5', 'Equity', 'CR', '2023-05-22', 'admin', '', 1, 2
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT 1 FROM tbl_acgroups WHERE acgroup_id = 5 SELECT 1 FROM tbl_acgroups WHERE acgroup_id = 5
@ -12,16 +12,14 @@ $AssetsAccounts = $this->acc->getAccountsByGroup(1);
$LiabilitiesTotal = $this->acc->getAccountBalanceByGroup(2); $LiabilitiesTotal = $this->acc->getAccountBalanceByGroup(2);
$EquityTotal = $this->acc->getAccountBalanceByGroup(5); $EquityTotal = $this->acc->getAccountBalanceByGroup(5);
$AssetsTotal = $this->acc->getAccountBalanceByGroup(1, false); $AssetsTotal = $this->acc->getAccountBalanceByGroup(1, false);
$IncomeAccounts = $this->acc->getAccountsByGroup(3); $IncomeAccounts = $this->acc->getAccountsByGroup(3);
$ExpenseAccounts = $this->acc->getAccountsByGroup(4); $ExpenseAccounts = $this->acc->getAccountsByGroup(4);
$IncomesTotal = $this->acc->getAccountBalanceByGroup(3); $IncomesTotal = $this->acc->getAccountBalanceByGroup(3);
$ExpensesTotal = $this->acc->getAccountBalanceByGroup(4); $ExpensesTotal = $this->acc->getAccountBalanceByGroup(4);
$PL = $IncomesTotal - $ExpensesTotal; $PL = $IncomesTotal - $ExpensesTotal;
$LiabilitiesTotal=$LiabilitiesTotal+$EquityTotal+$PL; $LiabilitiesTotal = $LiabilitiesTotal + $EquityTotal + $PL;
?> ?>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
@ -39,13 +37,11 @@ $LiabilitiesTotal=$LiabilitiesTotal+$EquityTotal+$PL;
</thead> </thead>
<tbody> <tbody>
<tr class="bg-dark"> <tr class="bg-dark">
<th>Liabilities</th> <th>Liabilities</th>
<th class="col-2">Amount</th> <th class="col-2">Amount</th>
<th>Assets</th> <th>Assets</th>
<th class="col-2">Amount</th> <th class="col-2">Amount</th>
</tr> </tr>
<tr class="bg-light"> <tr class="bg-light">
<td colspan="2"> <td colspan="2">
<?php $this->acc->showTable($LiabilitiesAccounts); ?> <?php $this->acc->showTable($LiabilitiesAccounts); ?>
@ -54,33 +50,22 @@ $LiabilitiesTotal=$LiabilitiesTotal+$EquityTotal+$PL;
<td colspan="2"> <td colspan="2">
<?php $this->acc->showTable($AssetsAccounts, false); ?> <?php $this->acc->showTable($AssetsAccounts, false); ?>
</td> </td>
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>
<tr class="bg-light"> <tr class="bg-light">
<th>Net Profit:</th> <th>Net Profit:</th>
<th><?php echo myCurrency($PL); ?></th> <th><?php echo myCurrency($PL); ?></th>
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>
<tr class="bg-light"> <tr class="bg-light">
<th>Total Liabilities:</th> <th>Total Liabilities:</th>
<th><?php echo myCurrency($LiabilitiesTotal); ?></th> <th><?php echo myCurrency($LiabilitiesTotal); ?></th>
<th>Total Assets: </th> <th>Total Assets: </th>
<th><?php echo myCurrency($AssetsTotal); ?></th> <th><?php echo myCurrency($AssetsTotal); ?></th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
</div> </div>
</div> </div>

View File

@ -2,7 +2,6 @@
$this->load->library("BIBAccounts"); $this->load->library("BIBAccounts");
$BIBAccounts = new BIBAccounts(); $BIBAccounts = new BIBAccounts();
?> ?>
<style> <style>
table, table,
td, td,
@ -13,7 +12,6 @@ $BIBAccounts = new BIBAccounts();
.group-name { .group-name {
width: 40%; width: 40%;
font-weight: 600px;
} }
.group-total { .group-total {
@ -85,85 +83,90 @@ $BIBAccounts = new BIBAccounts();
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;
} }
.table1 {
border: 0px !important;
padding: 0;
margin: 10 !important;
width: 100%;
vertical-align: middle;
}
.table-responsive {
overflow-x: auto;
}
.card-body {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<section class="content"> <section class="content">
<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">
<h3 class="card-title"><?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 " 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">
<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 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>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <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="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>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div> </div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -178,110 +181,44 @@ $BIBAccounts = new BIBAccounts();
<!-- /.card-tools --> <!-- /.card-tools -->
</div> </div>
<!-- <div class="card-body">
<form method="post" action="" id="FilterForm">
<div class="row align-items-end">
<div class="col-2">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
</div>
<div class="col-2">
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showOB"><?php myLang("Opening"); ?></label>
<input type="checkbox" class="form-control " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "" : "CHECKED"; ?>>
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showClosing"><?php myLang("Closing"); ?></label>
<input type="checkbox" class="form-control " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "" : "CHECKED"; ?>>
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showPeriod"><?php myLang("Period"); ?></label>
<input type="checkbox" class="form-control " name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
</div>
</div>
<div class="col">
<div class="form-group d-flex justify-content-end">
<button type="submit" class="btn btn-primary mr-2">Filter</button>
<button type="submit" class="btn btn-success mr-2">Export</button>
<button type="button" class="btn btn-warning" onclick="resetForm()">Reset</button>
</div>
</div>
</div>
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "2078-4-1";
document.getElementById("toDate").value = "2079-3-32";
document.getElementById("showOB").checked = false;
document.getElementById("showClosing").checked = false;
document.getElementById("FilterForm").submit();
}
</script>
</div> -->
</div> </div>
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<div class="content"> <div class="content">
<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 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 pl-2 ">
<div class="card-body p-0"> <div class="row">
<?php <?php
// echo $_POST['showClosing'];
// echo $_POST['showClosing']; $ReportOptions = array(
$ReportOptions = array( 'showZeroBalances' => false,
'showZeroBalances' => false, 'showOB' => false,
'showOB' => false, 'showClosing' => true,
'showClosing' => true, 'showPeriod' => false,
'showPeriod' => false, );
); ?>
?> <?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
<?php $Side1Total = 0; ?>
<table class="table table-bordered"> <div class="col-6 p-0 m-0 gy-0">
<thead> <div class="table-responsive">
<tr> <table class="table mb-0 pb-0">
<td class="group-name"><b>Particulars</b></td> <thead>
<td class="group-total text-right pr-2 "><b>Amount</b></td> <tr>
<td class="group-name"><b>Particulars</b></td> <th class="group-name pl-1">Particulars</th>
<td class="group-total text-right pr-2"><b>Amount</b></td> <th class="group-total text-center col-1">Amount</th>
</tr>
</thead>
</tr> <tbody>
</thead>
<tbody>
<tr>
<td colspan="2" class="p-0">
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?> <?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
<?php $Side1Total = 0; ?> <?php $Side1Total = 0; ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable"> <?php
<?php
// Initialize variables for column totals // Initialize variables for column totals
$incomes_totalOpeningDr = 0; $incomes_totalOpeningDr = 0;
$incomes_totalOpeningCr = 0; $incomes_totalOpeningCr = 0;
@ -293,12 +230,11 @@ $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><b><?php echo $group->acgroup_name; ?></b></td> <td><b><?php echo $group->acgroup_name; ?></b></td>
<td width="20%"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td> <td width="20%"><?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>
@ -309,12 +245,8 @@ $BIBAccounts = new BIBAccounts();
$Side1Total += $group->closing_balance; $Side1Total += $group->closing_balance;
?> ?>
<?php endforeach; ?> <?php endforeach; ?>
</table> <?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(5); ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(5); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php <?php
// Initialize variables for column totals // Initialize variables for column totals
$incomes_totalOpeningDr = 0; $incomes_totalOpeningDr = 0;
@ -326,13 +258,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>
@ -343,13 +274,25 @@ $BIBAccounts = new BIBAccounts();
$Side1Total += $group->closing_balance; $Side1Total += $group->closing_balance;
?> ?>
<?php endforeach; ?> <?php endforeach; ?>
</table>
</td>
<td colspan="2" class="p-0"> </tbody>
</table>
</div>
</div>
<div class="col-6 p-0 m-0">
<div class="table-responsive">
<table class="table mt-0 pt-0">
<thead>
<tr>
<th class="group-name pl-1">Particulars</th>
<th class="group-total text-center col-1">Amount</th>
</tr>
</thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(1); ?> <?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(1); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php <?php
// Initialize variables for column totals // Initialize variables for column totals
$totalOpeningDr = 0; $totalOpeningDr = 0;
@ -361,12 +304,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 "><?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>
@ -382,161 +325,192 @@ $BIBAccounts = new BIBAccounts();
$totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0; $totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?> ?>
<?php endforeach; ?> <?php endforeach; ?>
</table>
</td> </tbody>
</tr>
</table>
<?php </div>
</div>
<?php
// pre($BIBAccounts->getAccountGroupsWithBalances(4)); // pre($BIBAccounts->getAccountGroupsWithBalances(4));
$TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance; $TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance;
$TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance; $TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance;
$PL = $TotalIncomes - $TotalExpenses; $PL = $TotalIncomes - $TotalExpenses;
$Side1Total += $PL; $Side1Total += $PL;
?> ?>
<div class="col-6 p-0 m-0 gy-0">
<table class="table">
<tr> <tr>
<td colspan="2" class="p-0"> <td><b> Profit/Loss</b></td>
<table class="table table-bordered">
<tr>
<td>Total Profit/Loss</td>
<td class="cr closing-cr"><?php echo myCurrency($PL); ?></td> <td class="cr closing-cr"><?php echo myCurrency($PL); ?></td>
</tr>
</table>
</td>
<td colspan="2" class="p-0">
</td>
</tr> </tr>
<tr> <tr>
<td colspan="2" class="p-0"> <td colspan="2" class="p-0">
<table class="table table-bordered"> <table class="table">
<tr> <tr>
<th>Total Amount</th> <th class="pl-1">Total Amount</th>
<th class="cr closing-cr"> <th class="cr closing-cr">
<?php echo myCurrency($Side1Total); ?> <?php echo myCurrency($Side1Total); ?>
</th> </th>
</tr> </tr>
</table> </table>
</td>
</tr>
</table>
</div>
<div class="col-6 p-0 m-0 gy-0">
<table class="table">
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
<tr>
<td colspan="2" class="p-0">
<table class="table">
<tr>
<th class="pl-1">Total Amount</th>
<th class="dr closing-dr">
<?php echo myCurrency($totalClosingDr); ?>
</th>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- <div class="col-12 p-0">
<table class="table">
<?php
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
// $TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance;
// $TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance;
// $PL = $TotalIncomes - $TotalExpenses;
// $Side1Total += $PL;
?>
<tr>
<td>Total Profit/Loss</td>
<td class="cr closing-cr"><?php echo myCurrency($PL); ?></td>
</tr>
<tr>
<td colspan="2" class="p-0">
<table class="table">
<tr>
<th class="pl-1">Total Amount</th>
<th class="cr closing-cr">
<?php echo myCurrency($Side1Total); ?>
</th>
</tr>
</table>
</td> </td>
<td colspan="2" class="p-0"> <td colspan="2" class="p-0">
<table class="table table-bordered"> <table class="table">
<tr> <tr>
<th>Total Amount</th> <th class="pl-1">Total Amount</th>
<th class="dr closing-dr"> <th class="dr closing-dr">
<?php echo myCurrency($totalClosingDr); ?> <?php echo myCurrency($totalClosingDr); ?>
</th> </th>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
</table>
</div> -->
</table>
<?php //pre($BIBAccounts->getAccountGroupsWithBalances($acgroup_id = null));
?>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> <?php
</div> function footerfunctions()
<?php {
function footerfunctions() ?>
{ <script>
?> $(document).ready(function() {
<script> // Prevent the dropdown from closing when clicking inside
$(document).ready(function() { $('.dropdown-menu').on('click', function(event) {
document.getElementById("toggleShowAll").click(); event.stopPropagation();
});
});
</script>
<script>
$(document).ready(function() {
document.getElementById("toggleShowAll").click();
});
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
e.preventDefault();
var nestedRows = document.getElementsByClassName("collapse");
for (var i = 0; i < nestedRows.length; i++) {
if (nestedRows[i].classList.contains("show")) {
nestedRows[i].classList.remove("show");
} else {
nestedRows[i].classList.add("show");
}
}
});
var exportButton = document.getElementById("exportButton");
exportButton.addEventListener("click", function() {
exportTableToCSV("table.csv");
});
}); function exportTableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) {
document.getElementById("toggleShowAll").addEventListener("click", function(e) { var row = [];
e.preventDefault(); var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
var nestedRows = document.getElementsByClassName("collapse"); // Check if the parent row is collapsed or hidden
for (var i = 0; i < nestedRows.length; i++) { var parentRow = rows[i].closest(".collapse");
if (nestedRows[i].classList.contains("show")) { var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
nestedRows[i].classList.remove("show"); if (isParentCollapsed) {
} else { continue; // Skip child table rows if parent is collapsed
nestedRows[i].classList.add("show"); }
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>
var exportButton = document.getElementById("exportButton"); $("#fromDate").nepaliDatePicker({
exportButton.addEventListener("click", function() { dateFormat: "%y-%m-%d",
exportTableToCSV("table.csv"); 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>
function exportTableToCSV(filename) { <?php
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

@ -0,0 +1,405 @@
<?php
$this->load->library("BIBAccounts");
$BIBAccounts = new BIBAccounts();
?>
<div class="content-wrapper">
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " 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 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">
<!-- <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 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 class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle
Collapse</button> -->
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</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>
<!-- /.card-tools -->
</div>
<!-- <div class="card-body">
<form method="post" action="" id="FilterForm">
<div class="row align-items-end">
<div class="col-2">
<div class="form-group">
<label for="fromDate"><?php //myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php //echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
</div>
<div class="col-2">
<div class="form-group">
<label for="toDate"><?php //myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php //echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showOB"><?php// myLang("Opening"); ?></label>
<input type="checkbox" class="form-control " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "" : "CHECKED"; ?>>
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showClosing"><?php //myLang("Closing"); ?></label>
<input type="checkbox" class="form-control " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "" : "CHECKED"; ?>>
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showPeriod"><?php //myLang("Period"); ?></label>
<input type="checkbox" class="form-control " name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
</div>
</div>
<div class="col">
<div class="form-group d-flex justify-content-end">
<button type="submit" class="btn btn-primary mr-2">Filter</button>
<button type="submit" class="btn btn-success mr-2">Export</button>
<button type="button" class="btn btn-warning" onclick="resetForm()">Reset</button>
</div>
</div>
</div>
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "2078-4-1";
document.getElementById("toDate").value = "2079-3-32";
document.getElementById("showOB").checked = false;
document.getElementById("showClosing").checked = false;
document.getElementById("FilterForm").submit();
}
</script>
</div> -->
</div>
</div><!-- /.container-fluid -->
</section>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<!-- <button class="btn btn-secondary toggle-collapse mr-2" id="toggleShowAll">Toggle Collapse</button> -->
<div class="card card-primary card-outline">
<div class="card-body p-0">
<?php
// echo $_POST['showClosing'];
$ReportOptions = array(
'showZeroBalances' => false,
'showOB' => false,
'showClosing' => true,
'showPeriod' => false,
);
?>
<table class="table table-bordered">
<thead>
<tr>
<td class="group-name "><b>Liabilities</b></td>
<td class="group-total text-right pr-2 "><b>Amount</b></td>
<td class="group-name"><b>Assets</b></td>
<td class="group-total text-right pr-2"><b>Amount</b></td>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="p-0">
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
<?php $Side1Total = 0; ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals
$incomes_totalOpeningDr = 0;
$incomes_totalOpeningCr = 0;
$incomes_totalThisYearDr = 0;
$incomes_totalThisYearCr = 0;
$incomes_totalClosingDr = 0;
$incomes_totalClosingCr = 0;
?>
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td><b><?php echo $group->acgroup_name; ?></b></td>
<td width="20%"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div>
</td>
</tr>
<?php
// Update column totals
$Side1Total += $group->closing_balance;
?>
<?php endforeach; ?>
</table>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(5); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals
$incomes_totalOpeningDr = 0;
$incomes_totalOpeningCr = 0;
$incomes_totalThisYearDr = 0;
$incomes_totalThisYearCr = 0;
$incomes_totalClosingDr = 0;
$incomes_totalClosingCr = 0;
?>
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name"><b><?php echo $group->acgroup_name; ?></b></td>
<td class="group-total"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div>
</td>
</tr>
<?php
// Update column totals
$Side1Total += $group->closing_balance;
?>
<?php endforeach; ?>
</table>
</td>
<td colspan="2" class="p-0">
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(1); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals
$totalOpeningDr = 0;
$totalOpeningCr = 0;
$totalThisYearDr = 0;
$totalThisYearCr = 0;
$totalClosingDr = 0;
$totalClosingCr = 0;
?>
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name"><b><?php echo $group->acgroup_name; ?></b></td>
<td class="group-total text-right pr-2"><?php echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0); ?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div>
</td>
</tr>
<?php
// Update column totals
$totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0;
$totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0;
$totalThisYearDr += ($group->posting_side == "DR") ? $group->regular_balance : 0;
$totalThisYearCr += ($group->posting_side == "CR") ? $group->regular_balance : 0;
$totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0;
$totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?>
<?php endforeach; ?>
</table>
</td>
</tr>
<?php
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
$TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance;
$TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance;
$PL = $TotalIncomes - $TotalExpenses;
$Side1Total += $PL;
?>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<td>Total Profit/Loss</td>
<td class="cr closing-cr"><?php echo myCurrency($PL); ?></td>
</tr>
</table>
</td>
<td colspan="2" class="p-0">
</td>
</tr>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Amount</th>
<th class="cr closing-cr">
<?php echo myCurrency($Side1Total); ?>
</th>
</tr>
</table>
</td>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Amount</th>
<th class="dr closing-dr">
<?php echo myCurrency($totalClosingDr); ?>
</th>
</tr>
</table>
</td>
</tr>
</table>
<?php //pre($BIBAccounts->getAccountGroupsWithBalances($acgroup_id = null));
?>
</div>
</div>
</div>
</div>
</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>
$(document).ready(function() {
document.getElementById("toggleShowAll").click();
});
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
e.preventDefault();
var nestedRows = document.getElementsByClassName("collapse");
for (var i = 0; i < nestedRows.length; i++) {
if (nestedRows[i].classList.contains("show")) {
nestedRows[i].classList.remove("show");
} else {
nestedRows[i].classList.add("show");
}
}
});
var exportButton = document.getElementById("exportButton");
exportButton.addEventListener("click", function() {
exportTableToCSV("table.csv");
});
function exportTableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) {
var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed
}
for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue);
}
csv.push(row.join(","));
}
// Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", filename);
document.body.appendChild(link);
link.click();
}
</script>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<?php
}

View File

@ -8,9 +8,7 @@ $ExpenseAccounts = $this->acc->getAccountsByGroup(4);
$IncomesTotal = $this->acc->getAccountBalanceByGroup(3); $IncomesTotal = $this->acc->getAccountBalanceByGroup(3);
$ExpensesTotal = $this->acc->getAccountBalanceByGroup(4); $ExpensesTotal = $this->acc->getAccountBalanceByGroup(4);
$PL = $IncomesTotal - $ExpensesTotal; $PL = $IncomesTotal - $ExpensesTotal;
?> ?>
<style> <style>
table, table,
td, td,
@ -92,78 +90,97 @@ $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;
} }
.table1 {
border: 0px !important;
padding: 0;
margin: 10 !important;
width: 100%;
vertical-align: middle;
}
.table-responsive {
overflow-x: auto;
}
.card-body {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
}
.card-body.p-0 .table tbody>tr>td:last-of-type, .card-body.p-0 .table tbody>tr>th:last-of-type, .card-body.p-0 .table tfoot>tr>td:last-of-type, .card-body.p-0 .table tfoot>tr>th:last-of-type, .card-body.p-0 .table thead>tr>td:last-of-type, .card-body.p-0 .table thead>tr>th:last-of-type {
padding-right:0!important;
}
.text-bold{
font-weight: 900;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<section class="content"> <section class="content">
<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 ">
<h3 class="card-title">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 -->
<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" 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>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <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="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>
<!-- <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>
@ -171,10 +188,9 @@ $PL = $IncomesTotal - $ExpensesTotal;
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</div> </div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
<!-- <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>
function resetForm() { function resetForm() {
@ -230,9 +246,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
document.getElementById("fromDate").value = "2078-4-1"; document.getElementById("fromDate").value = "2078-4-1";
@ -242,31 +256,28 @@ $PL = $IncomesTotal - $ExpensesTotal;
document.getElementById("FilterForm").submit(); document.getElementById("FilterForm").submit();
} }
</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>
</div> --> </div> -->
<div class="card-body table-responsive p-0"> <div class="card-body table-responsive p-0">
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?> <?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
<table class="table table-head-fixed table-bordered g-0"> <table class="table table-bordered p-0 ">
<thead> <thead>
<tr> <tr>
<th class="" width="35%"><?php myLang("Cash inflow"); ?></th> <th class="" width="30%"><?php myLang("Cash inflow"); ?></th>
<th class="text-right" width="15%"></th> <th class="text-right" width="10%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th> <th class="text-right pr-1" width="10%"><?php myLang("Amount"); ?></th>
<th class="" width="35%"><?php echo myLang("Cash outflow"); ?></th> <th class="pl-2" width="30%"><?php echo myLang("Cash outflow"); ?></th>
<th class="text-right" width="15%"></th> <th class="text-right" width="10%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th> <th class="text-right pr-1" width="10%"><?php myLang("Amount"); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -274,37 +285,35 @@ $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>
<td width="15%"></td> <td width="15%"></td>
<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="" width="70%"><b><?php echo $Incomes['category']; ?></b></td> <td class="" width="60%"><b><?php echo $Incomes['category']; ?></b></td>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td> <td width="20%"></td>
<td width="15%"></td> <td class="text-right " width="20%"><?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="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td> <td class="" width="60%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td>
<td width="15%"></td> <td class="text-right " width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td> <td width="20%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php $counter = $index ?>
<?php }; ?> <?php }; ?>
</table> </table>
</td> </td>
<td colspan=3 class="p-0"> <td colspan=3 class="p-0">
<table class="table g-0"> <table class="table p-0">
<?php $total = 0; <?php $total = 0;
foreach ($IncomesExpenses['Expenses'] as $Expenses) { foreach ($IncomesExpenses['Expenses'] as $Expenses) {
if ($Expenses['account'] == "GROUP TOTAL") : ?> if ($Expenses['account'] == "GROUP TOTAL") : ?>
@ -312,53 +321,41 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td class="" width="70%"><b><?php echo $Expenses['group']; ?></b></td> <td class="" width="70%"><b><?php echo $Expenses['group']; ?></b></td>
<td width="15%"></td> <td width="15%"></td>
<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="60%"><b><?php echo $Expenses['category']; ?></b></td>
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <td width="20%"></td>
<td width="15%"></td> <td class="text-right " width="20%"><?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="60%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td>
<td width="15%"></td> <td class="text-right" width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <td width="20%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php }; ?> <?php }; ?>
</table> </table>
</td> </td>
</tr> </tr>
</tbody> </tbody>
<tr> <tr>
<th>Total</th> <th class="p-1">Total</th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($total1); ?></td> <td class="text-right text-bold"><?php echo myCurrency($total1); ?></td>
<th class="p-1">Total</th>
<th>Total</th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($total); ?></td> <td class="text-right text-bold"><?php echo myCurrency($total); ?></td>
</tr> </tr>
<tr> <tr>
<th></th> <th></th>
<td></td> <td></td>
<td class="text-right"></td> <td class="text-right"></td>
<th class="pl-1">Net Inflow</th>
<th>Net Inflow</th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($total1 - $total); ?></td> <td class="text-right text-bold"><?php echo myCurrency($total1 - $total); ?></td>
</tr> </tr>
<?php $Bank = $BIBAccounts->getAccountCategoriesWithBalances(null, 2); ?> <?php $Bank = $BIBAccounts->getAccountCategoriesWithBalances(null, 2); ?>
<?php foreach ($Bank->accounts as $account) : ?> <?php foreach ($Bank->accounts as $account) : ?>
@ -366,54 +363,102 @@ $PL = $IncomesTotal - $ExpensesTotal;
<th></th> <th></th>
<td></td> <td></td>
<td class="text-right"></td> <td class="text-right"></td>
<th class="pl-1"><?php echo $account->account_name; ?></th>
<th><?php echo $account->account_name; ?></th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($account->balances['dr_total'] - $account->balances['cr_total']); ?></td> <td class="text-right text-bold"><?php echo myCurrency($account->balances['dr_total'] - $account->balances['cr_total']); ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php $Cash = $BIBAccounts->getAccountCategoriesWithBalances(null, 3); ?> <?php $Cash = $BIBAccounts->getAccountCategoriesWithBalances(null, 3); ?>
<?php foreach ($Cash->accounts as $account) : ?> <?php foreach ($Cash->accounts as $account) : ?>
<tr> <tr>
<th></th> <th></th>
<td></td> <td></td>
<td class="text-right"></td> <td class="text-right"></td>
<th class="pl-1"><?php echo $account->account_name; ?></th>
<th><?php echo $account->account_name; ?></th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($account->balances['dr_total'] - $account->balances['cr_total']); ?></td> <td class="text-right text-bold"><?php echo myCurrency($account->balances['dr_total'] - $account->balances['cr_total']); ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</table> </table>
<?php //pre($IncomesExpenses); <?php //pre($IncomesExpenses);
?> ?>
</div> </div>
</div> </div>
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<?php function footerFunctions()
<?php function footerFunctions() { ?>
{ ?> <script>
<script> $(document).ready(function() {
$("#fromDate").nepaliDatePicker({ // Prevent the dropdown from closing when clicking inside
dateFormat: "%y-%m-%d", $('.dropdown-menu').on('click', function(event) {
closeOnDateSelect: true, event.stopPropagation();
minDate: $('#fromDate').data('start'), });
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

@ -1,24 +1,94 @@
<style>
.mt-26 {
margin-top: 26px;
}
</style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<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"> <div class="card-header">
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<h5 class="m-0"><?php echo $pageTitle; ?> </h5> <div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</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">
<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">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="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button>
</div>
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</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 class="card-body"> <div class="card-body">
<form method="GET" action=""> <form method="GET" action="">
<div class="row"> <div class="row">
<div class="col-2"><?php createNepaliDateInput("from_date", "Date", "from_date", isset($_GET['from_date']) ? $_GET['from_date'] : ''); ?></div> <div class="col-2"><?php createNepaliDateInput("from_date", "Date", "from_date", isset($_GET['from_date']) ? $_GET['from_date'] : ''); ?></div>
<div class="col-1"><?php createButton("show_voucher", "Show", "show_voucher", "Submit", "mt-30"); ?></div> <div class="col-1"><?php createButton("show_voucher", "Show", "show_voucher", "Submit", "mt-26 btn btn-block btn-primary btn-sm "); ?></div>
</div> </div>
</form> </form>
<div id="dataTable_Commands"></div> <div id="dataTable_Commands"></div>
@ -30,8 +100,6 @@
$vouchertype_id = isset($_GET['vouchertypes']) ? $_GET['vouchertypes'] : ''; $vouchertype_id = isset($_GET['vouchertypes']) ? $_GET['vouchertypes'] : '';
$this->myaccounts->listVouchers($fromDate, $fromDate, $account_id, $vouchertype_id, true, true); $this->myaccounts->listVouchers($fromDate, $fromDate, $account_id, $vouchertype_id, true, true);
?> ?>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,5 +1,4 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
@ -15,8 +14,8 @@
</div> --> </div> -->
<div class="col"> <div class="col">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header bg-primary disabled color-palette"> <div class="card-header disabled color-palette">
<h3 class="card-title m-0"><?php echo $pageTitle; ?></h3> <h5 class="card-title m-0"><?php echo $pageTitle; ?></h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
@ -79,7 +78,6 @@ $tree .= "]";
var id = $(this).attr("id").substr(8); var id = $(this).attr("id").substr(8);
showLedger(id); showLedger(id);
}); });
function getAccounts(id) { function getAccounts(id) {
$("#accountsContainer").empty(); $("#accountsContainer").empty();
$.ajax({ $.ajax({
@ -94,7 +92,6 @@ $tree .= "]";
}); });
} }
getAccountsAll(); getAccountsAll();
function getAccountsAll() { function getAccountsAll() {
$("#accountsContainer").html(""); $("#accountsContainer").html("");
$.ajax({ $.ajax({
@ -107,7 +104,6 @@ $tree .= "]";
} }
}); });
} }
function showLedger(id) { function showLedger(id) {
// $("#accountsContainer").html(""); // $("#accountsContainer").html("");
alert(id); alert(id);

View File

@ -1,70 +1,58 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<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 bg-primary disabled color-palette"> <div class="card-header bg-primary disabled color-palette">
<h3 class="card-title m-0"><?php echo $pageTitle; ?></h3> <h3 class="card-title m-0"><?php echo $pageTitle; ?></h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<form method="GET" action="#"> <form method="GET" action="#">
<div class="row"> <div class="row">
<div class="col"><?php createNepaliDateInput("from_date", "", "from_date", isset($fromDate_Nepali) ? $fromDate_Nepali : firstDayOfNepaliMonth()); ?></div> <div class="col"><?php createNepaliDateInput("from_date", "", "from_date", isset($fromDate_Nepali) ? $fromDate_Nepali : firstDayOfNepaliMonth()); ?></div>
<div class="col"><?php createNepaliDateInput("to_date", "", "to_date", isset($toDate_Nepali) ? $toDate_Nepali : ''); ?></div> <div class="col"><?php createNepaliDateInput("to_date", "", "to_date", isset($toDate_Nepali) ? $toDate_Nepali : ''); ?></div>
<div class="col"><?php $this->myaccounts->showAccountsCombo("account_id", "", "account_id", "status=1", isset($_GET['account_id']) ? $_GET['account_id'] : 1, $CSSclass = ""); ?> </div> <div class="col"><?php $this->myaccounts->showAccountsCombo("account_id", "", "account_id", "status=1", isset($_GET['account_id']) ? $_GET['account_id'] : 1, $CSSclass = ""); ?> </div>
<div class="col"><?php createButton("show_ledger", "Show Ledger", "show_ledger","Submit", "btn btn-primary"); ?></div> <div class="col"><?php createButton("show_ledger", "Show Ledger", "show_ledger", "Submit", "btn btn-primary"); ?></div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div id="dataTable_Commands"> <div id="dataTable_Commands">
</div>
</div> <?php
<?php if (!isset($account_id)) {
if(!isset($account_id)){ $account_id = 1;
$account_id = 1; }
} ?>
?> <?php if (isset($account_id) && $account_id != "") {
$fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth());
<?php if (isset($account_id) && $account_id != "") { $toDate = isset($_GET['to_date']) ? $_GET['to_date'] : Today();
$fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth()); $this->myaccounts->showLedger($account_id, $fromDate, $toDate, $fiscalStart, $fiscalEnd);
$toDate = isset($_GET['to_date']) ? $_GET['to_date'] : Today(); } ?>
$this->myaccounts->showLedger($account_id, $fromDate, $toDate); <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 fade" id="ledgerdetails_box" tabindex="-1" role="dialog" aria-labelledby="ledgerdetails_box" aria-hidden="true"> <div class="modal-content">
<div class="modal-dialog modal-xl" role="document"> <div class="modal-header">
<div class="modal-content"> <h5 class="modal-title" id="exampleModalLabel">Ledger Details</h5>
<div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<h5 class="modal-title" id="exampleModalLabel">Ledger Details</h5> <span aria-hidden="true">&times;</span>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> </button>
<span aria-hidden="true">&times;</span> </div>
</button> <div class="modal-body" id="details_container">
</div> Ledger Details Goes Here
<div class="modal-body" id="details_container"> </div>
Ledger Details Goes Here <div class="modal-footer">
</div> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<div class="modal-footer"> <button type="button" class="btn btn-success" data-dismiss="modal">Print</button>
<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> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -3,9 +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 bg-primary disabled color-palette"> <div class="card-header disabled color-palette">
<h3 class="card-title"><?php echo $pageTitle; ?> </h3> <h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " 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 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">
<!-- <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 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 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">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</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 class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
@ -16,11 +89,11 @@
<?php <?php
$accategory_id = 3; $accategory_id = 3;
$CI = &get_instance(); $CI = &get_instance();
$CI->db->where("status", 1)->where("accategory_id = 2"); $CI->db->where("status", 1)->where("accategory_id = 2");
$CI->db->order_by("account_name ASC"); $CI->db->order_by("account_name ASC");
$Accounts = $CI->db->get("tbl_accounts")->result(); $Accounts = $CI->db->get("tbl_accounts")->result();
foreach ($Accounts as $Account) { foreach ($Accounts as $Account) {
$Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row(); $Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row();
$Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row(); $Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row();
@ -35,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'>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'>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;
@ -43,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='col-2 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\">
@ -85,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

@ -4,8 +4,81 @@
<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 bg-primary disabled color-palette"> <div class="card-header disabled color-palette">
<h3 class="card-title"><?php echo $pageTitle; ?> </h3> <h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " 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 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">
<!-- <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 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 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">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</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 class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
@ -16,12 +89,12 @@
<?php <?php
$accategory_id = 3; $accategory_id = 3;
$CI = &get_instance(); $CI = &get_instance();
// $CI->db->where("status", 1)->where("(accategory_id = 2 OR accategory_id = 3)"); // $CI->db->where("status", 1)->where("(accategory_id = 2 OR accategory_id = 3)");
$CI->db->where("status", 1)->where("accategory_id = 3"); $CI->db->where("status", 1)->where("accategory_id = 3");
$CI->db->order_by("account_name ASC"); $CI->db->order_by("account_name ASC");
$Accounts = $CI->db->get("tbl_accounts")->result(); $Accounts = $CI->db->get("tbl_accounts")->result();
foreach ($Accounts as $Account) { foreach ($Accounts as $Account) {
$Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row(); $Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row();
$Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row(); $Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row();
@ -36,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'>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'>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;
@ -44,30 +117,30 @@
$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='col-2 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\">
<div class=\"modal-content\"> <div class=\"modal-content\">
<div class=\"modal-header\"> <div class=\"modal-header\">
<h5 class=\"modal-title\" id=\"exampleModalLabel\">Ledger Details</h5> <h5 class=\"modal-title\" id=\"exampleModalLabel\">Ledger Details</h5>
<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"> <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">
<span aria-hidden=\"true\">&times;</span> <span aria-hidden=\"true\">&times;</span>
</button> </button>
</div> </div>
<div class=\"modal-body\" id=\"details_container\"> <div class=\"modal-body\" id=\"details_container\">
Ledger Details Goes Here Ledger Details Goes Here
</div> </div>
<!--<div class=\"modal-footer\"> <!--<div class=\"modal-footer\">
<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button> <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button>
<button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button> <button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button>
</div>--> </div>-->
</div> </div>
</div> </div>
</div>"; </div>";
$html .= '<script>function showLedger(id) {$.ajax({url: \''; $html .= '<script>function showLedger(id) {$.ajax({url: \'';
$html .= site_url("accounts/reports/ajax/getledgersummary/"); $html .= site_url("accounts/reports/ajax/getledgersummary/");
$html .= '\' + id,success: function(data) {$(\'#ledgerdetails_box #details_container\').html(data);$(\'#ledgerdetails_box\').modal(\'show\');}});}</script>'; $html .= '\' + id,success: function(data) {$(\'#ledgerdetails_box #details_container\').html(data);$(\'#ledgerdetails_box\').modal(\'show\');}});}</script>';
@ -86,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

@ -6,7 +6,7 @@
<div class="col"> <div class="col">
<div class="card card-primary card-outline "> <div class="card card-primary card-outline ">
<div class="card-header bg-primary disabled color-palette"> <div class="card-header disabled color-palette">
<h5 class="m-0"><?php echo $pageTitle; ?> </h5> <h5 class="m-0"><?php echo $pageTitle; ?> </h5>
</div> </div>

View File

@ -1,15 +1,12 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<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 bg-primary disabled color-palette"> <div class="card-header disabled color-palette">
<h5 class="m-0"><?php echo $pageTitle; ?></h5> <h5 class="m-0"><?php echo $pageTitle; ?></h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
@ -18,9 +15,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -28,13 +22,9 @@
</div> </div>
</div> </div>
</div> </div>
<?php function footerFunctions() <?php function footerFunctions()
{ {
?> ?>
<?php <?php
} }
?> ?>

View File

@ -4,7 +4,7 @@
<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 bg-primary disabled color-palette"> <div class="card-header disabled color-palette">
<h3 class="card-title"><?php echo $pageTitle; ?> </h3> <h3 class="card-title"><?php echo $pageTitle; ?> </h3>
</div> </div>
<div class="card-body"> <div class="card-body">

View File

@ -0,0 +1,430 @@
<?php
$this->load->library("BIBAccounts");
$BIBAccounts = new BIBAccounts();
?>
<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<!-- Include jQuery UI -->
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<style>
table,
td,
tr {
padding: 0px;
margin: 0px;
}
.group-name {
width: 40%;
}
.group-total {
width: 10%;
}
.table-gray {
background-color: #eee;
}
.table td,
.table th {
padding: 0px;
margin: 0px;
}
.bg-darker {
background-color: #ddd;
}
td .table {
border: 0px !important;
margin-bottom: 0rem;
}
table td:first-child {
padding-left: 5px;
}
.table-bordered.vertical-borders td,
.table-bordered.vertical-borders th {
border-left: 1px solid #dee2e6;
border-right: 1px solid #dee2e6;
}
.table-bordered.vertical-borders thead th {
padding: 0.25rem;
border-top: none;
border-bottom: 2px solid #dee2e6;
}
.table-bordered.vertical-borders tfoot th {
padding: 0.25rem;
border-top: 2px solid #dee2e6;
border-bottom: none;
}
.currency {
font-weight: normal !important;
}
.underline {
text-decoration: underline;
}
.form-control {
display: block;
width: 100%;
height: calc(1.5rem + 1px);
padding: 0.375rem 0.75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: 0.25rem;
box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
</style>
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="card card-primary card-outline ">
<div class="card-header">
<h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report");
?></h2>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " 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 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">
<!-- <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 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 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">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</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>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<div class="card card-primary card-outline ">
<div class="card-body p-0">
<?php
// echo $_POST['showClosing'];
$ReportOptions = array(
'showZeroBalances' => false,
'showOB' => false,
'showClosing' => true,
'showPeriod' => false,
);
// die;
?>
<table class="table table-bordered">
<thead>
<tr>
<th class="group-name" width="85%">Particulars</th>
<th class="group-total text-center" width="10%">Amount</th>
<th class="group-name" width="85%">Particulars</th>
<th class="group-total text-center" width="15%">Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="p-0">
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(3); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals
$incomes_totalOpeningDr = 0;
$incomes_totalOpeningCr = 0;
$incomes_totalThisYearDr = 0;
$incomes_totalThisYearCr = 0;
$incomes_totalClosingDr = 0;
$incomes_totalClosingCr = 0;
?>
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name"><b><?php //echo $group->acgroup_name;
?></b></td>
<td class="group-total text-right"><?php //echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0);
?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0" width="85%">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div>
</td>
</tr>
<?php
// Update column totals
$incomes_totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0;
$incomes_totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0;
$incomes_totalThisYearDr += ($group->posting_side == "DR") ? $group->regular_balance : 0;
$incomes_totalThisYearCr += ($group->posting_side == "CR") ? $group->regular_balance : 0;
$incomes_totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0;
$incomes_totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?>
<?php endforeach; ?>
</table>
</td>
<td colspan="2" class="p-0">
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(4); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals
$totalOpeningDr = 0;
$totalOpeningCr = 0;
$totalThisYearDr = 0;
$totalThisYearCr = 0;
$totalClosingDr = 0;
$totalClosingCr = 0;
?>
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name" width="85%"> <?php //echo $group->acgroup_name;
?></td>
<td class="group-total" width="15%"><?php //echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0);
?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<i> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</i>
</div>
</td>
</tr>
<?php
// Update column totals
$totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0;
$totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0;
$totalThisYearDr += ($group->posting_side == "DR") ? $group->regular_balance : 0;
$totalThisYearCr += ($group->posting_side == "CR") ? $group->regular_balance : 0;
$totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0;
$totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?>
<?php endforeach; ?>
</table>
</td>
</tr>
<?php $PL = $incomes_totalClosingCr - $totalClosingDr; ?>
<?php if ($incomes_totalClosingCr > $totalClosingDr) : ?>
<tr>
<td colspan="2" width="15%">
</td>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Profit</th>
<th class="cr closing-cr text-right"><?php echo myCurrency($PL); ?></th>
</tr>
</table>
</td>
</tr>
<?php else : ?>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Loss</th>
<th class="cr closing-cr"><?php echo myCurrency(abs($PL)); ?></th>
</tr>
</table>
</td>
<td colspan="2">
</td>
</tr>
<?php endif; ?>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Incomes</th>
<th class="cr closing-cr">
<?php if ($PL > 0) : ?>
<?php echo myCurrency($incomes_totalClosingCr); ?>
<?php else : ?>
<?php echo myCurrency($incomes_totalClosingCr + abs($PL)); ?>
<?php endif; ?>
</th>
</tr>
</table>
</td>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Expenses</th>
<th class="dr closing-dr">
<?php if ($PL > 0) : ?>
<?php echo myCurrency($totalClosingDr + abs($PL)); ?>
<?php else : ?>
<?php echo myCurrency($totalClosingDr); ?>
<?php endif; ?>
</th>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script>
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");
}
}
});
var exportButton = document.getElementById("exportButton");
exportButton.addEventListener("click", function() {
exportTableToCSV("table.csv");
});
function exportTableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) {
var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed
}
for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue);
}
csv.push(row.join(","));
}
// Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", filename);
document.body.appendChild(link);
link.click();
}
</script>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<?php
}
?>

View File

@ -4,7 +4,6 @@ $BIBAccounts = new BIBAccounts();
?> ?>
<!-- Include jQuery --> <!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<!-- Include jQuery UI --> <!-- Include jQuery UI -->
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
@ -89,76 +88,94 @@ $BIBAccounts = new BIBAccounts();
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;
} }
.table1 {
border: 0px !important;
padding: 0;
margin: 10 !important;
width: 100%;
vertical-align: middle;
}
.table-responsive {
overflow-x: auto;
}
.card-body {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
}
.text-bold{
font-weight: 900;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<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"><?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">
<!-- 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 " 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>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <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="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>
<!-- <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>
@ -166,10 +183,8 @@ $BIBAccounts = new BIBAccounts();
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</div> </div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -185,47 +200,36 @@ $BIBAccounts = new BIBAccounts();
</div> </div>
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<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 pl-2 pr-2">
<div class="card-body p-0"> <div class="row">
<?php
<?php // echo $_POST['showClosing'];
$ReportOptions = array(
// echo $_POST['showClosing']; 'showZeroBalances' => false,
$ReportOptions = array( 'showOB' => false,
'showZeroBalances' => false, 'showClosing' => true,
'showOB' => false, 'showPeriod' => false,
'showClosing' => true, );
'showPeriod' => false, // die;
); ?>
// die; <div class="col-6 p-0">
?> <div class="table-responsive">
<table class="table table-bordered"> <table class="table ">
<thead> <thead>
<tr> <tr>
<th class="group-name" width="85%">Particulars</th> <th class="group-name pl-1">Particulars</th>
<th class="group-total text-center" width="10%">Amount</th> <th class="group-total text-center col-1">Amount</th>
<th class="group-name" width="85%">Particulars</th> </tr>
<th class="group-total text-center" width="15%">Amount</th> </thead>
<tbody>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="p-0">
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(3); ?> <?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(3); ?>
<?php
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals // Initialize variables for column totals
$incomes_totalOpeningDr = 0; $incomes_totalOpeningDr = 0;
$incomes_totalOpeningCr = 0; $incomes_totalOpeningCr = 0;
@ -235,23 +239,16 @@ $BIBAccounts = new BIBAccounts();
$incomes_totalClosingCr = 0; $incomes_totalClosingCr = 0;
?> ?>
<?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>
<td class="group-name"><b><?php //echo $group->acgroup_name; <td colspan="2" class="p-0">
?></b></td> <div id="group_<?php echo $group->acgroup_id; ?>" class="">
<td class="group-total text-right"><?php //echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0);
?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0" width="85%">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
<?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>
</td> </td>
</tr>
<?php </tr>
<?php
// Update column totals // Update column totals
$incomes_totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0; $incomes_totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0;
$incomes_totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0; $incomes_totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0;
@ -259,16 +256,42 @@ $BIBAccounts = new BIBAccounts();
$incomes_totalThisYearCr += ($group->posting_side == "CR") ? $group->regular_balance : 0; $incomes_totalThisYearCr += ($group->posting_side == "CR") ? $group->regular_balance : 0;
$incomes_totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0; $incomes_totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0;
$incomes_totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0; $incomes_totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?> ?>
<?php endforeach; ?>
</table> <?php endforeach; ?>
</td>
<td colspan="2" class="p-0">
</tbody>
<tfoot>
<?php $PL = $incomes_totalClosingCr - $incomes_totalClosingDr; ?>
<tr>
<th class="p-1">Total Incomes</th>
<th class="cr closing-cr text-bold">
<?php if ($PL > 0) : ?>
<?php echo myCurrency($incomes_totalClosingCr); ?>
<?php else : ?>
<?php echo myCurrency($incomes_totalClosingCr + abs($PL)); ?>
<?php endif; ?>
</th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="col-6 p-0">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="group-name pl-1">Particulars</th>
<th class="group-total text-center col-1">Amount</th>
</tr>
</thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(4); ?> <?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(4); ?>
<?php
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals // Initialize variables for column totals
$totalOpeningDr = 0; $totalOpeningDr = 0;
$totalOpeningCr = 0; $totalOpeningCr = 0;
@ -278,22 +301,16 @@ $BIBAccounts = new BIBAccounts();
$totalClosingCr = 0; $totalClosingCr = 0;
?> ?>
<?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>
<td class="group-name" width="85%"> <?php //echo $group->acgroup_name; <td colspan="2" class="p-0">
?></td> <div id="group_<?php echo $group->acgroup_id; ?>" class="">
<td class="group-total" width="15%"><?php //echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0);
?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
<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>
</div> </div>
</td> </td>
</tr> </tr>
<?php <?php
// Update column totals // Update column totals
$totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0; $totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0;
$totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0; $totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0;
@ -303,88 +320,37 @@ $BIBAccounts = new BIBAccounts();
$totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0; $totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?> ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php $PL = $incomes_totalClosingCr - $totalClosingDr; ?>
</table>
</td>
</tr>
<?php $PL = $incomes_totalClosingCr - $totalClosingDr; ?>
<?php if ($incomes_totalClosingCr > $totalClosingDr) : ?> <?php if ($incomes_totalClosingCr > $totalClosingDr) : ?>
<tr> <tr>
<td colspan="2" width="15%"> <!-- <th></th>
<th></th> -->
<th class="pl-1">Total Profit</th>
</td> <th class="cr closing-cr text-right text-bold"><?php echo myCurrency($PL); ?></th>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Profit</th>
<th class="cr closing-cr text-right"><?php echo myCurrency($PL); ?></th>
</tr>
</table>
</td>
</tr>
<?php else : ?>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Loss</th>
<th class="cr closing-cr"><?php echo myCurrency(abs($PL)); ?></th>
</tr>
</table>
</td>
<td colspan="2">
</td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<tr> </tbody>
<td colspan="2" class="p-0"> <tfoot>
<table class="table table-bordered"> <th class="pl-1">Total Expenses</th>
<tr> <th class="dr closing-dr text-bold">
<th>Total Incomes</th>
<th class="cr closing-cr">
<?php if ($PL > 0) : ?> <?php if ($PL > 0) : ?>
<?php echo myCurrency($incomes_totalClosingCr); ?> <?php echo myCurrency($totalClosingDr + abs($PL)); ?>
<?php else : ?>
<?php echo myCurrency($incomes_totalClosingCr + abs($PL)); ?>
<?php endif; ?>
</th>
</tr>
</table>
</td>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Expenses</th>
<th class="dr closing-dr">
<?php if ($PL > 0) : ?>
<?php echo myCurrency($totalClosingDr + abs($PL)); ?>
<?php else : ?> <?php else : ?>
<?php echo myCurrency($totalClosingDr); ?> <?php echo myCurrency($totalClosingDr); ?>
<?php endif; ?> <?php endif; ?>
</th> </th>
</tfoot>
</tr> </table>
</table> </div>
</td> </div>
</tr> </div>
</table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -394,6 +360,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
@ -418,27 +392,21 @@ function footerfunctions()
function exportTableToCSV(filename) { function exportTableToCSV(filename) {
var csv = []; var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)"); var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) { for (var i = 0; i < rows.length; i++) {
var row = []; var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)"); var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden // Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse"); var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show")); var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) { if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed continue; // Skip child table rows if parent is collapsed
} }
for (var j = 0; j < cols.length; j++) { for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue); row.push(cellValue);
} }
csv.push(row.join(",")); csv.push(row.join(","));
} }
// Create a CSV file // Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n"); var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent); var encodedUri = encodeURI(csvContent);

View File

@ -8,7 +8,6 @@ $ExpenseAccounts = $this->acc->getAccountsByGroup(4);
$IncomesTotal = $this->acc->getAccountBalanceByGroup(3); $IncomesTotal = $this->acc->getAccountBalanceByGroup(3);
$ExpensesTotal = $this->acc->getAccountBalanceByGroup(4); $ExpensesTotal = $this->acc->getAccountBalanceByGroup(4);
$PL = $IncomesTotal - $ExpensesTotal; $PL = $IncomesTotal - $ExpensesTotal;
?> ?>
<style> <style>
table, table,
@ -91,80 +90,72 @@ $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;
;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<section class="content"> <section class="content">
<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">
<h3 class="card-title">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">
<!-- 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" 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>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <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="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>
<!-- <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>
@ -172,10 +163,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 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>
function resetForm() { function resetForm() {
@ -189,39 +178,36 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div> </div>
<!-- /.card-tools --> <!-- /.card-tools -->
</div> </div>
<!-- <div class="card-body"> <!-- <div class="card-body">
<form method="post" action="" id="FilterForm"> <form method="post" action="" id="FilterForm">
<div class="row align-items-end"> <div class="row align-items-end">
<div class="col-2"> <div class="col-2">
<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 nepaliDatePicker" name="fromDate" value="<?php //echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
</div> </div>
<div class="col-2"> <div class="col-2">
<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 nepaliDatePicker" name="toDate" value="<?php //echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="col-1 text-center"> <div class="col-1 text-center">
<div class="form-group"> <div class="form-group">
<label for="showOB"><?php myLang("Opening"); ?></label> <label for="showOB"><?php //myLang("Opening"); ?></label>
<input type="checkbox" class="form-control " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-control " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : "CHECKED"; ?>>
</div> </div>
</div> </div>
<div class="col-1 text-center"> <div class="col-1 text-center">
<div class="form-group"> <div class="form-group">
<label for="showClosing"><?php myLang("Closing"); ?></label> <label for="showClosing"><?php //myLang("Closing"); ?></label>
<input type="checkbox" class="form-control " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-control " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : "CHECKED"; ?>>
</div> </div>
</div> </div>
<div class="col-1 text-center"> <div class="col-1 text-center">
<div class="form-group"> <div class="form-group">
<label for="showPeriod"><?php myLang("Period"); ?></label> <label for="showPeriod"><?php //myLang("Period"); ?></label>
<input type="checkbox" class="form-control " name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-control " name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
</div> </div>
</div> </div>
@ -234,9 +220,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
document.getElementById("fromDate").value = "2078-4-1"; document.getElementById("fromDate").value = "2078-4-1";
@ -246,23 +230,20 @@ $PL = $IncomesTotal - $ExpensesTotal;
document.getElementById("FilterForm").submit(); document.getElementById("FilterForm").submit();
} }
</script> </script>
</div> --> </div> -->
</div> </div>
<div class="card"> <div class="card">
<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="30%"><?php myLang("Receipts"); ?></th>
<th class="text-right" width="15%"></th> <th class="text-right" width="10%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th> <th class="text-right pr-2" width="10%"><?php myLang("Amount"); ?></th>
<th class="" width="35%"><?php echo myLang("Payments"); ?></th> <th class="" width="30%"><?php echo myLang("Payments"); ?></th>
<th class="text-right" width="15%"></th> <th class="text-right" width="10%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th> <th class="text-right pr-2" width="10%"><?php myLang("Amount"); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -270,33 +251,34 @@ $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>
<td width="15%"></td> <td width="15%"></td>
<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> <?php $index++; ?>
<td class="" width="70%"><b><?php echo $Incomes['category']; ?></b></td> <tr class="parent-row" class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $index; ?>">
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td> <td class="" width="60%"><b><?php echo $Incomes['category']; ?></b></td>
<td width="15%"></td> <td width="20%"></td>
<td class="text-right pr-2" width="20%"><?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="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td> <td class="pr-2" width="60%">
<td width="15%"></td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td> </td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td width="20%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php $counter = $index ?>
<?php }; ?> <?php }; ?>
</table> </table>
</td> </td>
<td colspan=3 class="p-0"> <td colspan=3 class="p-0">
@ -308,41 +290,35 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td class="" width="70%"><b><?php echo $Expenses['group']; ?></b></td> <td class="" width="70%"><b><?php echo $Expenses['group']; ?></b></td>
<td width="15%"></td> <td width="15%"></td>
<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> <?php $counter++; ?>
<td class="" width="70%"><b><?php echo $Expenses['category']; ?></b></td> <tr data-toggle="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <td class="pr-2" width="60%"><b><?php echo $Expenses['category']; ?></b></td>
<td width="15%"></td> <td width="20%"></td>
<td class="text-right pr-2" width="20%"><?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="60%">
<td width="15%"></td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <?php echo $Expenses['account']; ?>
</td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td width="20%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php }; ?> <?php }; ?>
</table> </table>
</td> </td>
</tr> </tr>
<?php $balance_fi = $total1 - $total; ?> <?php $balance_fi = $total1 - $total; ?>
<?php if ($balance_fi < 0) : $total1 += $balance_fi; ?> <?php if ($balance_fi < 0) : $total1 += $balance_fi; ?>
<tr> <tr>
<th><?php echo myLang("Closing Balance"); ?></th> <th class="pl-2"><?php echo myLang("Closing Balance"); ?></th>
<th></th> <th></th>
<td><span class="text-red"><?php echo myCurrency($balance_fi); ?></span></td> <td><span class="text-red pr-2"><?php echo myCurrency($balance_fi); ?></span></td>
<th></th> <th></th>
<th></th> <th></th>
<td></td> <td></td>
@ -352,51 +328,98 @@ $PL = $IncomesTotal - $ExpensesTotal;
<th></th> <th></th>
<th></th> <th></th>
<td></td> <td></td>
<th><?php echo myLang("Closing Balance"); ?></th> <th class="pl-2"><?php echo myLang("Closing Balance"); ?></th>
<th></th> <th></th>
<td><?php echo myCurrency($balance_fi); ?></td> <td class="pr-2"><?php echo myCurrency($balance_fi); ?></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<tr> <tr>
<th>Total</th> <th class="pl-2">Total</th>
<th></th> <th></th>
<td><?php echo myCurrency($total1); ?></td> <td class="pr-2"><?php echo myCurrency($total1); ?></td>
<th>Total</th> <th class="pl-2">Total</th>
<th></th> <th></th>
<td><?php echo myCurrency($total); ?></td> <td class="pr-2"><?php echo myCurrency($total); ?></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<?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");
}
}
});
<?php function footerFunctions() function exportTableToCSV(filename) {
{ ?> var csv = [];
<script> var rows = document.querySelectorAll("table tr:not(.hide)");
$("#fromDate").nepaliDatePicker({ for (var i = 0; i < rows.length; i++) {
dateFormat: "%y-%m-%d", var row = [];
closeOnDateSelect: true, var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
minDate: $('#fromDate').data('start'), // Check if the parent row is collapsed or hidden
maxDate: $('#fromDate').data('end'), var parentRow = rows[i].closest(".collapse");
}); var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
</script> if (isParentCollapsed) {
<script> continue; // Skip child table rows if parent is collapsed
$("#toDate").nepaliDatePicker({ }
dateFormat: "%y-%m-%d", for (var j = 0; j < cols.length; j++) {
closeOnDateSelect: true, var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
minDate: $('#toDate').data('start'), row.push(cellValue);
maxDate: $('#toDate').data('end'), }
}); csv.push(row.join(","));
</script> }
<?php } ?> // 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

@ -25,7 +25,7 @@
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <h5 class="m-0 card-title"><?php echo $pageTitle; ?>
<!-- <a href="<?php //echo site_url("accounts/setup/addsingleentryvoucher"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle; ?></a> --> <!-- <a href="<?php //echo site_url("accounts/setup/addsingleentryvoucher"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle; ?></a> -->
</h5> </h5>
@ -34,15 +34,15 @@
<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>Sn</th> <th class="text-center">Sn</th>
<th>Voucher Name</th> <th class="col-2">Voucher Name</th>
<th>Default Debits</th> <th class="col-4">Default Debits</th>
<th>Default Credits</th> <th class="col-4">Default Credits</th>
<th>Voucher Color</th> <th class="col-1 text-center">Voucher Color</th>
<th class="table-col col-2">Action</th> <th class=" text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -51,14 +51,14 @@
<?php foreach ($TableRow as $cols) : $id = $cols; <?php foreach ($TableRow as $cols) : $id = $cols;
break; break;
endforeach; ?><tr class="<?php echo ($TableRow->status == 0) ? "table-danger" : ""; ?>"> endforeach; ?><tr class="<?php echo ($TableRow->status == 0) ? "table-danger" : ""; ?>">
<td><?php echo $sn; ?></td> <td class="text-center"><?php echo $sn; ?></td>
<td><?php echo $TableRow->voucher_name; ?></td> <td><?php echo $TableRow->voucher_name; ?></td>
<td><?php echo showAccountCategoriesByIds(($TableRow->default_debits!="")?explode(",",$TableRow->default_debits):array()); ?></td> <td><?php echo showAccountCategoriesByIds(($TableRow->default_debits!="")?explode(",",$TableRow->default_debits):array()); ?></td>
<td><?php echo showAccountCategoriesByIds(($TableRow->default_credits!="")?explode(",",$TableRow->default_credits):array()); ?></td> <td><?php echo showAccountCategoriesByIds(($TableRow->default_credits!="")?explode(",",$TableRow->default_credits):array()); ?></td>
<td><span class="inline-block" style="padding:0px 8px;border:1px solid <?php echo $TableRow->voucher_color; ?>;background:<?php echo $TableRow->voucher_color; ?>">&nbsp;</span> </td> <td class="text-center"><span class="inline-block " style="padding:0px 8px;text-align:center;border:1px solid <?php echo $TableRow->voucher_color; ?>;background:<?php echo $TableRow->voucher_color; ?>">&nbsp;</span> </td>
<td> <td class="text-center">
<?php showEditButton($commandURL = "accounts/setup/editvouchertype/" . $TableRow->vouchertype_id , "Edit", ""); ?> <?php showEditButton($commandURL = "accounts/setup/editvouchertype/" . $TableRow->vouchertype_id , "Edit", ""); ?>
</td> </td>

View File

@ -21,6 +21,7 @@ $BIBAccounts = new BIBAccounts();
.group-total { .group-total {
width: 10%; width: 10%;
} }
.table-gray { .table-gray {
@ -31,8 +32,10 @@ $BIBAccounts = new BIBAccounts();
.table th { .table th {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
.table t
.bg-darker { .bg-darker {
background-color: #ddd; background-color: #ddd;
} }
@ -71,6 +74,9 @@ $BIBAccounts = new BIBAccounts();
.underline { .underline {
text-decoration: underline; text-decoration: underline;
} }
.text-right{
padding-right: 5px;
}
.form-control { .form-control {
display: block; display: block;
@ -88,13 +94,17 @@ $BIBAccounts = new BIBAccounts();
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;
} }
.bg-gray tr th {
vertical-align: middle;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<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"><?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,51 +115,49 @@ $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>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <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="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>
@ -161,7 +169,7 @@ $BIBAccounts = new BIBAccounts();
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</div> </div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> <!-- <button type="button" class="btn btn-info 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>
@ -203,16 +211,16 @@ $BIBAccounts = new BIBAccounts();
<table class="table table-bordered vertical-borders" id="TrialBalanceTable"> <table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<thead class="bg-gray"> <thead class="bg-gray">
<tr> <tr>
<th rowspan="2">Particulars</th> <th rowspan="2 class="">Particulars</th>
<?php if ($ReportOptions['showOB']) : ?> <?php if ($ReportOptions['showOB']) : ?>
<th colspan="2" class="text-center">Opening</th> <th colspan=" 2" class="text-center">Opening</th>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showPeriod']) : ?> <?php if ($ReportOptions['showPeriod']) : ?>
<th colspan="2" class="text-center">Current Period</th> <th colspan="2" class="text-center">Current Period</th>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showClosing']) : ?> <?php if ($ReportOptions['showClosing']) : ?>
<th colspan="2" class="text-center">Closing</th> <th colspan="2" class="text-center">Closing</th>
<?php endif; ?> <?php endif; ?>
</tr> </tr>
<tr> <tr>
@ -246,7 +254,7 @@ $BIBAccounts = new BIBAccounts();
<?php if ($ReportOptions['showOB']) : ?> <?php if ($ReportOptions['showOB']) : ?>
<td class="group-total"><?php // echo myCurrency(($group->posting_side == "DR") ? $group->opening_balance : 0); <td class="group-total"><?php // echo myCurrency(($group->posting_side == "DR") ? $group->opening_balance : 0);
?></td> ?></td>
<td class="group-total"><?php // echo myCurrency(($group->posting_side == "CR") ? $group->opening_balance : 0); <td class="group-total "><?php // echo myCurrency(($group->posting_side == "CR") ? $group->opening_balance : 0);
?></td> ?></td>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showPeriod']) : ?> <?php if ($ReportOptions['showPeriod']) : ?>
@ -309,6 +317,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() {
@ -357,23 +373,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

@ -1,121 +1,82 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content-header"> <div class="content-header">
<div class="container-fluid"> <div class="container-fluid">
<div class="row mb-2"> <div class="row mb-2">
<div class="col-sm-6"> <div class="col-sm-6">
<h1 class="m-0"> <h1 class="m-0">
<?php echo $pageTitle; ?></h1> <?php echo $pageTitle; ?></h1>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<ol class="breadcrumb float-sm-right"> <ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"> <li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>"> <a href="<?php echo base_url(); ?>">
Dashboard</a> Dashboard</a>
</li> </li>
<li class="breadcrumb-item active"> <li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li> <?php echo $pageTitle; ?></li>
</ol> </ol>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<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"> <div class="card-header">
<h5 class="m-0"> <h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="btn btn-sm btn-primary float-right"> <?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5> Create New <?php echo $pageTitle; ?></a></h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<?php $TableData = $Vouchers ?> <?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList"> <table class="table table-bordered table-striped" id="voucherList">
<thead> <thead>
<tr> <tr>
<th>ID#</th> <th>ID#</th>
<th>Voucher No</th> <th>Voucher No</th>
<th>Voucher Date</th> <th>Voucher Date</th>
<th>Voucher Type</th> <th>Voucher Type</th>
<th>Voucher State</th> <th>Voucher State</th>
<th class="table-col col-2">Action</th> <th class="table-col col-2">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?> <?php $a = 0;
foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols; <?php foreach ($TableRow as $cols) : $id = $cols;
break; break;
endforeach; ?><tr data-id="<?php echo $TableRow->voucher_id; ?>" class="<?php echo ($TableRow->voucher_state == "Reversed") ? "table-danger" : ""; ?>"> endforeach; ?><tr data-id="<?php echo $TableRow->voucher_id; ?>" class="<?php echo ($TableRow->voucher_state == "Reversed") ? "table-danger" : ""; ?>">
<td><?php echo $TableRow->voucher_id; ?></td> <td><?php echo $TableRow->voucher_id; ?></td>
<td><?php echo $TableRow->voucher_no; ?></td> <td><?php echo $TableRow->voucher_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td> <td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td> <td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td> <td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1"> <td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details"> <a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye"> <i class="fa fa-eye">
</i></a> </i></a>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tbody> <tbody>
</table> </table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_box" aria-hidden="true"> <div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_box" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document"> <div class="modal-dialog modal-xl" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"> <h5 class="modal-title" id="exampleModalLabel">
Voucher Details</h5> Voucher Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"> <span aria-hidden="true">
&times;</span> &times;</span>
</button> </button>
</div> </div>
<div class="modal-body" id="details_container"> <div class="modal-body" id="details_container">
Voucher Details Goes Here Voucher Details Goes Here
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id=""> <button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button> Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal"> <button type="button" class="btn btn-secondary" data-dismiss="modal">
@ -138,7 +99,6 @@
function reversalEntry() { function reversalEntry() {
var id = $("#reversalBtn").data("id"); var id = $("#reversalBtn").data("id");
if (confirm("Are you sure you want to post reversal for this voucher?")) { if (confirm("Are you sure you want to post reversal for this voucher?")) {
window.location = "<?php echo site_url("accounts/vouchers/reversal/"); ?>" + id; window.location = "<?php echo site_url("accounts/vouchers/reversal/"); ?>" + id;
} }
@ -158,7 +118,6 @@ function footerfunctions()
<script> <script>
$(document).ready(function() { $(document).ready(function() {
var table = $('#voucherList').DataTable(); var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr'); var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() { tableRows.each(function() {
async: false; async: false;
@ -169,8 +128,6 @@ function footerfunctions()
Transactions = getVoucherDetails(id); Transactions = getVoucherDetails(id);
row.child(Transactions).show(); row.child(Transactions).show();
}); });
}); });
function getVoucherDetails(id) { function getVoucherDetails(id) {

View File

@ -81,7 +81,7 @@ button:hover {
<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" style="background-color: <?php echo $VoucherType->voucher_color; ?>;"> <!-- <div class="card-header" style="background-color: <?php //echo $VoucherType->voucher_color; ?>;">
<h5 class="m-0"> <h5 class="m-0">
<?php //echo $pageTitle; <?php //echo $pageTitle;
?> ?>
@ -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

@ -1,17 +1,12 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<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"> <div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> </h5> <h5 class="m-0"><?php echo $pageTitle; ?> </h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<form method="GET" action=""> <form method="GET" action="">
<div class="row"> <div class="row">
@ -26,11 +21,10 @@
</div> </div>
<!-- <div class="col"><?php $this->myaccounts->showAccountsCombo("account_id", "Account", "account_id", "status=1", isset($_GET['account_id']) ? $_GET['account_id'] : ''); //fillComboWithValue("account_id","Account","account_id","tbl_accounts","account_name","account_id",isset($_GET['account_id'])?$_GET['account_id']:''); <!-- <div class="col"><?php $this->myaccounts->showAccountsCombo("account_id", "Account", "account_id", "status=1", isset($_GET['account_id']) ? $_GET['account_id'] : ''); //fillComboWithValue("account_id","Account","account_id","tbl_accounts","account_name","account_id",isset($_GET['account_id'])?$_GET['account_id']:'');
?></div> --> ?></div> -->
<div class="col-2"><?php createNepaliDateInput("from_date", "From Date", "from_date", isset($fromDate_bs) ? $fromDate_bs : FYStart()); ?></div> <div class="col-2"><?php createNepaliDateInput("from_date", "From Date", "from_date", isset($fromDate_bs) ? $fromDate_bs : FYStart()); ?></div>
<div class="col-2"><?php createNepaliDateInput("to_date", "To Date", "to_date", isset($toDate_bs) ? $toDate_bs : FYEnd()); ?></div> <div class="col-2"><?php createNepaliDateInput("to_date", "To Date", "to_date", isset($toDate_bs) ? $toDate_bs : FYEnd()); ?></div>
<div class="col-1"><?php createButton("show_voucher", "Show", "show_voucher", "Submit", "mt-30"); ?></div> <div class="col-1"><?php createButton("show_voucher", "Show", "show_voucher", "Submit", "mt-26"); ?></div>
<div class="col-1"><?php createButton("show_voucher_reset", "Reset", "reset", site_url("accounts/vouchers/listvouchers"), "mt-30"); ?></div> <div class="col-1"><?php createButton("show_voucher_reset", "Reset", "reset", site_url("accounts/vouchers/listvouchers"), "mt-26"); ?></div>
</div> </div>
</form> </form>
<div id="dataTable_Commands"></div> <div id="dataTable_Commands"></div>
@ -40,14 +34,13 @@
// 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>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -8,7 +8,7 @@
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<!-- <?php echo isset($item) ? 'Edit' : 'Create'; ?> --> <!-- <?php echo isset($item) ? 'Edit' : 'Create'; ?> -->
<h5 class="m-0">Create <?php echo $pageTitle; ?> <h5 class="m-0 card-title">Create <?php echo $pageTitle; ?>
<?php //showListButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/list","List ".$pageTitle); <?php //showListButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/list","List ".$pageTitle);
?> ?>
</h5> </h5>
@ -80,7 +80,7 @@
<div class="col-9"> <div class="col-9">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"> <h5 class="m-0 card-title">
Current Fiscal Year : Current Fiscal Year :
<?php $currentFiscalYear = showFiscalYear(); ?> <?php $currentFiscalYear = showFiscalYear(); ?>
@ -95,12 +95,12 @@
<table class="table table-bordered table-striped longdataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th>Fiscal Year </th> <th class="col-2">Fiscal Year </th>
<th> Code</th> <th class="col-4"> Code</th>
<th>From</th> <th>From</th>
<th>To</th> <th>To</th>
<!-- <th>Created By</th> --> <!-- <th>Created By</th> -->
<th>Action</th> <th class="col-1 text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -115,7 +115,7 @@
<td><?php echo $TableRow->fiscalyear_to; ?></td> <td><?php echo $TableRow->fiscalyear_to; ?></td>
<!-- <td><?php //echo $TableRow->created_by; <!-- <td><?php //echo $TableRow->created_by;
?></td> --> ?></td> -->
<td> <td class="text-center">
<!-- <?php //showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?> --> <!-- <?php //showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?> -->

View File

@ -4,7 +4,6 @@ $param = $this->uri->segment(2);
$subparam = $this->uri->segment(3); $subparam = $this->uri->segment(3);
$subparam2 = $this->uri->segment(4); $subparam2 = $this->uri->segment(4);
?> ?>
<!-- Main Sidebar Container --> <!-- Main Sidebar Container -->
<aside class="main-sidebar main-sidebar-custom sidebar-dark-primary elevation-4"> <aside class="main-sidebar main-sidebar-custom sidebar-dark-primary elevation-4">
<!-- Brand Logo --> <a href="<?php echo base_url(); ?>" class="brand-link"> <img src="<?php echo base_url(); ?>dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8"> <span class="brand-text font-weight-light"> <!-- Brand Logo --> <a href="<?php echo base_url(); ?>" class="brand-link"> <img src="<?php echo base_url(); ?>dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8"> <span class="brand-text font-weight-light">
@ -16,7 +15,6 @@ $subparam2 = $this->uri->segment(4);
<div class="user-panel mt-3 pb-3 mb-3 d-flex"> <div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image"> <img src="<?php echo base_url(); ?>dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image"> </div> <div class="image"> <img src="<?php echo base_url(); ?>dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image"> </div>
<div class="info"> <a href="#" class="d-block"><?php echo $this->session->userdata("CompanyName"); ?> (<?php echo ($this->session->userdata("FiscalYear")->fiscalyear_year); ?>)</a></div> <div class="info"> <a href="#" class="d-block"><?php echo $this->session->userdata("CompanyName"); ?> (<?php echo ($this->session->userdata("FiscalYear")->fiscalyear_year); ?>)</a></div>
</div> <!-- SidebarSearch Form --> </div> <!-- SidebarSearch Form -->
<div class="form-inline pb-2"> <div class="form-inline pb-2">
<div class="input-group" data-widget="sidebar-search"> <div class="input-group" data-widget="sidebar-search">
@ -74,7 +72,7 @@ $subparam2 = $this->uri->segment(4);
<?php if ($LoggedUser == "admin") : ?> <?php if ($LoggedUser == "admin") : ?>
<?php //showMenu("Create New Ledger", "accounts/accountheads/add"); <?php //showMenu("Create New Ledger", "accounts/accountheads/add");
?> ?>
<?php showMenu("List of Ledgers", "accounts/accountheads/list"); ?> <?php showMenu("Ledgers", "accounts/accountheads/list"); ?>
<?php endif; ?> <?php endif; ?>
</ul> </ul>
</li> </li>
@ -118,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; ?>
@ -140,7 +138,6 @@ $subparam2 = $this->uri->segment(4);
<?php if ($LoggedUser == "admin") : <?php if ($LoggedUser == "admin") :
// showMenu("Inventory Stock", "inventory/stocks/list"); // showMenu("Inventory Stock", "inventory/stocks/list");
showMenu("Stock Report", "inventory/stocks/summary"); showMenu("Stock Report", "inventory/stocks/summary");
showMenu("Sales Register", "inventory/sales/sales_register"); showMenu("Sales Register", "inventory/sales/sales_register");
showMenu("Purchase Register", "inventory/purchases/purchase_register"); showMenu("Purchase Register", "inventory/purchases/purchase_register");
showMenu("Purchase Vs Sales", "inventory/reports/purchase_vs_sales"); showMenu("Purchase Vs Sales", "inventory/reports/purchase_vs_sales");
@ -163,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 Payments", "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");
@ -189,7 +186,6 @@ $subparam2 = $this->uri->segment(4);
// showMenu("Group Summary", "accounts/ledger/partyledger"); // showMenu("Group Summary", "accounts/ledger/partyledger");
showMenu("Group Summary", "accounts/reports/balance_by_group"); showMenu("Group Summary", "accounts/reports/balance_by_group");
// showMenu("Balance by Category", "accounts/reports/balance_by_category"); // showMenu("Balance by Category", "accounts/reports/balance_by_category");
showMenu("Accounts Receivables", "accounts/ledger/receiveables"); showMenu("Accounts Receivables", "accounts/ledger/receiveables");
showMenu("Accounts Payables", "accounts/ledger/payables"); showMenu("Accounts Payables", "accounts/ledger/payables");
showMenu("Purchase Summary", "inventory/purchases/list"); showMenu("Purchase Summary", "inventory/purchases/list");

View File

@ -91,7 +91,7 @@
<th width="30%"><?php myLang('Inventory Group'); ?></th> <th width="30%"><?php myLang('Inventory Group'); ?></th>
<!-- <th width="5%"><?php //myLang('Unit'); ?></th> --> <!-- <th width="5%"><?php //myLang('Unit'); ?></th> -->
<th width="57%"><?php myLang('Remarks'); ?></th> <th width="57%"><?php myLang('Remarks'); ?></th>
<td width="8%"><?php myLang("Action"); ?></th> <td class="text-center col-1"><?php myLang("Action"); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -100,11 +100,11 @@
<?php foreach ($TableRow as $cols) : $id = $cols; <?php foreach ($TableRow as $cols) : $id = $cols;
break; break;
endforeach; ?><tr> endforeach; ?><tr>
<td><?php echo $a; ?></td> <td class="text-center"><?php echo $a; ?></td>
<td><?php echo $TableRow->title; ?></td> <td><?php echo $TableRow->title; ?></td>
<!-- <td><?php //echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id); ?></td> --> <!-- <td><?php //echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id); ?></td> -->
<td><?php echo $TableRow->description; ?></td> <td><?php echo $TableRow->description; ?></td>
<td> <td class="text-center">
<?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?> <?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>
<?php showDeleteButton($id); ?> <?php showDeleteButton($id); ?>
</td> </td>

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", "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", "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-->
@ -117,7 +117,7 @@
<table class="table table-bordered table-striped longdataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th width="5%"><?php myLang('S.N'); ?></th> <th width="5%" class="text-center"><?php myLang('S.N'); ?></th>
<th width="25%"><?php myLang('Name'); ?></th> <th width="25%"><?php myLang('Name'); ?></th>
<th width="10%"><?php myLang('Code'); ?></th> <th width="10%"><?php myLang('Code'); ?></th>
<th width="10%"><?php myLang('Units'); ?></th> <th width="10%"><?php myLang('Units'); ?></th>
@ -125,7 +125,7 @@
<th width="10%" class="text-right"><?php myLang('Qty'); ?></th> <th width="10%" class="text-right"><?php myLang('Qty'); ?></th>
<th width="10%" class="text-right"><?php myLang('Rate'); ?></th> <th width="10%" class="text-right"><?php myLang('Rate'); ?></th>
<th width="10%" class="text-right"><?php myLang('Total'); ?></th> <th width="10%" class="text-right"><?php myLang('Total'); ?></th>
<td width="10%" class="text-bold"><?php myLang("Action"); ?></th> <td width="7%" class="col-1 text-bold text-center"><?php myLang("Action"); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -134,7 +134,7 @@
<?php foreach ($TableRow as $cols) : $id = $cols; <?php foreach ($TableRow as $cols) : $id = $cols;
break; break;
endforeach; ?><tr> endforeach; ?><tr>
<td><?php echo $a; ?></td> <td class="text-center"><?php echo $a; ?></td>
<td><?php echo $TableRow->title; ?></td> <td><?php echo $TableRow->title; ?></td>
<td><?php echo $TableRow->item_code; ?></td> <td><?php echo $TableRow->item_code; ?></td>
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id); ?></td> <td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id); ?></td>
@ -142,7 +142,7 @@
<td class="text-right"><?php echo $TableRow->Stock->qty; ?></td> <td class="text-right"><?php echo $TableRow->Stock->qty; ?></td>
<td class="text-right"><?php echo $TableRow->Stock->rate; ?></td> <td class="text-right"><?php echo $TableRow->Stock->rate; ?></td>
<td class="text-right"><?php echo $TableRow->Stock->amount; ?></td> <td class="text-right"><?php echo $TableRow->Stock->amount; ?></td>
<td> <td class="text-center">
<?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?> <?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>
<?php showDeleteButton($id); ?> <?php showDeleteButton($id); ?>
</td> </td>

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

@ -12,12 +12,11 @@
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped dataTable">
<thead> <thead>
<tr> <tr>
<th><?php myLang('S.N'); ?></th> <th class="text-center"><?php myLang('S.N'); ?></th>
<th><?php myLang('Date'); ?></th> <th><?php myLang('Date'); ?></th>
<th><?php myLang('Purchase Transaction'); ?></th> <th><?php myLang('Purchase Transaction'); ?></th>
<th><?php myLang('Amount'); ?></th> <th class="text-center"><?php myLang('Amount'); ?></th>
<td class="text-center"><b>Action</b></th>
<td><b>Action</b></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -52,9 +51,7 @@
</div> </div>
</td> </td>
<td><?php echo myCurrency($TableRow->TotalPurchase); ?></td> <td><?php echo myCurrency($TableRow->TotalPurchase); ?></td>
<td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
<?php showDeleteButton($id); ?> <?php showDeleteButton($id); ?>
</td> </td>
</tr> </tr>

View File

@ -12,12 +12,12 @@
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped dataTable">
<thead> <thead>
<tr> <tr>
<th><?php myLang('S.N'); ?></th> <th width="3%" class="text-center"><?php myLang('S.N'); ?></th>
<th><?php myLang('Date'); ?></th> <th width="10%" class="col-1"><?php myLang('Date'); ?></th>
<th><?php myLang('Purchase Transaction'); ?></th> <th class="table-col col-9"><?php myLang('Purchase Transaction'); ?></th>
<th><?php myLang('Amount'); ?></th> <th width="8%"class="col-2"><?php myLang('Amount'); ?></th>
<td><b>Action</b></th> <td class="col-1 text-center"><b>Action</b></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -29,7 +29,7 @@
<td><?php echo $TableRow->purchase_date; ?></td> <td><?php echo $TableRow->purchase_date; ?></td>
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></td> <td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></td>
<td><?php echo myCurrency($TableRow->TotalPurchase); ?></td> <td><?php echo myCurrency($TableRow->TotalPurchase); ?></td>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?> <td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
<?php showDeleteButton($id); ?> <?php showDeleteButton($id); ?>
</td> </td>
</tr> </tr>

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,11 +88,24 @@
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</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

@ -184,7 +184,7 @@
<?php $a = 0; <?php $a = 0;
foreach ($StockItems as $Stock) : $a++; ?> foreach ($StockItems as $Stock) : $a++; ?>
<tr> <tr>
<td><?php echo $a; ?></td> <td class="text-center"><?php echo $a; ?></td>
<td><?php echo $Stock->Item->title; ?></td> <td><?php echo $Stock->Item->title; ?></td>
<td><?php echo $Stock->Summary->Unit->title; ?></td> <td><?php echo $Stock->Summary->Unit->title; ?></td>
<td class="text-right"><?php echo $oqty = $Stock->Summary->Opening->qty; ?></td> <td class="text-right"><?php echo $oqty = $Stock->Summary->Opening->qty; ?></td>

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

@ -12,17 +12,17 @@
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped dataTable">
<thead> <thead>
<tr> <tr>
<th class="table-col col-1"><?php myLang('Sales Voucher #'); ?></th> <th class="table-col col-1 text-center"><?php myLang('Sales Voucher #'); ?></th>
<th width="10%"><?php myLang('Date'); ?></th> <th width="10%"><?php myLang('Date'); ?></th>
<th><?php myLang('Transaction'); ?></th> <th><?php myLang('Transaction'); ?></th>
<th class="table-col col-1"><?php myLang('Amount'); ?></th> <th class="table-col col-1 text-center"><?php myLang('Amount'); ?></th>
<th class="table-col col-1"><?php myLang('Action'); ?></th> <th class="table-col col-1 text-center"><?php myLang('Action'); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($SalesRecords as $TableRow) : ?> <?php foreach ($SalesRecords as $TableRow) : ?>
<tr> <tr>
<td><?php echo $TableRow->sales_id; ?></td> <td class="text-center"><?php echo $TableRow->sales_id; ?></td>
<td><?php echo $TableRow->sales_date; ?></td> <td><?php echo $TableRow->sales_date; ?></td>
<td><b><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></b> <td><b><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></b>
<div class="row ml-2 mr-2" style="border-bottom: 1px solid;"> <div class="row ml-2 mr-2" style="border-bottom: 1px solid;">
@ -48,7 +48,7 @@
</div> </div>
</td> </td>
<td><?php echo myCurrency($TableRow->totalsales); ?></td> <td><?php echo myCurrency($TableRow->totalsales); ?></td>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?> <td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?>
<?php showDeleteButton($TableRow->sales_id); ?> <?php showDeleteButton($TableRow->sales_id); ?>
</td> </td>
</tr> </tr>

View File

@ -5,31 +5,29 @@
<div class="col"> <div class="col">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<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 card-title"><?php echo $pageTitle; ?> </h5><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>
</div> </div>
<div class="card-body"> <div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_sales where status=1")->result(); ?> <?php $TableData = $this->db->query("select * from tbl_sales where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped dataTable">
<thead> <thead>
<tr> <tr>
<th class="table-col col-1"><?php myLang('Sales Voucher #'); ?></th> <th class=" col-1 text-center"><?php myLang('Sales Voucher #'); ?></th>
<th width="10%"><?php myLang('Date'); ?></th> <th class="col-1"><?php myLang('Date'); ?></th>
<th><?php myLang('Transaction'); ?></th> <th><?php myLang('Transaction'); ?></th>
<th class="table-col col-1"><?php myLang('Amount'); ?></th> <th class="table-col col-1 text-center"><?php myLang('Amount'); ?></th>
<th class="table-col col-1"><?php myLang('Action'); ?></th> <th class="text-center" width="5%"> <?php myLang('Action'); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($SalesRecords as $TableRow) : ?> <?php foreach ($SalesRecords as $TableRow) : ?>
<tr> <tr>
<td><?php echo $TableRow->sales_id; ?></td> <td class="text-center"><?php echo $TableRow->sales_id; ?></td>
<td><?php echo $TableRow->sales_date; ?></td> <td><?php echo $TableRow->sales_date; ?></td>
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?> <td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?>
</td> </td>
<td><?php echo myCurrency($TableRow->totalsales); ?></td> <td><?php echo myCurrency($TableRow->totalsales); ?></td>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?> <td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?>
<?php showDeleteButton($TableRow->sales_id); ?> <?php showDeleteButton($TableRow->sales_id); ?>
</td> </td>
</tr> </tr>

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

@ -2,21 +2,14 @@
<!-- <div class="content"> <!-- <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary "> <div class="card card-primary ">
<div class="card-header"> <div class="card-header">
<h3 class="card-title"><?php //echo $pageTitle; <h3 class="card-title"><?php //echo $pageTitle;
?> </h3> ?> </h3>
<div class="card-tools"> <div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-plus"></i> <button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-plus"></i>
</button> </button>
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<form method="post" action="" id="FilterForm"> <form method="post" action="" id="FilterForm">
<div class="row align-items-end"> <div class="row align-items-end">
@ -62,7 +55,6 @@
</div> </div>
<div class="col"> <div class="col">
<div class="form-group d-flex justify-content-end"> <div class="form-group d-flex justify-content-end">
<button type="submit" class="btn btn-primary mr-2">Choose</button> <button type="submit" class="btn btn-primary mr-2">Choose</button>
<button type="submit" class="btn btn-primary mr-2">Filter</button> <button type="submit" class="btn btn-primary mr-2">Filter</button>
<button type="submit" class="btn btn-success mr-2">Export</button> <button type="submit" class="btn btn-success mr-2">Export</button>
@ -70,7 +62,6 @@
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -89,10 +80,7 @@
</div> </div>
</div> </div>
</div> --> </div> -->
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
@ -100,96 +88,99 @@
<div class="card-header"> <div class="card-header">
<h5 class="card-title"> <h5 class="card-title">
<?php echo $pageTitle; ?> <?php echo $pageTitle; ?>
<!-- <?php //echo $pageTitle; <!-- <?php //echo $pageTitle;
?> <a href="<?php //echo site_url("inventory/purchases/add"); ?> <a href="<?php //echo site_url("inventory/purchases/add");
?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle; ?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle;
?></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="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 nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> </div>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " 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="dropdown-divider"></div>
<!-- <div class="form-check">
<div class="form-group"> <input class="form-check-input" type="checkbox">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label class="form-check-label">Select
<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"> 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">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<input class="form-check-input" type="checkbox"> <button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
<label class="form-check-label">Select
All</label>
</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> </div>
<div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button>
</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-danger 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"><?php myLang('Item'); ?></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" width="80"><?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>
<th colspan="3" class="text-center"><?php myLang('Purchase'); ?></th> <th colspan="3" class="text-center"><?php myLang('Purchase'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Sales'); ?></th> <th colspan="3" class="text-center"><?php myLang('Sales'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Closing'); ?></th> <th colspan="3" class="text-center"><?php myLang('Closing'); ?></th>
</tr> </tr>
<tr> <tr>
<th class="text-center" width="80"><?php myLang('Qty'); ?></th> <th class="text-center" width="80"><?php myLang('Qty'); ?></th>
<th class="text-center" width="80"><?php myLang('Avg. Rate'); ?></th> <th class="text-center" width="80"><?php myLang('Avg. Rate'); ?></th>
<th class="text-center" width="80"><?php myLang('Amount'); ?></th> <th class="text-center" width="80"><?php myLang('Amount'); ?></th>
@ -202,16 +193,17 @@
<th class="text-center" width="80"><?php myLang('Qty'); ?></th> <th class="text-center" width="80"><?php myLang('Qty'); ?></th>
<th class="text-center" width="80"><?php myLang('Avg. Rate'); ?></th> <th class="text-center" width="80"><?php myLang('Avg. Rate'); ?></th>
<th class="text-center" width="80"><?php myLang('Amount'); ?></th> <th class="text-center" width="80"><?php myLang('Amount'); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $Total = 0;
<?php $Total = 0;$PTotal=0;$STotal=0;$CTotal=0; $PTotal = 0;
foreach ($StockRecords as $TableRow) : ?> $STotal = 0;
$CTotal = 0;
foreach ($StockRecords as $index => $TableRow) : ?>
<tr> <tr>
<td class="text-center"><?php echo $index + 1; ?></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>
@ -229,14 +221,12 @@
<td class="text-right"><?php echo $TableRow->Summary->Closing->rate; ?></td> <td class="text-right"><?php echo $TableRow->Summary->Closing->rate; ?></td>
<td><?php echo myCurrency($cTotal = $TableRow->Summary->Closing->amount); <td><?php echo myCurrency($cTotal = $TableRow->Summary->Closing->amount);
$CTotal += $cTotal; ?></td> $CTotal += $cTotal; ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<tbody> <tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="4" class="text-right"><b><?php echo myLang("Total"); ?></b></td> <td colspan="5" class="text-right"><b><?php echo myLang("Total"); ?></b></td>
<td><?php echo myCurrency($Total); ?></td> <td><?php echo myCurrency($Total); ?></td>
<td colspan="2"></td> <td colspan="2"></td>
<td><?php echo myCurrency($PTotal); ?></td> <td><?php echo myCurrency($PTotal); ?></td>
@ -244,6 +234,7 @@
<td><?php echo myCurrency($STotal); ?></td> <td><?php echo myCurrency($STotal); ?></td>
<td colspan="2"></td> <td colspan="2"></td>
<td><?php echo myCurrency($CTotal); ?></td> <td><?php echo myCurrency($CTotal); ?></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
@ -253,4 +244,85 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php function footerFunctions()
{
?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</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

@ -5,7 +5,7 @@
<div class="col-3"> <div class="col-3">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"><?php echo isset($unit) ? 'Edit' : 'Add'; ?> <h5 class="m-0 card-title"><?php echo isset($unit) ? 'Edit' : 'Add'; ?>
<?php myLang('Inventory Unit'); ?> <?php myLang('Inventory Unit'); ?>
<?php //echo $pageTitle; ?> <?php //echo $pageTitle; ?>
<?php //showListButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/list","List ".$pageTitle); ?> <?php //showListButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/list","List ".$pageTitle); ?>
@ -59,7 +59,7 @@
<div class="col-9"> <div class="col-9">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"> <?php myLang(' List Inventory Units'); ?> <?php //echo $pageTitle; ?> <h5 class="m-0 card-title"> <?php myLang(' List Inventory Units'); ?> <?php //echo $pageTitle; ?>
<?php //showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?> <?php //showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?>
</h5> </h5>
</div> </div>
@ -68,10 +68,10 @@
<table class="table table-bordered table-striped longdataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th class="table-col col-1"><?php myLang('S.N'); ?></th> <th class="text-center" width="5%"><?php myLang('S.N'); ?></th>
<th><?php myLang('Unit Name '); ?></th> <th class="col-5" width="30%"><?php myLang('Unit Name '); ?></th>
<th><?php myLang('Unit Code'); ?></th> <th class="col-5" width="57%"><?php myLang('Unit Code'); ?></th>
<th class="table-col col-1">Action</th> <th class="col-1 text-center" >Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -80,10 +80,10 @@
<?php foreach ($TableRow as $cols) : $id = $cols; <?php foreach ($TableRow as $cols) : $id = $cols;
break; break;
endforeach; ?><tr> endforeach; ?><tr>
<td><?php echo $a; ?></td> <td class="text-center"><?php echo $a; ?></td>
<td><?php echo $TableRow->title; ?></td> <td><?php echo $TableRow->title; ?></td>
<td><?php echo $TableRow->description; ?></td> <td><?php echo $TableRow->description; ?></td>
<td><?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?> <td class="text-center"><?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>
<?php showDeleteButton($id); ?> <?php showDeleteButton($id); ?>
</td> </td>
</tr> </tr>

View File

@ -1,39 +1,34 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<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"> <div class="card-header">
<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 class="card-body "> <div class="card-body ">
<?php $TableData = $this->db->query("select * from tbl_translations where status=1")->result(); ?> <?php $TableData = $this->db->query("select * from tbl_translations where status=1")->result(); ?>
<table class="table table-bordered table-striped longdataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th class="text-center col-1"><?php myLang('Translation Id'); ?></th> <th class="text-center col-1"><?php myLang('Translation Id'); ?></th>
<th class="text-center col-2"><?php myLang('English'); ?></th> <th class="text-center col-5"><?php myLang('English'); ?></th>
<th class="text-center col-2"><?php myLang('Nepali'); ?></th> <th class="text-center col-5"><?php myLang('Nepali'); ?></th>
<th class="text-center col-1"><?php myLang('Action'); ?></th> <th class="text-center col-1"><?php myLang('Action'); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?> <?php $a = 0;
foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols; <?php foreach ($TableRow as $cols) : $id = $cols;
break; break;
endforeach; ?><tr> endforeach; ?><tr>
<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; ?>

View File

@ -123,12 +123,22 @@ margin-bottom: .5rem;
.select2-container--default .select2-selection--single .select2-selection__arrow b { .select2-container--default .select2-selection--single .select2-selection__arrow b {
margin-top: 0 !important; margin-top: 0 !important;
} }
.card-body.p-0 .table tbody>tr>td:last-of-type, .card-body.p-0 .table tbody>tr>th:last-of-type, .card-body.p-0 .table tfoot>tr>td:last-of-type, .card-body.p-0 .table tfoot>tr>th:last-of-type, .card-body.p-0 .table thead>tr>td:last-of-type, .card-body.p-0 .table thead>tr>th:last-of-type { /* .card-body.p-0 .table tbody>tr>td:last-of-type, .card-body.p-0 .table tbody>tr>th:last-of-type, .card-body.p-0 .table tfoot>tr>td:last-of-type, .card-body.p-0 .table tfoot>tr>th:last-of-type, .card-body.p-0 .table thead>tr>td:last-of-type, .card-body.p-0 .table thead>tr>th:last-of-type {
padding-right: 0!important; padding-right: 0px!important;
} } */
.form-group textarea.form-control { .form-group textarea.form-control {
height: 50px !important; height: 50px !important;
} }
.select2-container .select2-selection--single { .select2-container .select2-selection--single {
height: 30px!important; height: 30px!important;
}
.mt-26{
margin-top: 26px;
}
table.dataTable>thead>tr>th:not(.sorting_disabled), table.dataTable>thead>tr>td:not(.sorting_disabled) {
vertical-align: middle;
}
.text-right{
padding-right: 10px;
} }

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

View File

@ -1,5 +1,5 @@
APP_NAME="BIB-Accounts" APP_NAME="BIB-Accounts"
APP_URL=http://localhost/School-With-Accounts/account/ APP_URL=http://localhost/bbnepal/BBnepal-Accounts
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=127.0.0.1:3309 DB_HOST=127.0.0.1:3309
DB_PORT=3309 DB_PORT=3309