edit css and table

This commit is contained in:
Raju Shrestha 2024-08-09 10:00:40 +05:45
parent 169a49c376
commit e9fc0b8270
4 changed files with 26 additions and 64 deletions

View File

@ -208,7 +208,7 @@ class myaccounts
$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'></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>"; $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'></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'>" . myCurrency($BalanceTotal) . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>";
} }
$html .= "</tfoot></table>\n"; $html .= "</tfoot></table>\n";
@ -543,7 +543,6 @@ class myaccounts
<tr> <tr>
<!-- <th class="col-1.5" rowspan="2"><?php //myLang(" Category"); <!-- <th class="col-1.5" rowspan="2"><?php //myLang(" Category");
?></th> --> ?></th> -->
<th class="col-1.5" rowspan="2"><?php myLang("Ledger"); ?></th> <th class="col-1.5" rowspan="2"><?php myLang("Ledger"); ?></th>
<th class="col-1.5" rowspan="2"><?php myLang(" Group"); ?></th> <th class="col-1.5" rowspan="2"><?php myLang(" Group"); ?></th>
<th colspan="2" class="col-3 text-center">Opening Balance</th> <th colspan="2" class="col-3 text-center">Opening Balance</th>
@ -627,7 +626,6 @@ class myaccounts
window.location = '<?php echo site_url("accounts/accountheads/delete/"); ?>' + id; window.location = '<?php echo site_url("accounts/accountheads/delete/"); ?>' + id;
} }
} }
function showDetails(id) { function showDetails(id) {
$.ajax({ $.ajax({
url: "<?php echo site_url("accounts/accountheads/getdetails/"); ?>" + id, url: "<?php echo site_url("accounts/accountheads/getdetails/"); ?>" + id,
@ -664,13 +662,11 @@ class myaccounts
} }
function showLedger($account_id, $fromDate = "", $toDate = "") function showLedger($account_id, $fromDate = "", $toDate = "")
{ {
$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();
@ -706,12 +702,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 +715,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 +725,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>
@ -967,13 +958,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,31 +974,30 @@ 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> <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>
</td> </td>
@ -1057,7 +1048,6 @@ class myaccounts
} }
}); });
} }
function showDetails(id) { function showDetails(id) {
$.ajax({ $.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id, url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
@ -1068,7 +1058,6 @@ class myaccounts
} }
}); });
} }
function reversalEntry() { function reversalEntry() {
var id = $("#reversalBtn").data("id"); var id = $("#reversalBtn").data("id");
if (confirm("Are you sure you want to post reversal for this voucher?")) { if (confirm("Are you sure you want to post reversal for this voucher?")) {
@ -1094,7 +1083,6 @@ class myaccounts
row.child(Transactions).show(); row.child(Transactions).show();
}); });
}); });
function getVoucherDetails(id) { function getVoucherDetails(id) {
$.data; $.data;
$.ajax({ $.ajax({
@ -1106,7 +1094,6 @@ class myaccounts
}); });
return ($.data); return ($.data);
} }
function deleteVoucher(id) { function deleteVoucher(id) {
// Show confirmation dialog // Show confirmation dialog
if (confirm("Are you sure you want to delete this voucher?")) { if (confirm("Are you sure you want to delete this voucher?")) {
@ -1303,13 +1290,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 +1303,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 +1326,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 = "")
@ -1369,7 +1346,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";
@ -1392,21 +1370,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 = "")
@ -1549,7 +1521,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

@ -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,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>
@ -42,8 +36,6 @@
$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);
?> ?>
</div> </div>
</div> </div>
</div> </div>

View File

@ -132,3 +132,6 @@ margin-bottom: .5rem;
.select2-container .select2-selection--single { .select2-container .select2-selection--single {
height: 30px!important; height: 30px!important;
} }
.mt-26{
margin-top: 26px;
}