This commit is contained in:
Sampanna Rimal 2024-08-12 16:21:46 +05:45
parent 16246fbdeb
commit fe8786f03f
11 changed files with 195 additions and 112 deletions

View File

@ -83,7 +83,7 @@ class Ledger extends CI_Controller
loadView("accounts/ledger_cashbook", $data);
break;
case 'receiveables':
$data['pageTitle'] = "Accounts Receiveables";
$data['pageTitle'] = "Accounts Receivables";
loadView("accounts/ledger_receiveables", $data);
break;
case 'payables':

View File

@ -95,14 +95,14 @@ function getFieldfromValue($tableName, $fieldName, $lookupField, $referenceValue
return "N/A";
}
}
function fillComboWithValue($fieldName, $displayName, $fieldID, $tableName, $displayField, $valueField, $default = "", $CSSclass = "", $multiple = false, $condition = "")
function fillComboWithValue($fieldName, $displayName, $fieldID, $tableName, $displayField, $valueField, $default = "", $CSSclass = "", $multiple = false, $condition = "", $required=false)
{
$ci = &get_instance();
?>
<?php if ($displayName != "") : ?>
<label for="<?php echo $fieldID; ?>"><?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></label>
<?php endif; ?>
<select name="<?php echo $fieldName; ?><?php echo ($multiple) ? "[]" : ""; ?>" <?php if ($CSSclass != "none") : ?>class="form-control select2 <?php echo $CSSclass; ?>" <?php else : ?> class="form-control" <?php endif; ?> id="<?php echo $fieldID; ?>" <?php echo ($multiple) ? "multiple" : ""; ?>>
<select name="<?php echo $fieldName; ?><?php echo ($multiple) ? "[]" : ""; ?>" <?php if ($CSSclass != "none") : ?>class="form-control select2 <?php echo $CSSclass; ?>" <?php else : ?> class="form-control" <?php endif; ?> id="<?php echo $fieldID; ?>" <?php echo ($multiple) ? "multiple" : ""; ?><?php echo ($required) ? "required" : ""; ?>>
<option value="">Select <?php echo function_exists("myLang") ? myLang($displayName) : $displayName; ?></option>
<?php
$q = "select * from $tableName";

View File

@ -209,12 +209,12 @@ class myaccounts
$balance = getBalance($Account->account_id);
$BalanceTotal += $balance;
// pre($Account);
$html .= "<tr><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='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'>". myCurrency($balance) ."</td><td class='text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach;
$html .= "</tbody><tfoot>";
if ($full == "") {
$html .= "<tr><th colspan=2 class='text-right '>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>";
}
// if ($full == "") {
$html .= "<tr><th colspan=2 class='text-right '>Total</th><th class='text-right'>" . (($BalanceTotal > 0) ? myCurrency(abs($BalanceTotal )) : "") . "</th><th class='text-right'>" . (($BalanceTotal < 0) ? myCurrency(abs($BalanceTotal )) : "") . "</th><th>" . myCurrency($BalanceTotal) . "</th><th></th></tr>";
// }
$html .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\">

View File

@ -80,7 +80,10 @@
$category_name = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $TableData->accategory_id);
?>
<div id="creditorFields" style="display: none;">
<!-- <?php //if ($category_name == "Sundry Creditors" || $category_name == "Sundry Debtors") : ?> -->
<!-- <?php //if ($category_name == "Sundry Creditors" || $category_name == "Sundry Debtors") :
?> -->
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Mailing Details:</b></div>
<div class="row">
<!--COL START-->
<div class="col">
@ -96,11 +99,11 @@
<label for="account_partyaddress">Party Address</label><input type="text" class="form-control" id="account_partyaddress" value="<?php echo $TableData->account_partyaddress; ?>" name="account_partyaddress">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_partypan">PAN</label><input type="text" class="form-control" id="account_partypan" value="<?php echo $TableData->account_partypan; ?>" name="account_partypan">
</div>
</div>
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Contact Details:</b></div>
<div class="row">
<!--COL END-->
<!--COL START-->
<div class="col">
@ -110,8 +113,6 @@
</div>
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
@ -142,14 +143,89 @@
</div>
<!--COL END-->
</div>
<!-- <?php //endif; ?> -->
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Tax Information:</b></div>
<div class="row">
<div class="col-md-6 col-lg-2">
<div class="form-group">
<label for="account_partypan">PAN</label><input type="text" class="form-control" id="account_partypan" value="<?php echo $TableData->account_partypan; ?>" name="account_partypan">
</div>
<div class="row" id="bankFields" >
<!-- <?php //if ($category_name == "Bank Account") : ?> -->
</div>
<!-- <?php //endif;
?> -->
</div>
</div>
<div id="bankFields">
<!-- <?php //if ($category_name == "Bank Account") :
?> -->
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Mailing Details:</b></div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyname">Party Name</label><input type="text" class="form-control" id="account_partyname" value="<?php echo $TableData->account_partyname; ?>" name="account_partyname">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyaddress">Party Address</label><input type="text" class="form-control" id="account_partyaddress" value="<?php echo $TableData->account_partyaddress; ?>" name="account_partyaddress">
</div>
</div>
</div>
<!--COL START-->
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Contact Details:</b></div>
<div class="row">
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyemail">Party Email</label><input type="email" class="form-control" id="account_partyemail" value="<?php echo $TableData->account_partyemail; ?>" name="account_partyemail">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontact">Party Contact</label><input type="text" class="form-control" id="account_partycontact" value="<?php echo $TableData->account_partycontact; ?>" name="account_partycontact">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactperson">Contact Person</label><input type="text" class="form-control" id="account_partycontactperson" value="<?php echo $TableData->account_partycontactperson; ?>" name="account_partycontactperson">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactpersoncontact">Contact Person Phone</label><input type="text" class="form-control" id="account_partycontactpersoncontact" value="<?php echo $TableData->account_partycontactpersoncontact; ?>" name="account_partycontactpersoncontact">
</div>
</div>
<!--COL END-->
</div>
<hr>
<div class="row" style="padding-bottom: 4px;"><b>Account Details:</b></div>
<div class="row">
<div class="col">
@ -179,12 +255,14 @@
</div>
</div>
</div>
<!--COL END-->
<!-- <?php //endif; ?> -->
<!-- <?php //endif;
?> -->
</div>
<hr>
<div class="row">
<!--COL START-->
<div class="col">

View File

@ -26,9 +26,10 @@ function displayCategoryTree($tree)
{
echo '<table class="table table-bordered">';
foreach ($tree as $category) {
// print_r($category);die;
echo '<tr>';
echo '<td class="col-1">' . $category['accategory_id'] . '</td>';
echo '<td class="col-6"><a href="' . site_url("accounts/reports/balance_by_group") . "?category=" . $category['accategory_id'] . '">' . $category['accategory_name'] . '</a></td>';
echo '<td class="col-6">'. ($category['parent_category_id'] == 0 ? "<b>" : "") .'<a href="' . site_url("accounts/reports/balance_by_group") . "?category=" . $category['accategory_id'] . '">' . $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>';

View File

@ -1,6 +1,8 @@
<?php
$drWidth = 250;
$crWidth = 250;
$balanceWidth = 250;
$AccountCategories = $this->myaccounts->getChildAccountCategories();
?>
<style>
@ -34,9 +36,11 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
<?php
$drTotal = 0;
$crTotal = 0;
$balanceTotal = 0;
foreach ($AccountCategories as $AccountCategory) :
$drTotal += $AccountCategory->dr;
$crTotal += $AccountCategory->cr;
$balanceTotal += $AccountCategory->Balance
?>
<!-- <?php //print_r($AccountCategory);die; ?> -->
<tr>
@ -46,7 +50,7 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
</a>
</td>
<td width="<?php echo $drWidth; ?>"><?php echo myCurrency($AccountCategory->dr); ?></td>
<td width="<?php echo $crWidth; ?>"><?php echo myCurrency($AccountCategory->cr); ?></td>
<td width="<?php echo $crWidth; ?>"><?php echo myCurrency(abs($AccountCategory->cr)); ?></td>
<td class="text-right"><?php echo myCurrency($AccountCategory->Balance); ?></td>
<td class="text-center"><a href="<?php echo site_url("accounts/reports/balance_by_ledger") . "?group=" . $AccountCategory->accategory_id; ?>" class="btn btn-info btn-xs"><i class="fas fa-eye"></i> </a></td>
</tr>
@ -56,8 +60,8 @@ $AccountCategories = $this->myaccounts->getChildAccountCategories();
<tr>
<th>Total</th>
<td width="<?php echo $drWidth; ?>"><?php echo myCurrency($drTotal); ?></td>
<td width="<?php echo $crWidth; ?>"><?php echo myCurrency($crTotal); ?></td>
<td ></td>
<td width="<?php echo $crWidth; ?>"><?php echo myCurrency(abs($crTotal)); ?></td>
<td class="text-right"><?php echo myCurrency($balanceTotal); ?></td>
<td ></td>
</tr>
</thead>

View File

@ -108,7 +108,7 @@
$html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>";
$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 col-1 '>Action</th></tr>";
$html .= "<tr><th class='text-center col-1'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1 '>Action</th></tr>";
$html .= "</thead><tbody>";
$sn = 0;
$BalanceTotal = 0;
@ -116,10 +116,10 @@
$balance = getBalance($Account->account_id);
$BalanceTotal += $balance;
// pre($Account);
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-1'>" . (myCurrency($balance)) . "</td><td class='text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach;
$html .= "</tbody><tfoot>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . (($BalanceTotal > 0) ? myCurrency(abs($BalanceTotal )) : "") . "</th><th class='text-right'>" . (($BalanceTotal < 0) ? myCurrency(abs($BalanceTotal )) : "") . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th></tr>";
$html .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\">

View File

@ -109,7 +109,7 @@
$html = "";
$html .= "<table 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 col-1'>Action</th></tr>";
$html .= "<tr><th class='text-center' width='25'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1'>Action</th></tr>";
$html .= "</thead><tbody>";
$sn = 0;
$BalanceTotal = 0;
@ -117,10 +117,10 @@
$balance = getBalance($Account->account_id);
$BalanceTotal += $balance;
// pre($Account);
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class=' text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-1'>" . (myCurrency($balance)) . "</td><td class=' text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach;
$html .= "</tbody><tfoot>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . (($BalanceTotal > 0) ? myCurrency(abs($BalanceTotal )) : "") . "</th><th class='text-right'>" . (($BalanceTotal < 0) ? myCurrency(abs($BalanceTotal )) : "") . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th></tr>";
$html .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\">

View File

@ -34,7 +34,7 @@
<div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_vouchertypes")->result(); ?>
<table class="table table-bordered table-striped dataTable">
<table class="table table-bordered table-striped longdataTable">
<thead>
<tr>
<th class="text-center">Sn</th>

View File

@ -38,7 +38,7 @@
<!--COL START-->
<div class="col-6">
<div class="form-group">
<?php fillComboWithValue("units_id", "Units <span class='text-danger'>*</span>", "units_id", "tbl_units", "title", "unit_id", isset($item) ? $item->units_id : '',); ?>
<?php fillComboWithValue("units_id", "Units <span class='text-danger'>*</span>", "units_id", "tbl_units", "title", "unit_id", isset($item) ? $item->units_id : '', "", false, "", true); ?>
</div>
</div>
<!--COL END-->
@ -47,7 +47,7 @@
<!--COL START-->
<div class="col">
<div class="form-group">
<?php fillComboWithValue("itemcategories_id", "Group <span class='text-danger'>*</span>", "itemcategories_id", "tbl_itemcategories", "title", "itemcategory_id", isset($item) ? $item->itemcategories_id : ''); ?>
<?php fillComboWithValue("itemcategories_id", "Group <span class='text-danger'>*</span>", "itemcategories_id", "tbl_itemcategories", "title", "itemcategory_id", isset($item) ? $item->itemcategories_id : '', "", false, "", true); ?>
</div>
</div>
<!--COL END-->

View File

@ -27,8 +27,8 @@
<td class="text-center"><?php echo $TableRow->translation_id; ?></td>
<td><?php echo $TableRow->english; ?></td>
<td><?php echo $TableRow->nepali; ?></td>
<td class="text-center"><a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>" class="btn btn-info btn-xs"><i class="fas fa-edit"></i> Edit</a>
<a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs"><i class="fas fa-trash"></i> Delete</a>
<td class="text-center"><a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>" class="btn btn-info btn-xs"><i class="fas fa-edit"></i></a>
<a onClick="javascript:doDelete(<?php echo $id; ?>);" class="btn btn-danger btn-xs"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>