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,377 @@
<style>
table tr td {
border: 1px solid #ddd;
}
thead tr th {
border: 1px solid #ddd;
}
.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: left;
}
.form-control1 {
display: inline-block;
width: 25%;
height: calc(1.80rem + 2px);
/* padding: .375rem .75rem; */
font-size: 1rem;
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;
}
.form-control2 {
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;
}
.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;
}
.bbsn {
left: 50%;
top: 50%;
}
.br0 {
border: 0px;
}
</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">
<h5 class="m-0">Create <?php //echo $pageTitle;
?> <a href="<?php // echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/list");
?>" class="btn btn-sm btn-primary float-right">List <?php //echo $pageTitle;
?></a></h5>
</div> -->
<div class="card-body">
<form method="POST" action="<?php echo site_url("inventory/purchases/create"); ?>" enctype="multipart/form-data" name="tbl_purchases">
<div class="row mb-2">
<div class="col-2">
<fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control2 nepaliDatePicker" id="purchase_date" value="<?php echo NepaliDate(); ?>" name="purchase_date">
</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> Voucher No. #</legend><input type="text" readonly class="form-control2" id="voucher_no" value="<?php echo generateVoucherNo(); ?>" name="voucher_no">
</fieldset>
</div>
</div>
<fieldset>
<legend> Enter Transaction</legend>
<div class="row ">
<!--COL START-->
<div class="col-1">
<div class="form-group">
<label for="purchase_ref"><?php myLang('Ref. No.'); ?></label>
<input type="text" class="form-control DatePicker" id="purchase_ref" value="" name="purchase_ref">
</div>
</div>
<div class="col-5">
<?php $this->myaccounts->showAccountsCombo("accounts_id", "Account", "accounts_id", "accategory_id=30"); ?>
</div>
<div class="col-3">
</div>
<div class="col-2 mt-1">
<button type="button" class="btn btn-primary mt-4 addPurchaseDetail" id="addPurchaseDetail">Add Purchase</button>
</div>
<!--COL END-->
</div>
</fieldset>
<!-- Purchase Details Section -->
<div class="col-12 table-responsive p-0 mt-3">
<table class="table table-striped">
<thead>
<tr>
<th>S.No.</th>
<th>Items</th>
<th class="text-right">Qty</th>
<th class="text-right">Units</th>
<th class="text-right">Rate</th>
<th class="text-right">Amount</th>
<th></th>
</tr>
</thead>
<tbody class="purchase-details-section">
<tr class="purchase-detail">
<td class="text-center bbsn">1</td>
<td width=40%> <?php fillComboWithValue("item_id[]", "", "", "tbl_items", "title", "item_id"); ?></td>
<td width=10%> <input type="text" class="form-control input-group-sm" name="quantity[]"></td>
<td width=5%><input type="text" class="form-control" name="pcs/dozen/kgs" required> </td>
<td width=15%><input type="text" class="form-control" name="rate[]"></td>
<td width=15%><input type="text" class="form-control" name="total[]"></td>
<td width="5%">
<button type="button" class="btn btn-primary btn-xs addPurchaseDetail" id="addPurchaseDetail">
<i class="fa fa-plus"></i></button>
<button type="button" class="btn btn-danger btn-xs remove-purchase-detail">
<i class="fa fa-minus"></i>
</button>
<!-- <button type="button" class="btn btn-danger btn-sm remove-purchase-detail"></button></td> -->
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4" rowspan="5">In words: </td>
<td class="text-right "><b>Total Amount</b></td>
<td class="text-right">
<b><input type="text" class="form-control" name="subtotal" id="subtotal" /></b>
</td>
<td></td>
</tr>
<tr>
<td class="text-right">
<input class="form-control1" type="text" name="discountpercentage" id="discountpercentage" value="0" width="2%">
<b>% Discount</b></td>
<td class="text-right"><b><input type="text" class="form-control" name="discount" id="discount" /></b></td>
<td></td>
</tr>
<tr>
<td class="text-right "><b>Taxable Amount</b></td>
<td class="text-right"><b><input type="text" class="form-control" name="taxable" id="taxable" /></b></td>
<td></td>
</tr>
<tr>
<td class="text-right "><b>13% VAT</b></td>
<td class="text-right">
<input type="text" class="form-control" name="tax" id="tax" />
</td>
<td></td>
</tr>
<tr>
<td class="text-right "><b>Grand Total Amount</b></td>
<td class="text-right">
<input type="text" class="form-control" name="grand_total" id="grand_total" />
</td>
<td></td>
</tr>
</tfoot>
</table>
</div>
<div class="row mb-3">
<div class="col">
<textarea class="form-control2" rows="3" name="narration" id="narration" placeholder="Narration:"></textarea>
<!-- <input type="text" name="narration" id="narration" class="form-control" /> -->
</div>
</div>
<!-- <div class="col">
<div class="purchase-details-section">
<div class="">
<div class="row">
<div class="col">
Item
</div>
<div class="col">
Qty
</div>
<div class="col">
Rate
</div>
<div class="col">
Total
</div>
<div class="col">
</div>
</div>
</div>
<div class="purchase-detail">
<div class="row">
<div class="col">
<?php //fillComboWithValue("item_id[]", "", "", "tbl_items", "title", "item_id");
?>
</div>
<div class="col">
<div class="form-group">
<input type="text" class="form-control" name="quantity[]">
</div>
</div>
<div class="col">
<div class="form-group">
<input type="text" class="form-control" name="rate[]">
</div>
</div>
<div class="col">
<div class="form-group">
<input type="text" class="form-control" name="total[]">
</div>
</div>
<div class="col">
<button type="button" class="btn btn-danger remove-purchase-detail">Remove</button>
</div>
</div>
</div>
</div>
<div class="">
<div class="row">
<div class="col">
</div>
<div class="col">
</div>
<div class="col">
</div>
<div class="col">
Total: <input type="text" class="form-control" name="subtotal" id="subtotal" />
</div>
<div class="col">
</div>
</div>
</div>
<div class="">
<div class="row">
<div class="col">
</div>
<div class="col">
</div>
<div class="col">
</div>
<div class="col">
13% VAT: <input type="text" class="form-control" name="tax" id="tax" />
</div>
<div class="col">
</div>
</div>
</div>
<div class="">
<div class="row">
<div class="col">
</div>
<div class="col">
</div>
<div class="col">
</div>
<div class="col">
Discount: <input type="text" class="form-control" name="discount" id="discount" />
</div>
<div class="col">
</div>
</div>
</div>
<div class="">
<div class="row">
<div class="col">
</div>
<div class="col">
</div>
<div class="col">
</div>
<div class="col">
Grand Total <input type="text" class="form-control" name="grand_total" id="grand_total" />
</div>
<div class="col">
</div>
</div>
</div>
</div> -->
<!-- End Purchase Details Section -->
<div class="float-right">
<!-- <button type="reset" class="btn btn-default">Reset</button> -->
<button class="btn btn-primary" type="submit" name="submit">Save</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
// Clone purchase detail div
var purchaseDetailClone = $(".purchase-detail").clone().show();
// Add Purchase Detail
$(document).on("click", ".addPurchaseDetail", function() {
var newPurchaseDetail = purchaseDetailClone.clone();
$(".purchase-details-section").append(newPurchaseDetail);
});
// Remove Purchase Detail
$(document).on("click", ".remove-purchase-detail", function() {
$(this).closest(".purchase-detail").remove();
calculateTotals();
});
// Calculate totals on change of rate or quantity
$(document).on("change", ".purchase-detail input[name^='quantity'], .purchase-detail input[name^='rate']", function() {
calculateRowTotal($(this).closest(".purchase-detail"));
calculateTotals();
});
$(document).on("change", "input[name=discountpercentage]", function() {
calculateRowTotal($(this).closest(".purchase-detail"));
calculateTotals();
});
// Calculate row total
function calculateRowTotal(row) {
var quantity = parseFloat(row.find("input[name^='quantity']").val()) || 0;
var rate = parseFloat(row.find("input[name^='rate']").val()) || 0;
var total = quantity * rate;
row.find("input[name^='total']").val(total.toFixed(2));
}
// Calculate totals
function calculateTotals() {
var subtotal = 0;
$(".purchase-detail").each(function() {
var total = parseFloat($(this).find("input[name^='total']").val()) || 0;
subtotal += total;
});
var discountpercent = parseFloat($("input[name=discountpercentage]").val());
var discountamount = subtotal * (discountpercent/100);
var taxable = subtotal - discountamount;
var tax = taxable * 0.13;
var grandTotal = taxable + tax;
$("#subtotal").val(subtotal.toFixed(2));
$("#discount").val(discountamount.toFixed(2));
$("#taxable").val(taxable.toFixed(2));
$("#tax").val(tax.toFixed(2));
$("#grand_total").val(grandTotal.toFixed(2));
}
});
</script>

View File

@@ -0,0 +1,77 @@
<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; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?></h5>
</div>
<div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_purchases where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th><?php myLang('S.N'); ?></th>
<th><?php myLang('Date'); ?></th>
<th><?php myLang('Purchase Transaction'); ?></th>
<th><?php myLang('Amount'); ?></th>
<td><b>Action</b></th>
</tr>
</thead>
<tbody>
<?php $a = 0;
foreach ($PurchaseRecords as $TableRow) : $a++; ?>
<?php foreach ($TableRow as $cols) : $id = $cols;
break;
endforeach; ?><tr>
<td><?php echo $TableRow->purchase_ref; ?></td>
<td><?php echo $TableRow->purchase_date; ?></td>
<td><b><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></b>
<div class="row ml-2 mr-2" style="border-bottom: 1px solid;">
<span class="col item_name"><?php echo myLang("Particulars") ?></span>
<span class="col item_qty"><?php echo myLang("Qty") ?></span>
<span class="col item_rate"><?php echo myLang("Rate") ?></span>
<span class="col item_amount"><?php echo myLang("Amount") ?></span>
</div>
<?php $l = 0;
foreach ($TableRow->Details as $r) : $l += (($r->qty) * ($r->rate)); ?>
<div class="row ml-2 mr-2">
<span class="col item_name"><?php echo $r->Item->title; ?></span>
<span class="col item_qty"><?php echo $r->qty; ?></span>
<span class="col item_rate text-right"><?php echo myCurrency($r->rate, true); ?></span>
<span class="col item_amount text-right"><?php echo myCurrency($r->qty * $r->rate, true); ?></span>
</div>
<?php endforeach; ?>
<div class="row ml-2 mr-2" style="border-top: 1px dotted;">
<span class="col item_name">&nbsp;</span>
<span class="col item_qty">&nbsp;</span>
<span class="col item_rate text-right">Total:</span>
<span class="col item_amount"><?php echo myCurrency($l); ?></span>
</div>
</td>
<td><?php echo myCurrency($TableRow->TotalPurchase); ?></td>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
<?php showDeleteButton($id); ?>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<script>
function doDelete(id) {
if (confirm('Are you sure to delete?')) {
window.location = '<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/delete/"); ?>' + id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,52 @@
<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; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?></h5>
</div>
<div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_purchases where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th><?php myLang('S.N'); ?></th>
<th><?php myLang('Date'); ?></th>
<th><?php myLang('Purchase Transaction'); ?></th>
<th><?php myLang('Amount'); ?></th>
<td><b>Action</b></th>
</tr>
</thead>
<tbody>
<?php $a = 0;
foreach ($PurchaseRecords as $TableRow) : $a++;
$id = $TableRow->purchase_id; ?>
<tr>
<td><?php echo $TableRow->purchase_ref; ?></td>
<td><?php echo $TableRow->purchase_date; ?></td>
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></td>
<td><?php echo myCurrency($TableRow->TotalPurchase); ?></td>
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
<?php showDeleteButton($id); ?>
</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<script>
function doDelete(id) {
if (confirm('Are you sure to delete?')) {
window.location = '<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/delete/"); ?>' + id;
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,84 @@
<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; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5>
</div>
<div class="card-body">
<div class="row bill-header">
<div class="col text-center">
<h2>Purchase Details</h2>
</div>
</div>
<div class="row bill-details">
<div class="col">
<p><strong>Bill Number:</strong> <?php echo $Purchase->purchase_id; ?></p>
<p><strong>Date:</strong> <?php echo myDate($Purchase->purchase_date); ?></p>
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Purchase->accounts_id)->account_name; ?></p>
</div>
</div>
<div class="row bill-items">
<div class="col">
<div class="item-row">
<div class="row">
<div class="col">
<p><strong>Item</strong></p>
</div>
<div class="col">
<p><strong>Quantity</strong></p>
</div>
<div class="col">
<p><strong>Price</strong></p>
</div>
<div class="col">
<p><strong>Total</strong></p>
</div>
</div>
</div>
<?php $total=0; foreach($PurchaseDetails as $PurchaseDetail):?>
<div class="item-row">
<div class="row">
<div class="col">
<p><?php echo getFieldfromValue("tbl_items","title","item_id",$PurchaseDetail->items_id); ?></p>
</div>
<div class="col">
<p><?php $qty=$PurchaseDetail->qty; echo $qty; ?></p>
</div>
<div class="col">
<p><?php $rate=$PurchaseDetail->rate; echo myCurrency($rate); ?></p>
</div>
<div class="col">
<p><?php $ltotal=$rate*$qty; $total+=$ltotal; echo myCurrency($ltotal); ?></p>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="row bill-footer">
<div class="col text-right">
<p><strong>Subtotal:</strong> <?php echo myCurrency($total,true); ?></p>
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($total*13)/100,true); ?></p>
<p><strong>Total:</strong> <?php echo myCurrency(($total+$tax),true); ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>