commitall

This commit is contained in:
Sampanna Rimal
2024-07-10 18:28:19 +05:45
parent 140abda4e6
commit 9cd05ef3cb
15723 changed files with 4818733 additions and 0 deletions

View File

@@ -0,0 +1,242 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a>
</li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if ($VoucherType->voucher_options == "") : ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount = $this->myaccounts->getAccountDetails($VoucherType->default_account); ?>
<legend><?php echo $DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3">
<?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4">
<input type="text" name="narration" id="narration" class="form-control" />
</td>
<td class="col-1">
<input type="text" name="debit" id="debit" value="0" class="form-control" />
</td>
<td class="col-1">
<input type="button" class="btn btn-primary full-width" id="addrow" value="Add" />
</td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">
Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">
Total</th>
<td>
<div id="debitTotal">
</div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">
Save Voucher</button>
</form>
<?php else : ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,190 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,242 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a>
</li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if ($VoucherType->voucher_options == "") : ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount = $this->myaccounts->getAccountDetails($VoucherType->default_account); ?>
<legend><?php echo $DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3">
<?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4">
<input type="text" name="narration" id="narration" class="form-control" />
</td>
<td class="col-1">
<input type="text" name="debit" id="debit" value="0" class="form-control" />
</td>
<td class="col-1">
<input type="button" class="btn btn-primary full-width" id="addrow" value="Add" />
</td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">
Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">
Total</th>
<td>
<div id="debitTotal">
</div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">
Save Voucher</button>
</form>
<?php else : ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,190 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a>
</li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id", id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry() {
var id = $("#reversalBtn").data("id");
if (confirm("Are you sure you want to post reversal for this voucher?")) {
window.location = "<?php echo site_url("accounts/vouchers/reversal/"); ?>" + id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id = $(this).data("id");
var Transactions = "<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions = getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data = data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,245 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a>
</li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if ($VoucherType->voucher_options == "") : ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php
$DefaultAccount = $this->myaccounts->getAccountDetails($VoucherType->default_account);
print_r($DefaultAccount);
?>
<legend><?php echo isset($DefaultAccount->account_name) ? $DefaultAccount->account_name : '' ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3">
<?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4">
<input type="text" name="narration" id="narration" class="form-control" />
</td>
<td class="col-1">
<input type="text" name="debit" id="debit" value="0" class="form-control" />
</td>
<td class="col-1">
<input type="button" class="btn btn-primary full-width" id="addrow" value="Add" />
</td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">
Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">
Total</th>
<td>
<div id="debitTotal">
</div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">
Save Voucher</button>
</form>
<?php else : ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,190 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,242 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a>
</li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if ($VoucherType->voucher_options == "") : ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount = $this->myaccounts->getAccountDetails($VoucherType->default_account); ?>
<legend><?php echo $DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3">
<?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4">
<input type="text" name="narration" id="narration" class="form-control" />
</td>
<td class="col-1">
<input type="text" name="debit" id="debit" value="0" class="form-control" />
</td>
<td class="col-1">
<input type="button" class="btn btn-primary full-width" id="addrow" value="Add" />
</td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">
Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">
Total</th>
<td>
<div id="debitTotal">
</div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">
Save Voucher</button>
</form>
<?php else : ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,191 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a>
</li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php
// print_r($TableData);
foreach ($TableData as $TableRow) : ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><tr data-id="<?php echo $TableRow->voucher_id; ?>" class="<?php echo ($TableRow->voucher_state == "Reversed") ? "table-danger" : ""; ?>">
<td><?php echo $TableRow->voucher_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id", id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry() {
var id = $("#reversalBtn").data("id");
if (confirm("Are you sure you want to post reversal for this voucher?")) {
window.location = "<?php echo site_url("accounts/vouchers/reversal/"); ?>" + id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id = $(this).data("id");
var Transactions = "<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions = getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data = data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,191 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a>
</li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php
// print_r($TableData);
foreach ($TableData as $TableRow) : ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><tr data-id="<?php echo $TableRow->voucher_id; ?>" class="<?php echo ($TableRow->voucher_state == "Reversed") ? "table-danger" : ""; ?>">
<td><?php echo $TableRow->voucher_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id", id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry() {
var id = $("#reversalBtn").data("id");
if (confirm("Are you sure you want to post reversal for this voucher?")) {
window.location = "<?php echo site_url("accounts/vouchers/reversal/"); ?>" + id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id = $(this).data("id");
var Transactions = "<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions = getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data = data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,204 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">Create <?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/listvouchers"); ?>" class="btn btn-sm btn-warning float-right"><i class="nav-icon fas fa-times"></i> Cancel <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<legend><span id="selectedAccountName"></span> Balance</legend><span id="selectedAccountBalance" style="padding: 6px 0px; display: inline-block; text-align: right; width: 100%;">Choose A/C First</span>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td class="col-4">Account</td>
<td class="col-5">Narration</td>
<td class="col-1">Debit</td>
<td class="col-1">Credit</td>
<td class="col-1"></td>
</tr>
</thead>
<tbody>
<tr>
<td> <?php $this->myaccounts->showAccountsCombo("account_id", "", "account_id", "status=1", $default = "", $CSSclass = ""); ?> </td>
<td> <input type="text" name="narration" id="narration" class="form-control" /> </td>
<td> <input type="text" name="debit" id="debit" value="0" class="form-control" /> </td>
<td> <input type="text" name="credit" id="credit" value="0" class="form-control" /> </td>
<td> <input type="button" class="btn btn-primary full-width" id="addrow" value="Add" /> </td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-success card-outline mt-4">
<div class="card-header">Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Debit</td>
<td>Credit</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">Total</th>
<td>
<div id="debitTotal"></div>
</td>
<td>
<div id="creditTotal"></div>
</td>
<td>
<div class="bold-text" id="balance"></div>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">Save Voucher</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$("#account_id").change(function(e) {
var account_id = this.value;
$.ajax({
url: "<?php echo site_url("accounts/Ledger/getaccountbalance/"); ?>" + account_id,
async: false,
dataType:"json",
success: function(data) {
$("#selectedAccountName").html(data.account_name);
$("#selectedAccountBalance").html(data.Balance);
}
});
});
var counter = 0; $("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
var credit = ($.isNumeric($("#credit").val()) ? $("#credit").val() : 0);
if ($.isNumeric(debit) && $.isNumeric(credit)) {
if (debit > 0 || credit > 0) {
addRow()
} else {
msg = "Either debit side or credit side must contain some value";
}
} else {
msg = "Non numberic value entered in debit side or credit side. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
}); $("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
console.log(arr);
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="credit[]" value="' + ($.isNumeric($("#credit").val()) ? $("#credit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("table.order-list").find('input[name^="credit[]"]').each(function() {
creditTotal += +$(this).val();
});
balance = Number(debitTotal) - Number(creditTotal);
roundbalance=balance.toFixed(2);
$("#debit").val(0);
$("#credit").val(0);
$("#debitTotal").text(debitTotal.toFixed(2));
$("#creditTotal").text(creditTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
if (roundbalance !=0) {
$("#saveButton").prop("disabled", true);
} else {
$("#saveButton").prop("disabled", false);
}
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,74 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Deposit Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount=$this->myaccounts->getAccountDetails($VoucherType->default_account);?>
<legend><?php echo $DefaultAccount->account_name; ?> <?php myLang("Balance");?></legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend><?php mylang("Voucher"); ?> #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend><?php myLang("Enter Deposit Details"); ?></legend>
<div class="row">
<div class="col"><?php createInput("debit[]","Deposited Amount","debit","",""); ?></div>
<div class="col"><?php fillComboWithValue("account_ids[]", "In Account Against", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?></div>
</div>
<div class="row">
<div class="col"><?php createInput("narration[]","Narration","narration","",""); ?></div>
</div>
<div class="row">
<div class="col"><?php createInput("cheque_number[]","Deposited Cheque","cheque_number","",""); ?></div>
<div class="col"><?php createInput("cheque_details[]","Deposited Cheque Details","cheque_details","",""); ?></div>
</div>
</fieldset>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">Save Voucher</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$("#saveButton").prop("disabled", false);
</script>

View File

@@ -0,0 +1,137 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details"><i class="fa fa-eye"></i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,69 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend><?php myLang("Transaction Date"); ?></legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount=$this->myaccounts->getAccountDetails($VoucherType->default_account);?>
<legend><?php echo $DefaultAccount->account_name; ?> <?php myLang("Balance"); ?></legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend><?php myLang("Voucher"); ?> #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend><?php myLang("Enter Transaction"); ?></legend>
<div class="row">
<div class="col"><?php createInput("debit[]","Payment Received Amount","debit","",""); ?></div>
<div class="col"><?php fillComboWithValue("account_ids[]", "In Account Against", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?></div>
</div>
<div class="row">
<div class="col"><?php createInput("narration[]","Narration","narration","",""); ?></div>
</div>
</fieldset>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">Save Voucher</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$("#saveButton").prop("disabled", false);
</script>

View File

@@ -0,0 +1,137 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details"><i class="fa fa-eye"></i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,177 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if($VoucherType->voucher_options==""): ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount=$this->myaccounts->getAccountDetails($VoucherType->default_account);?>
<legend><?php echo $DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3"> <?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4"> <input type="text" name="narration" id="narration" class="form-control" /> </td>
<td class="col-1"> <input type="text" name="debit" id="debit" value="0" class="form-control" /> </td>
<td class="col-1"> <input type="button" class="btn btn-primary full-width" id="addrow" value="Add" /> </td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">Total</th>
<td>
<div id="debitTotal"></div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">Save Voucher</button>
</form>
<?php else: ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,137 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details"><i class="fa fa-eye"></i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,74 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend><?php myLang("Payment Date"); ?></legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount=$this->myaccounts->getAccountDetails($VoucherType->default_account);?>
<legend><?php echo $DefaultAccount->account_name; ?> <?php myLang("Balance");?></legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend><?php mylang("Voucher"); ?> #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend><?php myLang("Enter Deposit Details"); ?></legend>
<div class="row">
<div class="col"><?php createInput("debit[]","Deposited Amount","debit","",""); ?></div>
<div class="col"><?php fillComboWithValue("account_ids[]", "In Account Against", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?></div>
</div>
<div class="row">
<div class="col"><?php createInput("narration[]","Narration","narration","",""); ?></div>
</div>
<div class="row">
<div class="col"><?php createInput("cheque_number[]","Deposited Cheque","cheque_number","",""); ?></div>
<div class="col"><?php createInput("cheque_details[]","Deposited Cheque Details","cheque_details","",""); ?></div>
</div>
</fieldset>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">Save Voucher</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$("#saveButton").prop("disabled", false);
</script>

View File

@@ -0,0 +1,137 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details"><i class="fa fa-eye"></i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,237 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if($VoucherType->voucher_options==""): ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount=$this->myaccounts->getAccountDetails($VoucherType->default_account);?>
<legend><?php echo $DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3">
<?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4">
<input type="text" name="narration" id="narration" class="form-control" /> </td>
<td class="col-1">
<input type="text" name="debit" id="debit" value="0" class="form-control" /> </td>
<td class="col-1">
<input type="button" class="btn btn-primary full-width" id="addrow" value="Add" /> </td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">
Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">
Total</th>
<td>
<div id="debitTotal">
</div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">
Save Voucher</button>
</form>
<?php else: ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,190 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,425 @@
<!-- <style>
:root {
--contra: #cfbdec;
--payment: #6f42c1;
--receipt: #e83e8c;
--journal: #dc3545;
--sales: #fd7e14;
--creditnote: #ffc107;
--purchase: #28a745;
--debitnote: #20c997;
--reversing: #17a2b8;
.border0 {
border: 0;
}
}
fieldset {
padding-bottom: 0 !important;
}
table {
margin-bottom: 0 !important;
}
.card-body.p-0 .table tbody>tr>td:first-of-type, .card-body.p-0 .table tbody>tr>th:first-of-type, .card-body.p-0 .table tfoot>tr>td:first-of-type, .card-body.p-0 .table tfoot>tr>th:first-of-type, .card-body.p-0 .table thead>tr>td:first-of-type, .card-body.p-0 .table thead>tr>th:first-of-type {
padding-left: .5rem;
}
.form-control1 {
display: block;
width: 100%;
height: calc(1.80rem + 2px);
padding: .375rem .75rem;
font-size: .9rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: .25rem;
box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
text-align: right;
}
.select2-container .select2-selection--single {
height: calc(1.80rem + 2px);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
color: #444;
line-height: 18px
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
margin-top: 0px !important;
}
</style> -->
<style>
.form-group {
margin-bottom: .5rem;
}
.form-control {
display: block;
width: 100%;
height: calc(1.80rem + 2px);
padding: .375rem .75rem;
font-size: .9rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: .25rem;
box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
text-align: right;
}
.custom-file-input {
position: relative;
z-index: 2;
width: 100%;
height: calc(1.80rem + 2px);
margin: 0;
overflow: hidden;
opacity: 0;
}
.custom-file-label {
position: absolute;
top: 0;
right: 0;
left: 0;
z-index: 1;
height: calc(1.80rem + 2px);
padding: .350rem .75rem;
overflow: hidden;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-color: #fff;
border: 1px solid #ced4da;
border-radius: .25rem;
box-shadow: none;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
padding-left: 0;
/* height: auto; */
height: calc(1.80rem + 2px) !important;
margin-top: -3px;
}
.select2-container .select2-selection--single {
height: 30px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
color: #444;
line-height: 20px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
margin-top: 0 !important;
}
</style>
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0"></h1>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<!-- <div class="card-header" style="background-color: <?php echo $VoucherType->voucher_color; ?>;">
<h5 class="m-0">
<?php //echo $pageTitle;
?>
<a href="<?php //echo site_url("accounts/vouchers/listvouchers");
?>" class="btn btn-sm btn-warning float-right"><i class="nav-icon fas fa-times"></i> Cancel <?php //echo $pageTitle;
?></a></h5>
</div> -->
<div class="card-body" style="background-color: <?php echo $VoucherType->voucher_color; ?>;">
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-6">
<h1 class="text-center"><?php echo $pageTitle; ?> Voucher</h1>
<!-- <fieldset>
<legend><span id="selectedAccountName"></span> Balance</legend><span id="selectedAccountBalance" style="padding: 6px 0px; display: inline-block; text-align: right; width: 100%;">Choose A/C First</span>
</fieldset> -->
</div>
<div class="col-3 ">
<fieldset>
<legend><?php echo $pageTitle; ?> Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table table-sm">
<thead>
<tr>
<td class="col-1"></td>
<td class="col-6 ">
<div class="row">
<div class="col-auto"><b>Account</b></div>
<div class="col text-right">
</div>
</div>
</td>
<td class="col-1"></td>
<td class="col-1 text-right"><b>Amount</b></td>
<td class="col-1"></td>
</tr>
</thead>
<tbody>
<tr>
<td> <select name="posting_side_selector" id="posting_side_selector" class="form-control form-select">
<option value="debit">Dr</option>
<option value="credit">Cr</option>
</select> </td>
<td>
<?php
if ($VoucherType->default_debits != null)
$VoucherType->default_debits = explode(",", $VoucherType->default_debits);
if ($VoucherType->default_credits != null)
$VoucherType->default_credits = explode(",", $VoucherType->default_credits);;
?>
<span id="dr_box"><?php $this->myaccounts->showAccountsComboForVoucher("account_id", "", "account_id_dr", "status=1", $default = "", $CSSclass = "", $VoucherType->default_debits) ?></span>
<span id="cr_box" style="display: none;"><?php $this->myaccounts->showAccountsComboForVoucher("account_id", "", "account_id_cr", "status=1", $default = "", $CSSclass = "", $VoucherType->default_credits) ?> </span>
</td>
<td> <span id="balance_display" class="d-inline-block text-center"></span>
</td>
<td> <input type="text" name="amount" id="amount" value="0" class="form-control text-right" /> </td>
<td> <input type="button" class="btn btn-primary btn-block " id="addrow" value="Add" /> </td>
</tr>
</tbody>
</table>
</fieldset>
<div class="card card-success card-outline mt-4">
<div class="card-header"><b>Transaction List</b> </div>
<div class="card-body p-0">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td></td>
<td width="60%"><b>Account</b></td>
<!-- <td>Narration</td> -->
<td class="text-right" width="15%"><b>Debit Amount</b></td>
<td class="text-right" width="15%"><b>Credit Amount</b></td>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">Total</th>
<td>
<div id="debitTotal" class="text-right text-bold"></div>
</td>
<td>
<div id="creditTotal" class="text-right text-bold"></div>
</td>
<td>
<!-- <div id="balance" class="text-right text-bold"></div> -->
</td>
</tr>
<tr>
<th colspan="2" class="text-right"></th>
<td>
<div id="balance_dr" class="text-right text-warning text-bold"></div>
</td>
<td>
<div id="balance_cr" class="text-right text-warning text-bold"></div>
</td>
<td>
<!-- <div id="balance" class="text-right text-bold"></div> -->
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<!--COL START-->
<div class="col">
<textarea class="form-control" rows="3" name="narration" id="narration" placeholder="Narration:"></textarea>
<!-- <input type="text" name="narration" id="narration" class="form-control" /> -->
</div>
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</div>
</div>
<!--COL END-->
<button class="btn btn-primary btn-sm float-right mt-2" type="submit" id="saveButton" name="submit">Save Voucher</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$("#posting_side_selector").change(function(e) {
var posting_side = $("#posting_side_selector").val();
if (posting_side == "debit") {
$("#dr_box").show();
$("#cr_box").hide();
} else {
{
$("#dr_box").hide();
$("#cr_box").show();
}
}
});
$("#posting_side_selector").change();
$("#account_id_dr").change(function(e) {
var account_id = this.value;
$.ajax({
url: "<?php echo site_url("accounts/Ledger/getaccountbalance/"); ?>" + account_id,
async: true,
dataType: "json",
success: function(data) {
// alert("COW");
// console.log(data.BalanceRaw);
$("#balance_display").html("Current Balance: " + data.BalanceRaw).css("white-space text-center", "nowrap");
setTimeout(function() {
$("#amount").val('').focus();
}, 100); // Delay focus by 100 milliseconds
}
});
});
$("#account_id_cr").change(function(e) {
var account_id = this.value;
$.ajax({
url: "<?php echo site_url("accounts/Ledger/getaccountbalance/"); ?>" + account_id,
async: true,
dataType: "json",
success: function(data) {
// alert("COW");
// console.log(data.BalanceRaw);
$("#balance_display").html("Current Balance: " + data.BalanceRaw).css("white-space text-center", "nowrap");
setTimeout(function() {
$("#amount").val('').focus();
}, 100); // Delay focus by 100 milliseconds
}
});
});
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
var posting_side = $("#posting_side_selector").val();
if (posting_side == "debit") {
var account_id = $("#account_id_dr").val();
var account_name = $("#account_id_dr option:selected").text();
} else {
var account_id = $("#account_id_cr").val();
var account_name = $("#account_id_cr option:selected").text();
}
var amount = ($.isNumeric($("#amount").val()) ? $("#amount").val() : 0);
if ($.isNumeric(amount)) {
debit = (posting_side == "debit") ? amount : 0;
credit = (posting_side == "credit") ? amount : 0;
if (debit > 0 || credit > 0) {
addRow(account_id, account_name, debit, credit);
$("#amount").val('');
} else {
msg = "Either debit side or credit side must contain some value";
}
} else {
msg = "Non numberic value entered in debit side or credit side. ";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#account_id_cr").val()=0;
$("#account_id_dr").val()=0;
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_ids[]"]').map(function() {
return this.value;
}).get();
// console.log(arr);
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow(account_id, account_name, debit, credit) {
var newRow = $("<tr>");
var cols = "";
cols += (debit == 0) ? '<td class="text-center">Cr</td>' : '<td class="text-center ">Dr</td>';
cols += '<td class="text-left col-7"><input type="hidden" class="form-control1 boarder0 " name="account_ids[]" value="' + account_id + '"/><input type="hidden" class="form-control1 p-0 border0 float-left " name="account_name[]" value="' + account_name + '"/>' + account_name + '</td>';
// cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td class="col-2 text-right"><input type="hidden" readonly class="form-control1 border0 text-right" name="debit[]" value="' + debit + '"/>' + debit + '</td>';
cols += '<td class="col-2 text-right"><input type="hidden" readonly class="form-control1 border0 text-right" name="credit[]" value="' + credit + '"/>' + credit + '</td>';
cols += '<td class="col-1 "><input type="button" class="ibtnDel btn btn-xs btn-danger float-right " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("table.order-list").find('input[name^="credit[]"]').each(function() {
creditTotal += +$(this).val();
});
balance = Number(debitTotal) - Number(creditTotal);
roundbalance = balance.toFixed(2);
$("#debit").val(0);
$("#credit").val(0);
$("#debitTotal").text(debitTotal.toFixed(2));
$("#creditTotal").text(creditTotal.toFixed(2));
if (balance > 0) {
$("#balance_cr").text(balance.toFixed(2));
$("#balance_dr").text("");
} else {
$("#balance_cr").text("");
$("#balance_dr").text(balance.toFixed(2));
}
if (roundbalance != 0) {
$("#saveButton").prop("disabled", true);
} else {
$("#saveButton").prop("disabled", false);
}
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,190 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a>
</li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/" . $VoucherType->voucher_alias . "/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id", id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry() {
var id = $("#reversalBtn").data("id");
if (confirm("Are you sure you want to post reversal for this voucher?")) {
window.location = "<?php echo site_url("accounts/vouchers/reversal/"); ?>" + id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id = $(this).data("id");
var Transactions = "<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions = getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data = data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,477 @@
<style>
:root {
--contra: #cfbdec;
--payment: #6f42c1;
--receipt: #e83e8c;
--journal: #dc3545;
--sales: #fd7e14;
--creditnote: #ffc107;
--purchase: #28a745;
--debitnote: #20c997;
--reversing: #17a2b8;
.border0 {
border: 0;
}
}
table {
margin-bottom: 0 !important;
}
.card-body.p-0 .table tbody>tr>td:first-of-type,
.card-body.p-0 .table tbody>tr>th:first-of-type,
.card-body.p-0 .table tfoot>tr>td:first-of-type,
.card-body.p-0 .table tfoot>tr>th:first-of-type,
.card-body.p-0 .table thead>tr>td:first-of-type,
.card-body.p-0 .table thead>tr>th:first-of-type {
padding-left: .5rem;
}
.tables td {
border: 0px;
}
#addButton {
/* position: absolute; */
top: 0;
right: 0;
background-color: #f0f0f0;
border: none;
cursor: pointer;
padding: 5px;
font-size: 16px;
line-height: 16px;
}
#mySelect {
padding: 5px;
font-size: 16px;
line-height: 16px;
}
.custom-select1 {
position: relative;
display: inline-block;
width: 100%;
}
.select2-container {
width: 94% !important;
}
button.addplus {
position: absolute;
right: 0;
top: 0;
height: 100%;
padding: 10px;
background-color: #ddd;
border: none;
border-left: 1px solid #ccc;
border-radius: 0 4px 4px 0;
cursor: pointer;
font-size: 12px;
}
button:hover {
background-color: #ccc;
}
</style>
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<!-- <div class="card-header" style="background-color: <?php echo $VoucherType->voucher_color; ?>;">
<h5 class="m-0">
<?php //echo $pageTitle;
?>
<a href="<?php //echo site_url("accounts/vouchers/listvouchers");
?>" class="btn btn-sm btn-warning float-right"><i class="nav-icon fas fa-times"></i> Cancel <?php //echo $pageTitle;
?></a></h5>
</div> -->
<div class="card-body" style="background-color: <?php echo $VoucherType->voucher_color; ?>;">
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row mb-2">
<div class="col-2">
<fieldset>
<legend>Transaction Date <span class="text-danger">*</span></legend>
<input type="text" class="form-control2 nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date" required>
</fieldset>
</div>
<div class="col-8">
<h1 class="text-center"><?php echo $pageTitle; ?> Voucher</h1>
<!-- <fieldset>
<legend><span id="selectedAccountName"></span> Balance</legend><span id="selectedAccountBalance" style="padding: 6px 0px; display: inline-block; text-align: right; width: 100%;">Choose A/C First</span>
</fieldset> -->
</div>
<div class="col-2 ">
<fieldset>
<legend><?php echo $pageTitle; ?> Voucher #</legend><input type="text" readonly class="form-control2" id="voucher_no" value="<?php echo generateVoucherNo($VoucherType->vouchertype_id); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table tables table-sm">
<thead>
<tr>
<td class="col-1"></td>
<td class="col-6 ">
<div class="row">
<div class="col-auto"><b>Account</b> <span class="text-danger">*</span></div>
<div class="col text-right">
</div>
</div>
</td>
<td class="col-1 text-bold">Current Balance</td>
<td class="col-1 text-right"><b>Amount</b><span class="text-danger">*</span></td>
<td class="col-1"></td>
</tr>
</thead>
<tbody>
<tr>
<td> <select name="posting_side_selector" id="posting_side_selector" class="form-control form-select">
<option value="debit">Dr</option>
<option value="credit">Cr</option>
</select> </td>
<td>
<?php
if ($VoucherType->default_debits != null)
$VoucherType->default_debits = explode(",", $VoucherType->default_debits);
if ($VoucherType->default_credits != null)
$VoucherType->default_credits = explode(",", $VoucherType->default_credits);;
?>
<span id="dr_box" class="custom-select1">
<?php $this->myaccounts->showAccountsComboForVoucher("account_id", "", "account_id_dr", "status=1", $default = "", $CSSclass = "", $VoucherType->default_debits) ?>
</span>
<span id="cr_box" style="display: none;" class="custom-select1">
<?php $this->myaccounts->showAccountsComboForVoucher("account_id", "", "account_id_cr", "status=1", $default = "", $CSSclass = "", $VoucherType->default_credits) ?>
</span>
</td>
<td class="text-center"> <span id="balance_display" class="d-inline-block text-bold fs-20"></span></td>
<td> <input type="text" name="amount" id="amount" value="0" class="form-control text-right" /> </td>
<td> <input type="button" class="btn btn-primary btn-block btn-sm " id="addrow" value="Add" /> </td>
</tr>
</tbody>
</table>
</fieldset>
<div class="card card-success card-outline mt-3">
<div class="card-header"><b>Transaction List</b> </div>
<div class="card-body p-0">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td width="60%" colspan="2"><b>Account</b></td>
<!-- <td>Narration</td> -->
<td class="text-right" width="15%"><b>Debit Amount</b></td>
<td class="text-right" width="15%"><b>Credit Amount</b></td>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">Total</th>
<td>
<div id="debitTotal" class="text-right text-bold"></div>
</td>
<td>
<div id="creditTotal" class="text-right text-bold"></div>
</td>
<td>
<!-- <div id="balance" class="text-right text-bold"></div> -->
</td>
</tr>
<tr>
<th colspan="2" class="text-right"></th>
<td>
<div id="balance_dr" class="text-right text-danger text-bold"></div>
</td>
<td>
<div id="balance_cr" class="text-right text-danger text-bold"></div>
</td>
<td>
<!-- <div id="balance" class="text-right text-bold"></div> -->
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<!--COL START-->
<div class="col">
<textarea class="form-control" rows="30" style="height: 60px!important;" name="narration" id="narration" placeholder="Narration:"></textarea>
<!-- <input type="text" name="narration" id="narration" class="form-control" /> -->
</div>
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</div>
</div>
<!--COL END-->
<button class="btn btn-primary btn-sm float-right mt-2" type="submit" id="saveButton" name="submit">Save Voucher</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Create Ledger</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="modal-body">
<div class="row">
<!--COL START-->
<div class="col-8">
<div class="form-group"> <label for="account_name">Account Name</label><input type="text" class="form-control" id="account_name" value="" name="account_name" required> </div>
</div>
<div class="col-4">
<div class="form-group">
<label for="exampleInputFile">Upload Image</label>
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input" id="exampleInputFile">
<label class="custom-file-label" for="exampleInputFile">Choose file</label>
</div>
</div>
</div>
<!-- <div class="text-center">
<img class="profile-user-img img-fluid " src="../../dist/img/user4-128x128.jpg" alt="User profile picture">
</div> -->
</div>
<!--COL END-->
</div>
<div class="row">
<div class="col-6">
<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-4">
<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-2">
<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>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Close</button>
<button class="btn btn-primary btn-sm" type="submit" name="submit">Save</button>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
function addOption() {
var newOption = prompt("Enter new option:");
if (newOption != null) {
var select = document.getElementById("mySelect");
var option = document.createElement("option");
option.text = newOption;
option.value = newOption.toLowerCase().replace(/\s+/g, '');
select.add(option);
}
}
</script>
<script>
$(document).ready(function() {
$("#posting_side_selector").change(function(e) {
var posting_side = $("#posting_side_selector").val();
if (posting_side == "debit") {
$("#dr_box").show();
$("#cr_box").hide();
} else {
{
$("#dr_box").hide();
$("#cr_box").show();
}
}
});
$("#posting_side_selector").change();
$("#account_id_dr").change(function(e) {
var account_id = this.value;
$.ajax({
url: "<?php echo site_url("accounts/Ledger/getaccountbalance/"); ?>" + account_id,
async: true,
dataType: "json",
success: function(data) {
// alert("COW");
// console.log(data.BalanceRaw);
$("#balance_display").html(" " + data.BalanceRaw).css("white-space text-center", "nowrap");
setTimeout(function() {
$("#amount").val('').focus();
}, 100); // Delay focus by 100 milliseconds
}
});
});
$("#account_id_cr").change(function(e) {
var account_id = this.value;
$.ajax({
url: "<?php echo site_url("accounts/Ledger/getaccountbalance/"); ?>" + account_id,
async: true,
dataType: "json",
success: function(data) {
// alert("COW");
// console.log(data.BalanceRaw);
$("#balance_display").html("Current Balance: " + data.BalanceRaw).css("white-space text-center", "nowrap");
setTimeout(function() {
$("#amount").val('').focus();
}, 100); // Delay focus by 100 milliseconds
}
});
});
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
var posting_side = $("#posting_side_selector").val();
if (posting_side == "debit") {
var account_id = $("#account_id_dr").val();
var account_name = $("#account_id_dr option:selected").text();
} else {
var account_id = $("#account_id_cr").val();
var account_name = $("#account_id_cr option:selected").text();
}
var amount = ($.isNumeric($("#amount").val()) ? $("#amount").val() : 0);
if ($.isNumeric(amount)) {
debit = (posting_side == "debit") ? amount : 0;
credit = (posting_side == "credit") ? amount : 0;
if (debit > 0 || credit > 0) {
addRow(account_id, account_name, debit, credit);
$("#amount").val('');
} else {
msg = "Either debit side or credit side must contain some value";
}
} else {
msg = "Non numberic value entered in debit side or credit side. ";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#account_id_cr").val() = 0;
$("#account_id_dr").val() = 0;
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_ids[]"]').map(function() {
return this.value;
}).get();
// console.log(arr);
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow(account_id, account_name, debit, credit) {
var newRow = $("<tr>");
var cols = "";
cols += (debit == 0) ? '<td class="text-center">Cr</td>' : '<td class="text-center ">Dr</td>';
cols += '<td class="text-left col-7"><input type="hidden" class="form-control1 boarder0 " name="account_ids[]" value="' + account_id + '"/><input type="hidden" class="form-control1 p-0 border0 float-left " name="account_name[]" value="' + account_name + '"/>' + account_name + '</td>';
// cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td class="col-2 text-right"><input type="hidden" readonly class="form-control1 border0 text-right" name="debit[]" value="' + debit + '"/>' + debit + '</td>';
cols += '<td class="col-2 text-right"><input type="hidden" readonly class="form-control1 border0 text-right" name="credit[]" value="' + credit + '"/>' + credit + '</td>';
cols += '<td class="col-1 "><input type="button" class="ibtnDel btn btn-xs btn-danger float-right " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("table.order-list").find('input[name^="credit[]"]').each(function() {
creditTotal += +$(this).val();
});
balance = Number(debitTotal) - Number(creditTotal);
roundbalance = balance.toFixed(2);
$("#debit").val(0);
$("#credit").val(0);
$("#debitTotal").text(debitTotal.toFixed(2));
$("#creditTotal").text(creditTotal.toFixed(2));
if (balance > 0) {
$("#balance_cr").text(balance.toFixed(2));
$("#balance_dr").text("");
} else {
$("#balance_cr").text("");
$("#balance_dr").text(balance.toFixed(2));
}
if (roundbalance != 0) {
$("#saveButton").prop("disabled", true);
} else {
$("#saveButton").prop("disabled", false);
}
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,237 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if($VoucherType->voucher_options==""): ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount=$this->myaccounts->getAccountDetails($VoucherType->default_account);?>
<legend><?php echo $DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3">
<?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4">
<input type="text" name="narration" id="narration" class="form-control" /> </td>
<td class="col-1">
<input type="text" name="debit" id="debit" value="0" class="form-control" /> </td>
<td class="col-1">
<input type="button" class="btn btn-primary full-width" id="addrow" value="Add" /> </td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">
Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">
Total</th>
<td>
<div id="debitTotal">
</div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">
Save Voucher</button>
</form>
<?php else: ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,190 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,237 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if($VoucherType->voucher_options==""): ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount=$this->myaccounts->getAccountDetails($VoucherType->default_account);?>
<legend><?php echo $DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3">
<?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4">
<input type="text" name="narration" id="narration" class="form-control" /> </td>
<td class="col-1">
<input type="text" name="debit" id="debit" value="0" class="form-control" /> </td>
<td class="col-1">
<input type="button" class="btn btn-primary full-width" id="addrow" value="Add" /> </td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">
Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">
Total</th>
<td>
<div id="debitTotal">
</div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">
Save Voucher</button>
</form>
<?php else: ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,190 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,53 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<form method="GET" action="">
<div class="row">
<div class="col">
<label for="vouchertypes">Voucher Type</label>
<select name="vouchertypes" id="vouchertypes" class="form-control">
<option value="">Choose Voucher Type</option>
<?php foreach ($VoucherTypes as $VoucherType) { ?>
<option value="<?php echo $VoucherType->vouchertype_id; ?>" <?php echo (isset($_GET['vouchertypes'])) ? (($VoucherType->vouchertype_id == $_GET['vouchertypes']) ? "SELECTED" : "") : "" ?>><?php echo $VoucherType->voucher_type; ?></option>
<?php }; ?>
</select>
</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> -->
<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-1"><?php createButton("show_voucher", "Show", "show_voucher", "Submit", "mt-30"); ?></div>
<div class="col-1"><?php createButton("show_voucher_reset", "Reset", "reset", site_url("accounts/vouchers/listvouchers"), "mt-30"); ?></div>
</div>
</form>
<div id="dataTable_Commands"></div>
<?php
$fromDate = isset($_GET['from_date']) ? NepaliToEnglishDate($_GET['from_date']) : NepaliToEnglishDate(firstDayOfNepaliMonth());
$toDate = isset($_GET['to_date']) ? NepaliToEnglishDate($_GET['to_date']) : Today();
// echo $toDate;
$account_id = isset($_GET['account_id']) ? $_GET['account_id'] : '';
$vouchertype_id = isset($_GET['vouchertypes']) ? $_GET['vouchertypes'] : '';
$this->myaccounts->listVouchers($fromDate, $toDate, $account_id, $vouchertype_id, true);
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,237 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if($VoucherType->voucher_options==""): ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount=$this->myaccounts->getAccountDetails($VoucherType->default_account);?>
<legend><?php echo $DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3">
<?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4">
<input type="text" name="narration" id="narration" class="form-control" /> </td>
<td class="col-1">
<input type="text" name="debit" id="debit" value="0" class="form-control" /> </td>
<td class="col-1">
<input type="button" class="btn btn-primary full-width" id="addrow" value="Add" /> </td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">
Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">
Total</th>
<td>
<div id="debitTotal">
</div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">
Save Voucher</button>
</form>
<?php else: ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,190 @@
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">
<?php echo $pageTitle; ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">
<a href="<?php echo base_url(); ?>">
Dashboard</a></li>
<li class="breadcrumb-item active">
<?php echo $pageTitle; ?></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">
<?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">
Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details">
<i class="fa fa-eye">
</i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">
Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">
Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1,12 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<?php $this->myaccounts->showvoucher($voucher_id); ?>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,177 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0">Create <?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<?php if($VoucherType->voucher_options==""): ?>
<form method=POST action="" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<div class="col-3">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date">
</fieldset>
</div>
<div class="col-3">
<fieldset>
<?php $DefaultAccount=$this->myaccounts->getAccountDetails($VoucherType->default_account);?>
<legend><?php echo $DefaultAccount->account_name; ?> Balance</legend><?php echo myCurrency($DefaultAccount->Balance); ?>
</fieldset>
</div>
<div class="col-3 offset-3">
<fieldset>
<legend>Voucher #</legend><input type="text" readonly class="form-control" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<div class="row">
<div class="col">
<fieldset>
<legend>Enter Transaction</legend>
<table id="EntryTable" class="table order-list">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td class="col-3"> <?php fillComboWithValue("account_id", "", "account_id", "tbl_accounts", "account_name", "account_id", "", "", "", "status=1"); ?> </td>
<td class="col-4"> <input type="text" name="narration" id="narration" class="form-control" /> </td>
<td class="col-1"> <input type="text" name="debit" id="debit" value="0" class="form-control" /> </td>
<td class="col-1"> <input type="button" class="btn btn-primary full-width" id="addrow" value="Add" /> </td>
</tr>
</tbody>
</table>
<div id="errorBox" class="alert alert-secondary hidden" role="alert">
<h5></h5>
</div>
</fieldset>
<div class="card card-primary card-outline">
<div class="card-header">Transaction List </div>
<div class="card-body">
<table id="myTable" class=" table order-list table-striped table-bordered">
<thead>
<tr>
<td>Account</td>
<td>Narration</td>
<td>Amount</td>
</tr>
</thead>
<tbody> </tbody>
<tfoot>
<tr>
<th colspan="2" class="text-right">Total</th>
<td>
<div id="debitTotal"></div>
</td>
<td>
</td>
</tr>
</tfoot>
</table>
</div>
</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 class="btn btn-primary" type="submit" id="saveButton" name="submit">Save Voucher</button>
</form>
<?php else: ?>
<?php echo $VoucherType->voucher_options; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var counter = 0;
$("#addrow").on("click", function() {
var msg = "Transaction Row Added !!";
if ($("#account_id").val() != "") {
if (!isAccountAdded($("#account_id").val())) {
if ($("#narration").val() != "") {
var debit = ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0);
if ($.isNumeric(debit)) {
if (debit > 0) {
addRow()
} else {
msg = "Amount contain some value";
}
} else {
msg = "Non numberic value entered in amount. ";
}
} else {
msg = "Narration can't be empty!";
}
} else {
msg = "Account already added in transactions";
}
} else {
msg = "Account Head Not Selected!";
}
$("#errorBox h5").html(msg);
$("#errorBox").fadeTo(2000, 500).slideUp(500, function() {
$("#errorBox").slideUp(500);
});
});
$("table.order-list").on("click", ".ibtnDel", function(event) {
$(this).closest("tr").remove();
calculateTotals();
});
});
function isAccountAdded(account_id) {
var arr = $('input[name="account_id[]"]').map(function() {
return this.value;
}).get();
if ($.inArray(account_id, arr) >= 0) return true;
else return false;
}
function addRow() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="hidden" class="form-control" name="account_ids[]" value="' + $("#account_id").val() + '"/><input type="text" readonly class="form-control" name="account_name[]" value="' + $("#account_id option:selected").text() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="narration[]" value="' + $("#narration").val() + '"/></td>';
cols += '<td><input type="text" readonly class="form-control" name="debit[]" value="' + ($.isNumeric($("#debit").val()) ? $("#debit").val() : 0) + '"/></td>';
cols += '<td><input type="button" class="ibtnDel btn btn-md btn-danger " value="Delete"></td>';
newRow.append(cols);
$("#myTable.order-list").append(newRow);
calculateTotals();
}
function calculateTotals() {
var debitTotal = 0;
var creditTotal = 0;
var balance = 0;
$("table.order-list").find('input[name^="debit[]"]').each(function() {
debitTotal += +$(this).val();
});
$("#debit").val(0);
$("#narration").val("");
$("#debitTotal").text(debitTotal.toFixed(2));
$("#balance").text(balance.toFixed(2));
$("#saveButton").prop("disabled", false);
}
$("#saveButton").prop("disabled", true);
</script>

View File

@@ -0,0 +1,137 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url("accounts/vouchers/".$VoucherType->voucher_alias."/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
</div>
<div class="card-body">
<?php $TableData = $Vouchers ?>
<table class="table table-bordered table-striped" id="voucherList">
<thead>
<tr>
<th>ID#</th>
<th>Voucher No</th>
<th>Voucher Date</th>
<th>Voucher Type</th>
<th>Voucher State</th>
<th class="table-col col-2">Action</th>
</tr>
</thead>
<tbody>
<?php $a=0; foreach ($TableData as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><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_no; ?></td>
<td><?php echo $TableRow->voucher_date; ?></td>
<td><?php echo $TableRow->voucher_type; ?></td>
<td><?php echo $TableRow->voucher_state; ?></td>
<td class="col-1">
<a onClick="javascript:showDetails(<?php echo $id; ?>);" class="btn btn-success btn-xs" title="View Details"><i class="fa fa-eye"></i></a>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<div class="modal fade" id="voucherdetails_box" tabindex="-1" role="dialog" aria-labelledby="voucherdetails_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">Voucher 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">
Voucher Details Goes Here
</div>
<div class="modal-footer">
<button type="button" onClick='reversalEntry()' id="reversalBtn" class="btn btn-secondary" data-dismiss="modal" data-id="">Revarsal Entry</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
success: function(data) {
$("#details_container").html(data);
$("#reversalBtn").data("id",id);
$("#voucherdetails_box").modal('show');
}
});
}
function reversalEntry()
{
var id=$("#reversalBtn").data("id");
if(confirm("Are you sure you want to post reversal for this voucher?"))
{
window.location="<?php echo site_url("accounts/vouchers/reversal/"); ?>"+id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
function footerfunctions()
{
?>
<script>
$(document).ready(function() {
var table = $('#voucherList').DataTable();
var tableRows = $('table#voucherList tbody').find('tr');
tableRows.each(function() {
async: false;
var jqueryRow = $(this);
var row = table.row(jqueryRow);
var id=$(this).data("id");
var Transactions="<table class='table table-resonsive'><tr><th>Account<\/th><th>Narration<\/th><th>Dr<\/th><th>Cr<\/th><\/tr><tr><td>Billable Projects<\/td><td>Website Development<\/td><td>50000<\/td><td>0<\/td><\/tr><tr><td>Larke Himal Jadibuti Udhyog<\/td><td>Website Development<\/td><td>0<\/td><td>50000<\/td><\/tr><\/table>";
Transactions=getVoucherDetails(id);
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
url: "<?php echo site_url("ajax/getVoucherDetailsTable/"); ?>" + id,
async: false,
success: function(data) {
$.data=data;
}
});
return ($.data);
}
</script>
<?php
}
?>

View File

@@ -0,0 +1 @@
<?php $this->myaccounts->showVoucher($Voucher->voucher_id); ?>