BBnepal-Accounts/account/application/views/accounts/accountheads/list.php

277 lines
13 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<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">
2024-07-16 12:58:54 +00:00
<form method="POST" action="<?php echo site_url("accounts/accountheads/add"); ?>" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<!-- Account Name -->
<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>
2024-07-10 12:43:19 +00:00
</div>
2024-07-16 12:58:54 +00:00
<div class="row">
<!-- Account Category -->
<div class="col-12">
<div class="form-group">
<?php
// Assuming this PHP function shows a dropdown for account categories
$this->myaccounts->showAccountsCategoriesWithParentsCombo("accategory_id", "Under", "accategory_id", "status=1", "", "select2", "required");
?>
</div>
</div>
2024-07-10 12:43:19 +00:00
</div>
2024-07-16 12:58:54 +00:00
<div class="row" id="additionalFields" style="display: none;">
<!-- Additional Fields for Sundry Debtors or Sundry Creditors -->
<div class="row">
<div class="col">
<div class="form-group">
<label for="account_partyaddress">Address</label>
<input type="text" class="form-control" id="account_partyaddress" name="account_partyaddress">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_partypan">PAN No.</label>
<input type="text" class="form-control" id="account_partypan" name="account_partypan">
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label for="account_partycontact">Phone No.</label>
<input type="text" class="form-control" id="account_partycontact" name="account_partycontact">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_partyemail">Email</label>
<input type="email" class="form-control" id="account_partyemail" name="account_partyemail">
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label for="account_partycontactperson">Contact Person Name</label>
<input type="text" class="form-control" id="account_partycontactperson" name="account_partycontactperson">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_partycontactpersoncontact">Contact Person No.</label>
<input type="text" class="form-control" id="account_partycontactpersoncontact" name="account_partycontactpersoncontact">
</div>
</div>
</div>
2024-07-10 12:43:19 +00:00
</div>
2024-07-16 12:58:54 +00:00
<div class="row" id="bankFields" style="display: none;">
<!-- Additional Fields for Bank Account -->
<div class="col">
<div class="form-group">
<label for="account_number">Account No.</label>
<input type="text" class="form-control" id="account_number" name="account_number">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_branch">Branch</label>
<input type="text" class="form-control" id="account_branch" name="account_branch">
</div>
</div>
2024-07-10 12:43:19 +00:00
</div>
2024-07-16 12:58:54 +00:00
<div class="row">
<!-- Opening Balance and Dr/Cr -->
<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">Dr</option>
<option value="CR">Cr</option>
</select>
</div>
</div>
</div>
<div class="row">
<!-- Remarks -->
<div class="col">
<div class="form-group">
<label for="remarks">Remarks</label>
<textarea class="form-control" id="remarks" name="remarks"></textarea>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="row">
<div class="col">
<button class="btn btn-primary btn-sm float-right mt-2" type="submit" name="submit">Save</button>
</div>
2024-07-10 12:43:19 +00:00
</div>
</form>
2024-07-16 12:58:54 +00:00
</div>
2024-07-10 12:43:19 +00:00
</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');
}
});
}
2024-07-16 12:58:54 +00:00
$(document).ready(function() {
$('#accategory_id').change(function() {
var selectedOption = $(this).val();
// Reset form and hide all additional fields
$('#additionalFields').hide();
$('#bankFields').hide();
$('.required-field').prop('required', false);
// Show additional fields based on selected option
if (selectedOption == 4 || selectedOption == 30) {
$('#additionalFields').show();
$('.required-field').prop('required', true);
} else if (selectedOption == 2) {
$('#bankFields').show();
$('.required-field').prop('required', true);
}
});
});
2024-07-10 12:43:19 +00:00
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>