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) {
$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;
case 'partyledger':
$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'];
if (isset($_GET['show_ledger'])) {
$fromDate_Nepali = $_GET['from_date'];
@ -75,15 +77,19 @@ class Ledger extends CI_Controller
loadView("accounts/daybook", $data);
break;
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";
loadView("accounts/ledger_bankbook", $data);
break;
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";
loadView("accounts/ledger_cashbook", $data);
break;
case 'receiveables':
$data['pageTitle'] = "Accounts Receiveables";
$data['pageTitle'] = "Accounts Receivables";
loadView("accounts/ledger_receiveables", $data);
break;
case 'payables':

View File

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

View File

@ -26,6 +26,8 @@ class Vouchers extends CI_Controller
break;
case 'listvouchers':
$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();
$todate_bs = isset($_GET['to_date']) ? $_GET['to_date'] : NepaliDate(Today());
$fromDate_ad = NepaliToEnglishDate($fromDate_bs);

View File

@ -57,6 +57,8 @@ class Stocks extends CI_Controller
loadView("inventory/stocks/add", $data);
break;
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();
// pre($data['StockRecords']);
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;
$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 = (float)$category_part + 1;
//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;
$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 = (float)$account_part + 1;
//if($category_part<10)$category_part="00".$category_part;
if ($account_part < 10) $account_part = "00" . $account_part;
@ -54,13 +52,10 @@ function showAccountCategoriesSelector($fieldName, $fieldID, $condition = "1=1",
$html .= " required";
}
$html .= ">";
$html .= "<option value='' " . (($selectedID == '') ? "SELECTED" : "") . ">Select Account Category</option>";
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 .= "</select>";
echo $html;
}
@ -68,7 +63,6 @@ function showAccountCategoriesByIds($AccountCategories = array())
{
// pre($AccountCategories); //die;
$ci = &get_instance();
if ($AccountCategories) {
$AccountCategories_a = $ci->db->where("status", 1);
$AccountCategories_a = $AccountCategories_a->where_in("accategory_id", $AccountCategories);
@ -80,11 +74,9 @@ function showAccountCategoriesByIds($AccountCategories = array())
echo implode(", ", $html);
}
}
function linkVoucher($voucher_id)
{
if($voucher_id!=0) {
if ($voucher_id != 0) {
$ci = &get_instance();
$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;
@ -95,7 +87,6 @@ function linkVoucher($voucher_id)
}
function linkLedger($Account)
{
$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>";
}
@ -143,15 +134,11 @@ function generateVoucherNo($vouchertype_id = "")
{
$ci = &get_instance();
$voucherTypeCondition = ($vouchertype_id != "") ? " WHERE voucher_type = '$vouchertype_id'" : "";
$query = $ci->db->query("SELECT MAX(voucher_no) AS voucher_no FROM tbl_vouchers" . $voucherTypeCondition);
$row = $query->row();
$newVoucherNo = ($row->voucher_no !== null) ? $row->voucher_no + 1 : 1;
return $newVoucherNo;
}
function countChildCategories($acgroup_id)
{
$ci = &get_instance();

View File

@ -44,8 +44,8 @@ function createNepaliDateInput($name, $display, $id, $default = "", $class = "")
<?php if ($display != "") : ?>
<label for="datepicker<?php echo $id; ?>"><?php echo function_exists("myLang") ? myLang($display) : $display; ?></label>
<?php endif; ?>
<div class="input-group" 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; ?>">
<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 <?php echo $class; ?>" autocomplete="off" value="<?php echo ($default == "") ? NepaliDate() : $default; ?>">
</div>
<?php
}
@ -95,14 +95,14 @@ function getFieldfromValue($tableName, $fieldName, $lookupField, $referenceValue
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();
?>
<?php if ($displayName != "") : ?>
<label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label>
<?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>
<?php
$q = "select * from $tableName";

View File

@ -766,17 +766,16 @@ class bibaccounts
<tr>
<td class="group-name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i><?php echo $Account->account_name; ?></i></td>
<?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 == 'CR') ? $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>
<?php endif; ?>
<?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>
<?php endif; ?>
<?php if ($ReportOptions['showClosing']) : ?>
<td class="group-total"><?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 == 'DR') ? $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; ?>
</tr>
<?php endforeach; ?>

View File

@ -70,6 +70,7 @@ class myaccounts
$crTotal = 0;
$drTotal = 0;
$fields = array();
// print_r($VoucherDetails);die;
foreach ($VoucherDetails as $VoucherDetail) :
$i++;
$fields['account_name_' . $i] = $VoucherDetail->account_name;
@ -90,6 +91,9 @@ class myaccounts
$fields['amount_in_words'] = trim($CI->numbertoword->nepali_word($crTotal));
else
$fields['amount_in_words'] = trim($CI->numbertoword->english_word($crTotal));
// $fields['narration_' . $i] = $VoucherDetail->narration;
$file = APPPATH . "/../pdf/e_voucher1.pdf";
$pdf = new FPDM($file);
//pre($pdf->getContent($file,"PDF"));
@ -182,11 +186,11 @@ class myaccounts
<div class="col">
<form method="get">
<div class="row">
<div class="col-5">
<div class="col-3">
<?php $this->showAccountsCategoriesCombo("accategory_id", "", "accategory_id"); ?>
</div>
<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>
</form>
@ -197,7 +201,7 @@ class myaccounts
$html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>";
$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>";
$sn = 0;
$BalanceTotal = 0;
@ -205,12 +209,12 @@ class myaccounts
$balance = getBalance($Account->account_id);
$BalanceTotal += $balance;
// 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;
$html .= "</tbody><tfoot>";
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>";
}
// if ($full == "") {
$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 .= " <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\">
@ -543,7 +547,6 @@ class myaccounts
<tr>
<!-- <th class="col-1.5" rowspan="2"><?php //myLang(" Category");
?></th> -->
<th class="col-1.5" rowspan="2"><?php myLang("Ledger"); ?></th>
<th class="col-1.5" rowspan="2"><?php myLang(" Group"); ?></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;
}
}
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/accountheads/getdetails/"); ?>" + id,
@ -662,15 +664,13 @@ class myaccounts
$data['oldBalance'] = $oldBalance;
return $data;
}
function showLedger($account_id, $fromDate = "", $toDate = "")
function showLedger($account_id, $fromDate = "", $toDate = "", $fiscalStart = "", $fiscalEnd = "" )
{
$oldBalance = $this->getOldBalance($account_id, FYStart());
$fromDate = ($fromDate == "") ? NepaliToEnglishDate(FYStart()) : $fromDate;
$toDate = ($toDate == "") ? Today() : $toDate;
$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();
$Account = $ci->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
foreach ($Transactions as $T) {
$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("Credit"); ?></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>
</thead>
<tbody>
@ -706,12 +707,10 @@ class myaccounts
$drTotal = 0;
$crTotal = 0;
$balance = 0;
foreach ($TableData as $TableRow) : $r++;
?>
<tr>
<td><?php echo NepaliDate(($TableRow->transaction_date)); ?></td>
<td>
<?php
if ($TableRow->voucher_id != 0) :
@ -721,9 +720,7 @@ class myaccounts
echo $T->account_name;
break;
}
endforeach;
// pre($Tr);
else :
echo "Opening Balance";
@ -733,7 +730,6 @@ class myaccounts
?></td> -->
<td>
<?php linkVoucher($TableRow->voucher_id); ?>
</td>
<td><?php echo myCurrency($TableRow->dr);
$drTotal += $TableRow->dr; ?></td>
@ -782,6 +778,22 @@ class myaccounts
</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
}
function ledgerPDF_FPDM($account_id, $fromDate, $toDate)
{
@ -931,7 +943,7 @@ class myaccounts
// $pdf->Output("F", $OutputFileLocation . $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;
$ci = &get_instance();
@ -967,13 +979,14 @@ class myaccounts
<th width="90"><?php myLang("Dr"); ?></th>
<th width="90"><?php myLang("Cr"); ?></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>
</thead>
<tbody>
<?php $a = 0; $drTotal=0;$crTotal=0;
<?php $a = 0;
$drTotal = 0;
$crTotal = 0;
foreach ($TableData as $TableRow) : $a++; ?>
<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_no; ?></td>
@ -982,33 +995,35 @@ class myaccounts
<?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>
<?php endforeach; ?>
<?php if($TableRow->narration): ?>
<?php if ($TableRow->narration): ?>
(<span class="narration_display"><?php echo $TableRow->narration; ?></span>)
<?php endif; ?>
</td>
<?php if ($showVoucherTypes) : ?>
<td>
<?php echo $TableRow->VoucherType->voucher_name; ?>
</td>
<?php endif; ?>
<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 endforeach; ?>
</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 endforeach; ?>
</td>
<!-- <td><?php echo $TableRow->voucher_type; ?></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-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>
<?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>
</tr>
<?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" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
<input type="hidden" id="refdate" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>">
</div>
</div>
</div>
@ -1057,7 +1073,6 @@ class myaccounts
}
});
}
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
@ -1068,7 +1083,6 @@ class myaccounts
}
});
}
function reversalEntry() {
var id = $("#reversalBtn").data("id");
if (confirm("Are you sure you want to post reversal for this voucher?")) {
@ -1094,7 +1108,6 @@ class myaccounts
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
@ -1106,7 +1119,6 @@ class myaccounts
});
return ($.data);
}
function deleteVoucher(id) {
// Show confirmation dialog
if (confirm("Are you sure you want to delete this voucher?")) {
@ -1125,6 +1137,15 @@ class myaccounts
}
}
</script>
<script>
$(".ass_date").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#refdate').data('start'),
maxDate: $('#refdate').data('end'),
});
</script>
<?php
}
?>
@ -1217,7 +1238,7 @@ class myaccounts
<td><?php echo myCurrency($drTotal); ?></td>
</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>
<td colspan="<?php echo $TotalCols; ?>" class="text-center" height=200>
@ -1303,13 +1324,8 @@ class myaccounts
</option>
<?php endif; ?>
<?php endforeach; ?>
</select>
<button type="button" class="btn input-group-text addplus" data-toggle="modal" data-target="#exampleModal"><i class="fas fa-plus"></i></button>
<?php
}
function showAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "")
@ -1321,7 +1337,8 @@ class myaccounts
<?php endif; ?>
<select name="<?php echo $fieldName; ?>" class="form-control select2 <?php echo $CSSclass; ?>" id="<?php echo $fieldID; ?>">
<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
$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";
@ -1343,21 +1360,15 @@ class myaccounts
<?php $current_acgroup = $value->acgroup_name;
endif;
endforeach;
*/
foreach ($Values as $value) : ?>
<option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>>
<?php echo $value->accategory_name; ?>
</option>
<?php
endforeach;
?>
</select>
<?php
}
function showFixedAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "")
@ -1367,9 +1378,10 @@ class myaccounts
<?php if ($displayName != "") : ?>
<label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label>
<?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 <?php //echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></option> -->
<!-- <option value="">Select <?php //echo function_exists("myLang") ? myLang($displayName) : $displayName;
?></option> -->
<?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 .= ($condition != "") ? " where $condition" : " where status=1";
@ -1392,21 +1404,15 @@ class myaccounts
<?php $current_acgroup = $value->acgroup_name;
endif;
endforeach;
*/
foreach ($Values as $value) : ?>
<option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>>
<?php echo $value->accategory_name; ?>
</option>
<?php
endforeach;
?>
</select>
<?php
}
function showAccountsCategoriesWithParentsCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "", $extras = "")
@ -1549,7 +1555,6 @@ class myaccounts
$ci->dbforge->add_column('tbl_vouchertypes', array('default_debits' => array('type' => 'VARCHAR', 'constraint' => 255)));
}
}
function hasTransaction($type, $id)
{
switch ($type) {

View File

@ -5,7 +5,7 @@
<div class="col-3">
<div class="card card-primary card-outline">
<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; ?>
<!-- <a href="<?php //echo site_url("master/accategories/list");
?>" class="btn btn-sm btn-primary float-right">List <?php //echo $pageTitle;
@ -34,7 +34,7 @@
<div class="form-group">
<?php
// $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="card card-primary card-outline">
<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");
?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle;
?></a> -->
@ -77,8 +77,8 @@
<!-- <th class="col-3">Category</th> -->
<th class="col-3"><?php myLang("Group Name"); ?></th>
<th class="col-3"><?php myLang("Under"); ?></th>
<th class="col-3"><?php myLang('Remarks');?></th>
<th class="col-2 text-center">Action</th>
<th class="col-4"><?php myLang('Remarks');?></th>
<th class="col-1 text-center">Action</th>
</tr>
</thead>
<tbody>

View File

@ -14,9 +14,9 @@
<table class="table table-bordered table-striped longdataTable">
<thead>
<tr>
<th class="col-2">Type</th>
<th class="col-1">Type</th>
<th>Category Name</th>
<td class="col-1">Action</th>
<th class="col-1 text-center">Action</th>
</tr>
</thead>
<tbody>
@ -26,7 +26,7 @@
break;
endforeach; ?>
<?php if ($TableRow->parent_category_id == 0) : ?>
<tr>
<tr class="text-center">
<td><?php echo $TableRow->AccountGroup->acgroup_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>

View File

@ -34,7 +34,7 @@
<div class="col-7">
<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>
@ -80,7 +80,10 @@
$category_name = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $TableData->accategory_id);
?>
<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">
<!--COL START-->
<div class="col">
@ -96,11 +99,11 @@
<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>
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Contact Details:</b></div>
<div class="row">
<!--COL END-->
<!--COL START-->
<div class="col">
@ -110,8 +113,6 @@
</div>
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
@ -142,14 +143,89 @@
</div>
<!--COL END-->
</div>
<!-- <?php //endif; ?> -->
<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 class="row" id="bankFields" >
<!-- <?php //if ($category_name == "Bank Account") : ?> -->
</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">
@ -179,12 +255,14 @@
</div>
</div>
</div>
<!--COL END-->
<!-- <?php //endif; ?> -->
<!-- <?php //endif;
?> -->
</div>
<hr>
<div class="row">
<!--COL START-->
<div class="col">
@ -224,7 +302,7 @@
</script>
<script>
$(document).ready(function() {
$(document).ready(function() {
function updateFields() {
var category = $('#accategory_id').val(); // Assuming the category select field has this ID
@ -247,5 +325,5 @@ $(document).ready(function() {
$('#accategory_id').change(function() {
updateFields();
});
});
});
</script>

View File

@ -7,7 +7,7 @@
<div class="col-3">
<div class="card card-primary card-outline">
<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;
?>
@ -31,7 +31,7 @@
<div class="form-group">
<?php
// 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>
@ -135,7 +135,7 @@
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<h5 class="m-0 card-title">
<?php echo myLang('List Accounts'); ?>
<?php //myLang($pageTitle);
?>
@ -164,10 +164,10 @@
<tr>
<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 vm" rowspan="2"><?php myLang("Ledger"); ?></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 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>
@ -191,7 +191,7 @@
echo ($TableRow->cr_opening_balance > 0) ? myCurrency($TableRow->cr_opening_balance) : ""; ?></td>
<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 onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs" title="Delete"><i class="fas fa-trash"></i> </a>
</td>

View File

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

View File

@ -1,6 +1,8 @@
<?php
$drWidth = 250;
$crWidth = 250;
$balanceWidth = 250;
$AccountCategories = $this->myaccounts->getChildAccountCategories();
?>
<style>
@ -10,7 +12,6 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
</style>
<div class="content-wrapper">
<div class="container-fluid">
</div>
<div class="content">
<div class="container-fluid">
@ -27,16 +28,21 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
<th>Account</th>
<th width="<?php echo $drWidth; ?>">Dr</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>
</thead>
<tbody>
<?php
$drTotal = 0;
$crTotal = 0;
$balanceTotal = 0;
foreach ($AccountCategories as $AccountCategory) :
$drTotal += $AccountCategory->dr;
$crTotal += $AccountCategory->cr;
$balanceTotal += $AccountCategory->Balance
?>
<!-- <?php //print_r($AccountCategory);die; ?> -->
<tr>
<td>
<a href="<?php echo site_url("accounts/reports/balance_by_ledger") . "?group=" . $AccountCategory->accategory_id; ?>">
@ -44,7 +50,9 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
</a>
</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>
<?php endforeach; ?>
</tbody>
@ -52,20 +60,18 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
<tr>
<th>Total</th>
<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>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<script>
function toggleSubTable(row) {
@ -73,5 +79,4 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
subTable.style.display = subTable.style.display === 'none' ? 'table-row' : 'none';
}
</script>
</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
$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
WHERE NOT EXISTS (
SELECT 1 FROM tbl_acgroups WHERE acgroup_id = 5
@ -12,16 +12,14 @@ $AssetsAccounts = $this->acc->getAccountsByGroup(1);
$LiabilitiesTotal = $this->acc->getAccountBalanceByGroup(2);
$EquityTotal = $this->acc->getAccountBalanceByGroup(5);
$AssetsTotal = $this->acc->getAccountBalanceByGroup(1, false);
$IncomeAccounts = $this->acc->getAccountsByGroup(3);
$ExpenseAccounts = $this->acc->getAccountsByGroup(4);
$IncomesTotal = $this->acc->getAccountBalanceByGroup(3);
$ExpensesTotal = $this->acc->getAccountBalanceByGroup(4);
$PL = $IncomesTotal - $ExpensesTotal;
$LiabilitiesTotal=$LiabilitiesTotal+$EquityTotal+$PL;
$LiabilitiesTotal = $LiabilitiesTotal + $EquityTotal + $PL;
?>
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
@ -39,13 +37,11 @@ $LiabilitiesTotal=$LiabilitiesTotal+$EquityTotal+$PL;
</thead>
<tbody>
<tr class="bg-dark">
<th>Liabilities</th>
<th class="col-2">Amount</th>
<th>Assets</th>
<th class="col-2">Amount</th>
</tr>
<tr class="bg-light">
<td colspan="2">
<?php $this->acc->showTable($LiabilitiesAccounts); ?>
@ -54,33 +50,22 @@ $LiabilitiesTotal=$LiabilitiesTotal+$EquityTotal+$PL;
<td colspan="2">
<?php $this->acc->showTable($AssetsAccounts, false); ?>
</td>
</tr>
</tbody>
<tfoot>
<tr class="bg-light">
<th>Net Profit:</th>
<th><?php echo myCurrency($PL); ?></th>
<th></th>
<th></th>
</tr>
<tr class="bg-light">
<th>Total Liabilities:</th>
<th><?php echo myCurrency($LiabilitiesTotal); ?></th>
<th>Total Assets: </th>
<th><?php echo myCurrency($AssetsTotal); ?></th>
</tr>
</tfoot>
</table>
</div>
</div>

View File

@ -2,7 +2,6 @@
$this->load->library("BIBAccounts");
$BIBAccounts = new BIBAccounts();
?>
<style>
table,
td,
@ -13,7 +12,6 @@ $BIBAccounts = new BIBAccounts();
.group-name {
width: 40%;
font-weight: 600px;
}
.group-total {
@ -85,85 +83,90 @@ $BIBAccounts = new BIBAccounts();
box-shadow: inset 0 0 0 transparent;
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>
<div class="content-wrapper">
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title"><?php echo $pageTitle; ?> </h3>
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " 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 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">
<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="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>
<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">Closing</label>
<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">Period</label>
<label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button>
<div class="form-group p-2 pb-0 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-danger btn-sm " data-toggle="dropdown" data-offset="-52">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form>
<script>
function resetForm() {
@ -178,81 +181,20 @@ $BIBAccounts = new BIBAccounts();
<!-- /.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> -->
<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 pl-2 ">
<div class="card-body p-0">
<div class="row">
<?php
// echo $_POST['showClosing'];
$ReportOptions = array(
'showZeroBalances' => false,
@ -261,26 +203,21 @@ $BIBAccounts = new BIBAccounts();
'showPeriod' => false,
);
?>
<table class="table table-bordered">
<thead>
<tr>
<td class="group-name"><b>Particulars</b></td>
<td class="group-total text-right pr-2 "><b>Amount</b></td>
<td class="group-name"><b>Particulars</b></td>
<td class="group-total text-right pr-2"><b>Amount</b></td>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="p-0">
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
<?php $Side1Total = 0; ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<div class="col-6 p-0 m-0 gy-0">
<div class="table-responsive">
<table class="table mb-0 pb-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(2); ?>
<?php $Side1Total = 0; ?>
<?php
// Initialize variables for column totals
$incomes_totalOpeningDr = 0;
@ -293,12 +230,11 @@ $BIBAccounts = new BIBAccounts();
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td><b><?php echo $group->acgroup_name; ?></b></td>
<td width="20%"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div>
@ -309,12 +245,8 @@ $BIBAccounts = new BIBAccounts();
$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;
@ -326,13 +258,12 @@ $BIBAccounts = new BIBAccounts();
?>
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name"><?php echo $group->acgroup_name; ?></td>
<td class="group-name"><b><?php echo $group->acgroup_name; ?></b></td>
<td class="group-total"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div>
@ -343,12 +274,24 @@ $BIBAccounts = new BIBAccounts();
$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">
</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
// Initialize variables for column totals
@ -361,12 +304,12 @@ $BIBAccounts = new BIBAccounts();
?>
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name"><?php echo $group->acgroup_name; ?></td>
<td class="group-total"><?php echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0); ?></td>
<td class="group-name"><b><?php echo $group->acgroup_name; ?></b></td>
<td class="group-total text-right "><?php echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0); ?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div>
@ -383,94 +326,131 @@ $BIBAccounts = new BIBAccounts();
?>
<?php endforeach; ?>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<?php
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
$TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance;
$TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance;
$PL = $TotalIncomes - $TotalExpenses;
$Side1Total += $PL;
?>
<div class="col-6 p-0 m-0 gy-0">
<table class="table">
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<td>Total Profit/Loss</td>
<td><b> Profit/Loss</b></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">
<table class="table">
<tr>
<th>Total Amount</th>
<th class="pl-1">Total Amount</th>
<th class="cr closing-cr">
<?php echo myCurrency($Side1Total); ?>
</th>
</tr>
</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 colspan="2" class="p-0">
<table class="table table-bordered">
<table class="table">
<tr>
<th>Total Amount</th>
<th class="pl-1">Total Amount</th>
<th class="dr closing-dr">
<?php echo myCurrency($totalClosingDr); ?>
</th>
</tr>
</table>
</td>
</tr>
</table>
</div> -->
<?php //pre($BIBAccounts->getAccountGroupsWithBalances($acgroup_id = null));
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
</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");
@ -490,27 +470,21 @@ function footerfunctions()
function exportTableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) {
var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed
}
for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue);
}
csv.push(row.join(","));
}
// Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent);
@ -538,5 +512,5 @@ function footerfunctions()
});
</script>
<?php
}
<?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);
$ExpensesTotal = $this->acc->getAccountBalanceByGroup(4);
$PL = $IncomesTotal - $ExpensesTotal;
?>
<style>
table,
td,
@ -92,78 +90,97 @@ $PL = $IncomesTotal - $ExpensesTotal;
box-shadow: inset 0 0 0 transparent;
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>
<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">Cash Flow<?php //echo $pageTitle;
<h3 class="card-title mt-1">Cash Flow<?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">
<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">
<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">
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div>
</div> -->
<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 class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label>
<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">Closing</label>
<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">Period</label>
<label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button>
<div class="form-group p-2 pb-0 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-danger btn-sm " data-toggle="dropdown" data-offset="-52">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
@ -171,10 +188,9 @@ $PL = $IncomesTotal - $ExpensesTotal;
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button>
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
<!-- <button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> -->
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
</form>
<script>
function resetForm() {
@ -230,9 +246,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div>
</div>
</div>
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "2078-4-1";
@ -242,31 +256,28 @@ $PL = $IncomesTotal - $ExpensesTotal;
document.getElementById("FilterForm").submit();
}
</script>
</div> -->
</div>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<div class="card card-primary card-outline">
<!-- <div class="card-header">
<h4 class="card-title">Cash Flow</h4>
</div> -->
<div class="card-body table-responsive p-0">
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
<table class="table table-head-fixed table-bordered g-0">
<table class="table table-bordered p-0 ">
<thead>
<tr>
<th class="" width="35%"><?php myLang("Cash inflow"); ?></th>
<th class="text-right" width="15%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th>
<th class="" width="35%"><?php echo myLang("Cash outflow"); ?></th>
<th class="text-right" width="15%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th>
<th class="" width="30%"><?php myLang("Cash inflow"); ?></th>
<th class="text-right" width="10%"></th>
<th class="text-right pr-1" width="10%"><?php myLang("Amount"); ?></th>
<th class="pl-2" width="30%"><?php echo myLang("Cash outflow"); ?></th>
<th class="text-right" width="10%"></th>
<th class="text-right pr-1" width="10%"><?php myLang("Amount"); ?></th>
</tr>
</thead>
<tbody>
@ -274,37 +285,35 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td colspan=3 class="p-0">
<table class="table g-0">
<?php $total1 = 0;
$counter = 0;
$index = 0;
foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?>
<?php if ($Incomes['account'] == "GROUP TOTAL") : ?>
<!-- <tr>
<td class="" width="70%"><b><?php echo $Incomes['group']; ?></b></td>
<td width="15%"></td>
<td class="text-right" width="15%"><u><?php echo myCurrency($Incomes['amount']); ?></u></td>
</tr> -->
<?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?>
<tr>
<td class="" width="70%"><b><?php echo $Incomes['category']; ?></b></td>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td width="15%"></td>
<tr class="parent-row" class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $index; ?>">
<td class="" width="60%"><b><?php echo $Incomes['category']; ?></b></td>
<td width="20%"></td>
<td class="text-right " width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
</tr>
<?php else : ?>
<?php $total1 += $Incomes['amount']; ?>
<tr>
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td>
<td width="15%"></td>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
<tr class="collapse" data-target="#group_<?php echo $index; ?>">
<td class="" width="60%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td>
<td class="text-right " width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td width="20%"></td>
</tr>
<?php endif; ?>
<?php $counter = $index ?>
<?php }; ?>
</table>
</td>
<td colspan=3 class="p-0">
<table class="table g-0">
<table class="table p-0">
<?php $total = 0;
foreach ($IncomesExpenses['Expenses'] as $Expenses) {
if ($Expenses['account'] == "GROUP TOTAL") : ?>
@ -312,53 +321,41 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td class="" width="70%"><b><?php echo $Expenses['group']; ?></b></td>
<td width="15%"></td>
<td class="text-right" width="15%"><u><?php echo myCurrency($Expenses['amount']); ?></u></td>
</tr> -->
<?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?>
<tr>
<td class="" width="70%"><b><?php echo $Expenses['category']; ?></b></td>
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td width="15%"></td>
<tr data-toggle="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="" width="60%"><b><?php echo $Expenses['category']; ?></b></td>
<td width="20%"></td>
<td class="text-right " width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
</tr>
<?php else : ?>
<?php $total += $Expenses['amount']; ?>
<tr>
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td>
<td width="15%"></td>
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
<tr class="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="" width="60%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td>
<td class="text-right" width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td width="20%"></td>
</tr>
<?php endif; ?>
<?php }; ?>
</table>
</td>
</tr>
</tbody>
<tr>
<th>Total</th>
<th class="p-1">Total</th>
<td></td>
<td class="text-right"><?php echo myCurrency($total1); ?></td>
<th>Total</th>
<td class="text-right text-bold"><?php echo myCurrency($total1); ?></td>
<th class="p-1">Total</th>
<td></td>
<td class="text-right"><?php echo myCurrency($total); ?></td>
<td class="text-right text-bold"><?php echo myCurrency($total); ?></td>
</tr>
<tr>
<th></th>
<td></td>
<td class="text-right"></td>
<th>Net Inflow</th>
<th class="pl-1">Net Inflow</th>
<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>
<?php $Bank = $BIBAccounts->getAccountCategoriesWithBalances(null, 2); ?>
<?php foreach ($Bank->accounts as $account) : ?>
@ -366,40 +363,88 @@ $PL = $IncomesTotal - $ExpensesTotal;
<th></th>
<td></td>
<td class="text-right"></td>
<th><?php echo $account->account_name; ?></th>
<th class="pl-1"><?php echo $account->account_name; ?></th>
<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>
<?php endforeach; ?>
<?php $Cash = $BIBAccounts->getAccountCategoriesWithBalances(null, 3); ?>
<?php foreach ($Cash->accounts as $account) : ?>
<tr>
<th></th>
<td></td>
<td class="text-right"></td>
<th><?php echo $account->account_name; ?></th>
<th class="pl-1"><?php echo $account->account_name; ?></th>
<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>
<?php endforeach; ?>
</table>
<?php //pre($IncomesExpenses);
?>
</div>
</div>
</div><!-- /.container-fluid -->
</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 = [];
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",
@ -416,4 +461,4 @@ $PL = $IncomesTotal - $ExpensesTotal;
maxDate: $('#toDate').data('end'),
});
</script>
<?php } ?>
<?php } ?>

View File

@ -1,24 +1,94 @@
<style>
.mt-26 {
margin-top: 26px;
}
</style>
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<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>
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</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 class="card-body">
<form method="GET" action="">
<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-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>
</form>
<div id="dataTable_Commands"></div>
@ -30,8 +100,6 @@
$vouchertype_id = isset($_GET['vouchertypes']) ? $_GET['vouchertypes'] : '';
$this->myaccounts->listVouchers($fromDate, $fromDate, $account_id, $vouchertype_id, true, true);
?>
</div>
</div>
</div>

View File

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

View File

@ -1,46 +1,35 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header bg-primary disabled color-palette">
<h3 class="card-title m-0"><?php echo $pageTitle; ?></h3>
</div>
<div class="card-body">
<form method="GET" action="#">
<div class="row">
<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 $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>
</form>
</div>
</div>
<div class="card">
<div id="dataTable_Commands">
</div>
<?php
if(!isset($account_id)){
if (!isset($account_id)) {
$account_id = 1;
}
?>
<?php if (isset($account_id) && $account_id != "") {
$fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth());
$toDate = isset($_GET['to_date']) ? $_GET['to_date'] : Today();
$this->myaccounts->showLedger($account_id, $fromDate, $toDate);
$this->myaccounts->showLedger($account_id, $fromDate, $toDate, $fiscalStart, $fiscalEnd);
} ?>
<div class="modal fade" id="ledgerdetails_box" tabindex="-1" role="dialog" aria-labelledby="ledgerdetails_box" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
@ -67,4 +56,3 @@
</div>
</div>
</div>

View File

@ -3,9 +3,82 @@
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline ">
<div class="card-header bg-primary disabled color-palette">
<h3 class="card-title"><?php echo $pageTitle; ?> </h3>
<div class="card card-primary card-outline">
<div class="card-header disabled color-palette">
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<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 class="card-body">
<div class="row">
@ -35,7 +108,7 @@
$html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>";
$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>";
$sn = 0;
$BalanceTotal = 0;
@ -43,10 +116,10 @@
$balance = getBalance($Account->account_id);
$BalanceTotal += $balance;
// 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;
$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 .= " <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\">
@ -85,6 +158,79 @@
<?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

@ -4,8 +4,81 @@
<div class="row">
<div class="col">
<div class="card card-primary card-outline ">
<div class="card-header bg-primary disabled color-palette">
<h3 class="card-title"><?php echo $pageTitle; ?> </h3>
<div class="card-header disabled color-palette">
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<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 class="card-body">
<div class="row">
@ -36,7 +109,7 @@
$html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>";
$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>";
$sn = 0;
$BalanceTotal = 0;
@ -44,10 +117,10 @@
$balance = getBalance($Account->account_id);
$BalanceTotal += $balance;
// 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;
$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 .= " <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\">
@ -86,6 +159,79 @@
<?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

@ -6,7 +6,7 @@
<div class="col">
<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>
</div>

View File

@ -1,15 +1,12 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<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>
</div>
<div class="card-body">
<div class="row">
<div class="col">
@ -18,9 +15,6 @@
</div>
</div>
</div>
</div>
</div>
</div>
@ -28,13 +22,9 @@
</div>
</div>
</div>
<?php function footerFunctions()
{
?>
<?php
}
?>

View File

@ -4,7 +4,7 @@
<div class="row">
<div class="col">
<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>
</div>
<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 -->
<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>
@ -89,76 +88,94 @@ $BIBAccounts = new BIBAccounts();
box-shadow: inset 0 0 0 transparent;
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>
<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"><?php echo $pageTitle; ?> <?php myLang("Report"); ?></h2>
<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">
<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">
<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">
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div>
</div> -->
<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 class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label>
<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">Closing</label>
<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">Period</label>
<label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button>
<div class="form-group p-2 pb-0 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-danger btn-sm " data-toggle="dropdown" data-offset="-52">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
@ -166,10 +183,8 @@ $BIBAccounts = new BIBAccounts();
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form>
<script>
function resetForm() {
@ -185,18 +200,15 @@ $BIBAccounts = new BIBAccounts();
</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">
<!-- <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 pl-2 pr-2">
<div class="row">
<?php
// echo $_POST['showClosing'];
$ReportOptions = array(
'showZeroBalances' => false,
@ -206,25 +218,17 @@ $BIBAccounts = new BIBAccounts();
);
// die;
?>
<table class="table table-bordered">
<div class="col-6 p-0">
<div class="table-responsive">
<table class="table ">
<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>
<th class="group-name pl-1">Particulars</th>
<th class="group-total text-center col-1">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;
@ -235,21 +239,14 @@ $BIBAccounts = new BIBAccounts();
$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="collapse">
<td colspan="2" class="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
@ -260,14 +257,40 @@ $BIBAccounts = new BIBAccounts();
$incomes_totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0;
$incomes_totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?>
<?php endforeach; ?>
</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>
</td>
<td colspan="2" class="p-0">
</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); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
// Initialize variables for column totals
$totalOpeningDr = 0;
@ -278,15 +301,9 @@ $BIBAccounts = new BIBAccounts();
$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="collapse">
<td colspan="2" class="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>
@ -303,88 +320,37 @@ $BIBAccounts = new BIBAccounts();
$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%">
<!-- <th></th>
<th></th> -->
<th class="pl-1">Total Profit</th>
<th class="cr closing-cr text-right text-bold"><?php echo myCurrency($PL); ?></th>
</tr>
</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">
</tbody>
<tfoot>
<th class="pl-1">Total Expenses</th>
<th class="dr closing-dr text-bold">
<?php if ($PL > 0) : ?>
<?php echo myCurrency($totalClosingDr + abs($PL)); ?>
<?php else : ?>
<?php echo myCurrency($totalClosingDr); ?>
<?php endif; ?>
</th>
</tr>
</tfoot>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -394,6 +360,14 @@ $BIBAccounts = new BIBAccounts();
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
@ -418,27 +392,21 @@ function footerfunctions()
function exportTableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) {
var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed
}
for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue);
}
csv.push(row.join(","));
}
// Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent);

View File

@ -8,7 +8,6 @@ $ExpenseAccounts = $this->acc->getAccountsByGroup(4);
$IncomesTotal = $this->acc->getAccountBalanceByGroup(3);
$ExpensesTotal = $this->acc->getAccountBalanceByGroup(4);
$PL = $IncomesTotal - $ExpensesTotal;
?>
<style>
table,
@ -91,80 +90,72 @@ $PL = $IncomesTotal - $ExpensesTotal;
box-shadow: inset 0 0 0 transparent;
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>
<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">Receipts And Payments <?php //echo $pageTitle;
<h3 class="card-title mt-1">Receipts And Payments <?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">
<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">
<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">
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div>
</div> -->
<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 class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label>
<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">Closing</label>
<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">Period</label>
<label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button>
<div class="form-group p-2 pb-0 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-danger btn-sm " data-toggle="dropdown" data-offset="-52">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
@ -172,10 +163,8 @@ $PL = $IncomesTotal - $ExpensesTotal;
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<!-- <button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form>
<script>
function resetForm() {
@ -189,39 +178,36 @@ $PL = $IncomesTotal - $ExpensesTotal;
</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">
<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">
<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>
<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"; ?>>
</div>
</div>
<div class="col-1 text-center">
<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"; ?>>
</div>
</div>
<div class="col-1 text-center">
<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"; ?>>
</div>
</div>
@ -234,9 +220,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div>
</div>
</div>
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "2078-4-1";
@ -246,23 +230,20 @@ $PL = $IncomesTotal - $ExpensesTotal;
document.getElementById("FilterForm").submit();
}
</script>
</div> -->
</div>
<div class="card">
<div class="card card-primary card-outline">
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
<table class="table table-head-fixed table-bordered g-0">
<table class="table table-head-fixed table-bordered g-0" id="TrialBalanceTable">
<thead>
<tr>
<th class="" width="35%"><?php myLang("Receipts"); ?></th>
<th class="text-right" width="15%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th>
<th class="" width="35%"><?php echo myLang("Payments"); ?></th>
<th class="text-right" width="15%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th>
<th class="" width="30%"><?php myLang("Receipts"); ?></th>
<th class="text-right" width="10%"></th>
<th class="text-right pr-2" width="10%"><?php myLang("Amount"); ?></th>
<th class="" width="30%"><?php echo myLang("Payments"); ?></th>
<th class="text-right" width="10%"></th>
<th class="text-right pr-2" width="10%"><?php myLang("Amount"); ?></th>
</tr>
</thead>
<tbody>
@ -270,33 +251,34 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td colspan=3 class="p-0">
<table class="table g-0">
<?php $total1 = 0;
$counter = 0;
$index = 0;
foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?>
<?php if ($Incomes['account'] == "GROUP TOTAL") : ?>
<!--tr>
<td class="" width="70%"><b><?php echo $Incomes['group']; ?></b></td>
<td width="15%"></td>
<td class="text-right" width="15%"><u><?php echo myCurrency($Incomes['amount']); ?></u></td>
</tr-->
<?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?>
<tr>
<td class="" width="70%"><b><?php echo $Incomes['category']; ?></b></td>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td width="15%"></td>
<?php $index++; ?>
<tr class="parent-row" class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $index; ?>">
<td class="" width="60%"><b><?php echo $Incomes['category']; ?></b></td>
<td width="20%"></td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
</tr>
<?php else : ?>
<?php $total1 += $Incomes['amount']; ?>
<tr>
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td>
<td width="15%"></td>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td>
<tr class="collapse" data-target="#group_<?php echo $index; ?>">
<td class="pr-2" width="60%">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?>
</td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td width="20%"></td>
</tr>
<?php endif; ?>
<?php $counter = $index ?>
<?php }; ?>
</table>
</td>
<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 width="15%"></td>
<td class="text-right" width="15%"><u><?php echo myCurrency($Expenses['amount']); ?></u></td>
</tr-->
<?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?>
<tr>
<td class="" width="70%"><b><?php echo $Expenses['category']; ?></b></td>
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td width="15%"></td>
<?php $counter++; ?>
<tr data-toggle="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="pr-2" width="60%"><b><?php echo $Expenses['category']; ?></b></td>
<td width="20%"></td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
</tr>
<?php else : ?>
<?php $total += $Expenses['amount']; ?>
<tr>
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td>
<td width="15%"></td>
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td>
<tr class="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="" width="60%">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo $Expenses['account']; ?>
</td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td width="20%"></td>
</tr>
<?php endif; ?>
<?php }; ?>
</table>
</td>
</tr>
<?php $balance_fi = $total1 - $total; ?>
<?php if ($balance_fi < 0) : $total1 += $balance_fi; ?>
<tr>
<th><?php echo myLang("Closing Balance"); ?></th>
<th class="pl-2"><?php echo myLang("Closing Balance"); ?></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>
<td></td>
@ -352,37 +328,84 @@ $PL = $IncomesTotal - $ExpensesTotal;
<th></th>
<th></th>
<td></td>
<th><?php echo myLang("Closing Balance"); ?></th>
<th class="pl-2"><?php echo myLang("Closing Balance"); ?></th>
<th></th>
<td><?php echo myCurrency($balance_fi); ?></td>
<td class="pr-2"><?php echo myCurrency($balance_fi); ?></td>
</tr>
<?php endif; ?>
<tr>
<th>Total</th>
<th class="pl-2">Total</th>
<th></th>
<td><?php echo myCurrency($total1); ?></td>
<th>Total</th>
<td class="pr-2"><?php echo myCurrency($total1); ?></td>
<th class="pl-2">Total</th>
<th></th>
<td><?php echo myCurrency($total); ?></td>
<td class="pr-2"><?php echo myCurrency($total); ?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div><!-- /.container-fluid -->
</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 = [];
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",
@ -399,4 +422,4 @@ $PL = $IncomesTotal - $ExpensesTotal;
maxDate: $('#toDate').data('end'),
});
</script>
<?php } ?>
<?php } ?>

View File

@ -25,7 +25,7 @@
<div class="card card-primary card-outline">
<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> -->
</h5>
@ -34,15 +34,15 @@
<div class="card-body">
<?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>
<tr>
<th>Sn</th>
<th>Voucher Name</th>
<th>Default Debits</th>
<th>Default Credits</th>
<th>Voucher Color</th>
<th class="table-col col-2">Action</th>
<th class="text-center">Sn</th>
<th class="col-2">Voucher Name</th>
<th class="col-4">Default Debits</th>
<th class="col-4">Default Credits</th>
<th class="col-1 text-center">Voucher Color</th>
<th class=" text-center">Action</th>
</tr>
</thead>
<tbody>
@ -51,14 +51,14 @@
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
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 showAccountCategoriesByIds(($TableRow->default_debits!="")?explode(",",$TableRow->default_debits):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>
<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 class="text-center">
<?php showEditButton($commandURL = "accounts/setup/editvouchertype/" . $TableRow->vouchertype_id , "Edit", ""); ?>
</td>

View File

@ -21,6 +21,7 @@ $BIBAccounts = new BIBAccounts();
.group-total {
width: 10%;
}
.table-gray {
@ -31,8 +32,10 @@ $BIBAccounts = new BIBAccounts();
.table th {
padding: 0px;
margin: 0px;
}
.table t
.bg-darker {
background-color: #ddd;
}
@ -71,6 +74,9 @@ $BIBAccounts = new BIBAccounts();
.underline {
text-decoration: underline;
}
.text-right{
padding-right: 5px;
}
.form-control {
display: block;
@ -88,13 +94,17 @@ $BIBAccounts = new BIBAccounts();
box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.bg-gray tr th {
vertical-align: middle;
}
</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"><?php echo $pageTitle; ?> <?php myLang("Report"); ?></h2>
<h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report");
?></h2>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
@ -105,51 +115,49 @@ $BIBAccounts = new BIBAccounts();
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">
<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">
<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">
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div>
</div> -->
<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 class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label>
<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">Closing</label>
<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">Period</label>
<label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button>
<div class="form-group p-2 pb-0 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-danger btn-sm " data-toggle="dropdown" data-offset="-52">
<button type="submit" class="btn btn-warning btn-sm" data-toggle="dropdown" data-offset="-52">
Export
</button>
@ -161,7 +169,7 @@ $BIBAccounts = new BIBAccounts();
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button>
<!-- <button 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>
@ -203,9 +211,9 @@ $BIBAccounts = new BIBAccounts();
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<thead class="bg-gray">
<tr>
<th rowspan="2">Particulars</th>
<th rowspan="2 class="">Particulars</th>
<?php if ($ReportOptions['showOB']) : ?>
<th colspan="2" class="text-center">Opening</th>
<th colspan=" 2" class="text-center">Opening</th>
<?php endif; ?>
<?php if ($ReportOptions['showPeriod']) : ?>
<th colspan="2" class="text-center">Current Period</th>
@ -246,7 +254,7 @@ $BIBAccounts = new BIBAccounts();
<?php if ($ReportOptions['showOB']) : ?>
<td class="group-total"><?php // echo myCurrency(($group->posting_side == "DR") ? $group->opening_balance : 0);
?></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>
<?php endif; ?>
<?php if ($ReportOptions['showPeriod']) : ?>
@ -309,6 +317,14 @@ $BIBAccounts = new BIBAccounts();
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() {

View File

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

View File

@ -81,7 +81,7 @@ button:hover {
<div class="row">
<div class="col">
<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">
<?php //echo $pageTitle;
?>
@ -99,7 +99,7 @@ button:hover {
</fieldset>
</div>
<div class="col-8">
<h1 class="text-center"><?php echo $pageTitle; ?> Voucher</h1>
<h1 class="text-center"><?php echo $pageTitle; ?></h1>
<!-- <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>
</fieldset> -->

View File

@ -1,17 +1,12 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<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">
<form method="GET" action="">
<div class="row">
@ -26,11 +21,10 @@
</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> -->
<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-1"><?php createButton("show_voucher", "Show", "show_voucher", "Submit", "mt-30"); ?></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", "Show", "show_voucher", "Submit", "mt-26"); ?></div>
<div class="col-1"><?php createButton("show_voucher_reset", "Reset", "reset", site_url("accounts/vouchers/listvouchers"), "mt-26"); ?></div>
</div>
</form>
<div id="dataTable_Commands"></div>
@ -40,10 +34,8 @@
// echo $toDate;
$account_id = isset($_GET['account_id']) ? $_GET['account_id'] : '';
$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>
@ -51,3 +43,4 @@
</div>
</div>
</div>

View File

@ -8,7 +8,7 @@
<div class="card card-primary card-outline">
<div class="card-header">
<!-- <?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);
?>
</h5>
@ -80,7 +80,7 @@
<div class="col-9">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<h5 class="m-0 card-title">
Current Fiscal Year :
<?php $currentFiscalYear = showFiscalYear(); ?>
@ -95,12 +95,12 @@
<table class="table table-bordered table-striped longdataTable">
<thead>
<tr>
<th>Fiscal Year </th>
<th> Code</th>
<th class="col-2">Fiscal Year </th>
<th class="col-4"> Code</th>
<th>From</th>
<th>To</th>
<!-- <th>Created By</th> -->
<th>Action</th>
<th class="col-1 text-center">Action</th>
</tr>
</thead>
<tbody>
@ -115,7 +115,7 @@
<td><?php echo $TableRow->fiscalyear_to; ?></td>
<!-- <td><?php //echo $TableRow->created_by;
?></td> -->
<td>
<td class="text-center">
<!-- <?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);
$subparam2 = $this->uri->segment(4);
?>
<!-- Main Sidebar Container -->
<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">
@ -16,7 +15,6 @@ $subparam2 = $this->uri->segment(4);
<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="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 class="form-inline pb-2">
<div class="input-group" data-widget="sidebar-search">
@ -74,7 +72,7 @@ $subparam2 = $this->uri->segment(4);
<?php if ($LoggedUser == "admin") : ?>
<?php //showMenu("Create New Ledger", "accounts/accountheads/add");
?>
<?php showMenu("List of Ledgers", "accounts/accountheads/list"); ?>
<?php showMenu("Ledgers", "accounts/accountheads/list"); ?>
<?php endif; ?>
</ul>
</li>
@ -118,7 +116,7 @@ $subparam2 = $this->uri->segment(4);
<?php if ($LoggedUser == "admin") : ?>
<?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" : ""; ?>">
<p><?php echo $VoucherType->voucher_name; ?> Voucher</p>
<p><?php echo $VoucherType->voucher_name; ?></p>
</a></li>
<?php endif;
endforeach; ?>
@ -140,7 +138,6 @@ $subparam2 = $this->uri->segment(4);
<?php if ($LoggedUser == "admin") :
// showMenu("Inventory Stock", "inventory/stocks/list");
showMenu("Stock Report", "inventory/stocks/summary");
showMenu("Sales Register", "inventory/sales/sales_register");
showMenu("Purchase Register", "inventory/purchases/purchase_register");
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("Balance Sheet", "accounts/reports/balance_sheet");
// 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("Cash Flow", "accounts/reports/cash_flow");
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/reports/balance_by_group");
// showMenu("Balance by Category", "accounts/reports/balance_by_category");
showMenu("Accounts Receivables", "accounts/ledger/receiveables");
showMenu("Accounts Payables", "accounts/ledger/payables");
showMenu("Purchase Summary", "inventory/purchases/list");

View File

@ -91,7 +91,7 @@
<th width="30%"><?php myLang('Inventory Group'); ?></th>
<!-- <th width="5%"><?php //myLang('Unit'); ?></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>
</thead>
<tbody>
@ -100,11 +100,11 @@
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><tr>
<td><?php echo $a; ?></td>
<td class="text-center"><?php echo $a; ?></td>
<td><?php echo $TableRow->title; ?></td>
<!-- <td><?php //echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id); ?></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 showDeleteButton($id); ?>
</td>

View File

@ -38,7 +38,7 @@
<!--COL START-->
<div class="col-6">
<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>
<!--COL END-->
@ -47,7 +47,7 @@
<!--COL START-->
<div class="col">
<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>
<!--COL END-->
@ -117,7 +117,7 @@
<table class="table table-bordered table-striped longdataTable">
<thead>
<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="10%"><?php myLang('Code'); ?></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('Rate'); ?></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>
</thead>
<tbody>
@ -134,7 +134,7 @@
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
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->item_code; ?></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->rate; ?></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 showDeleteButton($id); ?>
</td>

View File

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

View File

@ -12,12 +12,11 @@
<table class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th><?php myLang('S.N'); ?></th>
<th class="text-center"><?php myLang('S.N'); ?></th>
<th><?php myLang('Date'); ?></th>
<th><?php myLang('Purchase Transaction'); ?></th>
<th><?php myLang('Amount'); ?></th>
<td><b>Action</b></th>
<th class="text-center"><?php myLang('Amount'); ?></th>
<td class="text-center"><b>Action</b></th>
</tr>
</thead>
<tbody>
@ -52,9 +51,7 @@
</div>
</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); ?>
</td>
</tr>

View File

@ -12,12 +12,12 @@
<table class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th><?php myLang('S.N'); ?></th>
<th><?php myLang('Date'); ?></th>
<th><?php myLang('Purchase Transaction'); ?></th>
<th><?php myLang('Amount'); ?></th>
<th width="3%" class="text-center"><?php myLang('S.N'); ?></th>
<th width="10%" class="col-1"><?php myLang('Date'); ?></th>
<th class="table-col col-9"><?php myLang('Purchase Transaction'); ?></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>
</thead>
<tbody>
@ -29,7 +29,7 @@
<td><?php echo $TableRow->purchase_date; ?></td>
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></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); ?>
</td>
</tr>

View File

@ -7,11 +7,11 @@
<div class="card card-primary card-outline">
<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>
</div>
<div id="printableArea">
<div class="card-body">
<div class="row bill-header">
@ -88,7 +88,7 @@
</div>
</div>
</div>
</div>
</div>
</div>
@ -96,3 +96,16 @@
</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;
foreach ($StockItems as $Stock) : $a++; ?>
<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->Summary->Unit->title; ?></td>
<td class="text-right"><?php echo $oqty = $Stock->Summary->Opening->qty; ?></td>

View File

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

View File

@ -12,17 +12,17 @@
<table class="table table-bordered table-striped dataTable">
<thead>
<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><?php myLang('Transaction'); ?></th>
<th class="table-col col-1"><?php myLang('Amount'); ?></th>
<th class="table-col col-1"><?php myLang('Action'); ?></th>
<th class="table-col col-1 text-center"><?php myLang('Amount'); ?></th>
<th class="table-col col-1 text-center"><?php myLang('Action'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($SalesRecords as $TableRow) : ?>
<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><b><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></b>
<div class="row ml-2 mr-2" style="border-bottom: 1px solid;">
@ -48,7 +48,7 @@
</div>
</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); ?>
</td>
</tr>

View File

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

View File

@ -7,11 +7,11 @@
<div class="card card-primary card-outline">
<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>
</div>
<div id="printableArea">
<div class="card-body">
<div class="row bill-header">
@ -86,7 +86,7 @@
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -2,21 +2,14 @@
<!-- <div class="content">
<div class="container-fluid">
<div class="card card-primary ">
<div class="card-header">
<h3 class="card-title"><?php //echo $pageTitle;
?> </h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-plus"></i>
</button>
</div>
</div>
<div class="card-body">
<form method="post" action="" id="FilterForm">
<div class="row align-items-end">
@ -62,7 +55,6 @@
</div>
<div class="col">
<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">Filter</button>
<button type="submit" class="btn btn-success mr-2">Export</button>
@ -70,7 +62,6 @@
</div>
</div>
</div>
</form>
<script>
function resetForm() {
@ -89,10 +80,7 @@
</div>
</div>
</div> -->
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
@ -100,66 +88,62 @@
<div class="card-header">
<h5 class="card-title">
<?php echo $pageTitle; ?>
<!-- <?php //echo $pageTitle;
?> <a href="<?php //echo site_url("inventory/purchases/add");
?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle;
?></a> -->
</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">
<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 nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div>
<div class="dropdown-divider"></div>
<div class="form-check">
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div>
</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>
<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">Closing</label>
<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">Period</label>
<label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button>
<div class="form-group p-2 pb-0 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="button" class="btn btn-danger btn-sm " data-toggle="dropdown" data-offset="-52">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button>
<!-- <div class="dropdown-menu" role="menu">
@ -170,6 +154,17 @@
</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 class="card-body">
@ -177,19 +172,15 @@
<table class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th rowspan="2"><?php myLang('Item'); ?></th>
<th rowspan="2" width="80"><?php myLang('Units'); ?></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" 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('Purchase'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Sales'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Closing'); ?></th>
</tr>
<tr>
<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('Amount'); ?></th>
@ -202,16 +193,17 @@
<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('Amount'); ?></th>
</tr>
</thead>
<tbody>
<?php $Total = 0;$PTotal=0;$STotal=0;$CTotal=0;
foreach ($StockRecords as $TableRow) : ?>
<?php $Total = 0;
$PTotal = 0;
$STotal = 0;
$CTotal = 0;
foreach ($StockRecords as $index => $TableRow) : ?>
<tr>
<td><?php echo ($TableRow->Item)?$TableRow->Item->title:"N/A"; ?></td>
<td class="text-center"><?php echo $index + 1; ?></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 class="text-right"><?php echo $TableRow->Summary->Opening->qty; ?></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><?php echo myCurrency($cTotal = $TableRow->Summary->Closing->amount);
$CTotal += $cTotal; ?></td>
</tr>
<?php endforeach; ?>
<tbody>
<tfoot>
<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 colspan="2"></td>
<td><?php echo myCurrency($PTotal); ?></td>
@ -244,6 +234,7 @@
<td><?php echo myCurrency($STotal); ?></td>
<td colspan="2"></td>
<td><?php echo myCurrency($CTotal); ?></td>
</tr>
</tfoot>
</table>
@ -254,3 +245,84 @@
</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="card card-primary card-outline">
<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 //echo $pageTitle; ?>
<?php //showListButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/list","List ".$pageTitle); ?>
@ -59,7 +59,7 @@
<div class="col-9">
<div class="card card-primary card-outline">
<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); ?>
</h5>
</div>
@ -68,10 +68,10 @@
<table class="table table-bordered table-striped longdataTable">
<thead>
<tr>
<th class="table-col col-1"><?php myLang('S.N'); ?></th>
<th><?php myLang('Unit Name '); ?></th>
<th><?php myLang('Unit Code'); ?></th>
<th class="table-col col-1">Action</th>
<th class="text-center" width="5%"><?php myLang('S.N'); ?></th>
<th class="col-5" width="30%"><?php myLang('Unit Name '); ?></th>
<th class="col-5" width="57%"><?php myLang('Unit Code'); ?></th>
<th class="col-1 text-center" >Action</th>
</tr>
</thead>
<tbody>
@ -80,10 +80,10 @@
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
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->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); ?>
</td>
</tr>

View File

@ -1,39 +1,34 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<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 class="card-body ">
<?php $TableData = $this->db->query("select * from tbl_translations where status=1")->result(); ?>
<table class="table table-bordered table-striped longdataTable">
<thead>
<tr>
<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-2"><?php myLang('Nepali'); ?></th>
<th class="text-center col-5"><?php myLang('English'); ?></th>
<th class="text-center col-5"><?php myLang('Nepali'); ?></th>
<th class="text-center col-1"><?php myLang('Action'); ?></th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php $a = 0;
foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><tr>
<td class="text-center"><?php echo $TableRow->translation_id; ?></td>
<td><?php echo $TableRow->english; ?></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>
<a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs"><i class="fas fa-trash"></i> Delete</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></a>
</td>
</tr>
<?php endforeach; ?>

View File

@ -123,12 +123,22 @@ margin-bottom: .5rem;
.select2-container--default .select2-selection--single .select2-selection__arrow b {
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 {
padding-right: 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 {
padding-right: 0px!important;
} */
.form-group textarea.form-control {
height: 50px !important;
}
.select2-container .select2-selection--single {
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_URL=http://localhost/School-With-Accounts/account/
APP_URL=http://localhost/bbnepal/BBnepal-Accounts
DB_CONNECTION=mysql
DB_HOST=127.0.0.1:3309
DB_PORT=3309