Compare commits

..

40 Commits

Author SHA1 Message Date
7008ec0310 New changes in BBNepal 2024-10-17 17:06:13 +05:45
4ac5a5e491 bbnepal new changes 2024-10-08 15:47:07 +05:45
ad3e5eb1ec account categories removed 2024-10-07 16:35:08 +05:45
318998d272 changes for bbnepal data 2024-10-07 13:59:13 +05:45
967642f2be changes for bbnepal 2024-10-07 11:41:27 +05:45
e3c8a3b5fe correction of error for purchase and sales 2024-10-04 16:31:02 +05:45
ec6bfaf7ff export excel second 2024-09-30 17:25:58 +05:45
4683fe67a7 export excel 2024-09-30 16:09:29 +05:45
60f4c75eb0 changes for print 2024-09-29 17:46:26 +05:45
684e01bf48 changes for filter and print 2024-09-29 16:59:27 +05:45
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
1398 changed files with 43636 additions and 76382 deletions

4
.env
View File

@ -3,7 +3,7 @@ APP_URL=http://localhost/bbnepal/School-With-Accounts/account/
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=localhost DB_HOST=localhost
DB_PORT=3309 DB_PORT=3309
DATABASE_OPTIONS=bbnepal_accounting,myurlsco_accounts1,myurlsco_accounts2,myurlsco_accounts3 DATABASE_OPTIONS=bbnepal_accounting,myurlsco_accounts1,myurlsco_accounts2,myurlsco_accounts3,myurlsco_bbnepal_acc #given
DB_DATABASE=bbnepal_accounting DB_DATABASE=bbnepal_accounting # given
DB_USERNAME=root DB_USERNAME=root
DB_PASSWORD= DB_PASSWORD=

View File

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

View File

@ -10,8 +10,8 @@ class Ledger extends CI_Controller
} }
public function _remap($alias = "", $params = array()) public function _remap($alias = "", $params = array())
{ {
$data['dataValue'] = $this->session; $data['dataValue'] = $this->session;
// echo "<pre>"; print_r($_GET['accategory_id']);die();
$data['pageTitle'] = "Account Head"; $data['pageTitle'] = "Account Head";
switch ($alias) { switch ($alias) {
@ -19,9 +19,13 @@ class Ledger extends CI_Controller
$data['pageTitle'] = "Ledger"; $data['pageTitle'] = "Ledger";
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result(); $AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
foreach ($AccountGroups as $AccountGroup) { foreach ($AccountGroups as $AccountGroup) {
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result(); // $AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("accategory_id ", ($_GET['accategory_id'] ?? ""))->get("tbl_accategories")->result();
} }
$data['AccountGroups'] = $AccountGroups; $data['AccountGroups'] = $AccountGroups;
// echo "<pre>"; print_r($data['AccountGroups']);die();
loadView("accounts/ledger/navigate", $data); loadView("accounts/ledger/navigate", $data);
break; break;
case 'getledgersummary': case 'getledgersummary':
@ -39,11 +43,27 @@ class Ledger extends CI_Controller
$this->load->view("accounts/ledgersummary", $data); $this->load->view("accounts/ledgersummary", $data);
break; break;
case 'partyledger': 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']; // $_GET['show_ledger'];
if (!isset($_GET['from_date'])) {
$data['from_date'] = null;
}
if (!isset($_GET['to_date'])) {
$data['to_date'] = null;
}
if (isset($_GET)) {
$data = $_GET;
}
$data['pageTitle'] = "View Party Ledger";
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
if (isset($_GET['show_ledger'])) { if (isset($_GET['show_ledger'])) {
$fromDate_Nepali = $_GET['from_date']; $fromDate_Nepali=$data['from_date'];
$toDate_Nepali = $_GET['to_date']; $toDate_Nepali =$data['to_date'];
$data['fromDate'] = NepaliToEnglishDate($fromDate_Nepali); $data['fromDate'] = NepaliToEnglishDate($fromDate_Nepali);
$data['toDate'] = NepaliToEnglishDate($toDate_Nepali); $data['toDate'] = NepaliToEnglishDate($toDate_Nepali);
$data['fromDate_Nepali'] = $fromDate_Nepali; $data['fromDate_Nepali'] = $fromDate_Nepali;
@ -52,7 +72,7 @@ class Ledger extends CI_Controller
} }
loadView("accounts/ledger/partywise", $data); loadView("accounts/ledger/partywise", $data);
break; break;
case 'print': case 'print':
$account_id = $this->uri->segment(4); $account_id = $this->uri->segment(4);
$fromDate=(isset($_GET['from_date'])?$_GET['from_date']:NepaliDate(($this->session->userdata('FiscalYear'))->fiscalyear_from)); $fromDate=(isset($_GET['from_date'])?$_GET['from_date']:NepaliDate(($this->session->userdata('FiscalYear'))->fiscalyear_from));
$toDate=(isset($_GET['to_date'])?$_GET['to_date']:NepaliDate(($this->session->userdata('FiscalYear'))->fiscalyear_to)); $toDate=(isset($_GET['to_date'])?$_GET['to_date']:NepaliDate(($this->session->userdata('FiscalYear'))->fiscalyear_to));
@ -75,15 +95,44 @@ class Ledger extends CI_Controller
loadView("accounts/daybook", $data); loadView("accounts/daybook", $data);
break; break;
case 'bank_book': case 'bank_book':
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Bank Book"; $data['pageTitle'] = "Bank Book";
loadView("accounts/ledger_bankbook", $data); loadView("accounts/ledger_bankbook", $data);
break; break;
case 'cash_book': case 'cash_book':
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Cash Book"; $data['pageTitle'] = "Cash Book";
loadView("accounts/ledger_cashbook", $data); loadView("accounts/ledger_cashbook", $data);
break; break;
case 'receiveables': case 'receiveables':
$data['pageTitle'] = "Accounts Receiveables"; $data['pageTitle'] = "Accounts Receivables";
loadView("accounts/ledger_receiveables", $data); loadView("accounts/ledger_receiveables", $data);
break; break;
case 'payables': case 'payables':

View File

@ -38,7 +38,7 @@ class Reports extends CI_Controller
$data['AccountGroups'] = $AccountGroups; $data['AccountGroups'] = $AccountGroups;
loadView("accounts/ledgerall", $data); loadView("accounts/ledgerall", $data);
break; break;
case 'getledgersummary': case 'getledgersummary':
$account_id = $this->uri->segment(3); $account_id = $this->uri->segment(3);
$data['pageTitle'] = "Ledger"; $data['pageTitle'] = "Ledger";
$Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result(); $Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
@ -52,6 +52,25 @@ class Reports extends CI_Controller
$data['account_id'] = $account_id; $data['account_id'] = $account_id;
$this->load->view("accounts/ledgersummary", $data); $this->load->view("accounts/ledgersummary", $data);
break; break;
case 'ledgerCashBook':
// $data = $this->uri->segment(3);
// $data['pageTitle'] = "Ledger";
// $Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
// $Account = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
// foreach ($Transactions as $T) {
// // $T->AccountCategory=$this->db->where("status",1)->where("accategory_id",$AccountGroup->acgroup_id)->get("tbl_accategories")->result();
// $T->Voucher = $this->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
// }
// $data['Transactions'] = $Transactions;
// $data['Account'] = $Account;
// $data['account_id'] = $account_id;
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$this->load->view("accounts/ledger/ledger_cash_book_details",$data);
break;
case 'trialbalance_old': case 'trialbalance_old':
$data['pageTitle'] = "Trial Balance"; $data['pageTitle'] = "Trial Balance";
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result(); $AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
@ -65,8 +84,20 @@ class Reports extends CI_Controller
loadView("accounts/trialbalance", $data); loadView("accounts/trialbalance", $data);
break; break;
case 'trialbalance': case 'trialbalance':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from); if (!isset($_POST['fromDate'])) {
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to); $data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
// echo "<pre>"; print_r($data); die();
$data['pageTitle'] = "Trial Balance"; $data['pageTitle'] = "Trial Balance";
loadView("accounts/trialbalance_new", $data); loadView("accounts/trialbalance_new", $data);
break; break;
@ -116,7 +147,7 @@ class Reports extends CI_Controller
break; break;
case 'balance_by_ledger': case 'balance_by_ledger':
$accategory_id = 0; $accategory_id = 0;
$data['pageTitle'] = "Account Balances By Group"; $data['pageTitle'] = "Account Balances By Ledgers";
if (isset($_GET['group'])) { if (isset($_GET['group'])) {
$accategory_id = ($_GET['group']) ? $_GET['group'] : 0; $accategory_id = ($_GET['group']) ? $_GET['group'] : 0;
} }
@ -131,11 +162,20 @@ class Reports extends CI_Controller
$data['pageTitle'] = "Profit & Loss Statement"; $data['pageTitle'] = "Profit & Loss Statement";
loadView("accounts/pl", $data); loadView("accounts/pl", $data);
break; break;
case 'pl': case 'pl':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from); if (!isset($_POST['fromDate'])) {
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to); $data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Profit & Loss Statement"; $data['pageTitle'] = "Profit & Loss Statement";
loadView("accounts/pl_new", $data); loadView("accounts/pl_new", $data);
break; break;
case 'pl_grouped': case 'pl_grouped':
@ -147,8 +187,20 @@ class Reports extends CI_Controller
loadView("accounts/balancesheet", $data); loadView("accounts/balancesheet", $data);
break; break;
case 'balance_sheet': case 'balance_sheet':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from); // $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to); // $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Balance Sheet"; $data['pageTitle'] = "Balance Sheet";
loadView("accounts/balancesheet_new", $data); loadView("accounts/balancesheet_new", $data);
break; break;
@ -157,8 +209,20 @@ class Reports extends CI_Controller
loadView("accounts/balance_sheet_vertical", $data); loadView("accounts/balance_sheet_vertical", $data);
break; break;
case 'cash_flow': case 'cash_flow':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from); // $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to); // $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Cash Flow"; $data['pageTitle'] = "Cash Flow";
loadView("accounts/cash_flow", $data); loadView("accounts/cash_flow", $data);
break; break;
@ -171,8 +235,22 @@ class Reports extends CI_Controller
loadView("accounts/incomes_expenses", $data); loadView("accounts/incomes_expenses", $data);
break; break;
case 'receipt_and_payment': case 'receipt_and_payment':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from); if (!isset($_POST['fromDate'])) {
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to); $data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Cash Flow"; $data['pageTitle'] = "Cash Flow";
loadView("accounts/receipt_and_payment", $data); loadView("accounts/receipt_and_payment", $data);
break; break;
@ -209,11 +287,9 @@ class Reports extends CI_Controller
case 'getledgersummary': case 'getledgersummary':
$account_id = $this->uri->segment(5); $account_id = $this->uri->segment(5);
$this->myaccounts->showLedger($account_id); $this->myaccounts->showLedger($account_id);
break; break;
case 'default': case 'default':
//show_404(); //show_404();
break; break;
} }
} }

View File

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

View File

@ -50,6 +50,7 @@ class Purchases extends CI_Controller
'items_id' => $item, 'items_id' => $item,
'qty' => $_POST['quantity'][$a], 'qty' => $_POST['quantity'][$a],
'rate' => $_POST['rate'][$a], 'rate' => $_POST['rate'][$a],
'vat' => $_POST['vat'][$a],
'created_on' => date('Y-m-d H:i:s'), 'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin', 'created_by' => 'admin',
'remarks' => '', 'remarks' => '',
@ -76,8 +77,8 @@ class Purchases extends CI_Controller
'remarks' => filter_var($_POST['remarks']), 'remarks' => filter_var($_POST['remarks']),
'status' => 1, 'status' => 1,
); );
pre($_POST); // pre($_POST);
die; // die;
//$this->db->insert('tbl_purchases', $TableData); //$this->db->insert('tbl_purchases', $TableData);
redirect("inventory/purchases/list"); redirect("inventory/purchases/list");
} }
@ -92,8 +93,22 @@ class Purchases extends CI_Controller
$this->db->delete('tbl_purchasedetails'); $this->db->delete('tbl_purchasedetails');
redirect("inventory/purchases/list"); redirect("inventory/purchases/list");
break; break;
case 'purchase_register': case 'purchase_register':
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords(); if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Sales & Register";
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords($data['fiscalStart'],$data['fiscalEnd']);
loadView("inventory/purchases/register", $data); loadView("inventory/purchases/register", $data);
break; break;

View File

@ -12,14 +12,17 @@ class Reports extends CI_Controller
} }
public function _remap($alias = "", $params = array()) public function _remap($alias = "", $params = array())
{ {
$data['dataValue'] = $this->session; // dd($this->session);
$data['dataValue'] = $this->session;
$data['pageTitle'] = "Sales"; $data['pageTitle'] = "Sales";
$datas['fiscalStart'] =NepaliDate($this->session->FiscalYear->fiscalyear_from);
$datas['fiscalEnd'] =NepaliDate($this->session->FiscalYear->fiscalyear_to);
switch ($alias) { switch ($alias) {
case 'purchase_vs_sales': case 'purchase_vs_sales':
$data['StockRecords']=$this->MStocks->getStockRecords(); $data['StockRecords']=$this->MStocks->getStockRecords();
$data['PurchaseDetails'] = $this->MPurchases->getItemPurchases(); $data['PurchaseDetails'] = $this->MPurchases->getItemPurchases();
$data['SalesDetails'] = $this->MSales->getItemSales(); $data['SalesDetails'] = $this->MSales->getItemSales();
$data['StockItems'] = $this->MStocks->getStockSummary(); $data['StockItems'] = $this->MStocks->getStockSummary($datas);
loadview("inventory/reports/purchase_vs_sales", $data); loadview("inventory/reports/purchase_vs_sales", $data);
break; break;
default: default:

View File

@ -10,8 +10,8 @@ class Sales extends CI_Controller
checkLogin(); checkLogin();
} }
public function _remap($alias = "", $params = array()) public function _remap($alias = "", $params = array())
{ {
$data['dataValue'] = $this->session; $data['dataValue'] = $this->session;
@ -44,12 +44,13 @@ class Sales extends CI_Controller
// print_r($_POST);die; // print_r($_POST);die;
foreach ($_POST['item_id'] as $item) { foreach ($_POST['item_id'] as $item) {
if ($item != 0 || $_POST['qty'][$i] != 0 || $_POST['rate'][$i] != 0) : if ($item != 0 || $_POST['qty'][$i] != 0 || $_POST['rate'][$i] != 0 || $_POST['vat'][$i] != 0) :
$TableData = array( $TableData = array(
'sales_id' => $sales_id, 'sales_id' => $sales_id,
'items_id' => $item, 'items_id' => $item,
'qty' => $_POST['qty'][$i], 'qty' => $_POST['qty'][$i],
'rate' => $_POST['rate'][$i], 'rate' => $_POST['rate'][$i],
'vat' => $_POST['vat'][$i],
'created_on' => date('Y-m-d H:i:s'), 'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin', 'created_by' => 'admin',
'status' => 1, 'status' => 1,
@ -61,13 +62,27 @@ class Sales extends CI_Controller
} }
// print_r($TableData); // print_r($TableData);
// die; // die;
// $this->db->where('sales_id', $sales_id); // $this->db->where('sales_id', $sales_id);
$this->MStocks->addSalesToStock($this->db->where('sales_id', $sales_id)->get('tbl_salesdetails')->result()); $this->MStocks->addSalesToStock($this->db->where('sales_id', $sales_id)->get('tbl_salesdetails')->result());
redirect("inventory/sales/list"); redirect("inventory/sales/list");
break; break;
case 'sales_register': case 'sales_register':
$data['SalesRecords'] = $this->MSales->getSalesRecords();
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Sales & Register";
$data['SalesRecords'] = $this->MSales->getSalesRecords($data['fiscalStart'],$data['fiscalEnd']);
loadView("inventory/sales/register", $data); loadView("inventory/sales/register", $data);
break; break;
case 'details': case 'details':
@ -104,19 +119,18 @@ class Sales extends CI_Controller
redirect("inventory/sales/list"); redirect("inventory/sales/list");
break; break;
case 'getunitbyitem': case 'getunitbyitem':
$id = $this->uri->segment(4); $id = $this->uri->segment(4);
$unit = $this->MStocks->getUnitByItemId($id); $unit = $this->MStocks->getUnitByItemId($id);
echo json_encode($unit); echo json_encode($unit);
break; break;
default: default:
$data['SalesRecords'] = $this->MSales->getSalesRecords(); $data['SalesRecords'] = $this->MSales->getSalesRecords();
loadView("inventory/sales/list", $data); loadView("inventory/sales/list", $data);
} }
} }
// public function getUnitByItemId($id) { // public function getUnitByItemId($id) {
// $unitName = $this->MStocks->getUnitByItemId($id); // $unitName = $this->MStocks->getUnitByItemId($id);

View File

@ -6,10 +6,18 @@ class Stocks extends CI_Controller
{ {
parent::__construct(); parent::__construct();
$this->load->model('MStocks'); $this->load->model('MStocks');
checkLogin(); $this->load->helper('form');
// checkLogin();
} }
public function _remap($alias = "", $params = array()) public function _remap($alias = "", $params = array())
{ {
// echo "<pre>"; var_dump($alias = "", $params = array()); die();
// echo "<pre>"; var_dump($alias,$this->input->post('fromDate'),$this->input->post('stocklocations_id'),$this->input->post('toDate')); die();
// var_dump(($_POST['stocklocations_id']));die();
$data['dataValue'] = $this->session; $data['dataValue'] = $this->session;
$data['pageTitle'] = "Inventory Stock"; $data['pageTitle'] = "Inventory Stock";
switch ($alias) { switch ($alias) {
@ -57,8 +65,28 @@ class Stocks extends CI_Controller
loadView("inventory/stocks/add", $data); loadView("inventory/stocks/add", $data);
break; break;
case 'summary': case 'summary':
$data['StockRecords'] = $this->MStocks->getStockSummary();
// pre($data['StockRecords']); if (!isset($_POST['stocklocations_id'])) {
$data['stocklocations_id'] = null;
}
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['pageTitle'] = "Inventory Stock";
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['StockRecords'] = $this->MStocks->getStockSummary($data);
loadView("inventory/stocks/summary", $data); loadView("inventory/stocks/summary", $data);
break; break;
case 'delete': case 'delete':
@ -68,8 +96,24 @@ class Stocks extends CI_Controller
redirect("inventory/stocks/list"); redirect("inventory/stocks/list");
break; break;
default: default:
// var_dump("hello");
// die();
// echo '<pre>';
// var_dump($_POST['fromDate'], $_POST['toDate']);
// die();
$data['StockRecords'] = $this->MStocks->getStockRecords(); $data['StockRecords'] = $this->MStocks->getStockRecords();
loadView("inventory/stocks/list", $data); loadView("inventory/stocks/list", $data);
} }
} }
// public function summary()
// {
// var_dump("hello");
// die();
// echo '<pre>';
// var_dump($_POST['stocklocations_id'], $_POST['fromDate'], $_POST['toDate']);
// die();
// $data['StockRecords'] = $this->MStocks->getStockSummary($_POST['stocklocations_id'] = 0, $_POST['fromDate'], $_POST['toDate']);
// // echo "<pre>", var_dump($data['StockRecords']); die();
// loadView("inventory/stocks/summary", $data);
// }
} }

View File

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

View File

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

View File

@ -76,7 +76,7 @@ class bibaccounts
$group->cr_total += $accountBalances['cr_total']; $group->cr_total += $accountBalances['cr_total'];
$group->regular_balance_dr += $accountBalances['regular_balance_dr']; $group->regular_balance_dr += $accountBalances['regular_balance_dr'];
$group->regular_balance_cr += $accountBalances['regular_balance_cr']; $group->regular_balance_cr += $accountBalances['regular_balance_cr'];
$account->balances=$accountBalances; $account->balances = $accountBalances;
} }
if ( if (
$group->dr_total > 0 && $group->dr_total > 0 &&
@ -90,7 +90,67 @@ class bibaccounts
$group->opening_balance = ($group->posting_side == "DR") ? $group->opening_balance_dr - $group->opening_balance_cr : $group->opening_balance_cr - $group->opening_balance_dr; $group->opening_balance = ($group->posting_side == "DR") ? $group->opening_balance_dr - $group->opening_balance_cr : $group->opening_balance_cr - $group->opening_balance_dr;
$group->closing_balance = ($group->posting_side == "DR") ? $group->dr_total - $group->cr_total : $group->cr_total - $group->dr_total; $group->closing_balance = ($group->posting_side == "DR") ? $group->dr_total - $group->cr_total : $group->cr_total - $group->dr_total;
$group->regular_balance = ($group->posting_side == "DR") ? $group->regular_balance_dr - $group->regular_balance_cr : $group->regular_balance_cr - $group->regular_balance_dr; $group->regular_balance = ($group->posting_side == "DR") ? $group->regular_balance_dr - $group->regular_balance_cr : $group->regular_balance_cr - $group->regular_balance_dr;
$group->accounts = $accounts;
$result[] = $group;
}
// pre($result);die;
return $result;
}
// new function
function getAccountGroupsWithBalancesNew($acgroup_id = null, $fiscalStart = null, $fiscalEnd = null)
{
$CI = &get_instance();
$result = [];
$whereClause = "";
if ($acgroup_id !== null) {
$whereClause = "WHERE acgroup_id = '$acgroup_id' AND status=1 AND created_on >= '$fiscalStart' AND created_on >= '$fiscalEnd' ";
}
$t = "SELECT * FROM `tbl_acgroups` $whereClause";
$accountGroups = $CI->db->query($t)->result();
foreach ($accountGroups as $group) {
$t = "SELECT * FROM tbl_accounts
WHERE (accategory_id IN (SELECT accategory_id FROM tbl_accategories WHERE acgroup_id = '{$group->acgroup_id}')
OR accategory_id IN (SELECT parent_category_id FROM tbl_accategories WHERE accategory_id IN (SELECT accategory_id FROM tbl_accategories WHERE acgroup_id = '{$group->acgroup_id}')))
AND status <> -1";
$accounts = $CI->db->query($t)->result();
$group->dr_total = 0;
$group->cr_total = 0;
$group->regular_balance_dr = 0;
$group->regular_balance_cr = 0;
$group->opening_balance_dr = 0;
$group->opening_balance_cr = 0;
foreach ($accounts as $account) {
$accountBalances = $this->getAccountBalances($account->account_id);
// pre($accountBalances);die;
$group->opening_balance_dr += $accountBalances['opening_balance_dr'];
$group->opening_balance_cr += $accountBalances['opening_balance_cr'];
$group->dr_total += $accountBalances['dr_total'];
$group->cr_total += $accountBalances['cr_total'];
$group->regular_balance_dr += $accountBalances['regular_balance_dr'];
$group->regular_balance_cr += $accountBalances['regular_balance_cr'];
$account->balances = $accountBalances;
}
if (
$group->dr_total > 0 &&
$group->cr_total > 0 &&
$group->regular_balance_dr > 0 &&
$group->regular_balance_cr > 0 &&
$group->opening_balance_dr > 0 &&
$group->opening_balance_cr > 0
) $group->isZero = 1;
else $group->isZero = 0;
$group->opening_balance = ($group->posting_side == "DR") ? $group->opening_balance_dr - $group->opening_balance_cr : $group->opening_balance_cr - $group->opening_balance_dr;
$group->closing_balance = ($group->posting_side == "DR") ? $group->dr_total - $group->cr_total : $group->cr_total - $group->dr_total;
$group->regular_balance = ($group->posting_side == "DR") ? $group->regular_balance_dr - $group->regular_balance_cr : $group->regular_balance_cr - $group->regular_balance_dr;
$group->accounts = $accounts; $group->accounts = $accounts;
$result[] = $group; $result[] = $group;
} }
@ -99,7 +159,9 @@ class bibaccounts
} }
function getAccountCategoriesWithBalances($acgroup_id = null, $accategory_id=null) // new function ends
function getAccountCategoriesWithBalances($acgroup_id = null, $accategory_id = null)
{ {
$CI = &get_instance(); $CI = &get_instance();
$result = []; $result = [];
@ -138,7 +200,7 @@ class bibaccounts
$category->cr_total += $accountBalances['cr_total']; $category->cr_total += $accountBalances['cr_total'];
$category->regular_balance_dr += $accountBalances['regular_balance_dr']; $category->regular_balance_dr += $accountBalances['regular_balance_dr'];
$category->regular_balance_cr += $accountBalances['regular_balance_cr']; $category->regular_balance_cr += $accountBalances['regular_balance_cr'];
$account->balances=$accountBalances; $account->balances = $accountBalances;
} }
$category->posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id='" . $category->accategory_id . "')")->row()->posting_side; $category->posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id='" . $category->accategory_id . "')")->row()->posting_side;
@ -149,8 +211,8 @@ class bibaccounts
$category->accounts = $accounts; $category->accounts = $accounts;
$result[] = $category; $result[] = $category;
} }
// pre($category); // pre($category);
if($accategory_id!=null)return isset($category)?$category:''; if ($accategory_id != null) return isset($category) ? $category : '';
return $result; return $result;
} }
@ -538,7 +600,7 @@ class bibaccounts
$fiscal_year_id = ($fiscal_year_id == "") ? $this->FY : $fiscal_year_id; $fiscal_year_id = ($fiscal_year_id == "") ? $this->FY : $fiscal_year_id;
$branch_id = ($branch_id == "") ? $this->Branch : $branch_id; $branch_id = ($branch_id == "") ? $this->Branch : $branch_id;
$CI = &get_instance(); $CI = &get_instance();
$query = $CI->db->query("SELECT SUM(dr) AS dr_total, SUM(cr) AS cr_total FROM tbl_voucherdetails WHERE account_id='$account_id' AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'"); $query = $CI->db->query("SELECT SUM(dr) AS dr_total, SUM(cr) AS cr_total FROM tbl_voucherdetails WHERE account_id='$account_id' AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id' ");
$result = $query->row(); $result = $query->row();
$drTotal = $result->dr_total; $drTotal = $result->dr_total;
@ -578,7 +640,51 @@ class bibaccounts
'regular_balance_cr' => $regularBalanceCr, 'regular_balance_cr' => $regularBalanceCr,
); );
} }
function getAccountBalancesNew($account_id, $fiscal_year_id = "", $branch_id = "",$fiscalStart = null, $fiscalEnd = null)
{
$fiscal_year_id = ($fiscal_year_id == "") ? $this->FY : $fiscal_year_id;
$branch_id = ($branch_id == "") ? $this->Branch : $branch_id;
$CI = &get_instance();
$query = $CI->db->query("SELECT SUM(dr) AS dr_total, SUM(cr) AS cr_total FROM tbl_voucherdetails WHERE account_id='$account_id' AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id' AND created_on >= '$fiscalStart' AND created_on >= '$fiscalEnd' ");
$result = $query->row();
echo "<pre>";print_r($result);die();
$drTotal = $result->dr_total;
$crTotal = $result->cr_total;
$posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id=(SELECT accategory_id FROM tbl_accounts WHERE account_id='$account_id'))")->row()->posting_side;
$drBalance = 0;
$crBalance = 0;
if ($posting_side == "DR") {
$drBalance = $drTotal - $crTotal;
} else {
$crBalance = $crTotal - $drTotal;
}
$openingBalanceQuery = $CI->db->query("SELECT SUM(dr) AS opening_balance_dr, SUM(cr) AS opening_balance_cr FROM tbl_voucherdetails WHERE account_id='$account_id' AND voucher_id=0 AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
$openingBalanceResult = $openingBalanceQuery->row();
$openingBalanceDr = $openingBalanceResult->opening_balance_dr;
$openingBalanceCr = $openingBalanceResult->opening_balance_cr;
$regularBalanceQuery = $CI->db->query("SELECT SUM(dr) AS regular_balance_dr, SUM(cr) AS regular_balance_cr FROM tbl_voucherdetails WHERE account_id='$account_id' AND voucher_id<>0 AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
$regularBalanceResult = $regularBalanceQuery->row();
$regularBalanceDr = $regularBalanceResult->regular_balance_dr;
$regularBalanceCr = $regularBalanceResult->regular_balance_cr;
return array(
'dr_total' => $drTotal,
'cr_total' => $crTotal,
'dr_balance' => $drBalance,
'cr_balance' => $crBalance,
'opening_balance_dr' => $openingBalanceDr,
'opening_balance_cr' => $openingBalanceCr,
'regular_balance_dr' => $regularBalanceDr,
'regular_balance_cr' => $regularBalanceCr,
);
}
////// //////
@ -586,7 +692,7 @@ class bibaccounts
{ {
if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180; if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?> ?>
<table class="table table-sm table-accounts"> <table id='myTable'class="table table-sm table-accounts">
<?php if ($displayHeadings) { ?> <?php if ($displayHeadings) { ?>
<thead> <thead>
<tr> <tr>
@ -608,12 +714,13 @@ class bibaccounts
<?php } ?> <?php } ?>
<tbody> <tbody>
<?php foreach ($accountCategories as $accountCategory) : ?> <?php foreach ($accountCategories as $accountCategory) : ?>
<?php //print_r($accountCategory);die; ?> <?php //print_r($accountCategory);die;
?>
<?php if ($ReportOptions['showZeroBalances'] && $accountCategory->isZero == true) continue; ?> <?php if ($ReportOptions['showZeroBalances'] && $accountCategory->isZero == true) continue; ?>
<tr class="<?php echo ($accountCategory->isParent) ? ' parent-row' : ''; ?>" data-toggle="collapse" data-target="#accategory_<?php echo $accountCategory->accategory_id; ?>"> <tr class="<?php echo ($accountCategory->isParent) ? ' parent-row' : ''; ?>" data-toggle="collapse" data-target="#accategory_<?php echo $accountCategory->accategory_id; ?>">
<td class="group-name"> <td class="group-name">
<?php if($accountCategory->parent_category_id): ?> <?php if ($accountCategory->parent_category_id): ?>
<?php echo "&nbsp;&nbsp;". $accountCategory->accategory_name; ?> <?php echo "&nbsp;&nbsp;" . $accountCategory->accategory_name; ?>
<?php else: ?> <?php else: ?>
<b><?php echo $accountCategory->accategory_name; ?></b> <b><?php echo $accountCategory->accategory_name; ?></b>
<?php endif; ?> <?php endif; ?>
@ -766,17 +873,16 @@ class bibaccounts
<tr> <tr>
<td class="group-name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i><?php echo $Account->account_name; ?></i></td> <td class="group-name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i><?php echo $Account->account_name; ?></i></td>
<?php if ($ReportOptions['showOB']) : ?> <?php if ($ReportOptions['showOB']) : ?>
<td class="group-total "><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->opening_balance : 0); ?></td> <td class="group-total"><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->opening_balance : 0); ?></td>
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->opening_balance : 0); ?></td> <td class="group-total "><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->opening_balance : 0); ?></td>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showPeriod']) : ?> <?php if ($ReportOptions['showPeriod']) : ?>
<td class="group-total"><i><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->regular_balance : 0); ?></i></td>
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->regular_balance : 0); ?><?php //pre($Account); <td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->regular_balance : 0); ?><?php //pre($Account);
?></td> ?></td>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showClosing']) : ?> <?php if ($ReportOptions['showClosing']) : ?>
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->closing_balance : 0); ?></td> <td class="group-total col-2"><?php echo myCurrency(($Account->posting_side == 'DR') ? $Account->closing_balance : 0); ?></td>
<td class="group-total"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->closing_balance : 0); ?></td> <td class="group-total col-2"><?php echo myCurrency(($Account->posting_side == 'CR') ? $Account->closing_balance : 0); ?></td>
<?php endif; ?> <?php endif; ?>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
@ -818,14 +924,14 @@ class bibaccounts
/* /*
* Retrieves the account groups and accounts with balances that has cash/bank in debit side * Retrieves the account groups and accounts with balances that has cash/bank in debit side
*/ */
function getIncomeAndExpenditure() function getIncomeAndExpenditure($fiscalStart,$fiscalEnd)
{ {
$CI = &get_instance(); $CI = &get_instance();
#2 >> Bank Accounts #2 >> Bank Accounts
#3 >> Cash Accounts #3 >> Cash Accounts
$Incomes = array(); $Incomes = array();
$Expenses = array(); $Expenses = array();
$t = "select * from tbl_voucherdetails where voucher_id in (select voucher_id from tbl_voucherdetails where voucher_id<>0 and account_id in (select account_id from tbl_accounts where accategory_id=2 or accategory_id=3)) and account_id not in (select account_id from tbl_accounts where accategory_id=2 or accategory_id=3)"; $t = "select * from tbl_voucherdetails where voucher_id in (select voucher_id from tbl_voucherdetails where voucher_id<>0 and account_id in (select account_id from tbl_accounts where accategory_id=2 or accategory_id=3)) AND created_on >= '$fiscalStart' AND created_on >= '$fiscalEnd' and account_id not in (select account_id from tbl_accounts where accategory_id=2 or accategory_id=3)";
$accounts = $CI->db->query($t)->result(); $accounts = $CI->db->query($t)->result();
foreach ($accounts as $account) { foreach ($accounts as $account) {
$account->details = $CI->db->query("select * from tbl_accounts where account_id=" . $account->account_id)->row(); $account->details = $CI->db->query("select * from tbl_accounts where account_id=" . $account->account_id)->row();
@ -955,14 +1061,14 @@ class bibaccounts
$sides["Incomes"] = $newArray; $sides["Incomes"] = $newArray;
else else
$sides["Expenses"] = $newArray; $sides["Expenses"] = $newArray;
endforeach; endforeach;
return $sides; return $sides;
} }
function prepareIncomeExpenses() function prepareIncomeExpenses($fiscalStart,$fiscalEnd)
{ {
$cashFlow = $this->getIncomeAndExpenditure(); $cashFlow = $this->getIncomeAndExpenditure($fiscalStart,$fiscalEnd);
$a = 0; $a = 0;
foreach ($cashFlow as $side) : foreach ($cashFlow as $side) :
$Groups = array(); $Groups = array();
@ -1004,7 +1110,7 @@ class bibaccounts
$sides["Incomes"] = $newArray; $sides["Incomes"] = $newArray;
else else
$sides["Expenses"] = $newArray; $sides["Expenses"] = $newArray;
endforeach; endforeach;
return $sides; return $sides;

View File

@ -577,7 +577,7 @@ class bibaccounts
////// //////
function renderAccountCategoriesTable($accountCategories, $ReportOptions, $displayHeadings = true, $parentCategories = []) function renderAccountCategoriesTable($accountCategories, $ReportOptions, $displayHeadings = true, $parentCategories = [])
{ {
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180; if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?> ?>
<table class="table table-sm"> <table class="table table-sm">
<?php if ($displayHeadings) { ?> <?php if ($displayHeadings) { ?>
@ -659,7 +659,7 @@ class bibaccounts
} }
function renderAccountCategoriesTableForBS($accountCategories, $ReportOptions, $displayHeadings = true, $parentCategories = []) function renderAccountCategoriesTableForBS($accountCategories, $ReportOptions, $displayHeadings = true, $parentCategories = [])
{ {
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180; if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?> ?>
<table class="table table-hover table-sm"> <table class="table table-hover table-sm">
@ -667,7 +667,7 @@ class bibaccounts
<?php foreach ($accountCategories as $accountCategory) : ?> <?php foreach ($accountCategories as $accountCategory) : ?>
<?php if ($ReportOptions['showZeroBalances']==false && $accountCategory->isZero == true) continue; ?> <?php if ($ReportOptions['showZeroBalances'] == false && $accountCategory->isZero == true) continue; ?>
<tr class="<?php echo ($accountCategory->isParent) ? 'bg-darker parent-row' : ''; ?>" data-toggle="collapse" data-target="#accategory_<?php echo $accountCategory->accategory_id; ?>"> <tr class="<?php echo ($accountCategory->isParent) ? 'bg-darker parent-row' : ''; ?>" data-toggle="collapse" data-target="#accategory_<?php echo $accountCategory->accategory_id; ?>">
<td class="group-name"><?php echo $accountCategory->accategory_name; ?></td> <td class="group-name"><?php echo $accountCategory->accategory_name; ?></td>
<?php if ($ReportOptions['showOB']) : ?> <?php if ($ReportOptions['showOB']) : ?>
@ -725,7 +725,7 @@ class bibaccounts
function renderAccountsTable($Accounts, $ReportOptions, $displayHeadings = false) function renderAccountsTable($Accounts, $ReportOptions, $displayHeadings = false)
{ {
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180; if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?> ?>
<table class="table table-hover table-gray"> <table class="table table-hover table-gray">
<?php if ($displayHeadings) { ?> <?php if ($displayHeadings) { ?>
@ -773,7 +773,7 @@ class bibaccounts
} }
function renderAccountsTableForBS($Accounts, $ReportOptions, $displayHeadings = false) function renderAccountsTableForBS($Accounts, $ReportOptions, $displayHeadings = false)
{ {
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180; if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?> ?>
<table class="table table-hover table-gray"> <table class="table table-hover table-gray">
@ -801,8 +801,4 @@ class bibaccounts
<?php <?php
} }
//////
} }

View File

@ -70,6 +70,7 @@ class myaccounts
$crTotal = 0; $crTotal = 0;
$drTotal = 0; $drTotal = 0;
$fields = array(); $fields = array();
// print_r($VoucherDetails);die;
foreach ($VoucherDetails as $VoucherDetail) : foreach ($VoucherDetails as $VoucherDetail) :
$i++; $i++;
$fields['account_name_' . $i] = $VoucherDetail->account_name; $fields['account_name_' . $i] = $VoucherDetail->account_name;
@ -90,6 +91,9 @@ class myaccounts
$fields['amount_in_words'] = trim($CI->numbertoword->nepali_word($crTotal)); $fields['amount_in_words'] = trim($CI->numbertoword->nepali_word($crTotal));
else else
$fields['amount_in_words'] = trim($CI->numbertoword->english_word($crTotal)); $fields['amount_in_words'] = trim($CI->numbertoword->english_word($crTotal));
// $fields['narration_' . $i] = $VoucherDetail->narration;
$file = APPPATH . "/../pdf/e_voucher1.pdf"; $file = APPPATH . "/../pdf/e_voucher1.pdf";
$pdf = new FPDM($file); $pdf = new FPDM($file);
//pre($pdf->getContent($file,"PDF")); //pre($pdf->getContent($file,"PDF"));
@ -125,7 +129,8 @@ class myaccounts
{ {
$CI = &get_instance(); $CI = &get_instance();
$Account = $CI->db->query("select * from tbl_accounts where account_id='$account_id'")->row(); $Account = $CI->db->query("select * from tbl_accounts where account_id='$account_id'")->row();
$Account->Balance = $this->getBalance($account_id); // $Account->Balance = $this->getBalance($account_id);
// echo"<pre>";print_r($Account); die();
return $Account; return $Account;
} }
function getBalance($account_id) function getBalance($account_id)
@ -175,18 +180,17 @@ class myaccounts
$Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row(); $Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row();
} }
//$q=$CI->db->get_compiled_select(); //$q=$CI->db->get_compiled_select();
//print($q);
?> ?>
<div class="row mb-3"> <div class="row mb-3">
<?php if ($accategory_id == "") : ?> <?php if ($accategory_id == "") : ?>
<div class="col"> <div class="col">
<form method="get"> <form method="get">
<div class="row"> <div class="row">
<div class="col-5"> <div class="col-3">
<?php $this->showAccountsCategoriesCombo("accategory_id", "", "accategory_id"); ?> <?php $this->showAccountsCategoriesCombo("accategory_id", "", "accategory_id"); ?>
</div> </div>
<div class="col-3"> <div class="col-3">
<input type="submit" value="Show Accounts" class="form-control btn btn-success"> <input type="submit" value="Show Accounts" class=" btn btn-success btn-sm">
</div> </div>
</div> </div>
</form> </form>
@ -195,9 +199,9 @@ class myaccounts
</div> </div>
<?php <?php
$html = ""; $html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>"; $html .= "<table class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>"; $html .= "<thead>";
$html .= "<tr><th>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Action</th></tr>"; $html .= "<tr><th>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1'>Action</th></tr>";
$html .= "</thead><tbody>"; $html .= "</thead><tbody>";
$sn = 0; $sn = 0;
$BalanceTotal = 0; $BalanceTotal = 0;
@ -205,12 +209,12 @@ class myaccounts
$balance = getBalance($Account->account_id); $balance = getBalance($Account->account_id);
$BalanceTotal += $balance; $BalanceTotal += $balance;
// pre($Account); // pre($Account);
$html .= "<tr><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-2 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>"; $html .= "<tr><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='text-right col-1'>" . myCurrency($balance) . "</td><td class='text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach; endforeach;
$html .= "</tbody><tfoot>"; $html .= "</tbody><tfoot>";
if ($full==""){ // if ($full == "") {
$html .= "<tr><th colspan=2 class='text-right '>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>"; $html .= "<tr><th colspan=2 class='text-right '>Total</th><th class='text-right'>" . (($BalanceTotal > 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th class='text-right'>" . (($BalanceTotal < 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th>" . myCurrency($BalanceTotal) . "</th><th></th></tr>";
} // }
$html .= "</tfoot></table>\n"; $html .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\"> $html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\"> <div class=\"modal-dialog modal-xl\" role=\"document\">
@ -543,7 +547,6 @@ class myaccounts
<tr> <tr>
<!-- <th class="col-1.5" rowspan="2"><?php //myLang(" Category"); <!-- <th class="col-1.5" rowspan="2"><?php //myLang(" Category");
?></th> --> ?></th> -->
<th class="col-1.5" rowspan="2"><?php myLang("Ledger"); ?></th> <th class="col-1.5" rowspan="2"><?php myLang("Ledger"); ?></th>
<th class="col-1.5" rowspan="2"><?php myLang(" Group"); ?></th> <th class="col-1.5" rowspan="2"><?php myLang(" Group"); ?></th>
<th colspan="2" class="col-3 text-center">Opening Balance</th> <th colspan="2" class="col-3 text-center">Opening Balance</th>
@ -662,15 +665,13 @@ class myaccounts
$data['oldBalance'] = $oldBalance; $data['oldBalance'] = $oldBalance;
return $data; return $data;
} }
function showLedger($account_id, $fromDate = "", $toDate = "") function showLedger($account_id, $fromDate = "", $toDate = "", $fiscalStart = "", $fiscalEnd = "")
{ {
$oldBalance = $this->getOldBalance($account_id, FYStart()); $oldBalance = $this->getOldBalance($account_id, FYStart());
$fromDate = ($fromDate == "") ? NepaliToEnglishDate(FYStart()) : $fromDate; $fromDate = ($fromDate == "") ? NepaliToEnglishDate(FYStart()) : $fromDate;
$toDate = ($toDate == "") ? Today() : $toDate; $toDate = ($toDate == "") ? Today() : $toDate;
$ci = &get_instance(); $ci = &get_instance();
$Transactions = $ci->db->where("transaction_date between '$fromDate' AND '$toDate'")->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result(); $Transactions = $ci->db->where("transaction_date between '$fromDate' AND '$toDate'")->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
$Account = $ci->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row(); $Account = $ci->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
foreach ($Transactions as $T) { foreach ($Transactions as $T) {
$T->Voucher = $ci->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row(); $T->Voucher = $ci->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
@ -681,14 +682,19 @@ class myaccounts
?> ?>
<div class="card-primary card-outline "> <div class="card-primary card-outline ">
<div class="card-header"> <div class="card-header">
<h5 class="m-0">Leger for Account : <?php echo $Account->account_name; ?> <a href="<?php echo site_url("accounts/ledger/print/" . $Account->account_id . "/?" . $_SERVER['QUERY_STRING']); ?>" class="btn btn-success btn-sm float-right">Print</a></h5> <h5 class="m-0">Leger for Account : <?php echo $Account->account_name; ?>
<!-- <a href="<?php echo site_url("accounts/ledger/print/" . $Account->account_id . "/?" . $_SERVER['QUERY_STRING']); ?>" class="btn btn-success btn-sm float-right">Print</a> -->
<button type="submit" id="downloadCsv1" class="btn btn-warning btn-sm ">
Export csv
</button>
</h5>
</div> </div>
<div class="card-body p-0 mb-20" id="printableDiv"> <div class="card-body p-0 mb-20" id="printableDiv">
<h3 class="text-center"><?php echo $ci->session->userdata("CompanyName"); ?></h3> <h3 class="text-center"><?php echo $ci->session->userdata("CompanyName"); ?></h3>
<h5 class="text-center">Ledger Details for <?php echo $Account->account_name; ?> </h5> <h5 class="text-center">Ledger Details for <?php echo $Account->account_name; ?> </h5>
<?php $TableData = $Transactions; ?> <?php $TableData = $Transactions; ?>
<?php $TotalCols = 7; ?> <?php $TotalCols = 7; ?>
<table class="table table-bordered table-head-fixed text-nowrap table-striped "> <table id='myTable1' class="table table-bordered table-head-fixed text-nowrap table-striped ">
<thead> <thead>
<tr> <tr>
<th class="col-1"><?php myLang("Date"); ?></th> <th class="col-1"><?php myLang("Date"); ?></th>
@ -699,6 +705,7 @@ class myaccounts
<th class="col-1 text-right"><?php myLang("Debit"); ?></th> <th class="col-1 text-right"><?php myLang("Debit"); ?></th>
<th class="col-1 text-right"><?php myLang("Credit"); ?></th> <th class="col-1 text-right"><?php myLang("Credit"); ?></th>
<th class="col-1"><?php myLang("Balance"); ?></th> <th class="col-1"><?php myLang("Balance"); ?></th>
<input type="hidden" id="refdate" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>">
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -706,12 +713,10 @@ class myaccounts
$drTotal = 0; $drTotal = 0;
$crTotal = 0; $crTotal = 0;
$balance = 0; $balance = 0;
foreach ($TableData as $TableRow) : $r++; foreach ($TableData as $TableRow) : $r++;
?> ?>
<tr> <tr>
<td><?php echo NepaliDate(($TableRow->transaction_date)); ?></td> <td><?php echo NepaliDate(($TableRow->transaction_date)); ?></td>
<td> <td>
<?php <?php
if ($TableRow->voucher_id != 0) : if ($TableRow->voucher_id != 0) :
@ -721,9 +726,7 @@ class myaccounts
echo $T->account_name; echo $T->account_name;
break; break;
} }
endforeach; endforeach;
// pre($Tr); // pre($Tr);
else : else :
echo "Opening Balance"; echo "Opening Balance";
@ -733,7 +736,6 @@ class myaccounts
?></td> --> ?></td> -->
<td> <td>
<?php linkVoucher($TableRow->voucher_id); ?> <?php linkVoucher($TableRow->voucher_id); ?>
</td> </td>
<td><?php echo myCurrency($TableRow->dr); <td><?php echo myCurrency($TableRow->dr);
$drTotal += $TableRow->dr; ?></td> $drTotal += $TableRow->dr; ?></td>
@ -766,6 +768,74 @@ class myaccounts
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">Modal Title</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="modal-body">
<!-- Content loaded via AJAX will go here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
$(document).ready(function() {
$('.open-modal').click(function(e) {
e.preventDefault(); // Prevent the default link behavior
const url = $(this).attr('href'); // Get the URL from the link
$('#modal-body').load(url, function() {
$('#myModal').modal('show'); // Show the modal after loading content
});
});
});
</script>
<script>
document.getElementById('downloadCsv1').addEventListener('click', function() {
const table = document.getElementById('myTable1');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<!-- <div class="container "> <!-- <div class="container ">
<div class="row mt-100 "> <div class="row mt-100 ">
<div class="col-2"><span class="underline-text"><?php echo $ci->session->userdata("loggedUser"); ?></span></div> <div class="col-2"><span class="underline-text"><?php echo $ci->session->userdata("loggedUser"); ?></span></div>
@ -781,6 +851,22 @@ class myaccounts
</div> --> </div> -->
</div> </div>
</div> </div>
<?php
function footerfunctions()
{
?>
<script>
$(".ass_date").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#refdate').data('start'),
maxDate: $('#refdate').data('end'),
});
</script>
<?php
}
?>
<?php <?php
} }
function ledgerPDF_FPDM($account_id, $fromDate, $toDate) function ledgerPDF_FPDM($account_id, $fromDate, $toDate)
@ -788,7 +874,8 @@ class myaccounts
$CI = &get_instance(); $CI = &get_instance();
$CI->load->library("numbertoword"); $CI->load->library("numbertoword");
$ledgerData = $this->getLedgerData($account_id, $fromDate, $toDate); $ledgerData = $this->getLedgerData($account_id, $fromDate, $toDate);
$file = APPPATH . "/../pdf/e_ledger1.pdf"; $file = APPPATH . "/../pdf/
.pdf";
$pdf = new FPDM($file); $pdf = new FPDM($file);
$i = 0; $i = 0;
$crTotal = 0; $crTotal = 0;
@ -931,7 +1018,7 @@ class myaccounts
// $pdf->Output("F", $OutputFileLocation . $OutputFile); // $pdf->Output("F", $OutputFileLocation . $OutputFile);
// return $OutputFile; // return $OutputFile;
} }
function listVouchers($fromDate = "", $toDate = "", $account_id = "", $vouchertype_id = "", $showAccounts = false, $showVoucherTypes = false) function listVouchers($fromDate = "", $toDate = "", $account_id = "", $vouchertype_id = "", $showAccounts = false, $showVoucherTypes = false, $fiscalStart = "", $fiscalEnd = "")
{ {
// echo $toDate; // echo $toDate;
$ci = &get_instance(); $ci = &get_instance();
@ -967,13 +1054,14 @@ class myaccounts
<th width="90"><?php myLang("Dr"); ?></th> <th width="90"><?php myLang("Dr"); ?></th>
<th width="90"><?php myLang("Cr"); ?></th> <th width="90"><?php myLang("Cr"); ?></th>
<!--<th><?php myLang("Voucher State"); ?></th> --> <!--<th><?php myLang("Voucher State"); ?></th> -->
<th class="table-col col-2">Action</th> <th class="table-col col-1 text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $a = 0; $drTotal=0;$crTotal=0; <?php $a = 0;
$drTotal = 0;
$crTotal = 0;
foreach ($TableData as $TableRow) : $a++; ?> foreach ($TableData as $TableRow) : $a++; ?>
<tr data-id="<?php echo $TableRow->voucher_id; ?>" class="<?php echo ($TableRow->voucher_state == "Reversed") ? "table-danger" : ""; ?>"> <tr data-id="<?php echo $TableRow->voucher_id; ?>" class="<?php echo ($TableRow->voucher_state == "Reversed") ? "table-danger" : ""; ?>">
<!-- <td><?php echo $TableRow->voucher_id; ?></td> --> <!-- <td><?php echo $TableRow->voucher_id; ?></td> -->
<td><?php echo $TableRow->voucher_no; ?></td> <td><?php echo $TableRow->voucher_no; ?></td>
@ -982,33 +1070,37 @@ class myaccounts
<?php foreach ($TableRow->Transactions as $Transaction) : ?> <?php foreach ($TableRow->Transactions as $Transaction) : ?>
<div><?php echo (($Transaction->cr) ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "") . $this->getAccountDetails($Transaction->account_id)->account_name; ?></div> <div><?php echo (($Transaction->cr) ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "") . $this->getAccountDetails($Transaction->account_id)->account_name; ?></div>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($TableRow->narration): ?> <?php if ($TableRow->narration): ?>
(<span class="narration_display"><?php echo $TableRow->narration; ?></span>) (<span class="narration_display"><?php echo $TableRow->narration; ?></span>)
<?php endif; ?> <?php endif; ?>
</td> </td>
<?php if ($showVoucherTypes) : ?> <?php if ($showVoucherTypes) : ?>
<td> <td>
<?php echo $TableRow->VoucherType->voucher_name; ?> <?php echo $TableRow->VoucherType->voucher_name; ?>
</td> </td>
<?php endif; ?> <?php endif; ?>
<td> <td>
<?php foreach ($TableRow->Transactions as $Transaction) : $drTotal+=$Transaction->dr; ?> <?php foreach ($TableRow->Transactions as $Transaction) : $drTotal += $Transaction->dr; ?>
<?php echo myCurrency($Transaction->dr); ?> <?php echo myCurrency($Transaction->dr); ?>
<?php endforeach; ?> <?php endforeach; ?>
</td> </td>
<td> <td>
<?php foreach ($TableRow->Transactions as $Transaction) : $crTotal+=$Transaction->cr; ?> <?php foreach ($TableRow->Transactions as $Transaction) : $crTotal += $Transaction->cr; ?>
<?php echo myCurrency($Transaction->cr); ?> <?php echo myCurrency($Transaction->cr); ?>
<?php endforeach; ?> <?php endforeach; ?>
</td> </td>
<!-- <td><?php echo $TableRow->voucher_type; ?></td> --> <!-- <td><?php echo $TableRow->voucher_type; ?></td> -->
<!-- <td><?php echo $TableRow->voucher_state; ?></td> --> <!-- <td><?php echo $TableRow->voucher_state; ?></td> -->
<td class="col-1"> <td class="col-1 text-center">
<a onClick="javascript:showDetails(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-success btn-xs" title="View Details"><i class="fa fa-eye"></i></a> <a onClick="javascript:showDetails(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-success btn-xs" title="View Details"><i class="fa fa-eye"></i></a>
<!-- <a onClick="javascript:showDetails(<?php //echo $TableRow->voucher_id;
?>);" class="btn btn-info btn-xs" title="View Details"><i class="fas fa-edit"></i></a> -->
<a onClick="javascript:showPDF(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-primary btn-xs" title="View PDF"><i class="fa fa-file-pdf"></i></a> <a onClick="javascript:showPDF(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-primary btn-xs" title="View PDF"><i class="fa fa-file-pdf"></i></a>
<a onClick="javascript:deleteVoucher(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-danger btn-xs" title="Delete Voucher"><i class="fa fa-trash"></i></a> <?php //print_r($ci->session->userdata());die;
?>
<?php if ($ci->session->userdata('LoggedUser') != 'admin'): ?>
<a onClick="javascript:deleteVoucher(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-danger btn-xs" title="Delete Voucher"><i class="fa fa-trash"></i></a>
<?php endif; ?>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
@ -1043,6 +1135,7 @@ class myaccounts
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">Revarsal Entry</button> <button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div> </div>
<input type="hidden" id="refdate" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>">
</div> </div>
</div> </div>
</div> </div>
@ -1125,6 +1218,15 @@ class myaccounts
} }
} }
</script> </script>
<script>
$(".ass_date").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#refdate').data('start'),
maxDate: $('#refdate').data('end'),
});
</script>
<?php <?php
} }
?> ?>
@ -1217,7 +1319,7 @@ class myaccounts
<td><?php echo myCurrency($drTotal); ?></td> <td><?php echo myCurrency($drTotal); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="<?php echo $TotalCols; ?>" class="text-left" height=100>Narration: <?php echo $TableRow->narration; ?></td> <td colspan="<?php echo $TotalCols; ?>" class="text-left" height=100><i>Narration: <?php echo $TableRow->narration; ?></i></td>
</tr> </tr>
<tr> <tr>
<td colspan="<?php echo $TotalCols; ?>" class="text-center" height=200> <td colspan="<?php echo $TotalCols; ?>" class="text-center" height=200>
@ -1303,13 +1405,8 @@ class myaccounts
</option> </option>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<button type="button" class="btn input-group-text addplus" data-toggle="modal" data-target="#exampleModal"><i class="fas fa-plus"></i></button> <button type="button" class="btn input-group-text addplus" data-toggle="modal" data-target="#exampleModal"><i class="fas fa-plus"></i></button>
<?php <?php
} }
function showAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "") function showAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "")
@ -1321,7 +1418,8 @@ class myaccounts
<?php endif; ?> <?php endif; ?>
<select name="<?php echo $fieldName; ?>" class="form-control select2 <?php echo $CSSclass; ?>" id="<?php echo $fieldID; ?>"> <select name="<?php echo $fieldName; ?>" class="form-control select2 <?php echo $CSSclass; ?>" id="<?php echo $fieldID; ?>">
<option value="">Select </option> <option value="">Select </option>
<!-- <option value="">Select <?php //echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></option> --> <!-- <option value="">Select <?php //echo function_exists("myLang") ? myLang($displayName) : $displayName;
?></option> -->
<?php <?php
$q = "select *,(select acgroup_name from tbl_acgroups where tbl_accategories.acgroup_id=tbl_acgroups.acgroup_id) as acgroup_name from tbl_accategories"; $q = "select *,(select acgroup_name from tbl_acgroups where tbl_accategories.acgroup_id=tbl_acgroups.acgroup_id) as acgroup_name from tbl_accategories";
$q .= ($condition != "") ? " where $condition" : " where status=1"; $q .= ($condition != "") ? " where $condition" : " where status=1";
@ -1343,21 +1441,15 @@ class myaccounts
<?php $current_acgroup = $value->acgroup_name; <?php $current_acgroup = $value->acgroup_name;
endif; endif;
endforeach; endforeach;
*/ */
foreach ($Values as $value) : ?> foreach ($Values as $value) : ?>
<option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>> <option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>>
<?php echo $value->accategory_name; ?> <?php echo $value->accategory_name; ?>
</option> </option>
<?php <?php
endforeach; endforeach;
?> ?>
</select> </select>
<?php <?php
} }
function showFixedAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "") function showFixedAccountsCategoriesCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "")
@ -1367,9 +1459,10 @@ class myaccounts
<?php if ($displayName != "") : ?> <?php if ($displayName != "") : ?>
<label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label> <label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label>
<?php endif; ?> <?php endif; ?>
<select name="<?php echo $fieldName; ?>" class="form-control select2 <?php echo $CSSclass; ?>" id="<?php echo $fieldID; ?>"> <select name="<?php echo $fieldName; ?>" class="form-control select2 <?php echo $CSSclass; ?>" id="<?php echo $fieldID; ?> " required>
<option value="">Select </option> <option value="">Select </option>
<!-- <option value="">Select <?php //echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></option> --> <!-- <option value="">Select <?php //echo function_exists("myLang") ? myLang($displayName) : $displayName;
?></option> -->
<?php <?php
$q = "select *,(select acgroup_name from tbl_acgroups where tbl_accategories.acgroup_id=tbl_acgroups.acgroup_id) as acgroup_name from tbl_accategories"; $q = "select *,(select acgroup_name from tbl_acgroups where tbl_accategories.acgroup_id=tbl_acgroups.acgroup_id) as acgroup_name from tbl_accategories";
$q .= ($condition != "") ? " where $condition" : " where status=1"; $q .= ($condition != "") ? " where $condition" : " where status=1";
@ -1392,21 +1485,15 @@ class myaccounts
<?php $current_acgroup = $value->acgroup_name; <?php $current_acgroup = $value->acgroup_name;
endif; endif;
endforeach; endforeach;
*/ */
foreach ($Values as $value) : ?> foreach ($Values as $value) : ?>
<option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>> <option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>>
<?php echo $value->accategory_name; ?> <?php echo $value->accategory_name; ?>
</option> </option>
<?php <?php
endforeach; endforeach;
?> ?>
</select> </select>
<?php <?php
} }
function showAccountsCategoriesWithParentsCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "", $extras = "") function showAccountsCategoriesWithParentsCombo($fieldName, $displayName, $fieldID, $condition = "", $default = "", $CSSclass = "", $extras = "")
@ -1428,11 +1515,11 @@ class myaccounts
foreach ($Values as $value) : ?> foreach ($Values as $value) : ?>
<?php if ($current_acgroup != $value->acgroup_name) : ?> <?php if ($current_acgroup != $value->acgroup_name) : ?>
<!--optgroup label="<?php echo $value->acgroup_name; ?>"--> <!--optgroup label="<?php echo $value->acgroup_name; ?>"-->
<?php endif; ?> <?php endif; ?>
<option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>><?php echo $value->accategory_name; ?></option> <option value="<?php echo $value->accategory_id; ?>" <?php echo ($value->accategory_id == $default) ? 'SELECTED' : ''; ?>><?php echo $value->accategory_name; ?></option>
<?php if ($current_acgroup != $value->acgroup_name) : ?><!--/optgroup--> <?php if ($current_acgroup != $value->acgroup_name) : ?><!--/optgroup-->
<?php $current_acgroup = $value->acgroup_name; <?php $current_acgroup = $value->acgroup_name;
endif; ?> endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<?php <?php
@ -1549,7 +1636,6 @@ class myaccounts
$ci->dbforge->add_column('tbl_vouchertypes', array('default_debits' => array('type' => 'VARCHAR', 'constraint' => 255))); $ci->dbforge->add_column('tbl_vouchertypes', array('default_debits' => array('type' => 'VARCHAR', 'constraint' => 255)));
} }
} }
function hasTransaction($type, $id) function hasTransaction($type, $id)
{ {
switch ($type) { switch ($type) {

View File

@ -39,9 +39,9 @@ class MPurchases extends CI_Model
} }
return $PurchaseRecords; return $PurchaseRecords;
} }
public function getPurchaseRecords() public function getPurchaseRecords($fromDate, $toDate)
{ {
$PurchaseRecords = $this->db->where("status", 1)->get("tbl_purchases")->result(); $PurchaseRecords = $this->db->where("status", 1)->where("created_on between '$fromDate' AND '$toDate'")->get("tbl_purchases")->result();
foreach ($PurchaseRecords as $PurchaseRecord) { foreach ($PurchaseRecords as $PurchaseRecord) {
$PurchaseRecord->Details = $this->getPurchaseDetails($PurchaseRecord->purchase_id); $PurchaseRecord->Details = $this->getPurchaseDetails($PurchaseRecord->purchase_id);
$PurchaseRecord->TotalPurchase = $this->getTotalPurchaseAmount($PurchaseRecord->purchase_id); $PurchaseRecord->TotalPurchase = $this->getTotalPurchaseAmount($PurchaseRecord->purchase_id);

View File

@ -39,9 +39,9 @@ class MSales extends CI_Model
} }
return $SalesRecords; return $SalesRecords;
} }
public function getSalesRecords() public function getSalesRecords($fromDate, $toDate)
{ {
$SalesRecords = $this->db->where("status", 1)->get("tbl_sales")->result(); $SalesRecords = $this->db->where("status", 1)->where("created_on between '$fromDate' AND '$toDate'")->get("tbl_sales")->result();
foreach ($SalesRecords as $SalesRecord) { foreach ($SalesRecords as $SalesRecord) {
$SalesRecord->Details = $this->getSalesDetails($SalesRecord->sales_id); $SalesRecord->Details = $this->getSalesDetails($SalesRecord->sales_id);
$SalesRecord->totalsales = $this->getTotalSalesAmount($SalesRecord->sales_id); $SalesRecord->totalsales = $this->getTotalSalesAmount($SalesRecord->sales_id);
@ -57,7 +57,7 @@ class MSales extends CI_Model
} }
$this->db->group_by('items_id'); $this->db->group_by('items_id');
$query = $this->db->get(); $query = $this->db->get();
$SalesRecords=$query->result(); $SalesRecords = $query->result();
foreach ($SalesRecords as $SalesRecord) { foreach ($SalesRecords as $SalesRecord) {
$SalesRecord->Item = $this->db->where("item_id", $SalesRecord->items_id)->get("tbl_items")->row(); $SalesRecord->Item = $this->db->where("item_id", $SalesRecord->items_id)->get("tbl_items")->row();
} }

View File

@ -71,8 +71,8 @@ class MStocks extends CI_Model
$nos++; $nos++;
$rate += $Item->rate; $rate += $Item->rate;
} }
if($nos!=0) $rate = $rate / $nos; if ($nos != 0) $rate = $rate / $nos;
$SalesStock = new stdClass; $SalesStock = new stdClass;
$SalesStock->qty = $qty; $SalesStock->qty = $qty;
$SalesStock->rate = $rate; $SalesStock->rate = $rate;
@ -94,14 +94,14 @@ class MStocks extends CI_Model
$nos++; $nos++;
$rate += $Item->rate; $rate += $Item->rate;
} }
if($nos!=0) $rate = $rate / $nos; if ($nos != 0) $rate = $rate / $nos;
$PurchaseStock = new stdClass; $PurchaseStock = new stdClass;
$PurchaseStock->qty = $qty; $PurchaseStock->qty = $qty;
$PurchaseStock->rate = $rate; $PurchaseStock->rate = $rate;
$PurchaseStock->amount = $qty * $rate; $PurchaseStock->amount = $qty * $rate;
return $PurchaseStock; return $PurchaseStock;
} }
public function getOpeningStock($item_id) public function getOpeningStock($item_id)
{ {
$this->db->where("status", 1); $this->db->where("status", 1);
@ -116,7 +116,7 @@ class MStocks extends CI_Model
$nos++; $nos++;
$rate += $Item->price; $rate += $Item->price;
} }
if($nos!=0) $rate = $rate / $nos; if ($nos != 0) $rate = $rate / $nos;
$OpeningStock = new stdClass; $OpeningStock = new stdClass;
$OpeningStock->qty = $qty; $OpeningStock->qty = $qty;
$OpeningStock->rate = $rate; $OpeningStock->rate = $rate;
@ -125,12 +125,12 @@ class MStocks extends CI_Model
} }
public function getClosingStock($item_id) public function getClosingStock($item_id)
{ {
$OpeningStock=$this->getOpeningStock($item_id); $OpeningStock = $this->getOpeningStock($item_id);
$PurchaseStock=$this->getItemPurchaseStock($item_id); $PurchaseStock = $this->getItemPurchaseStock($item_id);
$SalesStock=$this->getItemSalesStock($item_id); $SalesStock = $this->getItemSalesStock($item_id);
$ClosingStock = new stdClass; $ClosingStock = new stdClass;
$ClosingStock->qty =$PurchaseStock->qty+$OpeningStock->qty-$SalesStock->qty; $ClosingStock->qty = $PurchaseStock->qty + $OpeningStock->qty - $SalesStock->qty;
$ClosingStock->rate = $PurchaseStock->rate+$OpeningStock->rate-$SalesStock->rate; $ClosingStock->rate = $PurchaseStock->rate + $OpeningStock->rate - $SalesStock->rate;
$ClosingStock->amount = $ClosingStock->qty * $ClosingStock->rate; $ClosingStock->amount = $ClosingStock->qty * $ClosingStock->rate;
return $ClosingStock; return $ClosingStock;
} }
@ -151,8 +151,9 @@ class MStocks extends CI_Model
$Item->Closing = $this->getClosingStock($item_id); $Item->Closing = $this->getClosingStock($item_id);
return $Item; return $Item;
} }
public function getStockSummary($stocklocation_id = 0) public function getStockSummary($data)
{ {
$stocklocation_id = $data['stocklocation_id'] ?? null;
$this->db->where("status", 1); $this->db->where("status", 1);
if ($stocklocation_id != 0) { if ($stocklocation_id != 0) {
$this->db->where("stocklocations_id", $stocklocation_id); $this->db->where("stocklocations_id", $stocklocation_id);
@ -160,9 +161,19 @@ class MStocks extends CI_Model
$StockRecords = $this->db->select("distinct(items_id) as items_id")->get("tbl_stocks")->result(); $StockRecords = $this->db->select("distinct(items_id) as items_id")->get("tbl_stocks")->result();
foreach ($StockRecords as $StockRecord) { foreach ($StockRecords as $StockRecord) {
$StockRecord->Summary = $this->getStockItemSummary($StockRecord->items_id); $StockRecord->Summary = $this->getStockItemSummary($StockRecord->items_id);
// $StockRecord->StockLocation = $this->db->where("stocklocation_id", $StockRecord->stocklocations_id)->get("tbl_stocklocations")->row(); $this->db->where("stocklocation_id ", $StockRecord->Summary->stocklocations_id);
$StockRecord->Item = $this->db->where("item_id", $StockRecord->items_id)->get("tbl_items")->row(); $query1 = $this->db->get("tbl_stocklocations");
} $result2 = $query1->result();
$StockRecord->StockLocation = $result2;
//tbl_items
$this->db->where('created_on >=', date('Y-m-d', (strtotime($data['fiscalStart']))));
$this->db->where('created_on <=', date('Y-m-d', (strtotime($data['fiscalEnd']))));
$this->db->where('item_id', $StockRecord->items_id);
$query3 = $this->db->get('tbl_items');
$result3 = $query3->result();
$StockRecord->Item = $result3;
}
return $StockRecords; return $StockRecords;
} }
public function getStockRecords($stocklocation_id = 0) public function getStockRecords($stocklocation_id = 0)
@ -215,6 +226,5 @@ class MStocks extends CI_Model
$Item = $this->db->where("item_id", $id)->get("tbl_items")->row(); $Item = $this->db->where("item_id", $id)->get("tbl_items")->row();
$Unit = $this->db->where("unit_id", $Item->units_id)->get("tbl_units")->row(); $Unit = $this->db->where("unit_id", $Item->units_id)->get("tbl_units")->row();
return $Unit; return $Unit;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,8 @@
<?php <?php
$drWidth = 250; $drWidth = 250;
$crWidth = 250; $crWidth = 250;
$balanceWidth = 250;
$AccountCategories = $this->myaccounts->getChildAccountCategories(); $AccountCategories = $this->myaccounts->getChildAccountCategories();
?> ?>
<style> <style>
@ -9,9 +11,8 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
} }
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="container-fluid"> <div class="container-fluid">
</div>
</div>
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
@ -27,16 +28,21 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
<th>Account</th> <th>Account</th>
<th width="<?php echo $drWidth; ?>">Dr</th> <th width="<?php echo $drWidth; ?>">Dr</th>
<th width="<?php echo $crWidth; ?>">Cr</th> <th width="<?php echo $crWidth; ?>">Cr</th>
<th class="col-1 text-center">Balance</th>
<th class="col-1 text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
$drTotal = 0; $drTotal = 0;
$crTotal = 0; $crTotal = 0;
$balanceTotal = 0;
foreach ($AccountCategories as $AccountCategory) : foreach ($AccountCategories as $AccountCategory) :
$drTotal += $AccountCategory->dr; $drTotal += $AccountCategory->dr;
$crTotal += $AccountCategory->cr; $crTotal += $AccountCategory->cr;
$balanceTotal += $AccountCategory->Balance
?> ?>
<!-- <?php //print_r($AccountCategory);die; ?> -->
<tr> <tr>
<td> <td>
<a href="<?php echo site_url("accounts/reports/balance_by_ledger") . "?group=" . $AccountCategory->accategory_id; ?>"> <a href="<?php echo site_url("accounts/reports/balance_by_ledger") . "?group=" . $AccountCategory->accategory_id; ?>">
@ -44,7 +50,9 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
</a> </a>
</td> </td>
<td width="<?php echo $drWidth; ?>"><?php echo myCurrency($AccountCategory->dr); ?></td> <td width="<?php echo $drWidth; ?>"><?php echo myCurrency($AccountCategory->dr); ?></td>
<td width="<?php echo $crWidth; ?>"><?php echo myCurrency($AccountCategory->cr); ?></td> <td width="<?php echo $crWidth; ?>"><?php echo myCurrency(abs($AccountCategory->cr)); ?></td>
<td class="text-right"><?php echo myCurrency($AccountCategory->Balance); ?></td>
<td class="text-center"><a href="<?php echo site_url("accounts/reports/balance_by_ledger") . "?group=" . $AccountCategory->accategory_id; ?>" class="btn btn-info btn-xs"><i class="fas fa-eye"></i> </a></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
@ -52,20 +60,18 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
<tr> <tr>
<th>Total</th> <th>Total</th>
<td width="<?php echo $drWidth; ?>"><?php echo myCurrency($drTotal); ?></td> <td width="<?php echo $drWidth; ?>"><?php echo myCurrency($drTotal); ?></td>
<td width="<?php echo $crWidth; ?>"><?php echo myCurrency($crTotal); ?></td> <td width="<?php echo $crWidth; ?>"><?php echo myCurrency(abs($crTotal)); ?></td>
<td class="text-right"><?php echo myCurrency($balanceTotal); ?></td>
<td ></td>
</tr> </tr>
</thead> </thead>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<script> <script>
function toggleSubTable(row) { function toggleSubTable(row) {
@ -73,5 +79,4 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
subTable.style.display = subTable.style.display === 'none' ? 'table-row' : 'none'; subTable.style.display = subTable.style.display === 'none' ? 'table-row' : 'none';
} }
</script> </script>
</div> </div>

View File

@ -0,0 +1,168 @@
<?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 id="myTable" 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>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
</div>
<!-- /.content -->

View File

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

View File

@ -2,7 +2,6 @@
$this->load->library("BIBAccounts"); $this->load->library("BIBAccounts");
$BIBAccounts = new BIBAccounts(); $BIBAccounts = new BIBAccounts();
?> ?>
<style> <style>
table, table,
td, td,
@ -13,7 +12,6 @@ $BIBAccounts = new BIBAccounts();
.group-name { .group-name {
width: 40%; width: 40%;
font-weight: 600px;
} }
.group-total { .group-total {
@ -85,85 +83,94 @@ $BIBAccounts = new BIBAccounts();
box-shadow: inset 0 0 0 transparent; box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
} }
.table1 {
border: 0px !important;
padding: 0;
margin: 10 !important;
width: 100%;
vertical-align: middle;
}
.table-responsive {
overflow-x: auto;
}
.card-body {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<section class="content"> <section class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h3 class="card-title"><?php echo $pageTitle; ?> </h3> <h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action=<?php echo base_url('accounts/reports/balance_sheet'); ?> id="FilterForm">
<!-- button with a dropdown --> <!-- button with a dropdown -->
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52"> <button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters Filters
</button> </button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0">
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div>
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div>
</div> </div>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button type="submit" class="btn btn-danger btn-sm " data-toggle="dropdown" data-offset="-52"> <!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button> </button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div> </div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -178,109 +185,43 @@ $BIBAccounts = new BIBAccounts();
<!-- /.card-tools --> <!-- /.card-tools -->
</div> </div>
<!-- <div class="card-body">
<form method="post" action="" id="FilterForm">
<div class="row align-items-end">
<div class="col-2">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
</div>
<div class="col-2">
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showOB"><?php myLang("Opening"); ?></label>
<input type="checkbox" class="form-control " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "" : "CHECKED"; ?>>
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showClosing"><?php myLang("Closing"); ?></label>
<input type="checkbox" class="form-control " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "" : "CHECKED"; ?>>
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showPeriod"><?php myLang("Period"); ?></label>
<input type="checkbox" class="form-control " name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
</div>
</div>
<div class="col">
<div class="form-group d-flex justify-content-end">
<button type="submit" class="btn btn-primary mr-2">Filter</button>
<button type="submit" class="btn btn-success mr-2">Export</button>
<button type="button" class="btn btn-warning" onclick="resetForm()">Reset</button>
</div>
</div>
</div>
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "2078-4-1";
document.getElementById("toDate").value = "2079-3-32";
document.getElementById("showOB").checked = false;
document.getElementById("showClosing").checked = false;
document.getElementById("FilterForm").submit();
}
</script>
</div> -->
</div> </div>
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<!-- <button class="btn btn-secondary toggle-collapse mr-2" id="toggleShowAll">Toggle Collapse</button> --> <!-- <button class="btn btn-secondary toggle-collapse mr-2" id="toggleShowAll">Toggle Collapse</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle
Collapse</button>
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-body pl-2 ">
<div class="card-body p-0"> <div class="row">
<?php
<?php // echo $_POST['showClosing'];
$ReportOptions = array(
// echo $_POST['showClosing']; 'showZeroBalances' => false,
$ReportOptions = array( 'showOB' => false,
'showZeroBalances' => false, 'showClosing' => true,
'showOB' => false, 'showPeriod' => false,
'showClosing' => true, );
'showPeriod' => false, ?>
); <?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2, $fiscalStart, $fiscalEnd); ?>
?> <?php $Side1Total = 0; ?>
<div class="col-6 p-0 m-0 gy-0">
<table class="table table-bordered"> <div class="table-responsive">
<thead> <table id='myTable' class="table mb-0 pb-0">
<tr> <thead>
<td class="group-name"><b>Particulars</b></td> <tr>
<td class="group-total text-right pr-2 "><b>Amount</b></td> <th class="group-name pl-1">Particulars</th>
<td class="group-name"><b>Particulars</b></td> <th class="group-total text-center col-1">Amount</th>
<td class="group-total text-right pr-2"><b>Amount</b></td> </tr>
</thead>
<tbody>
</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 $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2, $fiscalStart, $fiscalEnd); ?>
<?php $Side1Total = 0; ?>
<?php <?php
// Initialize variables for column totals // Initialize variables for column totals
$incomes_totalOpeningDr = 0; $incomes_totalOpeningDr = 0;
@ -293,12 +234,11 @@ $BIBAccounts = new BIBAccounts();
<?php foreach ($AccountGroups as $group) : ?> <?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>"> <tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td><b><?php echo $group->acgroup_name; ?></b></td> <td><b><?php echo $group->acgroup_name; ?></b></td>
<td width="20%"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td> <td width="20%"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="7" class="group-details p-0"> <td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse"> <div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div> </div>
@ -309,11 +249,7 @@ $BIBAccounts = new BIBAccounts();
$Side1Total += $group->closing_balance; $Side1Total += $group->closing_balance;
?> ?>
<?php endforeach; ?> <?php endforeach; ?>
</table> <?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(5, $fiscalStart, $fiscalEnd); ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(5); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php <?php
// Initialize variables for column totals // Initialize variables for column totals
@ -326,13 +262,12 @@ $BIBAccounts = new BIBAccounts();
?> ?>
<?php foreach ($AccountGroups as $group) : ?> <?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>"> <tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name"><?php echo $group->acgroup_name; ?></td> <td class="group-name"><b><?php echo $group->acgroup_name; ?></b></td>
<td class="group-total"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td> <td class="group-total"><?php echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="7" class="group-details p-0"> <td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse"> <div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div> </div>
@ -343,12 +278,24 @@ $BIBAccounts = new BIBAccounts();
$Side1Total += $group->closing_balance; $Side1Total += $group->closing_balance;
?> ?>
<?php endforeach; ?> <?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->getAccountGroupsWithBalancesNew(1, $fiscalStart, $fiscalEnd); ?>
<?php <?php
// Initialize variables for column totals // Initialize variables for column totals
@ -361,12 +308,12 @@ $BIBAccounts = new BIBAccounts();
?> ?>
<?php foreach ($AccountGroups as $group) : ?> <?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>"> <tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name"><?php echo $group->acgroup_name; ?></td> <td class="group-name"><b><?php echo $group->acgroup_name; ?></b></td>
<td class="group-total"><?php echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0); ?></td> <td class="group-total text-right "><?php echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0); ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="7" class="group-details p-0"> <td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse"> <div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div> </div>
@ -383,160 +330,228 @@ $BIBAccounts = new BIBAccounts();
?> ?>
<?php endforeach; ?> <?php endforeach; ?>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<?php
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
$TotalIncomes = ($BIBAccounts->getAccountGroupsWithBalancesNew(3, $fiscalStart, $fiscalEnd)[0]->closing_balance) ?? 0;
$TotalExpenses = ($BIBAccounts->getAccountGroupsWithBalancesNew(4, $fiscalStart, $fiscalEnd)[0]->closing_balance) ?? 0;
$PL = $TotalIncomes - $TotalExpenses;
$Side1Total += $PL;
?>
<div class="col-6 p-0 m-0 gy-0">
<table class="table">
<tr>
<td><b> Profit/Loss</b></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>
</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 <?php
// pre($BIBAccounts->getAccountGroupsWithBalances(4)); // pre($BIBAccounts->getAccountGroupsWithBalances(4));
$TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance; // $TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance;
// $TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance;
$TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance; // $PL = $TotalIncomes - $TotalExpenses;
// $Side1Total += $PL;
$PL = $TotalIncomes - $TotalExpenses;
$Side1Total += $PL;
?> ?>
<tr> <tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<td>Total Profit/Loss</td> <td>Total Profit/Loss</td>
<td class="cr closing-cr"><?php echo myCurrency($PL); ?></td> <td class="cr closing-cr"><?php echo myCurrency($PL); ?></td>
</tr>
</table>
</td>
<td colspan="2" class="p-0">
</td>
</tr> </tr>
<tr> <tr>
<td colspan="2" class="p-0"> <td colspan="2" class="p-0">
<table class="table table-bordered"> <table class="table">
<tr> <tr>
<th>Total Amount</th> <th class="pl-1">Total Amount</th>
<th class="cr closing-cr"> <th class="cr closing-cr">
<?php echo myCurrency($Side1Total); ?> <?php echo myCurrency($Side1Total); ?>
</th> </th>
</tr> </tr>
</table> </table>
</td> </td>
<td colspan="2" class="p-0"> <td colspan="2" class="p-0">
<table class="table table-bordered"> <table class="table">
<tr> <tr>
<th>Total Amount</th> <th class="pl-1">Total Amount</th>
<th class="dr closing-dr"> <th class="dr closing-dr">
<?php echo myCurrency($totalClosingDr); ?> <?php echo myCurrency($totalClosingDr); ?>
</th> </th>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
</table>
</div> -->
</table>
<?php //pre($BIBAccounts->getAccountGroupsWithBalances($acgroup_id = null));
?>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> <?php
<?php function footerfunctions()
function footerfunctions() {
{ ?>
?> <script>
<script> $(document).ready(function() {
$(document).ready(function() { // Prevent the dropdown from closing when clicking inside
document.getElementById("toggleShowAll").click(); $('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
}); });
});
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>
<script> <script>
$("#toDate").nepaliDatePicker({ $(document).ready(function() {
dateFormat: "%y-%m-%d", document.getElementById("toggleShowAll").click();
closeOnDateSelect: true, });
minDate: $('#toDate').data('start'), document.getElementById("toggleShowAll").addEventListener("click", function(e) {
maxDate: $('#toDate').data('end'), 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> </script>
<?php <!-- pdf document -->
} <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php
}

View File

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

View File

@ -8,9 +8,7 @@ $ExpenseAccounts = $this->acc->getAccountsByGroup(4);
$IncomesTotal = $this->acc->getAccountBalanceByGroup(3); $IncomesTotal = $this->acc->getAccountBalanceByGroup(3);
$ExpensesTotal = $this->acc->getAccountBalanceByGroup(4); $ExpensesTotal = $this->acc->getAccountBalanceByGroup(4);
$PL = $IncomesTotal - $ExpensesTotal; $PL = $IncomesTotal - $ExpensesTotal;
?> ?>
<style> <style>
table, table,
td, td,
@ -92,78 +90,109 @@ $PL = $IncomesTotal - $ExpensesTotal;
box-shadow: inset 0 0 0 transparent; box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
} }
.table1 {
border: 0px !important;
padding: 0;
margin: 10 !important;
width: 100%;
vertical-align: middle;
}
.table-responsive {
overflow-x: auto;
}
.card-body {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
}
.card-body.p-0 .table tbody>tr>td:last-of-type,
.card-body.p-0 .table tbody>tr>th:last-of-type,
.card-body.p-0 .table tfoot>tr>td:last-of-type,
.card-body.p-0 .table tfoot>tr>th:last-of-type,
.card-body.p-0 .table thead>tr>td:last-of-type,
.card-body.p-0 .table thead>tr>th:last-of-type {
padding-right: 0 !important;
}
.text-bold {
font-weight: 900;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<section class="content"> <section class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header "> <div class="card-header ">
<h3 class="card-title">Cash Flow<?php //echo $pageTitle; <h3 class="card-title mt-1">Cash Flow<?php //echo $pageTitle;
?> </h3> ?> </h3>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action=<?php echo base_url('accounts/reports/cash_flow'); ?> id="FilterForm">
<!-- button with a dropdown --> <!-- button with a dropdown -->
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52"> <button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters Filters
</button> </button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0">
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div>
</div> </div>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button type="submit" class="btn btn-danger btn-sm " data-toggle="dropdown" data-offset="-52"> <!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button> </button>
<!-- <div class="dropdown-menu" role="menu"> <!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a> <a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a> <a href="#" class="dropdown-item">Pdf</a>
@ -171,10 +200,9 @@ $PL = $IncomesTotal - $ExpensesTotal;
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</div> </div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
<!-- <button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> -->
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> --> <!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -230,9 +258,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
document.getElementById("fromDate").value = "2078-4-1"; document.getElementById("fromDate").value = "2078-4-1";
@ -242,31 +268,30 @@ $PL = $IncomesTotal - $ExpensesTotal;
document.getElementById("FilterForm").submit(); document.getElementById("FilterForm").submit();
} }
</script> </script>
</div> --> </div> -->
</div> </div>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> --> <!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<!-- <div class="card-header"> <!-- <div class="card-header">
<h4 class="card-title">Cash Flow</h4> <h4 class="card-title">Cash Flow</h4>
</div> --> </div> -->
<div class="card-body table-responsive p-0"> <div class="card-body table-responsive p-0">
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart, $fiscalEnd);
// echo "<pre>";print_r($IncomesExpenses); die();
?>
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
<table class="table table-head-fixed table-bordered g-0"> <table id='myTable' class="table table-bordered p-0 ">
<thead> <thead>
<tr> <tr>
<th class="" width="35%"><?php myLang("Cash inflow"); ?></th> <th class="" width="30%"><?php myLang("Cash inflow"); ?></th>
<th class="text-right" width="15%"></th> <th class="text-right" width="10%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th> <th class="text-right pr-1" width="10%"><?php myLang("Amount"); ?></th>
<th class="" width="35%"><?php echo myLang("Cash outflow"); ?></th> <th class="pl-2" width="30%"><?php echo myLang("Cash outflow"); ?></th>
<th class="text-right" width="15%"></th> <th class="text-right" width="10%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th> <th class="text-right pr-1" width="10%"><?php myLang("Amount"); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -274,37 +299,35 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td colspan=3 class="p-0"> <td colspan=3 class="p-0">
<table class="table g-0"> <table class="table g-0">
<?php $total1 = 0; <?php $total1 = 0;
$counter = 0;
$index = 0;
foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?> foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?>
<?php if ($Incomes['account'] == "GROUP TOTAL") : ?> <?php if ($Incomes['account'] == "GROUP TOTAL") : ?>
<!-- <tr> <!-- <tr>
<td class="" width="70%"><b><?php echo $Incomes['group']; ?></b></td> <td class="" width="70%"><b><?php echo $Incomes['group']; ?></b></td>
<td width="15%"></td> <td width="15%"></td>
<td class="text-right" width="15%"><u><?php echo myCurrency($Incomes['amount']); ?></u></td> <td class="text-right" width="15%"><u><?php echo myCurrency($Incomes['amount']); ?></u></td>
</tr> --> </tr> -->
<?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?> <?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?>
<tr> <tr class="parent-row" class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $index; ?>">
<td class="" width="70%"><b><?php echo $Incomes['category']; ?></b></td> <td class="" width="60%"><b><?php echo $Incomes['category']; ?></b></td>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td> <td width="20%"></td>
<td width="15%"></td> <td class="text-right " width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
</tr> </tr>
<?php else : ?> <?php else : ?>
<?php $total1 += $Incomes['amount']; ?> <?php $total1 += $Incomes['amount']; ?>
<tr> <tr class="collapse" data-target="#group_<?php echo $index; ?>">
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td> <td class="" width="60%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td>
<td width="15%"></td> <td class="text-right " width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td> <td width="20%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php $counter = $index ?>
<?php }; ?> <?php }; ?>
</table> </table>
</td> </td>
<td colspan=3 class="p-0"> <td colspan=3 class="p-0">
<table class="table g-0"> <table class="table p-0">
<?php $total = 0; <?php $total = 0;
foreach ($IncomesExpenses['Expenses'] as $Expenses) { foreach ($IncomesExpenses['Expenses'] as $Expenses) {
if ($Expenses['account'] == "GROUP TOTAL") : ?> if ($Expenses['account'] == "GROUP TOTAL") : ?>
@ -312,53 +335,41 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td class="" width="70%"><b><?php echo $Expenses['group']; ?></b></td> <td class="" width="70%"><b><?php echo $Expenses['group']; ?></b></td>
<td width="15%"></td> <td width="15%"></td>
<td class="text-right" width="15%"><u><?php echo myCurrency($Expenses['amount']); ?></u></td> <td class="text-right" width="15%"><u><?php echo myCurrency($Expenses['amount']); ?></u></td>
</tr> --> </tr> -->
<?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?> <?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?>
<tr> <tr data-toggle="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="" width="70%"><b><?php echo $Expenses['category']; ?></b></td> <td class="" width="60%"><b><?php echo $Expenses['category']; ?></b></td>
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <td width="20%"></td>
<td width="15%"></td> <td class="text-right " width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
</tr> </tr>
<?php else : ?> <?php else : ?>
<?php $total += $Expenses['amount']; ?> <?php $total += $Expenses['amount']; ?>
<tr> <tr class="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td> <td class="" width="60%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td>
<td width="15%"></td> <td class="text-right" width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <td width="20%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php }; ?> <?php }; ?>
</table> </table>
</td> </td>
</tr> </tr>
</tbody> </tbody>
<tr> <tr>
<th>Total</th> <th class="p-1">Total</th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($total1); ?></td> <td class="text-right text-bold"><?php echo myCurrency($total1); ?></td>
<th class="p-1">Total</th>
<th>Total</th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($total); ?></td> <td class="text-right text-bold"><?php echo myCurrency($total); ?></td>
</tr> </tr>
<tr> <tr>
<th></th> <th></th>
<td></td> <td></td>
<td class="text-right"></td> <td class="text-right"></td>
<th class="pl-1">Net Inflow</th>
<th>Net Inflow</th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($total1 - $total); ?></td> <td class="text-right text-bold"><?php echo myCurrency($total1 - $total); ?></td>
</tr> </tr>
<?php $Bank = $BIBAccounts->getAccountCategoriesWithBalances(null, 2); ?> <?php $Bank = $BIBAccounts->getAccountCategoriesWithBalances(null, 2); ?>
<?php foreach ($Bank->accounts as $account) : ?> <?php foreach ($Bank->accounts as $account) : ?>
@ -366,54 +377,138 @@ $PL = $IncomesTotal - $ExpensesTotal;
<th></th> <th></th>
<td></td> <td></td>
<td class="text-right"></td> <td class="text-right"></td>
<th class="pl-1"><?php echo $account->account_name; ?></th>
<th><?php echo $account->account_name; ?></th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($account->balances['dr_total'] - $account->balances['cr_total']); ?></td> <td class="text-right text-bold"><?php echo myCurrency($account->balances['dr_total'] - $account->balances['cr_total']); ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php $Cash = $BIBAccounts->getAccountCategoriesWithBalances(null, 3); ?> <?php $Cash = $BIBAccounts->getAccountCategoriesWithBalances(null, 3); ?>
<?php foreach ($Cash->accounts as $account) : ?> <?php foreach ($Cash->accounts as $account) : ?>
<tr> <tr>
<th></th> <th></th>
<td></td> <td></td>
<td class="text-right"></td> <td class="text-right"></td>
<th class="pl-1"><?php echo $account->account_name; ?></th>
<th><?php echo $account->account_name; ?></th>
<td></td> <td></td>
<td class="text-right"><?php echo myCurrency($account->balances['dr_total'] - $account->balances['cr_total']); ?></td> <td class="text-right text-bold"><?php echo myCurrency($account->balances['dr_total'] - $account->balances['cr_total']); ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</table> </table>
<?php //pre($IncomesExpenses); <?php //pre($IncomesExpenses);
?> ?>
</div> </div>
</div> </div>
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<?php function footerFunctions()
<?php function footerFunctions() { ?>
{ ?> <script>
<script> $(document).ready(function() {
$("#fromDate").nepaliDatePicker({ // Prevent the dropdown from closing when clicking inside
dateFormat: "%y-%m-%d", $('.dropdown-menu').on('click', function(event) {
closeOnDateSelect: true, event.stopPropagation();
minDate: $('#fromDate').data('start'), });
maxDate: $('#fromDate').data('end'), });
});
</script> </script>
<script> <script>
$("#toDate").nepaliDatePicker({ // var exportButton = document.getElementById("exportButton");
dateFormat: "%y-%m-%d", // exportButton.addEventListener("click", function() {
closeOnDateSelect: true, // exportTableToCSV("table.csv");
minDate: $('#toDate').data('start'), // });
maxDate: $('#toDate').data('end'), document.addEventListener("DOMContentLoaded", function() {
}); // Trigger click event on page load
document.getElementById("toggleShowAll").click();
});
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
e.preventDefault();
var nestedRows = document.getElementsByClassName("collapse");
for (var i = 0; i < nestedRows.length; i++) {
if (nestedRows[i].classList.contains("show")) {
nestedRows[i].classList.remove("show");
} else {
nestedRows[i].classList.add("show");
}
}
});
function exportTableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) {
var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed
}
for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue);
}
csv.push(row.join(","));
}
// Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", filename);
document.body.appendChild(link);
link.click();
}
</script> </script>
<?php } ?> <script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php } ?>

View File

@ -1,24 +1,97 @@
<style>
.mt-26 {
margin-top: 26px;
}
</style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<h5 class="m-0"><?php echo $pageTitle; ?> </h5> <div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div>
<div class="dropdown-divider"></div>
<div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div>
<div class="form-check">
<input type="hidden" name="showOB" value="not">
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0">
<button type="button" class="btn btn-info btn-sm " onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm text-center">Search </button>
</div>
</div>
</div>
<div class="btn-group">
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>";
document.getElementById("toDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>";
document.getElementById("showOB").checked = <?php echo "false"; ?>;
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
document.getElementById("FilterForm").submit();
}
</script>
</div>
</div> </div>
<div class="card-body"> <div class="card-body">
<form method="GET" action=""> <form method="GET" action="">
<div class="row"> <div class="row">
<div class="col-2"><?php createNepaliDateInput("from_date", "Date", "from_date", isset($_GET['from_date']) ? $_GET['from_date'] : ''); ?></div> <div class="col-2"><?php createNepaliDateInput("from_date", "Date", "from_date", isset($_GET['from_date']) ? $_GET['from_date'] : ''); ?></div>
<div class="col-1"><?php createButton("show_voucher", "Show", "show_voucher", "Submit", "mt-30"); ?></div> <div class="col-1"><?php createButton("show_voucher", "Show", "show_voucher", "Submit", "mt-26 btn btn-block btn-primary btn-sm "); ?></div>
</div> </div>
</form> </form>
<div id="dataTable_Commands"></div> <div id="dataTable_Commands"></div>
@ -30,12 +103,46 @@
$vouchertype_id = isset($_GET['vouchertypes']) ? $_GET['vouchertypes'] : ''; $vouchertype_id = isset($_GET['vouchertypes']) ? $_GET['vouchertypes'] : '';
$this->myaccounts->listVouchers($fromDate, $fromDate, $account_id, $vouchertype_id, true, true); $this->myaccounts->listVouchers($fromDate, $fromDate, $account_id, $vouchertype_id, true, true);
?> ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('voucherList1');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->

View File

@ -0,0 +1,70 @@
<div class="card-body">
<div class="row">
<div class="col">
<div id="dataTable_wrapper">
<?php //$this->myaccounts->getAllAccountsTable(3);
?>
<?php
$accategory_id = 3;
$CI = &get_instance();
// $CI->db->where("status", 1)->where("(accategory_id = 2 OR accategory_id = 3)");
$CI->db->where("status", 1)->where("accategory_id = 3")->where("created_on >= '$fiscalStart'")->where("created_on >= '$fiscalEnd'");
$CI->db->order_by("account_name ASC");
$Accounts = $CI->db->get("tbl_accounts")->result();
foreach ($Accounts as $Account) {
$Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row();
$Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row();
}
?>
<div class="row mb-3">
<!-- <div id="dataTable_commands" class="col text-right"></div> -->
</div>
<?php
$html = "";
$html .= "<table id='myTable' class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>";
$html .= "<tr><th class='text-center' width='25'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1'>Action</th></tr>";
$html .= "</thead><tbody>";
$sn = 0;
$BalanceTotal = 0;
foreach ($Accounts as $Account) : $sn++;
$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-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'>" . (($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\">
<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;
?>
</div>
</div>
</div>
</div>

View File

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

View File

@ -1,70 +1,98 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header bg-primary disabled color-palette"> <div class="card-header bg-primary disabled color-palette">
<h3 class="card-title m-0"><?php echo $pageTitle; ?></h3> <h3 class="card-title m-0"><?php echo $pageTitle; ?></h3>
</div> </div>
<div class="card-body"> <div class="card-body">
<form method="GET" action="#"> <form method="GET" action="#">
<div class="row"> <div class="row">
<div class="col"><?php createNepaliDateInput("from_date", "", "from_date", isset($fromDate_Nepali) ? $fromDate_Nepali : firstDayOfNepaliMonth()); ?></div> <div class="col"><?php createNepaliDateInput("from_date", "", "from_date", isset($fromDate_Nepali) ? $fromDate_Nepali : firstDayOfNepaliMonth()); ?></div>
<div class="col"><?php createNepaliDateInput("to_date", "", "to_date", isset($toDate_Nepali) ? $toDate_Nepali : ''); ?></div> <div class="col"><?php createNepaliDateInput("to_date", "", "to_date", isset($toDate_Nepali) ? $toDate_Nepali : ''); ?></div>
<div class="col"><?php $this->myaccounts->showAccountsCombo("account_id", "", "account_id", "status=1", isset($_GET['account_id']) ? $_GET['account_id'] : 1, $CSSclass = ""); ?> </div> <div class="col"><?php $this->myaccounts->showAccountsCombo("account_id", "", "account_id", "status=1", isset($_GET['account_id']) ? $_GET['account_id'] : 1, $CSSclass = ""); ?> </div>
<div class="col"><?php createButton("show_ledger", "Show Ledger", "show_ledger","Submit", "btn btn-primary"); ?></div> <div class="col"><?php createButton("show_ledger", "Show Ledger", "show_ledger", "Submit", "btn btn-primary"); ?></div>
</div> </div>
</form> </form>
<button id="openModal" class="btn btn-primary">Open Modal</button>
</div> </div>
</div> </div>
<div class="card"> <div class="card">
<div id="dataTable_Commands"> <div id="dataTable_Commands">
</div>
</div> <?php
<?php if (!isset($account_id)) {
if(!isset($account_id)){ $account_id = 1;
$account_id = 1; }
} ?>
?> <?php if (isset($account_id) && $account_id != "") {
$fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth());
<?php if (isset($account_id) && $account_id != "") { $toDate = isset($_GET['to_date']) ? $_GET['to_date'] : Today();
$fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth()); $this->myaccounts->showLedger($account_id, $fromDate, $toDate, $fiscalStart, $fiscalEnd);
$toDate = isset($_GET['to_date']) ? $_GET['to_date'] : Today(); } ?>
$this->myaccounts->showLedger($account_id, $fromDate, $toDate); <div class="modal fade" id="ledgerdetails_box" tabindex="-1" role="dialog" aria-labelledby="ledgerdetails_box" aria-hidden="true">
} ?> <div class="modal-dialog modal-xl" role="document">
<div class="modal fade" id="ledgerdetails_box" tabindex="-1" role="dialog" aria-labelledby="ledgerdetails_box" aria-hidden="true"> <div class="modal-content">
<div class="modal-dialog modal-xl" role="document"> <div class="modal-header">
<div class="modal-content"> <h5 class="modal-title" id="exampleModalLabel">Ledger Details</h5>
<div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<h5 class="modal-title" id="exampleModalLabel">Ledger Details</h5> <span aria-hidden="true">&times;</span>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> </button>
<span aria-hidden="true">&times;</span> </div>
</button> <div class="modal-body" id="details_container">
</div> Ledger Details Goes Here
<div class="modal-body" id="details_container"> </div>
Ledger Details Goes Here <div class="modal-footer">
</div> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<div class="modal-footer"> <button type="button" class="btn btn-success" data-dismiss="modal">Print</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <!-- <button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
<button type="button" class="btn btn-success" data-dismiss="modal">Print</button> Export csv
</div> </button> -->
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->

View File

@ -3,9 +3,84 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="card card-primary card-outline "> <div class="card card-primary card-outline">
<div class="card-header bg-primary disabled color-palette"> <div class="card-header disabled color-palette">
<h3 class="card-title"><?php echo $pageTitle; ?> </h3> <h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="<?php echo base_url('accounts/ledger/bank_book'); ?>" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</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" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <button class="btn btn-warning btn-sm " onclick="exportTableToCSV('accounts_data.csv')">Export to CSV</button> -->
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>";
document.getElementById("toDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>";
document.getElementById("showOB").checked = <?php echo "false"; ?>;
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
document.getElementById("FilterForm").submit();
}
</script>
</div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
@ -16,11 +91,11 @@
<?php <?php
$accategory_id = 3; $accategory_id = 3;
$CI = &get_instance(); $CI = &get_instance();
$CI->db->where("status", 1)->where("accategory_id = 2"); $CI->db->where("status", 1)->where("accategory_id = 2")->where('created_on >=', date('Y-m-d', (strtotime($fiscalStart))))->where('created_on <=', date('Y-m-d', (strtotime($fiscalEnd))));
$CI->db->order_by("account_name ASC"); $CI->db->order_by("account_name ASC");
$Accounts = $CI->db->get("tbl_accounts")->result(); $Accounts = $CI->db->get("tbl_accounts")->result();
foreach ($Accounts as $Account) { foreach ($Accounts as $Account) {
$Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row(); $Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row();
$Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row(); $Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row();
@ -33,9 +108,9 @@
<?php <?php
$html = ""; $html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>"; $html .= "<table id='myTable'class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>"; $html .= "<thead>";
$html .= "<tr><th class='text-center'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Action</th></tr>"; $html .= "<tr><th class='text-center col-1'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1 '>Action</th></tr>";
$html .= "</thead><tbody>"; $html .= "</thead><tbody>";
$sn = 0; $sn = 0;
$BalanceTotal = 0; $BalanceTotal = 0;
@ -43,10 +118,10 @@
$balance = getBalance($Account->account_id); $balance = getBalance($Account->account_id);
$BalanceTotal += $balance; $BalanceTotal += $balance;
// pre($Account); // pre($Account);
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-2 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>"; $html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-1'>" . (myCurrency($balance)) . "</td><td class='text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach; endforeach;
$html .= "</tbody><tfoot>"; $html .= "</tbody><tfoot>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>"; $html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . (($BalanceTotal > 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th class='text-right'>" . (($BalanceTotal < 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th></tr>";
$html .= "</tfoot></table>\n"; $html .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\"> $html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\"> <div class=\"modal-dialog modal-xl\" role=\"document\">
@ -85,6 +160,116 @@
<?php function footerFunctions() <?php function footerFunctions()
{ {
?> ?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script>
// var exportButton = document.getElementById("exportButton");
// exportButton.addEventListener("click", function() {
// exportTableToCSV("table.csv");
// });
document.addEventListener("DOMContentLoaded", function() {
// Trigger click event on page load
document.getElementById("toggleShowAll").click();
});
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
e.preventDefault();
var nestedRows = document.getElementsByClassName("collapse");
for (var i = 0; i < nestedRows.length; i++) {
if (nestedRows[i].classList.contains("show")) {
nestedRows[i].classList.remove("show");
} else {
nestedRows[i].classList.add("show");
}
}
});
function exportTableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) {
var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed
}
for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue);
}
csv.push(row.join(","));
}
// Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", filename);
document.body.appendChild(link);
link.click();
}
</script>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php <?php
} }
?> ?>

View File

@ -4,8 +4,88 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="card card-primary card-outline "> <div class="card card-primary card-outline ">
<div class="card-header bg-primary disabled color-palette"> <div class="card-header disabled color-palette">
<h3 class="card-title"><?php echo $pageTitle; ?> </h3> <h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div>
<div class="dropdown-divider"></div>
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div> -->
<div class="form-check">
<!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label" for="showOB">Opening</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label" for="showClosing">Closing</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div>
</div>
</div>
<div class="btn-group">
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <button id="exportButton">Export to Excel</button> -->
<!-- <button class="btn btn-warning btn-sm " id="downloadBtn">Download CSV</button> -->
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div>
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>";
document.getElementById("toDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>";
document.getElementById("showOB").checked = <?php echo "false"; ?>;
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
document.getElementById("FilterForm").submit();
}
</script>
</div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
@ -16,12 +96,12 @@
<?php <?php
$accategory_id = 3; $accategory_id = 3;
$CI = &get_instance(); $CI = &get_instance();
// $CI->db->where("status", 1)->where("(accategory_id = 2 OR accategory_id = 3)"); // $CI->db->where("status", 1)->where("(accategory_id = 2 OR accategory_id = 3)");
$CI->db->where("status", 1)->where("accategory_id = 3"); $CI->db->where("status", 1)->where("accategory_id = 3")->where("created_on >= '$fiscalStart'")->where("created_on >= '$fiscalEnd'");
$CI->db->order_by("account_name ASC"); $CI->db->order_by("account_name ASC");
$Accounts = $CI->db->get("tbl_accounts")->result(); $Accounts = $CI->db->get("tbl_accounts")->result();
foreach ($Accounts as $Account) { foreach ($Accounts as $Account) {
$Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row(); $Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row();
$Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row(); $Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row();
@ -34,9 +114,9 @@
<?php <?php
$html = ""; $html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>"; $html .= "<table id='myTable' class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>"; $html .= "<thead>";
$html .= "<tr><th class='text-center'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Action</th></tr>"; $html .= "<tr><th class='text-center' width='25'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1'>Action</th></tr>";
$html .= "</thead><tbody>"; $html .= "</thead><tbody>";
$sn = 0; $sn = 0;
$BalanceTotal = 0; $BalanceTotal = 0;
@ -44,30 +124,30 @@
$balance = getBalance($Account->account_id); $balance = getBalance($Account->account_id);
$BalanceTotal += $balance; $BalanceTotal += $balance;
// pre($Account); // pre($Account);
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-2 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>"; $html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-1'>" . (myCurrency($balance)) . "</td><td class=' text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach; endforeach;
$html .= "</tbody><tfoot>"; $html .= "</tbody><tfoot>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>"; $html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . (($BalanceTotal > 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th class='text-right'>" . (($BalanceTotal < 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th></tr>";
$html .= "</tfoot></table>\n"; $html .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\"> $html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\"> <div class=\"modal-dialog modal-xl\" role=\"document\">
<div class=\"modal-content\"> <div class=\"modal-content\">
<div class=\"modal-header\"> <div class=\"modal-header\">
<h5 class=\"modal-title\" id=\"exampleModalLabel\">Ledger Details</h5> <h5 class=\"modal-title\" id=\"exampleModalLabel\">Ledger Details</h5>
<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"> <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">
<span aria-hidden=\"true\">&times;</span> <span aria-hidden=\"true\">&times;</span>
</button> </button>
</div> </div>
<div class=\"modal-body\" id=\"details_container\"> <div class=\"modal-body\" id=\"details_container\">
Ledger Details Goes Here Ledger Details Goes Here
</div> </div>
<!--<div class=\"modal-footer\"> <!--<div class=\"modal-footer\">
<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button> <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button>
<button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button> <button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button>
</div>--> </div>-->
</div> </div>
</div> </div>
</div>"; </div>";
$html .= '<script>function showLedger(id) {$.ajax({url: \''; $html .= '<script>function showLedger(id) {$.ajax({url: \'';
$html .= site_url("accounts/reports/ajax/getledgersummary/"); $html .= site_url("accounts/reports/ajax/getledgersummary/");
$html .= '\' + id,success: function(data) {$(\'#ledgerdetails_box #details_container\').html(data);$(\'#ledgerdetails_box\').modal(\'show\');}});}</script>'; $html .= '\' + id,success: function(data) {$(\'#ledgerdetails_box #details_container\').html(data);$(\'#ledgerdetails_box\').modal(\'show\');}});}</script>';
@ -86,6 +166,117 @@
<?php function footerFunctions() <?php function footerFunctions()
{ {
?> ?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script>
// var exportButton = document.getElementById("exportButton");
// exportButton.addEventListener("click", function() {
// exportTableToCSV("table.csv");
// });
document.addEventListener("DOMContentLoaded", function() {
// Trigger click event on page load
document.getElementById("toggleShowAll").click();
});
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
e.preventDefault();
var nestedRows = document.getElementsByClassName("collapse");
for (var i = 0; i < nestedRows.length; i++) {
if (nestedRows[i].classList.contains("show")) {
nestedRows[i].classList.remove("show");
} else {
nestedRows[i].classList.add("show");
}
}
});
function exportTableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) {
var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed
}
for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue);
}
csv.push(row.join(","));
}
// Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", filename);
document.body.appendChild(link);
link.click();
}
</script>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php <?php
} }
?> ?>

View File

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

View File

@ -1,15 +1,12 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="card card-primary card-outline "> <div class="card card-primary card-outline ">
<div class="card-header bg-primary disabled color-palette"> <div class="card-header disabled color-palette">
<h5 class="m-0"><?php echo $pageTitle; ?></h5> <h5 class="m-0"><?php echo $pageTitle; ?></h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
@ -18,9 +15,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -29,12 +23,10 @@
</div> </div>
</div> </div>
<?php function footerFunctions() <?php function footerFunctions()
{ {
?> ?>
<?php <?php
} }
?> ?>

View File

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

View File

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

View File

@ -17,7 +17,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
<h5 class="m-0"><?php echo $pageTitle; ?> </h5> <h5 class="m-0"><?php echo $pageTitle; ?> </h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table table-bordered table-hover"> <table id='myTable'class="table table-bordered table-hover">
<thead> <thead>
<tr> <tr>
<th colspan="4">Profit & Loss Statement</th> <th colspan="4">Profit & Loss Statement</th>
@ -95,7 +95,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
{ {
$total = 0; $total = 0;
?> ?>
<table class="table table-bordered table-hover"> <table id='myTable' class="table table-bordered table-hover">
<thead> <thead>
<tr> <tr>
<th>Account</th> <th>Account</th>
@ -121,6 +121,41 @@ $PL = $IncomesTotal - $ExpensesTotal;
</tr> </tr>
</tfoot> --> </tfoot> -->
</table> </table>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php <?php
} }

View File

@ -4,7 +4,6 @@ $BIBAccounts = new BIBAccounts();
?> ?>
<!-- Include jQuery --> <!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<!-- Include jQuery UI --> <!-- Include jQuery UI -->
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
@ -89,76 +88,102 @@ $BIBAccounts = new BIBAccounts();
box-shadow: inset 0 0 0 transparent; box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
} }
.table1 {
border: 0px !important;
padding: 0;
margin: 10 !important;
width: 100%;
vertical-align: middle;
}
.table-responsive {
overflow-x: auto;
}
.card-body {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
}
.text-bold {
font-weight: 900;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary card-outline "> <div class="card card-primary card-outline ">
<div class="card-header"> <div class="card-header">
<h2 class="card-title"><?php echo $pageTitle; ?> <?php myLang("Report"); ?></h2> <h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report");
?></h2>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action="<?php echo base_url('accounts/reports/pl'); ?>" id="FilterForm">
<!-- button with a dropdown --> <!-- button with a dropdown -->
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52"> <button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters Filters
</button> </button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0">
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div>
</div> </div>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button type="submit" class="btn btn-danger btn-sm " data-toggle="dropdown" data-offset="-52"> <!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export Export
</button> -->
<!-- <button type="submit" onclick="exportTableToCSV('accounts_data.csv')" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button> </button>
<!-- <div class="dropdown-menu" role="menu"> <!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a> <a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a> <a href="#" class="dropdown-item">Pdf</a>
@ -166,10 +191,8 @@ $BIBAccounts = new BIBAccounts();
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</div> </div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -180,51 +203,41 @@ $BIBAccounts = new BIBAccounts();
document.getElementById("FilterForm").submit(); document.getElementById("FilterForm").submit();
} }
</script> </script>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> <!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<div class="card card-primary card-outline "> <div class="card card-primary card-outline">
<div class="card-body pl-2 pr-2">
<div class="card-body p-0"> <div class="row">
<?php
<?php // echo $_POST['showClosing'];
$ReportOptions = array(
// echo $_POST['showClosing']; 'showZeroBalances' => false,
$ReportOptions = array( 'showOB' => false,
'showZeroBalances' => false, 'showClosing' => true,
'showOB' => false, 'showPeriod' => false,
'showClosing' => true, );
'showPeriod' => false, // die;
); ?>
// die; <div class="col-6 p-0">
?> <div class="table-responsive">
<table class="table table-bordered"> <table id='myTable' class="table">
<thead> <thead>
<tr> <tr>
<th class="group-name" width="85%">Particulars</th> <th class="group-name pl-1">Particulars</th>
<th class="group-total text-center" width="10%">Amount</th> <th class="group-total text-center col-1">Amount</th>
<th class="group-name" width="85%">Particulars</th> </tr>
<th class="group-total text-center" width="15%">Amount</th> </thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(3, $fiscalStart, $fiscalEnd); ?>
</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 <?php
// Initialize variables for column totals // Initialize variables for column totals
$incomes_totalOpeningDr = 0; $incomes_totalOpeningDr = 0;
@ -235,21 +248,14 @@ $BIBAccounts = new BIBAccounts();
$incomes_totalClosingCr = 0; $incomes_totalClosingCr = 0;
?> ?>
<?php foreach ($AccountGroups as $group) : ?> <?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<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> <tr>
<td colspan="7" class="group-details p-0" width="85%"> <td colspan="2" class="p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse"> <div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div> </div>
</td> </td>
</tr> </tr>
<?php <?php
// Update column totals // Update column totals
@ -260,14 +266,41 @@ $BIBAccounts = new BIBAccounts();
$incomes_totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0; $incomes_totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0;
$incomes_totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0; $incomes_totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?> ?>
<?php endforeach; ?> <?php endforeach; ?>
</table>
</td>
<td colspan="2" class="p-0">
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(4); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
</tbody>
<tfoot>
<?php $PL = $incomes_totalClosingCr - $incomes_totalClosingDr; ?>
<tr>
<td class="p-1">Total Incomes</th>
<td 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; ?>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="col-6 p-0">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="group-name pl-1">Particulars</th>
<th class="group-total text-center col-1">Amount</th>
</tr>
</thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(4, $fiscalStart, $fiscalEnd); ?>
<?php <?php
// Initialize variables for column totals // Initialize variables for column totals
$totalOpeningDr = 0; $totalOpeningDr = 0;
@ -278,18 +311,12 @@ $BIBAccounts = new BIBAccounts();
$totalClosingCr = 0; $totalClosingCr = 0;
?> ?>
<?php foreach ($AccountGroups as $group) : ?> <?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<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> <tr>
<td colspan="7" class="group-details p-0"> <td colspan="2" class="p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="collapse"> <div id="group_<?php echo $group->acgroup_id; ?>" class="">
<i> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?> <i> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?> <?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</i> </i>
</div> </div>
</td> </td>
</tr> </tr>
@ -303,88 +330,37 @@ $BIBAccounts = new BIBAccounts();
$totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0; $totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?> ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php $PL = $incomes_totalClosingCr - $totalClosingDr; ?>
</table> <?php if ($incomes_totalClosingCr > $totalClosingDr) : ?>
</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> <tr>
<th>Total Profit</th> <!-- <th></th>
<th class="cr closing-cr text-right"><?php echo myCurrency($PL); ?></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> </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>
<?php endif; ?>
</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>
</tfoot>
</table>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -394,6 +370,14 @@ $BIBAccounts = new BIBAccounts();
function footerfunctions() function footerfunctions()
{ {
?> ?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
// Trigger click event on page load // Trigger click event on page load
@ -418,27 +402,21 @@ function footerfunctions()
function exportTableToCSV(filename) { function exportTableToCSV(filename) {
var csv = []; var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)"); var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) { for (var i = 0; i < rows.length; i++) {
var row = []; var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)"); var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden // Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse"); var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show")); var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) { if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed continue; // Skip child table rows if parent is collapsed
} }
for (var j = 0; j < cols.length; j++) { for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue); row.push(cellValue);
} }
csv.push(row.join(",")); csv.push(row.join(","));
} }
// Create a CSV file // Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n"); var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent); var encodedUri = encodeURI(csvContent);
@ -466,6 +444,42 @@ function footerfunctions()
}); });
</script> </script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php <?php
} }
?> ?>

View File

@ -8,7 +8,6 @@ $ExpenseAccounts = $this->acc->getAccountsByGroup(4);
$IncomesTotal = $this->acc->getAccountBalanceByGroup(3); $IncomesTotal = $this->acc->getAccountBalanceByGroup(3);
$ExpensesTotal = $this->acc->getAccountBalanceByGroup(4); $ExpensesTotal = $this->acc->getAccountBalanceByGroup(4);
$PL = $IncomesTotal - $ExpensesTotal; $PL = $IncomesTotal - $ExpensesTotal;
?> ?>
<style> <style>
table, table,
@ -91,80 +90,75 @@ $PL = $IncomesTotal - $ExpensesTotal;
box-shadow: inset 0 0 0 transparent; box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
} }
.table.table-head-fixed thead tr:nth-child(1) th {
padding-left: 6px;
;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<section class="content"> <section class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary card-outline "> <div class="card card-primary card-outline ">
<div class="card-header"> <div class="card-header">
<h3 class="card-title">Receipts And Payments <?php //echo $pageTitle; <h3 class="card-title mt-1">Receipts And Payments <?php //echo $pageTitle;
?> </h3> ?> </h3>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action=<?php echo base_url('accounts/reports/receipt_and_payment'); ?> id="FilterForm">
<!-- button with a dropdown --> <!-- button with a dropdown -->
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52"> <button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters Filters
</button> </button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0">
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div>
</div> </div>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button type="submit" class="btn btn-danger btn-sm " data-toggle="dropdown" data-offset="-52"> <!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button> </button>
<!-- <div class="dropdown-menu" role="menu"> <!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a> <a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a> <a href="#" class="dropdown-item">Pdf</a>
@ -172,10 +166,8 @@ $PL = $IncomesTotal - $ExpensesTotal;
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</div> </div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> <!-- <button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -189,39 +181,43 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div> </div>
<!-- /.card-tools --> <!-- /.card-tools -->
</div> </div>
<!-- <div class="card-body"> <!-- <div class="card-body">
<form method="post" action="" id="FilterForm"> <form method="post" action="" id="FilterForm">
<div class="row align-items-end"> <div class="row align-items-end">
<div class="col-2"> <div class="col-2">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php //myLang("Starting Period");
<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>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php //echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from);
?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
</div> </div>
<div class="col-2"> <div class="col-2">
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php //myLang("Ending Period");
<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>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php //echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to);
?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="col-1 text-center"> <div class="col-1 text-center">
<div class="form-group"> <div class="form-group">
<label for="showOB"><?php myLang("Opening"); ?></label> <label for="showOB"><?php //myLang("Opening");
?></label>
<input type="checkbox" class="form-control " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-control " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : "CHECKED"; ?>>
</div> </div>
</div> </div>
<div class="col-1 text-center"> <div class="col-1 text-center">
<div class="form-group"> <div class="form-group">
<label for="showClosing"><?php myLang("Closing"); ?></label> <label for="showClosing"><?php //myLang("Closing");
?></label>
<input type="checkbox" class="form-control " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-control " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : "CHECKED"; ?>>
</div> </div>
</div> </div>
<div class="col-1 text-center"> <div class="col-1 text-center">
<div class="form-group"> <div class="form-group">
<label for="showPeriod"><?php myLang("Period"); ?></label> <label for="showPeriod"><?php //myLang("Period");
?></label>
<input type="checkbox" class="form-control " name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-control " name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
</div> </div>
</div> </div>
@ -234,9 +230,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
document.getElementById("fromDate").value = "2078-4-1"; document.getElementById("fromDate").value = "2078-4-1";
@ -246,23 +240,20 @@ $PL = $IncomesTotal - $ExpensesTotal;
document.getElementById("FilterForm").submit(); document.getElementById("FilterForm").submit();
} }
</script> </script>
</div> --> </div> -->
</div> </div>
<div class="card"> <div class="card">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?> <?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart, $fiscalEnd) ?>
<table class="table table-head-fixed table-bordered g-0"> <table id='myTable' class="table table-head-fixed table-bordered g-0" id="TrialBalanceTable">
<thead> <thead>
<tr> <tr>
<th class="" width="35%"><?php myLang("Receipts"); ?></th> <th class="" width="30%"><?php myLang("Receipts"); ?></th>
<th class="text-right" width="15%"></th> <th class="text-right" width="10%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th> <th class="text-right pr-2" width="10%"><?php myLang("Amount"); ?></th>
<th class="" width="35%"><?php echo myLang("Payments"); ?></th> <th class="" width="30%"><?php echo myLang("Payments"); ?></th>
<th class="text-right" width="15%"></th> <th class="text-right" width="10%"></th>
<th class="text-right" width="15%"><?php myLang("Amount"); ?></th> <th class="text-right pr-2" width="10%"><?php myLang("Amount"); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -270,33 +261,34 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td colspan=3 class="p-0"> <td colspan=3 class="p-0">
<table class="table g-0"> <table class="table g-0">
<?php $total1 = 0; <?php $total1 = 0;
$counter = 0;
$index = 0;
foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?> foreach ($IncomesExpenses['Incomes'] as $Incomes) { ?>
<?php if ($Incomes['account'] == "GROUP TOTAL") : ?> <?php if ($Incomes['account'] == "GROUP TOTAL") : ?>
<!--tr> <!--tr>
<td class="" width="70%"><b><?php echo $Incomes['group']; ?></b></td> <td class="" width="70%"><b><?php echo $Incomes['group']; ?></b></td>
<td width="15%"></td> <td width="15%"></td>
<td class="text-right" width="15%"><u><?php echo myCurrency($Incomes['amount']); ?></u></td> <td class="text-right" width="15%"><u><?php echo myCurrency($Incomes['amount']); ?></u></td>
</tr--> </tr-->
<?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?> <?php elseif ($Incomes['account'] == "CATEGORY TOTAL") : ?>
<tr> <?php $index++; ?>
<td class="" width="70%"><b><?php echo $Incomes['category']; ?></b></td> <tr class="parent-row" class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $index; ?>">
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td> <td class="" width="60%"><b><?php echo $Incomes['category']; ?></b></td>
<td width="15%"></td> <td width="20%"></td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
</tr> </tr>
<?php else : ?> <?php else : ?>
<?php $total1 += $Incomes['amount']; ?> <?php $total1 += $Incomes['amount']; ?>
<tr> <tr class="collapse" data-target="#group_<?php echo $index; ?>">
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?></td> <td class="pr-2" width="60%">
<td width="15%"></td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Incomes['account']; ?>
<td class="text-right" width="15%"><?php echo myCurrency($Incomes['amount']); ?></td> </td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Incomes['amount']); ?></td>
<td width="20%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php $counter = $index ?>
<?php }; ?> <?php }; ?>
</table> </table>
</td> </td>
<td colspan=3 class="p-0"> <td colspan=3 class="p-0">
@ -308,41 +300,35 @@ $PL = $IncomesTotal - $ExpensesTotal;
<td class="" width="70%"><b><?php echo $Expenses['group']; ?></b></td> <td class="" width="70%"><b><?php echo $Expenses['group']; ?></b></td>
<td width="15%"></td> <td width="15%"></td>
<td class="text-right" width="15%"><u><?php echo myCurrency($Expenses['amount']); ?></u></td> <td class="text-right" width="15%"><u><?php echo myCurrency($Expenses['amount']); ?></u></td>
</tr--> </tr-->
<?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?> <?php elseif ($Expenses['account'] == "CATEGORY TOTAL") : ?>
<tr> <?php $counter++; ?>
<td class="" width="70%"><b><?php echo $Expenses['category']; ?></b></td> <tr data-toggle="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <td class="pr-2" width="60%"><b><?php echo $Expenses['category']; ?></b></td>
<td width="15%"></td> <td width="20%"></td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
</tr> </tr>
<?php else : ?> <?php else : ?>
<?php $total += $Expenses['amount']; ?> <?php $total += $Expenses['amount']; ?>
<tr> <tr class="collapse" data-target="#group_<?php echo $counter; ?>">
<td class="" width="70%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $Expenses['account']; ?></td> <td class="" width="60%">
<td width="15%"></td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<td class="text-right" width="15%"><?php echo myCurrency($Expenses['amount']); ?></td> <?php echo $Expenses['account']; ?>
</td>
<td class="text-right pr-2" width="20%"><?php echo myCurrency($Expenses['amount']); ?></td>
<td width="20%"></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php }; ?> <?php }; ?>
</table> </table>
</td> </td>
</tr> </tr>
<?php $balance_fi = $total1 - $total; ?> <?php $balance_fi = $total1 - $total; ?>
<?php if ($balance_fi < 0) : $total1 += $balance_fi; ?> <?php if ($balance_fi < 0) : $total1 += $balance_fi; ?>
<tr> <tr>
<th><?php echo myLang("Closing Balance"); ?></th> <th class="pl-2"><?php echo myLang("Closing Balance"); ?></th>
<th></th> <th></th>
<td><span class="text-red"><?php echo myCurrency($balance_fi); ?></span></td> <td><span class="text-red pr-2"><?php echo myCurrency($balance_fi); ?></span></td>
<th></th> <th></th>
<th></th> <th></th>
<td></td> <td></td>
@ -352,51 +338,135 @@ $PL = $IncomesTotal - $ExpensesTotal;
<th></th> <th></th>
<th></th> <th></th>
<td></td> <td></td>
<th><?php echo myLang("Closing Balance"); ?></th> <th class="pl-2"><?php echo myLang("Closing Balance"); ?></th>
<th></th> <th></th>
<td><?php echo myCurrency($balance_fi); ?></td> <td class="pr-2"><?php echo myCurrency($balance_fi); ?></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<tr> <tr>
<th>Total</th> <th class="pl-2">Total</th>
<th></th> <th></th>
<td><?php echo myCurrency($total1); ?></td> <td class="pr-2"><?php echo myCurrency($total1); ?></td>
<th>Total</th> <th class="pl-2">Total</th>
<th></th> <th></th>
<td><?php echo myCurrency($total); ?></td> <td class="pr-2"><?php echo myCurrency($total); ?></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<?php function footerFunctions()
{ ?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script>
// var exportButton = document.getElementById("exportButton");
// exportButton.addEventListener("click", function() {
// exportTableToCSV("table.csv");
// });
document.addEventListener("DOMContentLoaded", function() {
// Trigger click event on page load
document.getElementById("toggleShowAll").click();
});
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
e.preventDefault();
var nestedRows = document.getElementsByClassName("collapse");
for (var i = 0; i < nestedRows.length; i++) {
if (nestedRows[i].classList.contains("show")) {
nestedRows[i].classList.remove("show");
} else {
nestedRows[i].classList.add("show");
}
}
});
<?php function footerFunctions() function exportTableToCSV(filename) {
{ ?> var csv = [];
<script> var rows = document.querySelectorAll("table tr:not(.hide)");
$("#fromDate").nepaliDatePicker({ for (var i = 0; i < rows.length; i++) {
dateFormat: "%y-%m-%d", var row = [];
closeOnDateSelect: true, var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
minDate: $('#fromDate').data('start'), // Check if the parent row is collapsed or hidden
maxDate: $('#fromDate').data('end'), var parentRow = rows[i].closest(".collapse");
}); var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
</script> if (isParentCollapsed) {
<script> continue; // Skip child table rows if parent is collapsed
$("#toDate").nepaliDatePicker({ }
dateFormat: "%y-%m-%d", for (var j = 0; j < cols.length; j++) {
closeOnDateSelect: true, var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
minDate: $('#toDate').data('start'), row.push(cellValue);
maxDate: $('#toDate').data('end'), }
}); csv.push(row.join(","));
</script> }
<?php } ?> // Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", filename);
document.body.appendChild(link);
link.click();
}
</script>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php } ?>

View File

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

View File

@ -1,6 +1,7 @@
<?php <?php
$this->load->library("BIBAccounts"); $this->load->library("BIBAccounts");
$BIBAccounts = new BIBAccounts(); $BIBAccounts = new BIBAccounts();
?> ?>
<!-- Include jQuery --> <!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
@ -21,6 +22,7 @@ $BIBAccounts = new BIBAccounts();
.group-total { .group-total {
width: 10%; width: 10%;
} }
.table-gray { .table-gray {
@ -31,9 +33,10 @@ $BIBAccounts = new BIBAccounts();
.table th { .table th {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
} }
.bg-darker { .table t .bg-darker {
background-color: #ddd; background-color: #ddd;
} }
@ -72,6 +75,10 @@ $BIBAccounts = new BIBAccounts();
text-decoration: underline; text-decoration: underline;
} }
.text-right {
padding-right: 5px;
}
.form-control { .form-control {
display: block; display: block;
width: 100%; width: 100%;
@ -88,16 +95,21 @@ $BIBAccounts = new BIBAccounts();
box-shadow: inset 0 0 0 transparent; box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
} }
.bg-gray tr th {
vertical-align: middle;
}
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h2 class="card-title"><?php echo $pageTitle; ?> <?php myLang("Report"); ?></h2> <h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report");
?></h2>
<div class="card-tools"> <div class="card-tools">
<form method="post" action="" id="FilterForm"> <form method="post" action=<?php echo site_url('/Accounts/Reports/trialbalance'); ?> id="FilterForm">
<!-- button with a dropdown --> <!-- button with a dropdown -->
<div class="btn-group"> <div class="btn-group">
@ -105,52 +117,53 @@ $BIBAccounts = new BIBAccounts();
Filters Filters
</button> </button>
<div class="dropdown-menu" role="menu"> <div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0"> <div class="form-group p-2 pb-0">
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <!-- <div class="form-check">
<input class="form-check-input" type="checkbox"> <input class="form-check-input" type="checkbox">
<label class="form-check-label">Select <label class="form-check-label">Select
All</label> All</label>
</div> </div> -->
<div class="form-check"> <div class="form-check">
<input type="hidden" name="showOB" value="not"> <!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label> <label class="form-check-label" for="showOB">Opening</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> --> <!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>> <input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label> <label class="form-check-label" for="showClosing">Closing</label>
</div> </div>
<div class="form-check"> <div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> --> <!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>> <input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label> <label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div>
</div> </div>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button type="submit" class="btn btn-danger btn-sm " data-toggle="dropdown" data-offset="-52"> <!-- <button type="submit" class="btn btn-warning btn-sm" data-toggle="dropdown" data-offset="-52">
Export Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button> </button>
@ -161,7 +174,7 @@ $BIBAccounts = new BIBAccounts();
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</div> </div>
<button type="button" class="btn btn-warning btn-sm" onclick="resetForm()">Reset</button> <!-- <button type="button" class="btn btn-info btn-sm" onclick="resetForm()">Reset</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
@ -200,19 +213,19 @@ $BIBAccounts = new BIBAccounts();
$showZeroBalances = false; $showZeroBalances = false;
?> ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(); ?> <?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable"> <table id='myTable' class="table table-bordered vertical-borders" id="TrialBalanceTable">
<thead class="bg-gray"> <thead class="bg-gray">
<tr> <tr>
<th rowspan="2">Particulars</th> <th rowspan="2 class="">Particulars</th>
<?php if ($ReportOptions['showOB']) : ?> <?php if ($ReportOptions['showOB']) : ?>
<th colspan="2" class="text-center">Opening</th> <th colspan=" 2" class="text-center">Opening</th>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showPeriod']) : ?> <?php if ($ReportOptions['showPeriod']) : ?>
<th colspan="2" class="text-center">Current Period</th> <th colspan="2" class="text-center">Current Period</th>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showClosing']) : ?> <?php if ($ReportOptions['showClosing']) : ?>
<th colspan="2" class="text-center">Closing</th> <th colspan="2" class="text-center">Closing</th>
<?php endif; ?> <?php endif; ?>
</tr> </tr>
<tr> <tr>
@ -246,8 +259,8 @@ $BIBAccounts = new BIBAccounts();
<?php if ($ReportOptions['showOB']) : ?> <?php if ($ReportOptions['showOB']) : ?>
<td class="group-total"><?php // echo myCurrency(($group->posting_side == "DR") ? $group->opening_balance : 0); <td class="group-total"><?php // echo myCurrency(($group->posting_side == "DR") ? $group->opening_balance : 0);
?></td> ?></td>
<td class="group-total"><?php // echo myCurrency(($group->posting_side == "CR") ? $group->opening_balance : 0); <td class="group-total "><?php // echo myCurrency(($group->posting_side == "CR") ? $group->opening_balance : 0);
?></td> ?></td>
<?php endif; ?> <?php endif; ?>
<?php if ($ReportOptions['showPeriod']) : ?> <?php if ($ReportOptions['showPeriod']) : ?>
<td class="group-total"><?php // echo myCurrency(($group->posting_side == "DR") ? $group->regular_balance : 0); <td class="group-total"><?php // echo myCurrency(($group->posting_side == "DR") ? $group->regular_balance : 0);
@ -309,6 +322,14 @@ $BIBAccounts = new BIBAccounts();
function footerfunctions() function footerfunctions()
{ {
?> ?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script> <script>
// var exportButton = document.getElementById("exportButton"); // var exportButton = document.getElementById("exportButton");
// exportButton.addEventListener("click", function() { // exportButton.addEventListener("click", function() {
@ -357,23 +378,60 @@ function footerfunctions()
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
} }
</script> </script>
<script> <script>
$("#fromDate").nepaliDatePicker({ $("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d", dateFormat: "%y-%m-%d",
closeOnDateSelect: true, closeOnDateSelect: true,
minDate: $('#fromDate').data('start'), minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'), maxDate: $('#fromDate').data('end'),
}); });
</script> </script>
<script> <script>
$("#toDate").nepaliDatePicker({ $("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d", dateFormat: "%y-%m-%d",
closeOnDateSelect: true, closeOnDateSelect: true,
minDate: $('#toDate').data('start'), minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'), maxDate: $('#toDate').data('end'),
}); });
</script> </script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php <?php
} }
?> ?>

View File

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

View File

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

View File

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

View File

@ -9,4 +9,4 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

@ -4,7 +4,7 @@
<head> <head>
<title><?php echo myLang($this->config->item("ProjectTitle")); ?> >> <?php echo isset($pageTitle)?$pageTitle:" | Dashboard"; ?></title> <title><?php echo myLang($this->config->item("ProjectTitle")); ?> >> <?php echo isset($pageTitle) ? $pageTitle : " | Dashboard"; ?></title>
<meta charset="utf-8"> <meta charset="utf-8">
@ -39,6 +39,80 @@
<link rel="stylesheet" href="<?php echo base_url(); ?>plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css"> <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>plugins/bstreeview/css/bstreeview.min.css"> <link rel="stylesheet" href="<?php echo base_url(); ?>plugins/bstreeview/css/bstreeview.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/bbnepalcustom.css"> <link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/bbnepalcustom.css">
<!-- CSV File create -->
<script>
// document.getElementById('downloadBtn').addEventListener('click', function() {
// const table = document.getElementById('myTable');
// const csvData = [];
// const rowCount = table.rows.length;
// const output = [];
// for (let i = 0; i < rowCount; i++) {
// const row = table.rows[i];
// const rowArray = [];
// let skipCell = 0;
// for (let j = 0; j < row.cells.length; j++) {
// const cell = row.cells[j];
// if (skipCell > 0) {
// skipCell--;
// continue; // Skip this cell due to rowspan
// }
// const cellContent = cell.textContent.trim();
// const colspan = cell.colSpan || 1;
// const rowspan = cell.rowSpan || 1;
// // Fill the rowArray for the colspan
// for (let k = 0; k < colspan; k++) {
// if (k === colspan - 1) {
// rowArray.push(cellContent); // Last cell of colspan gets content
// } else {
// rowArray.push(''); // Fill empty for additional colspan cells
// }
// }
// // Set skipCell to account for rowspan
// skipCell = rowspan - 1;
// // Ensure that the row length matches the maximum number of columns
// while (rowArray.length < output.length) {
// rowArray.push(''); // Fill empty cells
// }
// // Fill the output structure
// output[i] = rowArray;
// }
// }
// // Join rows for CSV format
// output.forEach(row => {
// const filledRow = row.map(cell => cell === undefined ? '' : cell);
// csvData.push(filledRow.join(','));
// });
// const csvContent = csvData.join('\n');
// const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
// const url = URL.createObjectURL(blob);
// const link = document.createElement('a');
// link.setAttribute('href', url);
// link.setAttribute('download', 'table_with_colspan_rowspan.csv');
// document.body.appendChild(link);
// link.click();
// document.body.removeChild(link);
// });
</script>
<!-- csv printing ends -->
<!-- Override Defaults By Prajwal --> <!-- Override Defaults By Prajwal -->
<style> <style>
body { body {
@ -299,14 +373,14 @@
width: 100%; width: 100%;
float: left; float: left;
} }
} }
.narration_display
{ .narration_display {
font-style: italic; font-style: italic;
} }
.text-bold .currency
{ .text-bold .currency {
font-weight: 600 !important; font-weight: 600 !important;
} }
</style> </style>

View File

@ -1,7 +1,7 @@
<!-- Navbar --> <!-- Navbar -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light "> <nav class="main-header navbar navbar-expand navbar-white navbar-light hidden-navbar ">
<!-- Left navbar links --> <!-- Left navbar links -->

View File

@ -4,7 +4,6 @@ $param = $this->uri->segment(2);
$subparam = $this->uri->segment(3); $subparam = $this->uri->segment(3);
$subparam2 = $this->uri->segment(4); $subparam2 = $this->uri->segment(4);
?> ?>
<!-- Main Sidebar Container --> <!-- Main Sidebar Container -->
<aside class="main-sidebar main-sidebar-custom sidebar-dark-primary elevation-4"> <aside class="main-sidebar main-sidebar-custom sidebar-dark-primary elevation-4">
<!-- Brand Logo --> <a href="<?php echo base_url(); ?>" class="brand-link"> <img src="<?php echo base_url(); ?>dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8"> <span class="brand-text font-weight-light"> <!-- Brand Logo --> <a href="<?php echo base_url(); ?>" class="brand-link"> <img src="<?php echo base_url(); ?>dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8"> <span class="brand-text font-weight-light">
@ -15,8 +14,7 @@ $subparam2 = $this->uri->segment(4);
<!-- Sidebar user panel (optional) --> <!-- Sidebar user panel (optional) -->
<div class="user-panel mt-3 pb-3 mb-3 d-flex"> <div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image"> <img src="<?php echo base_url(); ?>dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image"> </div> <div class="image"> <img src="<?php echo base_url(); ?>dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image"> </div>
<div class="info"> <a href="#" class="d-block"><?php echo $this->session->userdata("CompanyName"); ?> (<?php echo ($this->session->userdata("FiscalYear")->fiscalyear_year); ?>)</a></div> <div class="info"> <a href="#" class="d-block"><?php echo $this->session->userdata("CompanyName"); ?> (<?php echo ($this->session->userdata("FiscalYear")?->fiscalyear_year); ?>)</a></div>
</div> <!-- SidebarSearch Form --> </div> <!-- SidebarSearch Form -->
<div class="form-inline pb-2"> <div class="form-inline pb-2">
<div class="input-group" data-widget="sidebar-search"> <div class="input-group" data-widget="sidebar-search">
@ -52,14 +50,14 @@ $subparam2 = $this->uri->segment(4);
<!-- <li class="nav-item"><a href="<?php echo site_url("master/acgroups"); ?>" class="nav-link <?php echo ($param == "acgroups") ? "active" : ""; ?>"> <!-- <li class="nav-item"><a href="<?php echo site_url("master/acgroups"); ?>" class="nav-link <?php echo ($param == "acgroups") ? "active" : ""; ?>">
<p>Account Types</p> <p>Account Types</p>
</a></li> --> </a></li> -->
<li class="nav-item"><a href="<?php echo site_url("master/accategories/parent"); <!-- <li class="nav-item"><a href="<?php echo site_url("master/accategories/parent");
?>" class="nav-link <?php echo (($param == "accategories" && $subparam == "parent") || ?>" class="nav-link <?php echo (($param == "accategories" && $subparam == "parent") ||
($param == "accategories" && $subparam == "edit_parent") || ($param == "accategories" && $subparam == "edit_parent") ||
($param == "accategories" && $subparam == "add_parent") ($param == "accategories" && $subparam == "add_parent")
) ? "active" : ""; ) ? "active" : "";
?>"> ?>">
<p>Account Categories</p> <p>Account Categories</p>
</a></li> </a></li> -->
<li class="nav-item"><a href="<?php echo site_url("master/accategories/childs"); ?>" class="nav-link <?php echo (($param == "accategories" && $subparam == "childs") || <li class="nav-item"><a href="<?php echo site_url("master/accategories/childs"); ?>" class="nav-link <?php echo (($param == "accategories" && $subparam == "childs") ||
($param == "accategories" && $subparam == "add_child") || ($param == "accategories" && $subparam == "add_child") ||
($param == "accategories" && $subparam == "edit_child") ($param == "accategories" && $subparam == "edit_child")
@ -74,7 +72,7 @@ $subparam2 = $this->uri->segment(4);
<?php if ($LoggedUser == "admin") : ?> <?php if ($LoggedUser == "admin") : ?>
<?php //showMenu("Create New Ledger", "accounts/accountheads/add"); <?php //showMenu("Create New Ledger", "accounts/accountheads/add");
?> ?>
<?php showMenu("List of Ledgers", "accounts/accountheads/list"); ?> <?php showMenu("Ledgers", "accounts/accountheads/list"); ?>
<?php endif; ?> <?php endif; ?>
</ul> </ul>
</li> </li>
@ -118,7 +116,7 @@ $subparam2 = $this->uri->segment(4);
<?php if ($LoggedUser == "admin") : ?> <?php if ($LoggedUser == "admin") : ?>
<?php foreach ($VoucherTypes as $VoucherType) : if ($VoucherType->voucher_alias != "sales" && $VoucherType->voucher_alias != "purchase") : ?> <?php foreach ($VoucherTypes as $VoucherType) : if ($VoucherType->voucher_alias != "sales" && $VoucherType->voucher_alias != "purchase") : ?>
<li class="nav-item"><a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="nav-link <?php echo ($subparam == $VoucherType->voucher_alias && $subparam2 == "create") ? "active" : ""; ?>"> <li class="nav-item"><a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="nav-link <?php echo ($subparam == $VoucherType->voucher_alias && $subparam2 == "create") ? "active" : ""; ?>">
<p><?php echo $VoucherType->voucher_name; ?> Voucher</p> <p><?php echo $VoucherType->voucher_name; ?></p>
</a></li> </a></li>
<?php endif; <?php endif;
endforeach; ?> endforeach; ?>
@ -140,7 +138,6 @@ $subparam2 = $this->uri->segment(4);
<?php if ($LoggedUser == "admin") : <?php if ($LoggedUser == "admin") :
// showMenu("Inventory Stock", "inventory/stocks/list"); // showMenu("Inventory Stock", "inventory/stocks/list");
showMenu("Stock Report", "inventory/stocks/summary"); showMenu("Stock Report", "inventory/stocks/summary");
showMenu("Sales Register", "inventory/sales/sales_register"); showMenu("Sales Register", "inventory/sales/sales_register");
showMenu("Purchase Register", "inventory/purchases/purchase_register"); showMenu("Purchase Register", "inventory/purchases/purchase_register");
showMenu("Purchase Vs Sales", "inventory/reports/purchase_vs_sales"); showMenu("Purchase Vs Sales", "inventory/reports/purchase_vs_sales");
@ -163,7 +160,7 @@ $subparam2 = $this->uri->segment(4);
showMenu("Profit and Loss Statement", "accounts/reports/pl"); showMenu("Profit and Loss Statement", "accounts/reports/pl");
showMenu("Balance Sheet", "accounts/reports/balance_sheet"); showMenu("Balance Sheet", "accounts/reports/balance_sheet");
// showMenu("Balance Sheet (Vertical)", "accounts/reports/balance_sheet_vertical"); // showMenu("Balance Sheet (Vertical)", "accounts/reports/balance_sheet_vertical");
showMenu("Receipt And Payments", "accounts/reports/receipt_and_payment"); showMenu("Receipt and Payment", "accounts/reports/receipt_and_payment");
// showMenu("Income And Expenses", "accounts/reports/incomes_and_expenses"); // showMenu("Income And Expenses", "accounts/reports/incomes_and_expenses");
showMenu("Cash Flow", "accounts/reports/cash_flow"); showMenu("Cash Flow", "accounts/reports/cash_flow");
showMenu("Ratio Analysis", "accounts/reports/ratio_analysis"); showMenu("Ratio Analysis", "accounts/reports/ratio_analysis");
@ -189,7 +186,6 @@ $subparam2 = $this->uri->segment(4);
// showMenu("Group Summary", "accounts/ledger/partyledger"); // showMenu("Group Summary", "accounts/ledger/partyledger");
showMenu("Group Summary", "accounts/reports/balance_by_group"); showMenu("Group Summary", "accounts/reports/balance_by_group");
// showMenu("Balance by Category", "accounts/reports/balance_by_category"); // showMenu("Balance by Category", "accounts/reports/balance_by_category");
showMenu("Accounts Receivables", "accounts/ledger/receiveables"); showMenu("Accounts Receivables", "accounts/ledger/receiveables");
showMenu("Accounts Payables", "accounts/ledger/payables"); showMenu("Accounts Payables", "accounts/ledger/payables");
showMenu("Purchase Summary", "inventory/purchases/list"); showMenu("Purchase Summary", "inventory/purchases/list");

View File

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

View File

@ -38,7 +38,7 @@
<!--COL START--> <!--COL START-->
<div class="col-6"> <div class="col-6">
<div class="form-group"> <div class="form-group">
<?php fillComboWithValue("units_id", "Units", "units_id", "tbl_units", "title", "unit_id", isset($item) ? $item->units_id : '',); ?> <?php fillComboWithValue("units_id", "Units <span class='text-danger'>*</span>", "units_id", "tbl_units", "title", "unit_id", isset($item) ? $item->units_id : '', "", false, "", true); ?>
</div> </div>
</div> </div>
<!--COL END--> <!--COL END-->
@ -47,7 +47,7 @@
<!--COL START--> <!--COL START-->
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<?php fillComboWithValue("itemcategories_id", "Group", "itemcategories_id", "tbl_itemcategories", "title", "itemcategory_id", isset($item) ? $item->itemcategories_id : ''); ?> <?php fillComboWithValue("itemcategories_id", "Group <span class='text-danger'>*</span>", "itemcategories_id", "tbl_itemcategories", "title", "itemcategory_id", isset($item) ? $item->itemcategories_id : '', "", false, "", true); ?>
</div> </div>
</div> </div>
<!--COL END--> <!--COL END-->
@ -117,7 +117,7 @@
<table class="table table-bordered table-striped longdataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th width="5%"><?php myLang('S.N'); ?></th> <th width="5%" class="text-center"><?php myLang('S.N'); ?></th>
<th width="25%"><?php myLang('Name'); ?></th> <th width="25%"><?php myLang('Name'); ?></th>
<th width="10%"><?php myLang('Code'); ?></th> <th width="10%"><?php myLang('Code'); ?></th>
<th width="10%"><?php myLang('Units'); ?></th> <th width="10%"><?php myLang('Units'); ?></th>
@ -125,7 +125,7 @@
<th width="10%" class="text-right"><?php myLang('Qty'); ?></th> <th width="10%" class="text-right"><?php myLang('Qty'); ?></th>
<th width="10%" class="text-right"><?php myLang('Rate'); ?></th> <th width="10%" class="text-right"><?php myLang('Rate'); ?></th>
<th width="10%" class="text-right"><?php myLang('Total'); ?></th> <th width="10%" class="text-right"><?php myLang('Total'); ?></th>
<td width="10%" class="text-bold"><?php myLang("Action"); ?></th> <td width="7%" class="col-1 text-bold text-center"><?php myLang("Action"); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -134,15 +134,18 @@
<?php foreach ($TableRow as $cols) : $id = $cols; <?php foreach ($TableRow as $cols) : $id = $cols;
break; break;
endforeach; ?><tr> endforeach; ?><tr>
<td><?php echo $a; ?></td> <td class="text-center"><?php echo $a; ?></td>
<td><?php echo $TableRow->title; ?></td> <td><?php echo $TableRow->title; ?></td>
<td><?php echo $TableRow->item_code; ?></td> <td><?php echo $TableRow->item_code; ?></td>
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id); ?></td> <td><?php echo number_format((int)getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id),2); ?></td>
<td><?php echo getFieldfromValue("tbl_itemcategories", "title", "itemcategory_id", $TableRow->itemcategories_id); ?></td> <td><?php echo getFieldfromValue("tbl_itemcategories", "title", "itemcategory_id", $TableRow->itemcategories_id); ?></td>
<td class="text-right"><?php echo $TableRow->Stock->qty; ?></td> <td class="text-right"><?php echo number_format((int)$TableRow->Stock->qty,2); ?></td>
<td class="text-right"><?php echo $TableRow->Stock->rate; ?></td>
<td class="text-right"><?php echo $TableRow->Stock->amount; ?></td> <td class="text-right"><?php echo number_format((int)$TableRow->Stock->rate,2); ?></td>
<td> <td class="text-right"><?php echo number_format((int)$TableRow->Stock->amount,2); ?></td>
<td class="text-center">
<?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?> <?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>
<?php showDeleteButton($id); ?> <?php showDeleteButton($id); ?>
</td> </td>

View File

@ -143,6 +143,7 @@
<th class="text-right">Qty</th> <th class="text-right">Qty</th>
<th class="text-right">Units</th> <th class="text-right">Units</th>
<th class="text-right">Rate</th> <th class="text-right">Rate</th>
<th class="text-right" width=13%>VAT<span class="text-danger">*</span></th>
<th class="text-right">Amount</th> <th class="text-right">Amount</th>
<th></th> <th></th>
</tr> </tr>
@ -154,6 +155,8 @@
<td width=10%> <input type="text" class="form-control input-group-sm" name="quantity[]"></td> <td width=10%> <input type="text" class="form-control input-group-sm" name="quantity[]"></td>
<td width=5%><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td> <td width=5%><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td>
<td width=15%><input type="text" class="form-control" name="rate[]"></td> <td width=15%><input type="text" class="form-control" name="rate[]"></td>
<td><input type="number" name="vat[]" class="form-control vat" required></td>
<td width=15%><input type="text" class="form-control" name="total[]"></td> <td width=15%><input type="text" class="form-control" name="total[]"></td>
<td width="5%"> <td width="5%">
<button type="button" class="btn btn-primary btn-xs addPurchaseDetail" id="addPurchaseDetail"> <button type="button" class="btn btn-primary btn-xs addPurchaseDetail" id="addPurchaseDetail">
@ -174,9 +177,9 @@
<br> <br>
<br> <br>
<label for="vatToggle">VAT</label> <label for="vatToggle" class="d-none">VAT</label>
<input type="checkbox" id="vatToggle" checked> <input class="d-none" type="checkbox" id="vatToggle" checked>
<input type="hidden" id="vatToggleValue" name="vatToggleValue" value="1"> <input type="hidden" class="d-none" id="vatToggleValue" name="vatToggleValue" value="1">
</td> </td>
<td class="text-right "><b>Total Amount</b></td> <td class="text-right "><b>Total Amount</b></td>
<td class="text-right"> <td class="text-right">
@ -198,11 +201,13 @@
</tr> </tr>
<tr> <tr>
<td class="text-right "><b>13% VAT</b></td> <td class="text-right d-none "><b>13% VAT</b></td>
<td class="text-right"> <td class="text-right d-none">
<input type="text" class="form-control" name="tax" id="tax" /> <input type="text" class="form-control" name="tax" id="tax" />
</td> </td>
<td></td> <td>
<input type="hidden" name="vat_checkbox_value" id="vat_checkbox_value" value="0">
</td>
</tr> </tr>
<tr> <tr>
<td class="text-right "><b>Grand Total Amount</b></td> <td class="text-right "><b>Grand Total Amount</b></td>
@ -404,7 +409,7 @@
calculateTotals(); calculateTotals();
}); });
// Calculate totals on change of rate or quantity // Calculate totals on change of rate or quantity
$(document).on("change", ".purchase-detail input[name^='quantity'], .purchase-detail input[name^='rate']", function() { $(document).on("change", ".purchase-detail input[name^='quantity'], .purchase-detail input[name^='rate'],.purchase-detail input[name^='vat']", function() {
calculateRowTotal($(this).closest(".purchase-detail")); calculateRowTotal($(this).closest(".purchase-detail"));
calculateTotals(); calculateTotals();
}); });
@ -419,6 +424,9 @@
calculateTotals('amount'); calculateTotals('amount');
}); });
});
function updateSerialNumbers(){ function updateSerialNumbers(){
$('.purchase-detail').each(function(index){ $('.purchase-detail').each(function(index){
$(this).find('.bbsn').text(index + 1); $(this).find('.bbsn').text(index + 1);
@ -429,7 +437,15 @@
function calculateRowTotal(row) { function calculateRowTotal(row) {
var quantity = parseFloat(row.find("input[name^='quantity']").val()) || 0; var quantity = parseFloat(row.find("input[name^='quantity']").val()) || 0;
var rate = parseFloat(row.find("input[name^='rate']").val()) || 0; var rate = parseFloat(row.find("input[name^='rate']").val()) || 0;
var total = quantity * rate; var vat = parseFloat(row.find('input[name^="vat"]').val()) || 0;
//
var lineTotal = quantity * rate;
var vat_amt =(vat/100)*lineTotal;
var total =lineTotal + vat_amt ;
//
// var total = quantity * rate;
row.find("input[name^='total']").val(total.toFixed(2)); row.find("input[name^='total']").val(total.toFixed(2));
} }
// Calculate totals // Calculate totals
@ -441,10 +457,8 @@
}); });
if(type=='amount'){ if(type=='amount'){
alert("amount");
discountamount = parseFloat($("input[name='discount']").val()); discountamount = parseFloat($("input[name='discount']").val());
discountpercent = (discountamount * 100) / subtotal; discountpercent = (discountamount * 100) / subtotal;
alert(discountamount);
$("#discountpercentage").val(discountpercent.toFixed(2)); $("#discountpercentage").val(discountpercent.toFixed(2));
}else{ }else{
discountpercent = parseFloat($("input[name='discountpercentage']").val()); discountpercent = parseFloat($("input[name='discountpercentage']").val());
@ -455,18 +469,19 @@
// var discountamount = subtotal * (discountpercent/100); // var discountamount = subtotal * (discountpercent/100);
var taxable = subtotal - discountamount; var taxable = subtotal - discountamount;
var tax = 0; var tax = 0;
if ($('#vatToggle').is(':checked')) { // if ($('#vatToggle').is(':checked')) {
tax = taxable * 0.13; // Include 13% VAT if checkbox is checked // tax = taxable * 0.13; // Include 13% VAT if checkbox is checked
} // }
var grandTotal = taxable + tax; // var grandTotal = taxable + tax;
var grandTotal = taxable;
$("#subtotal").val(subtotal.toFixed(2)); $("#subtotal").val(subtotal.toFixed(2));
// $("#discount").val(discountamount.toFixed(2)); // $("#discount").val(discountamount.toFixed(2));
$("#taxable").val(taxable.toFixed(2)); $("#taxable").val(taxable.toFixed(2));
$("#tax").val(tax.toFixed(2)); $("#tax").val(tax.toFixed(2));
$("#grand_total").val(grandTotal.toFixed(2)); $("#grand_total").val(grandTotal.toFixed(2));
} };
});
</script> </script>
<?php function footerFunctions() <?php function footerFunctions()

View File

@ -12,12 +12,11 @@
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped dataTable">
<thead> <thead>
<tr> <tr>
<th><?php myLang('S.N'); ?></th> <th class="text-center"><?php myLang('S.N'); ?></th>
<th><?php myLang('Date'); ?></th> <th><?php myLang('Date'); ?></th>
<th><?php myLang('Purchase Transaction'); ?></th> <th><?php myLang('Purchase Transaction'); ?></th>
<th><?php myLang('Amount'); ?></th> <th class="text-center"><?php myLang('Amount'); ?></th>
<td class="text-center"><b>Action</b></th>
<td><b>Action</b></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -28,11 +27,12 @@
endforeach; ?><tr> endforeach; ?><tr>
<td><?php echo $TableRow->purchase_ref; ?></td> <td><?php echo $TableRow->purchase_ref; ?></td>
<td><?php echo $TableRow->purchase_date; ?></td> <td><?php echo $TableRow->purchase_date; ?></td>
<td><b><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></b> <td><b><?php echo (($this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name ?? "")); ?></b>
<div class="row ml-2 mr-2" style="border-bottom: 1px solid;"> <div class="row ml-2 mr-2" style="border-bottom: 1px solid;">
<span class="col item_name"><?php echo myLang("Particulars") ?></span> <span class="col item_name"><?php echo myLang("Particulars") ?></span>
<span class="col item_qty"><?php echo myLang("Qty") ?></span> <span class="col item_qty"><?php echo myLang("Qty") ?></span>
<span class="col item_rate"><?php echo myLang("Rate") ?></span> <span class="col item_rate"><?php echo myLang("Rate") ?></span>
<span class="col item_vat"><?php echo myLang("vat") ?></span>
<span class="col item_amount"><?php echo myLang("Amount") ?></span> <span class="col item_amount"><?php echo myLang("Amount") ?></span>
</div> </div>
<?php $l = 0; <?php $l = 0;
@ -40,8 +40,9 @@
<div class="row ml-2 mr-2"> <div class="row ml-2 mr-2">
<span class="col item_name"><?php echo $r->Item->title; ?></span> <span class="col item_name"><?php echo $r->Item->title; ?></span>
<span class="col item_qty"><?php echo $r->qty; ?></span> <span class="col item_qty"><?php echo $r->qty; ?></span>
<span class="col item_rate text-right"><?php echo myCurrency($r->rate, true); ?></span> <span class="col item_rate"><?php echo myCurrency($r->rate, true); ?></span>
<span class="col item_amount text-right"><?php echo myCurrency($r->qty * $r->rate, true); ?></span> <span class="col item_vat"><?php echo myCurrency($r->vat, true); ?></span>
<span class="col item_amount"><?php echo myCurrency($r->qty * $r->rate, true); ?></span>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<div class="row ml-2 mr-2" style="border-top: 1px dotted;"> <div class="row ml-2 mr-2" style="border-top: 1px dotted;">
@ -52,9 +53,7 @@
</div> </div>
</td> </td>
<td><?php echo myCurrency($TableRow->TotalPurchase); ?></td> <td><?php echo myCurrency($TableRow->TotalPurchase); ?></td>
<td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
<?php showDeleteButton($id); ?> <?php showDeleteButton($id); ?>
</td> </td>
</tr> </tr>

View File

@ -5,31 +5,100 @@
<div class="col"> <div class="col">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?></h5> <!-- <h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?></h5> -->
</div> </div>
<form class="ml-4" method="post" action="<?php echo base_url('accounts/reports/pl'); ?>" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
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 type="submit" onclick="exportTableToCSV('accounts_data.csv')" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</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>
<div class="card-body"> <div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_purchases where status=1")->result(); ?> <?php $TableData = $this->db->query("select * from tbl_purchases where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped dataTable" id="myTable">
<thead> <thead>
<tr> <tr>
<th><?php myLang('S.N'); ?></th> <th width="3%" class="text-center"><?php myLang('S.N'); ?></th>
<th><?php myLang('Date'); ?></th> <th width="10%" class="col-1"><?php myLang('Date'); ?></th>
<th><?php myLang('Purchase Transaction'); ?></th> <th class="table-col col-9"><?php myLang('Purchase Transaction'); ?></th>
<th><?php myLang('Amount'); ?></th> <th width="8%" class="col-2"><?php myLang('Amount'); ?></th>
<td><b>Action</b></th> <td class="col-1 text-center"><b>Action</b></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $a = 0; <?php $a = 0;
$n = 0;
foreach ($PurchaseRecords as $TableRow) : $a++; foreach ($PurchaseRecords as $TableRow) : $a++;
$id = $TableRow->purchase_id; ?> $id = $TableRow->purchase_id; ?>
<tr> <tr>
<td><?php echo $TableRow->purchase_ref; ?></td> <td><?php echo ++$n; ?></td>
<td><?php echo $TableRow->purchase_date; ?></td> <td><?php echo $TableRow->purchase_date; ?></td>
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></td> <td><?php echo ($this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name) ?? ""; ?></td>
<td><?php echo myCurrency($TableRow->TotalPurchase); ?></td> <td><?php echo myCurrency($TableRow->TotalPurchase); ?></td>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?> <td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
<?php showDeleteButton($id); ?> <?php showDeleteButton($id); ?>
</td> </td>
</tr> </tr>
@ -49,4 +118,41 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->

View File

@ -7,11 +7,11 @@
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<!-- <button class="btn btn-primary btn-xs float-right" style="margin-left: 2px;" onclick="printDiv('printableArea')"><i class="fas fa-print"></i></button> -->
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5> <h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5>
</div> </div>
<div id="printableArea">
<div class="card-body"> <div class="card-body">
<div class="row bill-header"> <div class="row bill-header">
@ -23,7 +23,7 @@
<div class="col"> <div class="col">
<p><strong>Bill Number:</strong> <?php echo $Purchase->purchase_id; ?></p> <p><strong>Bill Number:</strong> <?php echo $Purchase->purchase_id; ?></p>
<p><strong>Date:</strong> <?php echo dbDate($Purchase->purchase_date); ?></p> <p><strong>Date:</strong> <?php echo dbDate($Purchase->purchase_date); ?></p>
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Purchase->accounts_id)->account_name; ?></p> <p><strong>Vendor:</strong> <?php echo (($this->myaccounts->getAccountDetails($Purchase->accounts_id)->account_name ?? "")); ?></p>
</div> </div>
</div> </div>
@ -40,6 +40,9 @@
<div class="col"> <div class="col">
<p class="text-right"><strong>Price</strong></p> <p class="text-right"><strong>Price</strong></p>
</div> </div>
<div class="col">
<p class="text-right"><strong>VAT</strong></p>
</div>
<div class="col"> <div class="col">
<p class="text-right"><strong>Total</strong></p> <p class="text-right"><strong>Total</strong></p>
</div> </div>
@ -58,7 +61,10 @@
<p><?php $rate=$PurchaseDetail->rate; echo myCurrency($rate); ?></p> <p><?php $rate=$PurchaseDetail->rate; echo myCurrency($rate); ?></p>
</div> </div>
<div class="col"> <div class="col">
<p><?php $ltotal=$rate*$qty; $total+=$ltotal; echo myCurrency($ltotal); ?></p> <p><?php $vat=$PurchaseDetail->vat; echo myCurrency($vat); ?></p>
</div>
<div class="col">
<p><?php $ltotal=$rate*$qty*((100-$vat)/100); $total+=$ltotal; echo myCurrency($ltotal); ?></p>
</div> </div>
</div> </div>
</div> </div>
@ -88,11 +94,24 @@
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script>
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
</script>

View File

@ -45,7 +45,9 @@
<?php $PTotal = 0; <?php $PTotal = 0;
$a = 0; $a = 0;
foreach ($PurchaseDetails as $Purchase) : $a++; ?> foreach ($PurchaseDetails as $Purchase) : $a++; ?>
<?php// var_dump($Purchase->Item->title);die(); ?>
<tr> <tr>
<td><?php echo $a; ?></td> <td><?php echo $a; ?></td>
<td><?php echo $Purchase->Item->title; ?></td> <td><?php echo $Purchase->Item->title; ?></td>
<td class="text-right"><?php echo $Purchase->total_qty; ?></td> <td class="text-right"><?php echo $Purchase->total_qty; ?></td>
@ -184,8 +186,9 @@
<?php $a = 0; <?php $a = 0;
foreach ($StockItems as $Stock) : $a++; ?> foreach ($StockItems as $Stock) : $a++; ?>
<tr> <tr>
<td><?php echo $a; ?></td> <td class="text-center"><?php echo $a; ?></td>
<td><?php echo $Stock->Item->title; ?></td> <?php //echo "<pre>";print_r($Stock->Summary->Item->title); die() ;?>
<td><?php echo $Stock->Summary->Item->title; ?></td>
<td><?php echo $Stock->Summary->Unit->title; ?></td> <td><?php echo $Stock->Summary->Unit->title; ?></td>
<td class="text-right"><?php echo $oqty = $Stock->Summary->Opening->qty; ?></td> <td class="text-right"><?php echo $oqty = $Stock->Summary->Opening->qty; ?></td>
<td class="text-right"><?php echo myCurrency($orate = $Stock->Summary->Opening->rate); ?></td> <td class="text-right"><?php echo myCurrency($orate = $Stock->Summary->Opening->rate); ?></td>

View File

@ -12,11 +12,11 @@
<div class="col-2"> <div class="col-2">
<fieldset> <fieldset>
<legend>Transaction Date <span class="text-danger">*</span></legend> <legend>Transaction Date <span class="text-danger">*</span></legend>
<input type="text" class="form-control2" id="salesDate" value="<?php echo NepaliDate(); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" name="salesDate" required> <input type="text" class="form-control2" id="salesDate" value="<?php echo NepaliDate(); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" name="salesDate" required>
</fieldset> </fieldset>
</div> </div>
<div class="col-8"> <div class="col-8">
<h1 class="text-center"><?php echo $pageTitle; ?> Voucher</h1> <h1 class="text-center"><?php echo $pageTitle; ?> Voucher</h1>
<!-- <fieldset> <!-- <fieldset>
<legend><span id="selectedAccountName"></span> Balance</legend><span id="selectedAccountBalance" style="padding: 6px 0px; display: inline-block; text-align: right; width: 100%;">Choose A/C First</span> <legend><span id="selectedAccountName"></span> Balance</legend><span id="selectedAccountBalance" style="padding: 6px 0px; display: inline-block; text-align: right; width: 100%;">Choose A/C First</span>
</fieldset> --> </fieldset> -->
@ -31,7 +31,7 @@
<legend> Enter Transaction </legend> <legend> Enter Transaction </legend>
<div class="form-row mb-2"> <div class="form-row mb-2">
<div class="form-group col"> <div class="form-group col">
<?php $this->myaccounts->showAccountsCombo("accounts_id", " Account <span class='text-danger'>*</span>", "accounts_id", "accategory_id=4","required"); ?> <?php $this->myaccounts->showAccountsCombo("accounts_id", " Account <span class='text-danger'>*</span>", "accounts_id", "accategory_id=4", "required"); ?>
</div> </div>
<!-- <div class="form-group col"> <!-- <div class="form-group col">
<label for="salesDate">Sales Date:</label> <label for="salesDate">Sales Date:</label>
@ -49,6 +49,7 @@
<th width=50%>Items <span class="text-danger">*</span></th> <th width=50%>Items <span class="text-danger">*</span></th>
<th class="text-center" width=5%>Qty <span class="text-danger">*</span></th> <th class="text-center" width=5%>Qty <span class="text-danger">*</span></th>
<th class="text-center" width=5%>Units</th> <th class="text-center" width=5%>Units</th>
<th class="text-center" width=13%>VAT<span class="text-danger">*</span></th>
<th class="text-center" width=13%>Rate <span class="text-danger">*</span></th> <th class="text-center" width=13%>Rate <span class="text-danger">*</span></th>
<th class="text-right" width=20%>Amount</th> <th class="text-right" width=20%>Amount</th>
<th width=5%></th> <th width=5%></th>
@ -65,7 +66,9 @@
</select></td> </select></td>
<td> <input type="text" class="form-control input-group-sm" name="qty[]" required></td> <td> <input type="text" class="form-control input-group-sm" name="qty[]" required></td>
<td><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td> <td><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td>
<td><input type="number" name="vat[]" class="form-control vat" required></td>
<td><input type="text" class="form-control" name="rate[]" required></td> <td><input type="text" class="form-control" name="rate[]" required></td>
<span class="total-price"></span>
<td><input type="text" class="form-control" name="ltotal[]" required></td> <td><input type="text" class="form-control" name="ltotal[]" required></td>
<td> <td>
<button type="button" class="btn btn-primary btn-xs add-row"> <button type="button" class="btn btn-primary btn-xs add-row">
@ -98,10 +101,13 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td class="text-right "><b>13% VAT</b></td> <td class="text-right d-none"><b><input type="checkbox" name="vat_checkbox" id="vat_checkbox"
<td class="text-right"> >13% VAT</b></td>
<td class="text-right d-none">
<input type="text" class="form-control" id="tax"> <input type="text" class="form-control" id="tax">
<td></td> <td></td>
<input type="hidden" name="vat_checkbox_value" id="vat_checkbox_value" value="0">
</tr> </tr>
<tr> <tr>
<td class="text-right "><b>Grand Total Amount</b></td> <td class="text-right "><b>Grand Total Amount</b></td>
@ -142,39 +148,46 @@
$(document).on("click", ".remove-sales-detail", function() { $(document).on("click", ".remove-sales-detail", function() {
if ($("#salesDetails tr").length > 1) { if ($("#salesDetails tr").length > 1) {
$(this).closest("tr").remove(); $(this).closest("tr").remove();
updateSerialNumbers(); updateSerialNumbers();
calculateTotals(); calculateTotals();
} }
}); });
$(document).on('input', '.sales-detail-duplicator input[name^="qty"], .sales-detail-duplicator input[name^="rate"]', function() { $(document).on('input', '.sales-detail-duplicator input[name^="qty"],.sales-detail-duplicator input[name^="vat"], .sales-detail-duplicator input[name^="rate"]', function() {
calculateLineTotal($(this).closest('tr')); calculateLineTotal($(this).closest('tr'));
calculateTotals(); calculateTotals();
}); });
$(document).on("change", "input[name=discountpercentage]", function() { $(document).on("change", "input[name=discountpercentage]", function() {
calculateLineTotal($(this).closest("tr")); calculateLineTotal($(this).closest("tr"));
calculateTotals(); calculateTotals();
}); });
$(document).on("change", "input[name=discount]", function() { $(document).on("change", "input[name=discount]", function() {
calculateLineTotal($(this).closest("tr")); calculateLineTotal($(this).closest("tr"));
calculateTotals('amount'); calculateTotals('amount');
}); });
$(document).on("change", "input[name=vat_checkbox]", function() {
calculateLineTotal($(this).closest("tr"));
calculateTotals('vat');
});
function updateSerialNumbers() {
$('.purchase-detail').each(function(index) {
$(this).find('.bbsn').text(index + 1);
})
counter = $('.purchase-detail').length;
}
function updateSerialNumbers(){
$('.purchase-detail').each(function(index){
$(this).find('.bbsn').text(index + 1);
})
counter = $('.purchase-detail').length;
}
function calculateLineTotal(row) { function calculateLineTotal(row) {
var quantity = parseFloat(row.find('input[name^="qty"]').val()); var quantity = parseFloat(row.find('input[name^="qty"]').val());
var rate = parseFloat(row.find('input[name^="rate"]').val()); var rate = parseFloat(row.find('input[name^="rate"]').val());
if (!isNaN(quantity) && !isNaN(rate)) { var vat = parseFloat(row.find('input[name^="vat"]').val());
if (!isNaN(quantity) && !isNaN(rate) && !isNaN(vat)) {
var lineTotal = quantity * rate; var lineTotal = quantity * rate;
row.find("input[name^='ltotal[]']").val(lineTotal.toFixed(2)); var vat_amt =(vat/100)*lineTotal;
var ltotal =lineTotal + vat_amt ;
console.log(lineTotal,vat_amt,ltotal);
row.find("input[name^='ltotal[]']").val(ltotal.toFixed(2));
} }
@ -183,7 +196,7 @@
var counter = $('.sales-detail-duplicator').length; var counter = $('.sales-detail-duplicator').length;
var currentRow = $(".sales-detail-duplicator").clone().show(); var currentRow = $(".sales-detail-duplicator").clone().show();
$(document).on("click", ".add-row", function() { $(document).on("click", ".add-row", function() {
counter+=1; counter += 1;
var newRow = currentRow.clone(); var newRow = currentRow.clone();
newRow.find('.bbsn').text(counter); newRow.find('.bbsn').text(counter);
$("#salesDetails").append(newRow); $("#salesDetails").append(newRow);
@ -191,8 +204,8 @@
// calculateTotals(); // calculateTotals();
}); });
$(document).on('change', '.select_item', function(){ $(document).on('change', '.select_item', function() {
var selectedOption = $(this).find(':selected'); var selectedOption = $(this).find(':selected');
var selectedValue = selectedOption.val(); var selectedValue = selectedOption.val();
var unitInput = $(this).closest('.sales-detail-duplicator').find('.item_unit'); var unitInput = $(this).closest('.sales-detail-duplicator').find('.item_unit');
@ -200,7 +213,7 @@
$.ajax({ $.ajax({
url: "<?php echo site_url("inventory/Sales/getunitbyitem/"); ?>" + selectedValue, url: "<?php echo site_url("inventory/Sales/getunitbyitem/"); ?>" + selectedValue,
async: true, async: true,
dataType:"json", dataType: "json",
method: 'POST', method: 'POST',
success: function(response) { success: function(response) {
console.log(response); console.log(response);
@ -218,7 +231,7 @@
} }
}); });
// $(document).on("click", ".remove-sales-detail", function() { // $(document).on("click", ".remove-sales-detail", function() {
// $(this).closest(".sales-detail").remove(); // $(this).closest(".sales-detail").remove();
// calculateTotals(); // calculateTotals();
@ -229,7 +242,7 @@
}); });
</script> </script>
<script> <script>
function calculateTotals(type='') { function calculateTotals(type = '') {
var subtotal = 0; var subtotal = 0;
$(".sales-detail-duplicator").each(function() { $(".sales-detail-duplicator").each(function() {
var lineTotal = parseFloat($(this).find("input[name^='ltotal']").val()); var lineTotal = parseFloat($(this).find("input[name^='ltotal']").val());
@ -239,38 +252,50 @@
}); });
var discountamount = 0; var discountamount = 0;
var discountpercent = 0; var discountpercent = 0;
if(type=='amount'){ var tax_percentage =0;
alert("amount"); if (type == 'amount') {
discountamount = parseFloat($("input[name='discount']").val()); discountamount = parseFloat($("input[name='discount']").val());
discountpercent = (discountamount * 100) / subtotal; discountpercent = (discountamount * 100) / subtotal;
alert(discountamount);
$("#discountpercentage").val(discountpercent.toFixed(2)); $("#discountpercentage").val(discountpercent.toFixed(2));
}else{ } else if(type == 'vat'){
checkBox = $("input[name='vat_checkbox_value']").val();
if(checkBox == "0"){
// if(checkBox){
tax_percentage= 0.13;
$("input[name='vat_checkbox_value']").val('13');
}else{
tax_percentage =0;
$("input[name='vat_checkbox_value']").val('0');
}
// }
}
else {
discountpercent = parseFloat($("input[name='discountpercentage']").val()); discountpercent = parseFloat($("input[name='discountpercentage']").val());
discountamount = subtotal * (discountpercent/100); discountamount = subtotal * (discountpercent / 100);
$("#discount").val(discountamount.toFixed(2)); $("#discount").val(discountamount.toFixed(2));
} }
var taxable = subtotal - discountamount; var taxable = subtotal - discountamount;
var tax = taxable * 0.13; var tax = taxable * tax_percentage;
var grandTotal = taxable + tax; // var grandTotal = taxable + tax;
var grandTotal = taxable;
$('#subtotal').val(subtotal.toFixed(2)); $('#subtotal').val(subtotal.toFixed(2));
$("#taxable").val(taxable.toFixed(2)); $("#taxable").val(taxable.toFixed(2));
$('#tax').val(tax.toFixed(2)); $('#tax').val(tax.toFixed(2));
$('#grandtotal').val(grandTotal.toFixed(2)); $('#grandtotal').val(grandTotal.toFixed(2));
} }
</script> </script>
<?php function footerFunctions() <?php function footerFunctions()
{ ?> { ?>
<script> <script>
$("#salesDate").nepaliDatePicker({ $("#salesDate").nepaliDatePicker({
dateFormat: "%y-%m-%d", dateFormat: "%y-%m-%d",
closeOnDateSelect: true, closeOnDateSelect: true,
minDate: $('#salesDate').data('start'), minDate: $('#salesDate').data('start'),
maxDate: $('#salesDate').data('end'), maxDate: $('#salesDate').data('end'),
}); });
</script> </script>
<?php } ?> <?php } ?>

View File

@ -12,23 +12,24 @@
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped dataTable">
<thead> <thead>
<tr> <tr>
<th class="table-col col-1"><?php myLang('Sales Voucher #'); ?></th> <th class="table-col col-1 text-center"><?php myLang('Sales Voucher #'); ?></th>
<th width="10%"><?php myLang('Date'); ?></th> <th width="10%"><?php myLang('Date'); ?></th>
<th><?php myLang('Transaction'); ?></th> <th><?php myLang('Transaction'); ?></th>
<th class="table-col col-1"><?php myLang('Amount'); ?></th> <th class="table-col col-1 text-center"><?php myLang('Amount'); ?></th>
<th class="table-col col-1"><?php myLang('Action'); ?></th> <th class="table-col col-1 text-center"><?php myLang('Action'); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($SalesRecords as $TableRow) : ?> <?php foreach ($SalesRecords as $TableRow) : ?>
<tr> <tr>
<td><?php echo $TableRow->sales_id; ?></td> <td class="text-center"><?php echo $TableRow->sales_id; ?></td>
<td><?php echo $TableRow->sales_date; ?></td> <td><?php echo $TableRow->sales_date; ?></td>
<td><b><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></b> <td><b><?php echo (($this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name) ?? ""); ?></b>
<div class="row ml-2 mr-2" style="border-bottom: 1px solid;"> <div class="row ml-2 mr-2" style="border-bottom: 1px solid;">
<span class="col item_name"><?php echo myLang("Particulars") ?></span> <span class="col item_name"><?php echo myLang("Particulars") ?></span>
<span class="col item_qty"><?php echo myLang("Qty") ?></span> <span class="col item_qty"><?php echo myLang("Qty") ?></span>
<span class="col item_rate"><?php echo myLang("Rate") ?></span> <span class="col item_rate"><?php echo myLang("Rate") ?></span>
<span class="col item_vat"><?php echo myLang("VAT") ?></span>
<span class="col item_amount"><?php echo myLang("Amount") ?></span> <span class="col item_amount"><?php echo myLang("Amount") ?></span>
</div> </div>
<?php $l = 0; <?php $l = 0;
@ -36,8 +37,9 @@
<div class="row ml-2 mr-2"> <div class="row ml-2 mr-2">
<span class="col item_name"><?php echo $r->Item->title; ?></span> <span class="col item_name"><?php echo $r->Item->title; ?></span>
<span class="col item_qty"><?php echo $r->qty; ?></span> <span class="col item_qty"><?php echo $r->qty; ?></span>
<span class="col item_rate text-right"><?php echo myCurrency($r->rate, true); ?></span> <span class="col item_rate"><?php echo myCurrency($r->rate, true); ?></span>
<span class="col item_amount text-right"><?php echo myCurrency($r->qty * $r->rate, true); ?></span> <span class="col item_vat"><?php echo myCurrency($r->vat, true); ?></span>
<span class="col item_amount"><?php echo myCurrency($r->qty * $r->rate, true); ?></span>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<div class="row ml-2 mr-2" style="border-top: 1px dotted;"> <div class="row ml-2 mr-2" style="border-top: 1px dotted;">
@ -48,7 +50,7 @@
</div> </div>
</td> </td>
<td><?php echo myCurrency($TableRow->totalsales); ?></td> <td><?php echo myCurrency($TableRow->totalsales); ?></td>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?> <td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?>
<?php showDeleteButton($TableRow->sales_id); ?> <?php showDeleteButton($TableRow->sales_id); ?>
</td> </td>
</tr> </tr>

View File

@ -5,31 +5,87 @@
<div class="col"> <div class="col">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5> <h5 class="m-0 card-title"><?php echo $pageTitle; ?> </h5><a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a>
<!-- Filter Start -->
<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 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" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
</div>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
</form>
<!-- Filter Ends -->
</div> </div>
<div class="card-body"> <div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_sales where status=1")->result(); ?> <?php $TableData = $this->db->query("select * from tbl_sales where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped dataTable" id='myTable'>
<thead> <thead>
<tr> <tr>
<th class="table-col col-1"><?php myLang('Sales Voucher #'); ?></th> <th class=" col-1 text-center"><?php myLang('ID'); ?></th>
<th width="10%"><?php myLang('Date'); ?></th> <th class=" col-1 text-center"><?php myLang('Sales Voucher #'); ?></th>
<th class=" col-1 text-center"><?php myLang('Item'); ?></th>
<th class="col-1"><?php myLang('Date'); ?></th>
<th><?php myLang('Transaction'); ?></th> <th><?php myLang('Transaction'); ?></th>
<th class="table-col col-1"><?php myLang('Amount'); ?></th> <th class="table-col col-1 text-center"><?php myLang('Amount'); ?></th>
<th class="table-col col-1"><?php myLang('Action'); ?></th> <th class="text-center" width="5%"> <?php myLang('Action'); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($SalesRecords as $TableRow) : ?> <?php $n = 0; ?>
<?php foreach ($SalesRecords as $key => $TableRow) : ?>
<tr> <tr>
<td><?php echo $TableRow->sales_id; ?></td> <td class="text-center"><?php echo ++$n; ?></td>
<td class="text-center"><?php echo $TableRow->sales_id; ?></td>
<td class="text-center"><?php echo ($TableRow->Details[$key]->Item->title) ?? ""; ?></td>
<td><?php echo $TableRow->sales_date; ?></td> <td><?php echo $TableRow->sales_date; ?></td>
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?> <td><?php echo (($this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name) ?? ""); ?>
</td> </td>
<td><?php echo myCurrency($TableRow->totalsales); ?></td> <td><?php echo myCurrency($TableRow->totalsales); ?></td>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?> <td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?>
<?php showDeleteButton($TableRow->sales_id); ?> <?php showDeleteButton($TableRow->sales_id); ?>
</td> </td>
</tr> </tr>
@ -49,4 +105,41 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->

View File

@ -7,11 +7,11 @@
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<!-- <button class="btn btn-primary btn-xs float-right" style="margin-left: 2px;" onclick="printDiv('printableArea')"><i class="fas fa-print"></i></button> -->
<h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5> <h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
</div> </div>
<div id="printableArea">
<div class="card-body"> <div class="card-body">
<div class="row bill-header"> <div class="row bill-header">
@ -23,7 +23,7 @@
<div class="col"> <div class="col">
<p><strong>Bill Number:</strong> <?php echo $Sales->sales_id; ?></p> <p><strong>Bill Number:</strong> <?php echo $Sales->sales_id; ?></p>
<p><strong>Date:</strong> <?php echo dbDate($Sales->sales_date); ?></p> <p><strong>Date:</strong> <?php echo dbDate($Sales->sales_date); ?></p>
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Sales->accounts_id)->account_name; ?></p> <p><strong>Vendor:</strong> <?php echo (($this->myaccounts->getAccountDetails($Sales->accounts_id)->account_name ?? "")); ?></p>
</div> </div>
</div> </div>
@ -40,6 +40,9 @@
<div class="col text-right"> <div class="col text-right">
<p><strong>Price</strong></p> <p><strong>Price</strong></p>
</div> </div>
<div class="col text-right">
<p><strong>VAT</strong></p>
</div>
<div class="col text-right"> <div class="col text-right">
<p><strong>Total</strong></p> <p><strong>Total</strong></p>
</div> </div>
@ -57,6 +60,9 @@
<div class="col"> <div class="col">
<p><?php $rate=$SalesDetail->rate; echo myCurrency($rate); ?></p> <p><?php $rate=$SalesDetail->rate; echo myCurrency($rate); ?></p>
</div> </div>
<div class="col">
<p><?php $vat=($SalesDetail->vat); echo myCurrency($vat); ?></p>
</div>
<div class="col"> <div class="col">
<p><?php $ltotal=$rate*$qty; $total+=$ltotal; echo myCurrency($ltotal); ?></p> <p><?php $ltotal=$rate*$qty; $total+=$ltotal; echo myCurrency($ltotal); ?></p>
</div> </div>
@ -80,13 +86,15 @@
<?php //print_r($Purchase->vatToggle);die; ?> <?php //print_r($Purchase->vatToggle);die; ?>
<!-- <?php //if($Sales->vatToggle != 1): ?> --> <!-- <?php //if($Sales->vatToggle != 1): ?> -->
<p><strong>Taxable amount:</strong> <?php echo myCurrency($taxable,true); ?></p> <p><strong>Taxable amount:</strong> <?php echo myCurrency($taxable,true); ?></p>
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p> <!-- <p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p> -->
<!-- <?php //endif; ?> --> <!-- <?php //endif; ?> -->
<p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p> <!-- <p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p> -->
<p><strong>Total:</strong> <?php echo myCurrency(($taxable),true); ?></p>
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -2,21 +2,14 @@
<!-- <div class="content"> <!-- <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="card card-primary "> <div class="card card-primary ">
<div class="card-header"> <div class="card-header">
<h3 class="card-title"><?php //echo $pageTitle; <h3 class="card-title"><?php //echo $pageTitle;
?> </h3> ?> </h3>
<div class="card-tools"> <div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-plus"></i> <button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-plus"></i>
</button> </button>
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<form method="post" action="" id="FilterForm"> <form method="post" action="" id="FilterForm">
<div class="row align-items-end"> <div class="row align-items-end">
@ -62,7 +55,6 @@
</div> </div>
<div class="col"> <div class="col">
<div class="form-group d-flex justify-content-end"> <div class="form-group d-flex justify-content-end">
<button type="submit" class="btn btn-primary mr-2">Choose</button> <button type="submit" class="btn btn-primary mr-2">Choose</button>
<button type="submit" class="btn btn-primary mr-2">Filter</button> <button type="submit" class="btn btn-primary mr-2">Filter</button>
<button type="submit" class="btn btn-success mr-2">Export</button> <button type="submit" class="btn btn-success mr-2">Export</button>
@ -70,7 +62,6 @@
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<script> <script>
function resetForm() { function resetForm() {
@ -89,10 +80,7 @@
</div> </div>
</div> </div>
</div> --> </div> -->
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
@ -100,96 +88,112 @@
<div class="card-header"> <div class="card-header">
<h5 class="card-title"> <h5 class="card-title">
<?php echo $pageTitle; ?> <?php echo $pageTitle; ?>
<!-- <?php //echo $pageTitle; <!-- <?php //echo $pageTitle;
?> <a href="<?php //echo site_url("inventory/purchases/add"); ?> <a href="<?php //echo site_url("inventory/purchases/add");
?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle; ?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle;
?></a> --> ?></a> -->
</h5> </h5>
<div class="card-tools"> <div class="card-tools">
<!-- button with a dropdown --> <!-- test -->
<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">
<!-- test ends -->
<div class="form-group p-2 pb-0"> <form method="post" action=<?php echo site_url('/Inventory/Stocks/summary'); ?> id="FilterForm">
<div class="col"> <!-- button with a dropdown -->
<div class="form-group"> <input type="hidden" name="stocklocations_id" value="1" />
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <div class="btn-group">
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <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="" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> -->
</div>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div> </div>
<div class="dropdown-divider"></div>
<!-- <div class="form-check">
<div class="form-group"> <input class="form-check-input" type="checkbox">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label class="form-check-label">Select
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> All</label>
</div> -->
<div class="form-check">
<!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label" for="showOB">Opening</label>
StockRecords
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label" for="showClosing">Closing</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label" for="showPeriod">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<div class="form-check"> <div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<input class="form-check-input" type="checkbox"> <button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
<label class="form-check-label">Select
All</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label">Opening</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label">Closing</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label">Period</label>
</div> </div>
</div> </div>
<div class="dropdown-divider"></div>
<button type="submit" class="btn btn-primary mr-2 text-center">Search Now</button>
</div> </div>
</div> <div class="btn-group">
<div class="btn-group"> <!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
<button type="button" class="btn btn-danger btn-sm " data-toggle="dropdown" data-offset="-52"> Export
Export </button> -->
</button> <button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
<!-- <div class="dropdown-menu" role="menu"> Export csv
</button>
<!-- <button class="btn btn-warning btn-sm " onclick="exportTableToCSV('accounts_data.csv')">Export to CSV</button> -->
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a> <a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a> <a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a> <a href="#" class="dropdown-item">View calendar</a>
</div> --> </div> -->
</div> </div>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
</form>
<script>
function resetForm() {
document.getElementById("fromDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>";
document.getElementById("toDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>";
document.getElementById("showOB").checked = <?php echo "false"; ?>;
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
document.getElementById("FilterForm").submit();
}
</script>
</div> </div>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table table-bordered table-striped dataTable"> <table id='myTable' class="table table-bordered table-striped dataTable">
<thead> <thead>
<tr> <tr>
<th rowspan="2"><?php myLang('Item'); ?></th> <th rowspan="2" width="40" style="vertical-align: middle;"><?php myLang('S.No.'); ?></th>
<th rowspan="2" style="vertical-align: middle;"> <?php myLang('Item'); ?></th>
<th rowspan="2" width="80"><?php myLang('Units'); ?></th> <th rowspan="2" width="80" style="vertical-align: middle;"><?php myLang('Units'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Opening'); ?></th> <th colspan="3" class="text-center"><?php myLang('Opening'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Purchase'); ?></th> <th colspan="3" class="text-center"><?php myLang('Purchase'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Sales'); ?></th> <th colspan="3" class="text-center"><?php myLang('Sales'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Closing'); ?></th> <th colspan="3" class="text-center"><?php myLang('Closing'); ?></th>
</tr> </tr>
<tr> <tr>
<th class="text-center" width="80"><?php myLang('Qty'); ?></th> <th class="text-center" width="80"><?php myLang('Qty'); ?></th>
<th class="text-center" width="80"><?php myLang('Avg. Rate'); ?></th> <th class="text-center" width="80"><?php myLang('Avg. Rate'); ?></th>
<th class="text-center" width="80"><?php myLang('Amount'); ?></th> <th class="text-center" width="80"><?php myLang('Amount'); ?></th>
@ -202,41 +206,43 @@
<th class="text-center" width="80"><?php myLang('Qty'); ?></th> <th class="text-center" width="80"><?php myLang('Qty'); ?></th>
<th class="text-center" width="80"><?php myLang('Avg. Rate'); ?></th> <th class="text-center" width="80"><?php myLang('Avg. Rate'); ?></th>
<th class="text-center" width="80"><?php myLang('Amount'); ?></th> <th class="text-center" width="80"><?php myLang('Amount'); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $Total = 0;
<?php $Total = 0;$PTotal=0;$STotal=0;$CTotal=0; $PTotal = 0;
foreach ($StockRecords as $TableRow) : ?> $STotal = 0;
<tr> $CTotal = 0;
foreach ($StockRecords as $index => $TableRow) : ?>
<td><?php echo ($TableRow->Item)?$TableRow->Item->title:"N/A"; ?></td> <?php if ((count($TableRow->Item)) > 0):; ?>
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->Item->units_id); ?></td> <tr>
<td class="text-right"><?php echo $TableRow->Summary->Opening->qty; ?></td> <td class="text-center"><?php echo $index + 1; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Opening->rate; ?></td> <td><?php echo ($TableRow->Summary->Item->title) ? $TableRow->Summary->Item->title : "N/A"; ?></td>
<td><?php echo myCurrency($lTotal = $TableRow->Summary->Opening->amount); <!-- $StockRecord->Summary->Unit->unit_id -->
$Total += $lTotal; ?></td> <td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->Summary->Unit->unit_id); ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Purchase->qty; ?></td> <td class="text-right"><?php echo $TableRow->Summary->Opening->qty; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Purchase->rate; ?></td> <td class="text-right"><?php echo $TableRow->Summary->Opening->rate; ?></td>
<td><?php echo myCurrency($pTotal = $TableRow->Summary->Purchase->amount); <td><?php echo myCurrency($lTotal = $TableRow->Summary->Opening->amount);
$PTotal += $pTotal; ?></td> $Total += $lTotal; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Sales->qty; ?></td> <td class="text-right"><?php echo $TableRow->Summary->Purchase->qty; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Sales->rate; ?></td> <td class="text-right"><?php echo $TableRow->Summary->Purchase->rate; ?></td>
<td><?php echo myCurrency($sTotal = $TableRow->Summary->Sales->amount); <td><?php echo myCurrency($pTotal = $TableRow->Summary->Purchase->amount);
$STotal += $sTotal; ?></td> $PTotal += $pTotal; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Closing->qty; ?></td> <td class="text-right"><?php echo $TableRow->Summary->Sales->qty; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Closing->rate; ?></td> <td class="text-right"><?php echo $TableRow->Summary->Sales->rate; ?></td>
<td><?php echo myCurrency($cTotal = $TableRow->Summary->Closing->amount); <td><?php echo myCurrency($sTotal = $TableRow->Summary->Sales->amount);
$CTotal += $cTotal; ?></td> $STotal += $sTotal; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Closing->qty; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Closing->rate; ?></td>
</tr> <td><?php echo myCurrency($cTotal = $TableRow->Summary->Closing->amount);
$CTotal += $cTotal; ?></td>
</tr>
<?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
<tbody> <tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="4" class="text-right"><b><?php echo myLang("Total"); ?></b></td> <td colspan="5" class="text-right"><b><?php echo myLang("Total"); ?></b></td>
<td><?php echo myCurrency($Total); ?></td> <td><?php echo myCurrency($Total); ?></td>
<td colspan="2"></td> <td colspan="2"></td>
<td><?php echo myCurrency($PTotal); ?></td> <td><?php echo myCurrency($PTotal); ?></td>
@ -244,6 +250,7 @@
<td><?php echo myCurrency($STotal); ?></td> <td><?php echo myCurrency($STotal); ?></td>
<td colspan="2"></td> <td colspan="2"></td>
<td><?php echo myCurrency($CTotal); ?></td> <td><?php echo myCurrency($CTotal); ?></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
@ -253,4 +260,121 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php function footerFunctions()
{
?>
<script>
$(document).ready(function() {
// Prevent the dropdown from closing when clicking inside
$('.dropdown-menu').on('click', function(event) {
event.stopPropagation();
});
});
</script>
<script>
// var exportButton = document.getElementById("exportButton");
// exportButton.addEventListener("click", function() {
// exportTableToCSV("table.csv");
// });
document.addEventListener("DOMContentLoaded", function() {
// Trigger click event on page load
document.getElementById("toggleShowAll").click();
});
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
e.preventDefault();
var nestedRows = document.getElementsByClassName("collapse");
for (var i = 0; i < nestedRows.length; i++) {
if (nestedRows[i].classList.contains("show")) {
nestedRows[i].classList.remove("show");
} else {
nestedRows[i].classList.add("show");
}
}
});
function exportTableToCSV(filename) {
var csv = [];
var rows = document.querySelectorAll("table tr:not(.hide)");
for (var i = 0; i < rows.length; i++) {
var row = [];
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
// Check if the parent row is collapsed or hidden
var parentRow = rows[i].closest(".collapse");
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
if (isParentCollapsed) {
continue; // Skip child table rows if parent is collapsed
}
for (var j = 0; j < cols.length; j++) {
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
row.push(cellValue);
}
csv.push(row.join(","));
}
// Create a CSV file
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", filename);
document.body.appendChild(link);
link.click();
}
</script>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php
}
?>

View File

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

View File

@ -1,39 +1,34 @@
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?></h5>
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5>
</div> </div>
<div class="card-body "> <div class="card-body ">
<?php $TableData = $this->db->query("select * from tbl_translations where status=1")->result(); ?> <?php $TableData = $this->db->query("select * from tbl_translations where status=1")->result(); ?>
<table class="table table-bordered table-striped longdataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th class="text-center col-1"><?php myLang('Translation Id'); ?></th> <th class="text-center col-1"><?php myLang('Translation Id'); ?></th>
<th class="text-center col-2"><?php myLang('English'); ?></th> <th class="text-center col-5"><?php myLang('English'); ?></th>
<th class="text-center col-2"><?php myLang('Nepali'); ?></th> <th class="text-center col-5"><?php myLang('Nepali'); ?></th>
<th class="text-center col-1"><?php myLang('Action'); ?></th> <th class="text-center col-1"><?php myLang('Action'); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?> <?php $a = 0;
foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols; <?php foreach ($TableRow as $cols) : $id = $cols;
break; break;
endforeach; ?><tr> endforeach; ?><tr>
<td class="text-center"><?php echo $TableRow->translation_id; ?></td> <td class="text-center"><?php echo $TableRow->translation_id; ?></td>
<td><?php echo $TableRow->english; ?></td> <td><?php echo $TableRow->english; ?></td>
<td><?php echo $TableRow->nepali; ?></td> <td><?php echo $TableRow->nepali; ?></td>
<td class="text-center"><a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>" class="btn btn-info btn-xs"><i class="fas fa-edit"></i> Edit</a> <td class="text-center"><a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>" class="btn btn-info btn-xs"><i class="fas fa-edit"></i></a>
<a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs"><i class="fas fa-trash"></i> Delete</a> <a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs"><i class="fas fa-trash"></i></a>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

@ -25,6 +25,7 @@ SET time_zone = "+00:00";
-- --
-- Table structure for table `tbl_accategories` -- Table structure for table `tbl_accategories`
-- --
CREATE TABLE `tbl_accategories` ( CREATE TABLE `tbl_accategories` (

View File

@ -74,6 +74,12 @@ $route['student/admission_payment'] = 'Student/admission-payment';
$route['student/get_installdetails'] = 'Student/get-installdetails'; $route['student/get_installdetails'] = 'Student/get-installdetails';
$route['student/paypalipn_admission'] = 'Student/paypalipn-admission'; $route['student/paypalipn_admission'] = 'Student/paypalipn-admission';
//inventory
$route['inventory/stocks/summary'] = 'Inventory/Stocks/summary';
//inventory ends
$route['admin'] = 'Admin/index'; $route['admin'] = 'Admin/index';
$route['admin-logout'] = 'Admin/admin_logout'; $route['admin-logout'] = 'Admin/admin_logout';

View File

@ -75,6 +75,7 @@
$('[data-toggle="tooltip"]').tooltip() $('[data-toggle="tooltip"]').tooltip()
}) })
</script> </script>
</body> </body>
</html> </html>

636
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
APP_NAME="BIB-Accounts" APP_NAME="BIB-Accounts"
APP_URL=http://localhost/School-With-Accounts/account/ APP_URL=http://localhost/bbnepal/BBnepal-Accounts
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=127.0.0.1:3309 DB_HOST=127.0.0.1:3309
DB_PORT=3309 DB_PORT=3309
DATABASE_OPTIONS=bbnepal_accounting,myurlsco_accounts1,myurlsco_accounts2,myurlsco_accounts3 DATABASE_OPTIONS=bbnepal_accounting,myurlsco_accounts1,myurlsco_accounts2,myurlsco_accounts3 #given
DB_DATABASE=bbnepal_accounting DB_DATABASE=bbnepal_accounting
DB_USERNAME=root DB_USERNAME=root
DB_PASSWORD= DB_PASSWORD=

17
vendor/autoload.php vendored
View File

@ -3,8 +3,21 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) { if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; if (!headers_sent()) {
exit(1); header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
} }
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';

View File

@ -42,35 +42,37 @@ namespace Composer\Autoload;
*/ */
class ClassLoader class ClassLoader
{ {
/** @var ?string */ /** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir; private $vendorDir;
// PSR-4 // PSR-4
/** /**
* @var array[] * @var array<string, array<string, int>>
* @psalm-var array<string, array<string, int>>
*/ */
private $prefixLengthsPsr4 = array(); private $prefixLengthsPsr4 = array();
/** /**
* @var array[] * @var array<string, list<string>>
* @psalm-var array<string, array<int, string>>
*/ */
private $prefixDirsPsr4 = array(); private $prefixDirsPsr4 = array();
/** /**
* @var array[] * @var list<string>
* @psalm-var array<string, string>
*/ */
private $fallbackDirsPsr4 = array(); private $fallbackDirsPsr4 = array();
// PSR-0 // PSR-0
/** /**
* @var array[] * List of PSR-0 prefixes
* @psalm-var array<string, array<string, string[]>> *
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/ */
private $prefixesPsr0 = array(); private $prefixesPsr0 = array();
/** /**
* @var array[] * @var list<string>
* @psalm-var array<string, string>
*/ */
private $fallbackDirsPsr0 = array(); private $fallbackDirsPsr0 = array();
@ -78,8 +80,7 @@ class ClassLoader
private $useIncludePath = false; private $useIncludePath = false;
/** /**
* @var string[] * @var array<string, string>
* @psalm-var array<string, string>
*/ */
private $classMap = array(); private $classMap = array();
@ -87,29 +88,29 @@ class ClassLoader
private $classMapAuthoritative = false; private $classMapAuthoritative = false;
/** /**
* @var bool[] * @var array<string, bool>
* @psalm-var array<string, bool>
*/ */
private $missingClasses = array(); private $missingClasses = array();
/** @var ?string */ /** @var string|null */
private $apcuPrefix; private $apcuPrefix;
/** /**
* @var self[] * @var array<string, self>
*/ */
private static $registeredLoaders = array(); private static $registeredLoaders = array();
/** /**
* @param ?string $vendorDir * @param string|null $vendorDir
*/ */
public function __construct($vendorDir = null) public function __construct($vendorDir = null)
{ {
$this->vendorDir = $vendorDir; $this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
} }
/** /**
* @return string[] * @return array<string, list<string>>
*/ */
public function getPrefixes() public function getPrefixes()
{ {
@ -121,8 +122,7 @@ class ClassLoader
} }
/** /**
* @return array[] * @return array<string, list<string>>
* @psalm-return array<string, array<int, string>>
*/ */
public function getPrefixesPsr4() public function getPrefixesPsr4()
{ {
@ -130,8 +130,7 @@ class ClassLoader
} }
/** /**
* @return array[] * @return list<string>
* @psalm-return array<string, string>
*/ */
public function getFallbackDirs() public function getFallbackDirs()
{ {
@ -139,8 +138,7 @@ class ClassLoader
} }
/** /**
* @return array[] * @return list<string>
* @psalm-return array<string, string>
*/ */
public function getFallbackDirsPsr4() public function getFallbackDirsPsr4()
{ {
@ -148,8 +146,7 @@ class ClassLoader
} }
/** /**
* @return string[] Array of classname => path * @return array<string, string> Array of classname => path
* @psalm-return array<string, string>
*/ */
public function getClassMap() public function getClassMap()
{ {
@ -157,8 +154,7 @@ class ClassLoader
} }
/** /**
* @param string[] $classMap Class to filename map * @param array<string, string> $classMap Class to filename map
* @psalm-param array<string, string> $classMap
* *
* @return void * @return void
*/ */
@ -175,24 +171,25 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, either * Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix. * appending or prepending to the ones previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories * @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
* *
* @return void * @return void
*/ */
public function add($prefix, $paths, $prepend = false) public function add($prefix, $paths, $prepend = false)
{ {
$paths = (array) $paths;
if (!$prefix) { if (!$prefix) {
if ($prepend) { if ($prepend) {
$this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0 = array_merge(
(array) $paths, $paths,
$this->fallbackDirsPsr0 $this->fallbackDirsPsr0
); );
} else { } else {
$this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0, $this->fallbackDirsPsr0,
(array) $paths $paths
); );
} }
@ -201,19 +198,19 @@ class ClassLoader
$first = $prefix[0]; $first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) { if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths; $this->prefixesPsr0[$first][$prefix] = $paths;
return; return;
} }
if ($prepend) { if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths, $paths,
$this->prefixesPsr0[$first][$prefix] $this->prefixesPsr0[$first][$prefix]
); );
} else { } else {
$this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix], $this->prefixesPsr0[$first][$prefix],
(array) $paths $paths
); );
} }
} }
@ -222,9 +219,9 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, either * Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace. * appending or prepending to the ones previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories * @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* *
@ -232,17 +229,18 @@ class ClassLoader
*/ */
public function addPsr4($prefix, $paths, $prepend = false) public function addPsr4($prefix, $paths, $prepend = false)
{ {
$paths = (array) $paths;
if (!$prefix) { if (!$prefix) {
// Register directories for the root namespace. // Register directories for the root namespace.
if ($prepend) { if ($prepend) {
$this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4 = array_merge(
(array) $paths, $paths,
$this->fallbackDirsPsr4 $this->fallbackDirsPsr4
); );
} else { } else {
$this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4, $this->fallbackDirsPsr4,
(array) $paths $paths
); );
} }
} elseif (!isset($this->prefixDirsPsr4[$prefix])) { } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@ -252,18 +250,18 @@ class ClassLoader
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
} }
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths; $this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) { } elseif ($prepend) {
// Prepend directories for an already registered namespace. // Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths, $paths,
$this->prefixDirsPsr4[$prefix] $this->prefixDirsPsr4[$prefix]
); );
} else { } else {
// Append directories for an already registered namespace. // Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix], $this->prefixDirsPsr4[$prefix],
(array) $paths $paths
); );
} }
} }
@ -272,8 +270,8 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, * Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix. * replacing any others previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories * @param list<string>|string $paths The PSR-0 base directories
* *
* @return void * @return void
*/ */
@ -290,8 +288,8 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, * Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace. * replacing any others previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories * @param list<string>|string $paths The PSR-4 base directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* *
@ -425,7 +423,8 @@ class ClassLoader
public function loadClass($class) public function loadClass($class)
{ {
if ($file = $this->findFile($class)) { if ($file = $this->findFile($class)) {
includeFile($file); $includeFile = self::$includeFile;
$includeFile($file);
return true; return true;
} }
@ -476,9 +475,9 @@ class ClassLoader
} }
/** /**
* Returns the currently registered loaders indexed by their corresponding vendor directories. * Returns the currently registered loaders keyed by their corresponding vendor directories.
* *
* @return self[] * @return array<string, self>
*/ */
public static function getRegisteredLoaders() public static function getRegisteredLoaders()
{ {
@ -555,18 +554,26 @@ class ClassLoader
return false; return false;
} }
}
/** /**
* Scope isolated include. * @return void
* */
* Prevents access to $this/self from included files. private static function initializeIncludeClosure()
* {
* @param string $file if (self::$includeFile !== null) {
* @return void return;
* @private }
*/
function includeFile($file) /**
{ * Scope isolated include.
include $file; *
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
} }

View File

@ -98,7 +98,7 @@ class InstalledVersions
{ {
foreach (self::getInstalled() as $installed) { foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) { if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
} }
} }
@ -119,7 +119,7 @@ class InstalledVersions
*/ */
public static function satisfies(VersionParser $parser, $packageName, $constraint) public static function satisfies(VersionParser $parser, $packageName, $constraint)
{ {
$constraint = $parser->parseConstraints($constraint); $constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint); return $provided->matches($constraint);
@ -328,7 +328,9 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) { if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir]; $installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) { } elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1]; self::$installed = $installed[count($installed) - 1];
} }
@ -340,12 +342,17 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location, // only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') { if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php'; /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else { } else {
self::$installed = array(); self::$installed = array();
} }
} }
$installed[] = self::$installed;
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed; return $installed;
} }

View File

@ -471,6 +471,5 @@ return array(
'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => $vendorDir . '/sebastian/recursion-context/src/InvalidArgumentException.php', 'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => $vendorDir . '/sebastian/recursion-context/src/InvalidArgumentException.php',
'SebastianBergmann\\ResourceOperations\\ResourceOperations' => $vendorDir . '/sebastian/resource-operations/src/ResourceOperations.php', 'SebastianBergmann\\ResourceOperations\\ResourceOperations' => $vendorDir . '/sebastian/resource-operations/src/ResourceOperations.php',
'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php', 'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php',
'Stringable' => $vendorDir . '/myclabs/php-enum/stubs/Stringable.php',
'Text_Template' => $vendorDir . '/phpunit/php-text-template/src/Template.php', 'Text_Template' => $vendorDir . '/phpunit/php-text-template/src/Template.php',
); );

View File

@ -7,11 +7,8 @@ $baseDir = dirname($vendorDir);
return array( return array(
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', '6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'3109cb1a231dcd04bee1f9f620d46975' => $vendorDir . '/paragonie/sodium_compat/autoload.php', '3109cb1a231dcd04bee1f9f620d46975' => $vendorDir . '/paragonie/sodium_compat/autoload.php',

View File

@ -7,5 +7,4 @@ $baseDir = dirname($vendorDir);
return array( return array(
'org\\bovigo\\vfs' => array($vendorDir . '/mikey179/vfsstream/src/main/php'), 'org\\bovigo\\vfs' => array($vendorDir . '/mikey179/vfsstream/src/main/php'),
'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
); );

View File

@ -9,23 +9,23 @@ return array(
'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/reflection-docblock/src', $vendorDir . '/phpdocumentor/type-resolver/src'), 'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/reflection-docblock/src', $vendorDir . '/phpdocumentor/type-resolver/src'),
'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'), 'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Pusher\\' => array($vendorDir . '/pusher/pusher-php-server/src'), 'Pusher\\' => array($vendorDir . '/pusher/pusher-php-server/src'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'), 'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'),
'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'), 'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'),
'PHPStan\\PhpDocParser\\' => array($vendorDir . '/phpstan/phpdoc-parser/src'),
'Nilambar\\NepaliDate\\' => array($vendorDir . '/ernilambar/nepali-date/src'), 'Nilambar\\NepaliDate\\' => array($vendorDir . '/ernilambar/nepali-date/src'),
'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'),
'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'), 'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'Doctrine\\Deprecations\\' => array($vendorDir . '/doctrine/deprecations/lib/Doctrine/Deprecations'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'), 'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'), 'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'),
); );

View File

@ -31,25 +31,18 @@ class ComposerAutoloaderInitade43c0983b611153cb43d6dce42fdb7
$loader->register(true); $loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitade43c0983b611153cb43d6dce42fdb7::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInitade43c0983b611153cb43d6dce42fdb7::$files;
foreach ($includeFiles as $fileIdentifier => $file) { $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
composerRequireade43c0983b611153cb43d6dce42fdb7($fileIdentifier, $file); if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequireade43c0983b611153cb43d6dce42fdb7($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}

View File

@ -8,11 +8,8 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
{ {
public static $files = array ( public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'3109cb1a231dcd04bee1f9f620d46975' => __DIR__ . '/..' . '/paragonie/sodium_compat/autoload.php', '3109cb1a231dcd04bee1f9f620d46975' => __DIR__ . '/..' . '/paragonie/sodium_compat/autoload.php',
@ -33,7 +30,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
), ),
'S' => 'S' =>
array ( array (
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Polyfill\\Ctype\\' => 23, 'Symfony\\Polyfill\\Ctype\\' => 23,
'Symfony\\Component\\Yaml\\' => 23, 'Symfony\\Component\\Yaml\\' => 23,
), ),
@ -46,6 +42,7 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
'Psr\\Http\\Client\\' => 16, 'Psr\\Http\\Client\\' => 16,
'Prophecy\\' => 9, 'Prophecy\\' => 9,
'PhpOffice\\PhpSpreadsheet\\' => 25, 'PhpOffice\\PhpSpreadsheet\\' => 25,
'PHPStan\\PhpDocParser\\' => 21,
), ),
'N' => 'N' =>
array ( array (
@ -53,7 +50,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
), ),
'M' => 'M' =>
array ( array (
'MyCLabs\\Enum\\' => 13,
'Matrix\\' => 7, 'Matrix\\' => 7,
), ),
'G' => 'G' =>
@ -65,6 +61,7 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
'D' => 'D' =>
array ( array (
'Doctrine\\Instantiator\\' => 22, 'Doctrine\\Instantiator\\' => 22,
'Doctrine\\Deprecations\\' => 22,
'DeepCopy\\' => 9, 'DeepCopy\\' => 9,
), ),
'C' => 'C' =>
@ -88,10 +85,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
array ( array (
0 => __DIR__ . '/..' . '/webmozart/assert/src', 0 => __DIR__ . '/..' . '/webmozart/assert/src',
), ),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Polyfill\\Ctype\\' => 'Symfony\\Polyfill\\Ctype\\' =>
array ( array (
0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
@ -110,7 +103,7 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
), ),
'Psr\\Log\\' => 'Psr\\Log\\' =>
array ( array (
0 => __DIR__ . '/..' . '/psr/log/Psr/Log', 0 => __DIR__ . '/..' . '/psr/log/src',
), ),
'Psr\\Http\\Message\\' => 'Psr\\Http\\Message\\' =>
array ( array (
@ -129,14 +122,14 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
array ( array (
0 => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet', 0 => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet',
), ),
'PHPStan\\PhpDocParser\\' =>
array (
0 => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src',
),
'Nilambar\\NepaliDate\\' => 'Nilambar\\NepaliDate\\' =>
array ( array (
0 => __DIR__ . '/..' . '/ernilambar/nepali-date/src', 0 => __DIR__ . '/..' . '/ernilambar/nepali-date/src',
), ),
'MyCLabs\\Enum\\' =>
array (
0 => __DIR__ . '/..' . '/myclabs/php-enum/src',
),
'Matrix\\' => 'Matrix\\' =>
array ( array (
0 => __DIR__ . '/..' . '/markbaker/matrix/classes/src', 0 => __DIR__ . '/..' . '/markbaker/matrix/classes/src',
@ -157,6 +150,10 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
array ( array (
0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator', 0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator',
), ),
'Doctrine\\Deprecations\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/deprecations/lib/Doctrine/Deprecations',
),
'DeepCopy\\' => 'DeepCopy\\' =>
array ( array (
0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy', 0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy',
@ -175,13 +172,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
0 => __DIR__ . '/..' . '/mikey179/vfsstream/src/main/php', 0 => __DIR__ . '/..' . '/mikey179/vfsstream/src/main/php',
), ),
), ),
'H' =>
array (
'HTMLPurifier' =>
array (
0 => __DIR__ . '/..' . '/ezyang/htmlpurifier/library',
),
),
); );
public static $classMap = array ( public static $classMap = array (
@ -650,7 +640,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/recursion-context/src/InvalidArgumentException.php', 'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/recursion-context/src/InvalidArgumentException.php',
'SebastianBergmann\\ResourceOperations\\ResourceOperations' => __DIR__ . '/..' . '/sebastian/resource-operations/src/ResourceOperations.php', 'SebastianBergmann\\ResourceOperations\\ResourceOperations' => __DIR__ . '/..' . '/sebastian/resource-operations/src/ResourceOperations.php',
'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php', 'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php',
'Stringable' => __DIR__ . '/..' . '/myclabs/php-enum/stubs/Stringable.php',
'Text_Template' => __DIR__ . '/..' . '/phpunit/php-text-template/src/Template.php', 'Text_Template' => __DIR__ . '/..' . '/phpunit/php-text-template/src/Template.php',
); );

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
<?php return array( <?php return array(
'root' => array( 'root' => array(
'name' => 'codeigniter/framework', 'name' => 'codeigniter/framework',
'pretty_version' => '1.0.0+no-version-set', 'pretty_version' => 'dev-main',
'version' => '1.0.0.0', 'version' => 'dev-main',
'reference' => NULL, 'reference' => '497f567cba71733b286514954ef72c9fe5d46c51',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -11,14 +11,23 @@
), ),
'versions' => array( 'versions' => array(
'codeigniter/framework' => array( 'codeigniter/framework' => array(
'pretty_version' => '1.0.0+no-version-set', 'pretty_version' => 'dev-main',
'version' => '1.0.0.0', 'version' => 'dev-main',
'reference' => NULL, 'reference' => '497f567cba71733b286514954ef72c9fe5d46c51',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'doctrine/deprecations' => array(
'pretty_version' => '1.1.3',
'version' => '1.1.3.0',
'reference' => 'dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/deprecations',
'aliases' => array(),
'dev_requirement' => true,
),
'doctrine/instantiator' => array( 'doctrine/instantiator' => array(
'pretty_version' => '1.5.0', 'pretty_version' => '1.5.0',
'version' => '1.5.0.0', 'version' => '1.5.0.0',
@ -29,54 +38,45 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'ernilambar/nepali-date' => array( 'ernilambar/nepali-date' => array(
'pretty_version' => '1.0.5', 'pretty_version' => '1.0.7',
'version' => '1.0.5.0', 'version' => '1.0.7.0',
'reference' => '8ac91a49267e3821bf03f052d3cb6b7876af4a12', 'reference' => '886dcb25b10760b4f9c35083d0a1d3ef6fb98584',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../ernilambar/nepali-date', 'install_path' => __DIR__ . '/../ernilambar/nepali-date',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'ezyang/htmlpurifier' => array(
'pretty_version' => 'v4.16.0',
'version' => '4.16.0.0',
'reference' => '523407fb06eb9e5f3d59889b3978d5bfe94299c8',
'type' => 'library',
'install_path' => __DIR__ . '/../ezyang/htmlpurifier',
'aliases' => array(),
'dev_requirement' => false,
),
'guzzlehttp/guzzle' => array( 'guzzlehttp/guzzle' => array(
'pretty_version' => '7.5.0', 'pretty_version' => '7.9.2',
'version' => '7.5.0.0', 'version' => '7.9.2.0',
'reference' => 'b50a2a1251152e43f6a37f0fa053e730a67d25ba', 'reference' => 'd281ed313b989f213357e3be1a179f02196ac99b',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'guzzlehttp/promises' => array( 'guzzlehttp/promises' => array(
'pretty_version' => '1.5.2', 'pretty_version' => '2.0.3',
'version' => '1.5.2.0', 'version' => '2.0.3.0',
'reference' => 'b94b2807d85443f9719887892882d0329d1e2598', 'reference' => '6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises', 'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'guzzlehttp/psr7' => array( 'guzzlehttp/psr7' => array(
'pretty_version' => '2.4.3', 'pretty_version' => '2.7.0',
'version' => '2.4.3.0', 'version' => '2.7.0.0',
'reference' => '67c26b443f348a51926030c83481b85718457d3d', 'reference' => 'a70f5c95fb43bc83f07c9c948baa0dc1829bf201',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'maennchen/zipstream-php' => array( 'maennchen/zipstream-php' => array(
'pretty_version' => '2.2.6', 'pretty_version' => '3.1.0',
'version' => '2.2.6.0', 'version' => '3.1.0.0',
'reference' => '30ad6f93cf3efe4192bc7a4c9cad11ff8f4f237f', 'reference' => 'b8174494eda667f7d13876b4a7bfef0f62a7c0d1',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../maennchen/zipstream-php', 'install_path' => __DIR__ . '/../maennchen/zipstream-php',
'aliases' => array(), 'aliases' => array(),
@ -110,23 +110,14 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'myclabs/deep-copy' => array( 'myclabs/deep-copy' => array(
'pretty_version' => '1.11.0', 'pretty_version' => '1.12.0',
'version' => '1.11.0.0', 'version' => '1.12.0.0',
'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614', 'reference' => '3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../myclabs/deep-copy', 'install_path' => __DIR__ . '/../myclabs/deep-copy',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'myclabs/php-enum' => array(
'pretty_version' => '1.8.4',
'version' => '1.8.4.0',
'reference' => 'a867478eae49c9f59ece437ae7f9506bfaa27483',
'type' => 'library',
'install_path' => __DIR__ . '/../myclabs/php-enum',
'aliases' => array(),
'dev_requirement' => false,
),
'paragonie/random_compat' => array( 'paragonie/random_compat' => array(
'pretty_version' => 'v9.99.100', 'pretty_version' => 'v9.99.100',
'version' => '9.99.100.0', 'version' => '9.99.100.0',
@ -137,9 +128,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'paragonie/sodium_compat' => array( 'paragonie/sodium_compat' => array(
'pretty_version' => 'v1.19.0', 'pretty_version' => 'v1.21.1',
'version' => '1.19.0.0', 'version' => '1.21.1.0',
'reference' => 'cb15e403ecbe6a6cc515f855c310eb6b1872a933', 'reference' => 'bb312875dcdd20680419564fe42ba1d9564b9e37',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/sodium_compat', 'install_path' => __DIR__ . '/../paragonie/sodium_compat',
'aliases' => array(), 'aliases' => array(),
@ -155,27 +146,27 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'phpdocumentor/reflection-docblock' => array( 'phpdocumentor/reflection-docblock' => array(
'pretty_version' => '5.3.0', 'pretty_version' => '5.4.1',
'version' => '5.3.0.0', 'version' => '5.4.1.0',
'reference' => '622548b623e81ca6d78b721c5e029f4ce664f170', 'reference' => '9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/reflection-docblock', 'install_path' => __DIR__ . '/../phpdocumentor/reflection-docblock',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'phpdocumentor/type-resolver' => array( 'phpdocumentor/type-resolver' => array(
'pretty_version' => '1.6.2', 'pretty_version' => '1.8.2',
'version' => '1.6.2.0', 'version' => '1.8.2.0',
'reference' => '48f445a408c131e38cab1c235aa6d2bb7a0bb20d', 'reference' => '153ae662783729388a584b4361f2545e4d841e3c',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/type-resolver', 'install_path' => __DIR__ . '/../phpdocumentor/type-resolver',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'phpoffice/phpspreadsheet' => array( 'phpoffice/phpspreadsheet' => array(
'pretty_version' => '1.26.0', 'pretty_version' => '2.2.2',
'version' => '1.26.0.0', 'version' => '2.2.2.0',
'reference' => '5b6ceea9705b068f993e268e4debc566c2637063', 'reference' => 'ffbcee68069b073bff07a71eb321dcd9f2763513',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../phpoffice/phpspreadsheet', 'install_path' => __DIR__ . '/../phpoffice/phpspreadsheet',
'aliases' => array(), 'aliases' => array(),
@ -190,6 +181,15 @@
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'phpstan/phpdoc-parser' => array(
'pretty_version' => '1.31.0',
'version' => '1.31.0.0',
'reference' => '249f15fb843bf240cf058372dad29e100cee6c17',
'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpdoc-parser',
'aliases' => array(),
'dev_requirement' => true,
),
'phpunit/php-code-coverage' => array( 'phpunit/php-code-coverage' => array(
'pretty_version' => '4.0.8', 'pretty_version' => '4.0.8',
'version' => '4.0.8.0', 'version' => '4.0.8.0',
@ -254,9 +254,9 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'psr/http-client' => array( 'psr/http-client' => array(
'pretty_version' => '1.0.1', 'pretty_version' => '1.0.3',
'version' => '1.0.1.0', 'version' => '1.0.3.0',
'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', 'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-client', 'install_path' => __DIR__ . '/../psr/http-client',
'aliases' => array(), 'aliases' => array(),
@ -269,9 +269,9 @@
), ),
), ),
'psr/http-factory' => array( 'psr/http-factory' => array(
'pretty_version' => '1.0.1', 'pretty_version' => '1.1.0',
'version' => '1.0.1.0', 'version' => '1.1.0.0',
'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be', 'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-factory', 'install_path' => __DIR__ . '/../psr/http-factory',
'aliases' => array(), 'aliases' => array(),
@ -284,9 +284,9 @@
), ),
), ),
'psr/http-message' => array( 'psr/http-message' => array(
'pretty_version' => '1.0.1', 'pretty_version' => '2.0',
'version' => '1.0.1.0', 'version' => '2.0.0.0',
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', 'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message', 'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(), 'aliases' => array(),
@ -299,27 +299,27 @@
), ),
), ),
'psr/log' => array( 'psr/log' => array(
'pretty_version' => '1.1.4', 'pretty_version' => '3.0.2',
'version' => '1.1.4.0', 'version' => '3.0.2.0',
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/log', 'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/simple-cache' => array( 'psr/simple-cache' => array(
'pretty_version' => '1.0.1', 'pretty_version' => '3.0.0',
'version' => '1.0.1.0', 'version' => '3.0.0.0',
'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', 'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/simple-cache', 'install_path' => __DIR__ . '/../psr/simple-cache',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'pusher/pusher-php-server' => array( 'pusher/pusher-php-server' => array(
'pretty_version' => '7.2.2', 'pretty_version' => '7.2.4',
'version' => '7.2.2.0', 'version' => '7.2.4.0',
'reference' => '4ace4873873b06c25cecb2dd6d9fdcbf2f20b640', 'reference' => 'de2f72296808f9cafa6a4462b15a768ff130cddb',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../pusher/pusher-php-server', 'install_path' => __DIR__ . '/../pusher/pusher-php-server',
'aliases' => array(), 'aliases' => array(),
@ -335,9 +335,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'sebastian/code-unit-reverse-lookup' => array( 'sebastian/code-unit-reverse-lookup' => array(
'pretty_version' => '1.0.2', 'pretty_version' => '1.0.3',
'version' => '1.0.2.0', 'version' => '1.0.3.0',
'reference' => '1de8cd5c010cb153fcd68b8d0f64606f523f7619', 'reference' => '92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup', 'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup',
'aliases' => array(), 'aliases' => array(),
@ -425,32 +425,23 @@
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'symfony/deprecation-contracts' => array( 'symfony/deprecation-contracts' => array(
'pretty_version' => 'v2.5.2', 'pretty_version' => 'v3.5.0',
'version' => '2.5.2.0', 'version' => '3.5.0.0',
'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66', 'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-ctype' => array( 'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.27.0', 'pretty_version' => 'v1.31.0',
'version' => '1.27.0.0', 'version' => '1.31.0.0',
'reference' => '5bbc823adecdae860bb64756d639ecfec17b050a', 'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => true, 'dev_requirement' => true,
), ),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '8ad114f6b39e2c98a8b0e3bd907732c207c2b534',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/yaml' => array( 'symfony/yaml' => array(
'pretty_version' => 'v4.4.45', 'pretty_version' => 'v4.4.45',
'version' => '4.4.45.0', 'version' => '4.4.45.0',

19
vendor/doctrine/deprecations/LICENSE vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2020-2021 Doctrine Project
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

157
vendor/doctrine/deprecations/README.md vendored Normal file
View File

@ -0,0 +1,157 @@
# Doctrine Deprecations
A small (side-effect free by default) layer on top of
`trigger_error(E_USER_DEPRECATED)` or PSR-3 logging.
- no side-effects by default, making it a perfect fit for libraries that don't know how the error handler works they operate under
- options to avoid having to rely on error handlers global state by using PSR-3 logging
- deduplicate deprecation messages to avoid excessive triggering and reduce overhead
We recommend to collect Deprecations using a PSR logger instead of relying on
the global error handler.
## Usage from consumer perspective:
Enable Doctrine deprecations to be sent to a PSR3 logger:
```php
\Doctrine\Deprecations\Deprecation::enableWithPsrLogger($logger);
```
Enable Doctrine deprecations to be sent as `@trigger_error($message, E_USER_DEPRECATED)`
messages by setting the `DOCTRINE_DEPRECATIONS` environment variable to `trigger`.
Alternatively, call:
```php
\Doctrine\Deprecations\Deprecation::enableWithTriggerError();
```
If you only want to enable deprecation tracking, without logging or calling `trigger_error`
then set the `DOCTRINE_DEPRECATIONS` environment variable to `track`.
Alternatively, call:
```php
\Doctrine\Deprecations\Deprecation::enableTrackingDeprecations();
```
Tracking is enabled with all three modes and provides access to all triggered
deprecations and their individual count:
```php
$deprecations = \Doctrine\Deprecations\Deprecation::getTriggeredDeprecations();
foreach ($deprecations as $identifier => $count) {
echo $identifier . " was triggered " . $count . " times\n";
}
```
### Suppressing Specific Deprecations
Disable triggering about specific deprecations:
```php
\Doctrine\Deprecations\Deprecation::ignoreDeprecations("https://link/to/deprecations-description-identifier");
```
Disable all deprecations from a package
```php
\Doctrine\Deprecations\Deprecation::ignorePackage("doctrine/orm");
```
### Other Operations
When used within PHPUnit or other tools that could collect multiple instances of the same deprecations
the deduplication can be disabled:
```php
\Doctrine\Deprecations\Deprecation::withoutDeduplication();
```
Disable deprecation tracking again:
```php
\Doctrine\Deprecations\Deprecation::disable();
```
## Usage from a library/producer perspective:
When you want to unconditionally trigger a deprecation even when called
from the library itself then the `trigger` method is the way to go:
```php
\Doctrine\Deprecations\Deprecation::trigger(
"doctrine/orm",
"https://link/to/deprecations-description",
"message"
);
```
If variable arguments are provided at the end, they are used with `sprintf` on
the message.
```php
\Doctrine\Deprecations\Deprecation::trigger(
"doctrine/orm",
"https://github.com/doctrine/orm/issue/1234",
"message %s %d",
"foo",
1234
);
```
When you want to trigger a deprecation only when it is called by a function
outside of the current package, but not trigger when the package itself is the cause,
then use:
```php
\Doctrine\Deprecations\Deprecation::triggerIfCalledFromOutside(
"doctrine/orm",
"https://link/to/deprecations-description",
"message"
);
```
Based on the issue link each deprecation message is only triggered once per
request.
A limited stacktrace is included in the deprecation message to find the
offending location.
Note: A producer/library should never call `Deprecation::enableWith` methods
and leave the decision how to handle deprecations to application and
frameworks.
## Usage in PHPUnit tests
There is a `VerifyDeprecations` trait that you can use to make assertions on
the occurrence of deprecations within a test.
```php
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
class MyTest extends TestCase
{
use VerifyDeprecations;
public function testSomethingDeprecation()
{
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234');
triggerTheCodeWithDeprecation();
}
public function testSomethingDeprecationFixed()
{
$this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234');
triggerTheCodeWithoutDeprecation();
}
}
```
## What is a deprecation identifier?
An identifier for deprecations is just a link to any resource, most often a
Github Issue or Pull Request explaining the deprecation and potentially its
alternative.

View File

@ -0,0 +1,38 @@
{
"name": "doctrine/deprecations",
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
"license": "MIT",
"type": "library",
"homepage": "https://www.doctrine-project.org/",
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"phpstan/phpstan": "1.4.10 || 1.10.15",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psalm/plugin-phpunit": "0.18.4",
"psr/log": "^1 || ^2 || ^3",
"vimeo/psalm": "4.30.0 || 5.12.0"
},
"suggest": {
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
},
"autoload": {
"psr-4": {
"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"
}
},
"autoload-dev": {
"psr-4": {
"DeprecationTests\\": "test_fixtures/src",
"Doctrine\\Foo\\": "test_fixtures/vendor/doctrine/foo"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}

Some files were not shown because too many files have changed in this diff Show More