BBnepal-Accounts/account/application/views/accounts/accountheads/list.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

179 lines
8.1 KiB
PHP

<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-3">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php myLang('Create Account'); ?>
<?php //echo $pageTitle;
?>
</h5>
</div>
<div class="card-body">
<form method=POST action="<?php echo site_url("accounts/accountheads/add"); ?>" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group"> <label for="account_name">Account Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="account_name" value="" name="account_name" required> </div>
</div>
<!--COL END-->
</div>
<div class="row">
<div class="col-12">
<div class="form-group">
<?php
$this->myaccounts->showAccountsCategoriesWithParentsCombo($fieldName = "accategory_id", $displayName = "Under", $fieldID = "accategory_id", $condition = "status=1", $default = "", $CSSclass = "select2", "required");
?>
</div>
</div>
<div class="col-8">
<div class="form-group"> <label for="opening_balance">Opening Balance</label><input type="text" class="form-control" id="opening_balance" value="" name="opening_balance"> </div>
</div>
<div class="col-4">
<div class="form-group"> <label for="opening_balance_drcr">Dr/Cr</label>
<select class="form-control" id="opening_balance_drcr" name="opening_balance_drcr" required>
<option value="DR" class="text-left">Dr</option>
<option value="CR" class="text-left">Cr</option>
</select>
</div>
</div>
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group"> <label for="remarks">Remarks</label> <textarea class="form-control" id="remarks" name="remarks"></textarea> </div>
</div>
<!--COL END-->
</div>
<!-- <button type="reset" class="btn btn-default btn-sm">Reset</button> -->
<button class="btn btn-primary btn-sm float-right mt-2" type="submit" name="submit">Save</button>
</form>
</div>
</div>
</div>
<div class="col-9">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo myLang('List Accounts'); ?>
<?php //myLang($pageTitle);
?>
<!-- <span class="float-right">
<a class="btn btn-primary btn-sm" href="<?php //echo site_url("accounts/accountheads/add");
?>"><?php //myLang("Create New Account");
?></a>
<a class="btn btn-warning btn-sm" href="<?php //echo site_url("accounts/accountheads/renumerate");
?>"><?php //myLang("Re-Number Codes");
?></a>
</span> -->
</h5>
</div>
<div class="card-body table-responsive">
<?php $d = 0;
$c = 0;
$TableData = $this->myaccounts->getAccountHeads(true); ?>
<table class="table table-striped table-bordered longdataTable">
<thead>
<tr>
<th class="col-1.5" rowspan="2"><?php myLang("Ledger"); ?></th>
<th class="col-1.5" rowspan="2"><?php myLang(" Group"); ?></th>
<th colspan="2" class="col-3 text-center">Opening Balance</th>
<th class="col-2 text-center" rowspan="2"><?php myLang("Action"); ?></th>
</tr>
<tr>
<th class="col-1 text-center"><?php myLang("Dr"); ?></th>
<th class="col-1 text-center"><?php myLang("Cr"); ?></th>
</tr>
</thead>
<tbody>
<?php $sn = 0;
foreach ($TableData as $TableRow) : $sn++; //pre($TableRow); ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><tr>
<td><?php echo linkLedger($TableRow); ?></td>
<td><?php echo linkCategory($TableRow->Group); ?></td>
<td><?php $d += doubleval($TableRow->dr_opening_balance);
echo ($TableRow->dr_opening_balance > 0) ? myCurrency($TableRow->dr_opening_balance) : ""; ?></td>
<td><?php $c += doubleval($TableRow->cr_opening_balance);
echo ($TableRow->cr_opening_balance > 0) ? myCurrency($TableRow->cr_opening_balance) : ""; ?></td>
<td class="text-center">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-primary btn-xs"><i class="fas fa-copy"></i> </a>
<a href="<?php echo site_url("accounts/accountheads/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; ?>
</tbody>
</table>
<!-- Modal -->
<div class="modal fade" id="accountdetails_box" tabindex="-1" role="dialog" aria-labelledby="accountdetails_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">Account Details</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" id="details_container">
Account Details Goes Here
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<a class="btn btn-primary" id="details_edit_btn" href="">Edit</a>
</div>
</div>
</div>
</div>
<script>
function doDelete(id) {
if (confirm('Are you sure to delete?')) {
window.location = '<?php echo site_url("accounts/accountheads/delete/"); ?>' + id;
}
}
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/accountheads/getdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#details_edit_btn").attr("href", "<?php echo site_url("accounts/accountheads/edit/"); ?>" + id);
$("#accountdetails_box").modal('show');
}
});
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>