changes for filter and print
This commit is contained in:
@ -10,8 +10,8 @@ class Ledger extends CI_Controller
|
||||
}
|
||||
public function _remap($alias = "", $params = array())
|
||||
{
|
||||
|
||||
$data['dataValue'] = $this->session;
|
||||
// echo "<pre>"; print_r($_GET['accategory_id']);die();
|
||||
|
||||
$data['pageTitle'] = "Account Head";
|
||||
switch ($alias) {
|
||||
@ -19,9 +19,13 @@ class Ledger extends CI_Controller
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
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;
|
||||
// echo "<pre>"; print_r($data['AccountGroups']);die();
|
||||
|
||||
loadView("accounts/ledger/navigate", $data);
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
@ -39,13 +43,27 @@ class Ledger extends CI_Controller
|
||||
$this->load->view("accounts/ledgersummary", $data);
|
||||
break;
|
||||
case 'partyledger':
|
||||
$data['pageTitle'] = "View Party Ledger";
|
||||
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
|
||||
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
|
||||
// $_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'])) {
|
||||
$fromDate_Nepali = $_GET['from_date'];
|
||||
$toDate_Nepali = $_GET['to_date'];
|
||||
$fromDate_Nepali=$data['from_date'];
|
||||
$toDate_Nepali =$data['to_date'];
|
||||
$data['fromDate'] = NepaliToEnglishDate($fromDate_Nepali);
|
||||
$data['toDate'] = NepaliToEnglishDate($toDate_Nepali);
|
||||
$data['fromDate_Nepali'] = $fromDate_Nepali;
|
||||
@ -54,7 +72,7 @@ class Ledger extends CI_Controller
|
||||
}
|
||||
loadView("accounts/ledger/partywise", $data);
|
||||
break;
|
||||
case 'print':
|
||||
case 'print':
|
||||
$account_id = $this->uri->segment(4);
|
||||
$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));
|
||||
@ -77,14 +95,39 @@ class Ledger extends CI_Controller
|
||||
loadView("accounts/daybook", $data);
|
||||
break;
|
||||
case 'bank_book':
|
||||
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
|
||||
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";
|
||||
loadView("accounts/ledger_bankbook", $data);
|
||||
break;
|
||||
case 'cash_book':
|
||||
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
|
||||
|
||||
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";
|
||||
loadView("accounts/ledger_cashbook", $data);
|
||||
break;
|
||||
|
@ -65,8 +65,20 @@ class Reports extends CI_Controller
|
||||
loadView("accounts/trialbalance", $data);
|
||||
break;
|
||||
case 'trialbalance':
|
||||
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
$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);
|
||||
// echo "<pre>"; print_r($data); die();
|
||||
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
loadView("accounts/trialbalance_new", $data);
|
||||
break;
|
||||
@ -132,8 +144,17 @@ class Reports extends CI_Controller
|
||||
loadView("accounts/pl", $data);
|
||||
break;
|
||||
case 'pl':
|
||||
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
$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'] = "Profit & Loss Statement";
|
||||
loadView("accounts/pl_new", $data);
|
||||
break;
|
||||
@ -147,8 +168,20 @@ class Reports extends CI_Controller
|
||||
loadView("accounts/balancesheet", $data);
|
||||
break;
|
||||
case 'balance_sheet':
|
||||
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
|
||||
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
// $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";
|
||||
loadView("accounts/balancesheet_new", $data);
|
||||
break;
|
||||
@ -157,8 +190,20 @@ class Reports extends CI_Controller
|
||||
loadView("accounts/balance_sheet_vertical", $data);
|
||||
break;
|
||||
case 'cash_flow':
|
||||
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
|
||||
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
// $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";
|
||||
loadView("accounts/cash_flow", $data);
|
||||
break;
|
||||
@ -171,8 +216,22 @@ class Reports extends CI_Controller
|
||||
loadView("accounts/incomes_expenses", $data);
|
||||
break;
|
||||
case 'receipt_and_payment':
|
||||
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
$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['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
|
||||
$data['pageTitle'] = "Cash Flow";
|
||||
loadView("accounts/receipt_and_payment", $data);
|
||||
break;
|
||||
|
@ -6,10 +6,18 @@ class Stocks extends CI_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('MStocks');
|
||||
checkLogin();
|
||||
$this->load->helper('form');
|
||||
// checkLogin();
|
||||
}
|
||||
|
||||
|
||||
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['pageTitle'] = "Inventory Stock";
|
||||
switch ($alias) {
|
||||
@ -57,10 +65,28 @@ class Stocks extends CI_Controller
|
||||
loadView("inventory/stocks/add", $data);
|
||||
break;
|
||||
case 'summary':
|
||||
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
|
||||
$data['StockRecords'] = $this->MStocks->getStockSummary();
|
||||
// pre($data['StockRecords']);
|
||||
|
||||
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);
|
||||
break;
|
||||
case 'delete':
|
||||
@ -70,8 +96,24 @@ class Stocks extends CI_Controller
|
||||
redirect("inventory/stocks/list");
|
||||
break;
|
||||
default:
|
||||
// var_dump("hello");
|
||||
// die();
|
||||
// echo '<pre>';
|
||||
// var_dump($_POST['fromDate'], $_POST['toDate']);
|
||||
// die();
|
||||
$data['StockRecords'] = $this->MStocks->getStockRecords();
|
||||
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);
|
||||
// }
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class bibaccounts
|
||||
$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;
|
||||
$account->balances = $accountBalances;
|
||||
}
|
||||
if (
|
||||
$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->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;
|
||||
$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;
|
||||
$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();
|
||||
$result = [];
|
||||
@ -138,7 +200,7 @@ class bibaccounts
|
||||
$category->cr_total += $accountBalances['cr_total'];
|
||||
$category->regular_balance_dr += $accountBalances['regular_balance_dr'];
|
||||
$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;
|
||||
|
||||
@ -149,8 +211,8 @@ class bibaccounts
|
||||
$category->accounts = $accounts;
|
||||
$result[] = $category;
|
||||
}
|
||||
// pre($category);
|
||||
if($accategory_id!=null)return isset($category)?$category:'';
|
||||
// pre($category);
|
||||
if ($accategory_id != null) return isset($category) ? $category : '';
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -538,7 +600,7 @@ class bibaccounts
|
||||
$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'");
|
||||
$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();
|
||||
|
||||
$drTotal = $result->dr_total;
|
||||
@ -578,7 +640,51 @@ class bibaccounts
|
||||
'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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//////
|
||||
@ -608,12 +714,13 @@ class bibaccounts
|
||||
<?php } ?>
|
||||
<tbody>
|
||||
<?php foreach ($accountCategories as $accountCategory) : ?>
|
||||
<?php //print_r($accountCategory);die; ?>
|
||||
<?php //print_r($accountCategory);die;
|
||||
?>
|
||||
<?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; ?>">
|
||||
<td class="group-name">
|
||||
<?php if($accountCategory->parent_category_id): ?>
|
||||
<?php echo " ". $accountCategory->accategory_name; ?>
|
||||
<?php if ($accountCategory->parent_category_id): ?>
|
||||
<?php echo " " . $accountCategory->accategory_name; ?>
|
||||
<?php else: ?>
|
||||
<b><?php echo $accountCategory->accategory_name; ?></b>
|
||||
<?php endif; ?>
|
||||
@ -817,14 +924,14 @@ class bibaccounts
|
||||
/*
|
||||
* Retrieves the account groups and accounts with balances that has cash/bank in debit side
|
||||
*/
|
||||
function getIncomeAndExpenditure()
|
||||
function getIncomeAndExpenditure($fiscalStart,$fiscalEnd)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
#2 >> Bank Accounts
|
||||
#3 >> Cash Accounts
|
||||
$Incomes = 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();
|
||||
foreach ($accounts as $account) {
|
||||
$account->details = $CI->db->query("select * from tbl_accounts where account_id=" . $account->account_id)->row();
|
||||
@ -954,14 +1061,14 @@ class bibaccounts
|
||||
$sides["Incomes"] = $newArray;
|
||||
else
|
||||
$sides["Expenses"] = $newArray;
|
||||
|
||||
|
||||
endforeach;
|
||||
|
||||
return $sides;
|
||||
}
|
||||
function prepareIncomeExpenses()
|
||||
function prepareIncomeExpenses($fiscalStart,$fiscalEnd)
|
||||
{
|
||||
$cashFlow = $this->getIncomeAndExpenditure();
|
||||
$cashFlow = $this->getIncomeAndExpenditure($fiscalStart,$fiscalEnd);
|
||||
$a = 0;
|
||||
foreach ($cashFlow as $side) :
|
||||
$Groups = array();
|
||||
@ -1003,7 +1110,7 @@ class bibaccounts
|
||||
$sides["Incomes"] = $newArray;
|
||||
else
|
||||
$sides["Expenses"] = $newArray;
|
||||
|
||||
|
||||
endforeach;
|
||||
|
||||
return $sides;
|
||||
|
@ -800,7 +800,8 @@ class myaccounts
|
||||
$CI = &get_instance();
|
||||
$CI->load->library("numbertoword");
|
||||
$ledgerData = $this->getLedgerData($account_id, $fromDate, $toDate);
|
||||
$file = APPPATH . "/../pdf/e_ledger1.pdf";
|
||||
$file = APPPATH . "/../pdf/
|
||||
.pdf";
|
||||
$pdf = new FPDM($file);
|
||||
$i = 0;
|
||||
$crTotal = 0;
|
||||
@ -844,7 +845,7 @@ class myaccounts
|
||||
$OutputFile = "Ledger_" . $ledgerData['Account']->account_id . ".pdf";
|
||||
$pdf->Output("F", $OutputFileLocation . $OutputFile);
|
||||
return $OutputFile;
|
||||
}
|
||||
}
|
||||
function ledgerPDF($account_id, $fromDate, $toDate)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
|
@ -71,8 +71,8 @@ class MStocks extends CI_Model
|
||||
$nos++;
|
||||
$rate += $Item->rate;
|
||||
}
|
||||
if($nos!=0) $rate = $rate / $nos;
|
||||
|
||||
if ($nos != 0) $rate = $rate / $nos;
|
||||
|
||||
$SalesStock = new stdClass;
|
||||
$SalesStock->qty = $qty;
|
||||
$SalesStock->rate = $rate;
|
||||
@ -94,14 +94,14 @@ class MStocks extends CI_Model
|
||||
$nos++;
|
||||
$rate += $Item->rate;
|
||||
}
|
||||
if($nos!=0) $rate = $rate / $nos;
|
||||
if ($nos != 0) $rate = $rate / $nos;
|
||||
$PurchaseStock = new stdClass;
|
||||
$PurchaseStock->qty = $qty;
|
||||
$PurchaseStock->rate = $rate;
|
||||
$PurchaseStock->amount = $qty * $rate;
|
||||
return $PurchaseStock;
|
||||
}
|
||||
|
||||
|
||||
public function getOpeningStock($item_id)
|
||||
{
|
||||
$this->db->where("status", 1);
|
||||
@ -116,7 +116,7 @@ class MStocks extends CI_Model
|
||||
$nos++;
|
||||
$rate += $Item->price;
|
||||
}
|
||||
if($nos!=0) $rate = $rate / $nos;
|
||||
if ($nos != 0) $rate = $rate / $nos;
|
||||
$OpeningStock = new stdClass;
|
||||
$OpeningStock->qty = $qty;
|
||||
$OpeningStock->rate = $rate;
|
||||
@ -125,12 +125,12 @@ class MStocks extends CI_Model
|
||||
}
|
||||
public function getClosingStock($item_id)
|
||||
{
|
||||
$OpeningStock=$this->getOpeningStock($item_id);
|
||||
$PurchaseStock=$this->getItemPurchaseStock($item_id);
|
||||
$SalesStock=$this->getItemSalesStock($item_id);
|
||||
$OpeningStock = $this->getOpeningStock($item_id);
|
||||
$PurchaseStock = $this->getItemPurchaseStock($item_id);
|
||||
$SalesStock = $this->getItemSalesStock($item_id);
|
||||
$ClosingStock = new stdClass;
|
||||
$ClosingStock->qty =$PurchaseStock->qty+$OpeningStock->qty-$SalesStock->qty;
|
||||
$ClosingStock->rate = $PurchaseStock->rate+$OpeningStock->rate-$SalesStock->rate;
|
||||
$ClosingStock->qty = $PurchaseStock->qty + $OpeningStock->qty - $SalesStock->qty;
|
||||
$ClosingStock->rate = $PurchaseStock->rate + $OpeningStock->rate - $SalesStock->rate;
|
||||
$ClosingStock->amount = $ClosingStock->qty * $ClosingStock->rate;
|
||||
return $ClosingStock;
|
||||
}
|
||||
@ -151,8 +151,10 @@ class MStocks extends CI_Model
|
||||
$Item->Closing = $this->getClosingStock($item_id);
|
||||
return $Item;
|
||||
}
|
||||
public function getStockSummary($stocklocation_id = 0)
|
||||
public function getStockSummary($data)
|
||||
{
|
||||
|
||||
$stocklocation_id = $data['stocklocation_id'] ?? null;
|
||||
$this->db->where("status", 1);
|
||||
if ($stocklocation_id != 0) {
|
||||
$this->db->where("stocklocations_id", $stocklocation_id);
|
||||
@ -160,9 +162,19 @@ class MStocks extends CI_Model
|
||||
$StockRecords = $this->db->select("distinct(items_id) as items_id")->get("tbl_stocks")->result();
|
||||
foreach ($StockRecords as $StockRecord) {
|
||||
$StockRecord->Summary = $this->getStockItemSummary($StockRecord->items_id);
|
||||
// $StockRecord->StockLocation = $this->db->where("stocklocation_id", $StockRecord->stocklocations_id)->get("tbl_stocklocations")->row();
|
||||
$StockRecord->Item = $this->db->where("item_id", $StockRecord->items_id)->get("tbl_items")->row();
|
||||
}
|
||||
$this->db->where("stocklocation_id ", $StockRecord->Summary->stocklocations_id);
|
||||
$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;
|
||||
}
|
||||
public function getStockRecords($stocklocation_id = 0)
|
||||
@ -215,6 +227,5 @@ class MStocks extends CI_Model
|
||||
$Item = $this->db->where("item_id", $id)->get("tbl_items")->row();
|
||||
$Unit = $this->db->where("unit_id", $Item->units_id)->get("tbl_units")->row();
|
||||
return $Unit;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<form method="post" action=<?php echo base_url('accounts/reports/balance_sheet') ;?> id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
|
||||
@ -203,7 +203,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
'showPeriod' => false,
|
||||
);
|
||||
?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php $Side1Total = 0; ?>
|
||||
<div class="col-6 p-0 m-0 gy-0">
|
||||
<div class="table-responsive">
|
||||
@ -216,7 +216,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php $Side1Total = 0; ?>
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
@ -245,7 +245,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
$Side1Total += $group->closing_balance;
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(5); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(5,$fiscalStart,$fiscalEnd); ?>
|
||||
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
@ -291,7 +291,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(1); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(1,$fiscalStart,$fiscalEnd); ?>
|
||||
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
@ -328,14 +328,14 @@ $BIBAccounts = new BIBAccounts();
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
|
||||
$TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance;
|
||||
$TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance;
|
||||
$TotalIncomes = ($BIBAccounts->getAccountGroupsWithBalancesNew(3,$fiscalStart,$fiscalEnd)[0]->closing_balance) ?? 0;
|
||||
$TotalExpenses = ($BIBAccounts->getAccountGroupsWithBalancesNew(4,$fiscalStart,$fiscalEnd)[0]->closing_balance) ?? 0;
|
||||
$PL = $TotalIncomes - $TotalExpenses;
|
||||
$Side1Total += $PL;
|
||||
?>
|
||||
|
@ -129,7 +129,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<h3 class="card-title mt-1">Cash Flow<?php //echo $pageTitle;
|
||||
?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<form method="post" action=<?php echo base_url('accounts/reports/cash_flow') ;?> id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
|
||||
@ -264,7 +264,9 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<h4 class="card-title">Cash Flow</h4>
|
||||
</div> -->
|
||||
<div class="card-body table-responsive p-0">
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart,$fiscalEnd);
|
||||
// echo "<pre>";print_r($IncomesExpenses); die();
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
<div class="card-header disabled color-palette">
|
||||
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<form method="post" action="<?php echo base_url('accounts/ledger/bank_book'); ?>" id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
|
||||
Filters
|
||||
@ -56,7 +56,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
<button type="submit" onclick="exportTableToCSV('table_data.csv')" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button>
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
@ -90,7 +90,7 @@
|
||||
$accategory_id = 3;
|
||||
$CI = &get_instance();
|
||||
|
||||
$CI->db->where("status", 1)->where("accategory_id = 2");
|
||||
$CI->db->where("status", 1)->where("accategory_id = 2")->where('created_on >=', date('Y-m-d', (strtotime($fiscalStart))))->where('created_on <=', date('Y-m-d', (strtotime($fiscalEnd))));
|
||||
$CI->db->order_by("account_name ASC");
|
||||
$Accounts = $CI->db->get("tbl_accounts")->result();
|
||||
|
||||
@ -231,6 +231,101 @@
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- csv printing -->
|
||||
<!-- <script type="text/javascript">
|
||||
function tableToCSV() {
|
||||
|
||||
// Variable to store the final csv data
|
||||
let csv_data = [];
|
||||
|
||||
// Get each row data
|
||||
let rows = document.getElementsByTagName('tr');
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
|
||||
// Get each column data
|
||||
let cols = rows[i].querySelectorAll('td,th,span,a');
|
||||
|
||||
// Stores each csv row data
|
||||
let csvrow = [];
|
||||
for (let j = 0; j < cols.length; j++) {
|
||||
|
||||
// Get the text data of each cell
|
||||
// of a row and push it to csvrow
|
||||
csvrow.push(cols[j].innerText);
|
||||
}
|
||||
|
||||
// Combine each column value with comma
|
||||
csv_data.push(csvrow.join(","));
|
||||
}
|
||||
|
||||
// Combine each row data with new line character
|
||||
csv_data = csv_data.join('\n');
|
||||
|
||||
// Call this function to download csv file
|
||||
downloadCSVFile(csv_data);
|
||||
|
||||
}
|
||||
|
||||
function downloadCSVFile(csv_data) {
|
||||
|
||||
// Create CSV file object and feed
|
||||
// our csv_data into it
|
||||
CSVFile = new Blob([csv_data], {
|
||||
type: "text/csv"
|
||||
});
|
||||
|
||||
// Create to temporary link to initiate
|
||||
// download process
|
||||
let temp_link = document.createElement('a');
|
||||
|
||||
// Download csv file
|
||||
temp_link.download = "GfG.csv";
|
||||
let url = window.URL.createObjectURL(CSVFile);
|
||||
temp_link.href = url;
|
||||
|
||||
// This link should not be displayed
|
||||
temp_link.style.display = "none";
|
||||
document.body.appendChild(temp_link);
|
||||
|
||||
// Automatically click the link to
|
||||
// trigger download
|
||||
temp_link.click();
|
||||
document.body.removeChild(temp_link);
|
||||
} -->
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function exportTableToCSV(filename) {
|
||||
const csvRows = [];
|
||||
const rows = document.querySelectorAll(".longdataTable tr"); // Use the specific class
|
||||
|
||||
for (const row of rows) {
|
||||
const cols = row.querySelectorAll("td, th");
|
||||
const csvRow = [];
|
||||
|
||||
for (const col of cols) {
|
||||
csvRow.push(col.innerText); // Get text content of each cell
|
||||
}
|
||||
|
||||
csvRows.push(csvRow.join(",")); // Join cells with commas
|
||||
}
|
||||
|
||||
// Create a CSV string
|
||||
const csvString = csvRows.join("\n");
|
||||
|
||||
// Create a Blob for the CSV string
|
||||
const blob = new Blob([csvString], { type: "text/csv" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
</script>
|
||||
<!-- csv printing ends -->
|
||||
<?php
|
||||
}
|
||||
?>
|
@ -91,7 +91,7 @@
|
||||
$CI = &get_instance();
|
||||
|
||||
// $CI->db->where("status", 1)->where("(accategory_id = 2 OR accategory_id = 3)");
|
||||
$CI->db->where("status", 1)->where("accategory_id = 3");
|
||||
$CI->db->where("status", 1)->where("accategory_id = 3")->where("created_on >= '$fiscalStart'")->where("created_on >= '$fiscalEnd'");
|
||||
$CI->db->order_by("account_name ASC");
|
||||
$Accounts = $CI->db->get("tbl_accounts")->result();
|
||||
|
||||
|
@ -124,7 +124,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
<h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report");
|
||||
?></h2>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<form method="post" action="<?php echo base_url('accounts/reports/pl'); ?>" id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
|
||||
@ -194,7 +194,9 @@ $BIBAccounts = new BIBAccounts();
|
||||
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
|
||||
document.getElementById("FilterForm").submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -228,7 +230,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(3); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(3,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
$incomes_totalOpeningDr = 0;
|
||||
@ -290,7 +292,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(4); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(4,$fiscalStart,$fiscalEnd); ?>
|
||||
<?php
|
||||
// Initialize variables for column totals
|
||||
$totalOpeningDr = 0;
|
||||
|
@ -104,7 +104,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<h3 class="card-title mt-1">Receipts And Payments <?php //echo $pageTitle;
|
||||
?> </h3>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<form method="post" action=<?php echo base_url('accounts/reports/receipt_and_payment'); ?> id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
|
||||
@ -113,7 +113,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
<div class="dropdown-menu" role="menu">
|
||||
<div class="form-group p-2 pb-0">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
|
||||
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
|
||||
</div>
|
||||
@ -234,7 +234,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card card-primary card-outline">
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
|
||||
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart,$fiscalEnd) ?>
|
||||
<table class="table table-head-fixed table-bordered g-0" id="TrialBalanceTable">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$this->load->library("BIBAccounts");
|
||||
$BIBAccounts = new BIBAccounts();
|
||||
|
||||
?>
|
||||
<!-- Include jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
||||
@ -26,7 +27,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
|
||||
.table-gray {
|
||||
background-color: #eee;
|
||||
}
|
||||
}
|
||||
|
||||
.table td,
|
||||
.table th {
|
||||
@ -107,7 +108,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
?></h2>
|
||||
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<form method="post" action=<?php echo site_url('/Accounts/Reports/trialbalance'); ?> id="FilterForm">
|
||||
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
@ -207,7 +208,7 @@ $BIBAccounts = new BIBAccounts();
|
||||
);
|
||||
$showZeroBalances = false;
|
||||
?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(); ?>
|
||||
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances();?>
|
||||
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
|
||||
<thead class="bg-gray">
|
||||
<tr>
|
||||
|
@ -14,7 +14,7 @@ $subparam2 = $this->uri->segment(4);
|
||||
<!-- Sidebar user panel (optional) -->
|
||||
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
|
||||
<div class="image"> <img src="<?php echo base_url(); ?>dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image"> </div>
|
||||
<div class="info"> <a href="#" class="d-block"><?php echo $this->session->userdata("CompanyName"); ?> (<?php echo ($this->session->userdata("FiscalYear")->fiscalyear_year); ?>)</a></div>
|
||||
<div class="info"> <a href="#" class="d-block"><?php echo $this->session->userdata("CompanyName"); ?> (<?php echo ($this->session->userdata("FiscalYear")?->fiscalyear_year); ?>)</a></div>
|
||||
</div> <!-- SidebarSearch Form -->
|
||||
<div class="form-inline pb-2">
|
||||
<div class="input-group" data-widget="sidebar-search">
|
||||
|
@ -94,8 +94,13 @@
|
||||
?></a> -->
|
||||
</h5>
|
||||
<div class="card-tools">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<!-- test -->
|
||||
|
||||
<!-- test ends -->
|
||||
|
||||
<form method="post" action=<?php echo site_url('/Inventory/Stocks/summary'); ?> id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<input type="hidden" name="stocklocations_id" value="1" />
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
|
||||
Filters
|
||||
@ -106,6 +111,8 @@
|
||||
<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>
|
||||
@ -123,6 +130,7 @@
|
||||
<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"> -->
|
||||
@ -201,27 +209,30 @@
|
||||
$STotal = 0;
|
||||
$CTotal = 0;
|
||||
foreach ($StockRecords as $index => $TableRow) : ?>
|
||||
<tr>
|
||||
<td class="text-center"><?php echo $index + 1; ?></td>
|
||||
<td><?php echo ($TableRow->Item) ? $TableRow->Item->title : "N/A"; ?></td>
|
||||
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->Item->units_id); ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Opening->qty; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Opening->rate; ?></td>
|
||||
<td><?php echo myCurrency($lTotal = $TableRow->Summary->Opening->amount);
|
||||
$Total += $lTotal; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Purchase->qty; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Purchase->rate; ?></td>
|
||||
<td><?php echo myCurrency($pTotal = $TableRow->Summary->Purchase->amount);
|
||||
$PTotal += $pTotal; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Sales->qty; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Sales->rate; ?></td>
|
||||
<td><?php echo myCurrency($sTotal = $TableRow->Summary->Sales->amount);
|
||||
$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>
|
||||
<td><?php echo myCurrency($cTotal = $TableRow->Summary->Closing->amount);
|
||||
$CTotal += $cTotal; ?></td>
|
||||
</tr>
|
||||
<?php if ((count($TableRow->Item)) > 0):; ?>
|
||||
<tr>
|
||||
<td class="text-center"><?php echo $index + 1; ?></td>
|
||||
<td><?php echo ($TableRow->Summary->Item->title) ? $TableRow->Summary->Item->title : "N/A"; ?></td>
|
||||
<!-- $StockRecord->Summary->Unit->unit_id -->
|
||||
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->Summary->Unit->unit_id); ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Opening->qty; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Opening->rate; ?></td>
|
||||
<td><?php echo myCurrency($lTotal = $TableRow->Summary->Opening->amount);
|
||||
$Total += $lTotal; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Purchase->qty; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Purchase->rate; ?></td>
|
||||
<td><?php echo myCurrency($pTotal = $TableRow->Summary->Purchase->amount);
|
||||
$PTotal += $pTotal; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Sales->qty; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Sales->rate; ?></td>
|
||||
<td><?php echo myCurrency($sTotal = $TableRow->Summary->Sales->amount);
|
||||
$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>
|
||||
<td><?php echo myCurrency($cTotal = $TableRow->Summary->Closing->amount);
|
||||
$CTotal += $cTotal; ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<tbody>
|
||||
<tfoot>
|
||||
@ -234,7 +245,7 @@
|
||||
<td><?php echo myCurrency($STotal); ?></td>
|
||||
<td colspan="2"></td>
|
||||
<td><?php echo myCurrency($CTotal); ?></td>
|
||||
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@ -316,12 +327,11 @@
|
||||
</script>
|
||||
<script>
|
||||
$("#toDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#toDate').data('start'),
|
||||
maxDate: $('#toDate').data('end'),
|
||||
}
|
||||
);
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#toDate').data('start'),
|
||||
maxDate: $('#toDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
Reference in New Issue
Block a user