changes for bbnepal
This commit is contained in:
parent
e3c8a3b5fe
commit
967642f2be
@ -54,7 +54,7 @@ class Ledger extends CI_Controller
|
||||
$data['to_date'] = null;
|
||||
}
|
||||
if (isset($_GET)) {
|
||||
$data = $_GET;
|
||||
$data = $_GET;
|
||||
}
|
||||
$data['pageTitle'] = "View Party Ledger";
|
||||
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
|
||||
|
@ -38,7 +38,7 @@ class Reports extends CI_Controller
|
||||
$data['AccountGroups'] = $AccountGroups;
|
||||
loadView("accounts/ledgerall", $data);
|
||||
break;
|
||||
case 'getledgersummary':
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(3);
|
||||
$data['pageTitle'] = "Ledger";
|
||||
$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;
|
||||
$this->load->view("accounts/ledgersummary", $data);
|
||||
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':
|
||||
$data['pageTitle'] = "Trial Balance";
|
||||
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
|
||||
@ -268,8 +287,6 @@ class Reports extends CI_Controller
|
||||
case 'getledgersummary':
|
||||
$account_id = $this->uri->segment(5);
|
||||
$this->myaccounts->showLedger($account_id);
|
||||
|
||||
|
||||
break;
|
||||
case 'default':
|
||||
//show_404();
|
||||
|
@ -80,7 +80,7 @@ function linkVoucher($voucher_id)
|
||||
$ci = &get_instance();
|
||||
$Voucher = $ci->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
|
||||
$Name = $ci->db->where("vouchertype_id", $Voucher->voucher_type)->get("tbl_vouchertypes")->row()->voucher_type . " Voucher # " . $Voucher->voucher_no;
|
||||
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 {
|
||||
echo "";
|
||||
}
|
||||
|
@ -129,7 +129,8 @@ class myaccounts
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$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;
|
||||
}
|
||||
function getBalance($account_id)
|
||||
@ -179,7 +180,6 @@ class myaccounts
|
||||
$Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row();
|
||||
}
|
||||
//$q=$CI->db->get_compiled_select();
|
||||
//print($q);
|
||||
?>
|
||||
<div class="row mb-3">
|
||||
<?php if ($accategory_id == "") : ?>
|
||||
@ -684,7 +684,7 @@ class myaccounts
|
||||
<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> -->
|
||||
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
|
||||
<button type="submit" id="downloadCsv1" class="btn btn-warning btn-sm ">
|
||||
Export csv
|
||||
</button>
|
||||
</h5>
|
||||
@ -694,7 +694,7 @@ class myaccounts
|
||||
<h5 class="text-center">Ledger Details for <?php echo $Account->account_name; ?> </h5>
|
||||
<?php $TableData = $Transactions; ?>
|
||||
<?php $TotalCols = 7; ?>
|
||||
<table id='myTable' 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>
|
||||
<tr>
|
||||
<th class="col-1"><?php myLang("Date"); ?></th>
|
||||
@ -769,13 +769,43 @@ class myaccounts
|
||||
</tfoot>
|
||||
</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">×</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.getElementById('downloadCsv').addEventListener('click', function() {
|
||||
const table = document.getElementById('myTable');
|
||||
$(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 = [];
|
||||
|
||||
|
@ -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\">×</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>
|
@ -16,6 +16,7 @@
|
||||
<div class="col"><?php createButton("show_ledger", "Show Ledger", "show_ledger", "Submit", "btn btn-primary"); ?></div>
|
||||
</div>
|
||||
</form>
|
||||
<button id="openModal" class="btn btn-primary">Open Modal</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
|
@ -9,4 +9,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
<!-- 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 -->
|
||||
|
||||
|
@ -137,11 +137,14 @@
|
||||
<td class="text-center"><?php echo $a; ?></td>
|
||||
<td><?php echo $TableRow->title; ?></td>
|
||||
<td><?php echo $TableRow->item_code; ?></td>
|
||||
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id); ?></td>
|
||||
<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 class="text-right"><?php echo $TableRow->Stock->qty; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Stock->rate; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Stock->amount; ?></td>
|
||||
<td class="text-right"><?php echo number_format((int)$TableRow->Stock->qty,2); ?></td>
|
||||
|
||||
<td class="text-right"><?php echo number_format((int)$TableRow->Stock->rate,2); ?></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 showDeleteButton($id); ?>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div class="col">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?></h5>
|
||||
<!-- <h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?></h5> -->
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php $TableData = $this->db->query("select * from tbl_purchases where status=1")->result(); ?>
|
||||
@ -21,13 +21,13 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $a = 0;
|
||||
<?php $a = 0; $n=0;
|
||||
foreach ($PurchaseRecords as $TableRow) : $a++;
|
||||
$id = $TableRow->purchase_id; ?>
|
||||
<tr>
|
||||
<td><?php echo $TableRow->purchase_ref; ?></td>
|
||||
<td><?php echo ++$n; ?></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 class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
|
||||
<?php showDeleteButton($id); ?>
|
||||
|
@ -24,7 +24,7 @@
|
||||
<tr>
|
||||
<td class="text-center"><?php echo $TableRow->sales_id; ?></td>
|
||||
<td><?php echo $TableRow->sales_date; ?></td>
|
||||
<td><b><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></b>
|
||||
<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;">
|
||||
<span class="col item_name"><?php echo myLang("Particulars") ?></span>
|
||||
<span class="col item_qty"><?php echo myLang("Qty") ?></span>
|
||||
|
@ -12,17 +12,22 @@
|
||||
<table class="table table-bordered table-striped dataTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class=" col-1 text-center"><?php myLang('ID'); ?></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 class="table-col col-1 text-center"><?php myLang('Amount'); ?></th>
|
||||
<th class="text-center" width="5%"> <?php myLang('Action'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($SalesRecords as $TableRow) : ?>
|
||||
<tbody>
|
||||
<?php $n=0 ; ?>
|
||||
<?php foreach ($SalesRecords as $key=>$TableRow) : ?>
|
||||
<tr>
|
||||
<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 $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?>
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user