commitall
This commit is contained in:
207
account/application/views/inventory/sales/create.php
Normal file
207
account/application/views/inventory/sales/create.php
Normal file
@ -0,0 +1,207 @@
|
||||
<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-body">
|
||||
<form id="salesForm" method="post" action="<?php echo site_url("inventory/sales/store"); ?>">
|
||||
<input type="hidden" class="form-control" id="transactionType" name="transactionType" value="Sales Entry">
|
||||
<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="salesDate" value="<?php echo NepaliDate(); ?>" name="salesDate" 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> 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="form-row mb-2">
|
||||
<div class="form-group col">
|
||||
<?php $this->myaccounts->showAccountsCombo("accounts_id", " Account <span class='text-danger'>*</span>", "accounts_id", "accategory_id=4","required"); ?>
|
||||
</div>
|
||||
<!-- <div class="form-group col">
|
||||
<label for="salesDate">Sales Date:</label>
|
||||
<input type="text" class="form-control" id="salesDate" name="salesDate">
|
||||
</div> -->
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">Sales Details</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th width=50%>Items <span class="text-danger">*</span></th>
|
||||
<th class="text-center" width=5%>Qty <span class="text-danger">*</span></th>
|
||||
<th class="text-center" width=5%>Units</th>
|
||||
<th class="text-center" width=13%>Rate <span class="text-danger">*</span></th>
|
||||
<th class="text-right" width=20%>Amount</th>
|
||||
<th width=5%></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="salesDetails">
|
||||
<tr class="sales-detail-duplicator">
|
||||
|
||||
<td> <select name="item_id[]" class="form-control" required>
|
||||
<option value="">Select Item</option>
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<option value="<?php echo $item->item_id; ?>" required><?php echo $item->title; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select></td>
|
||||
<td> <input type="text" class="form-control input-group-sm" name="qty[]" required></td>
|
||||
<td><input type="text" class="form-control" name="pcs/dozen/kgs" required> </td>
|
||||
<td><input type="text" class="form-control" name="rate[]" required></td>
|
||||
<td><input type="text" class="form-control" name="ltotal[]" required></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary btn-xs add-row">
|
||||
<i class="fa fa-plus"></i></button>
|
||||
<button type="button" class="btn btn-danger btn-xs remove-sales-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="3" 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="5" width="2%"> <b>% Discount</b>
|
||||
</td>
|
||||
<td class="text-right"><b> <input type="text" class="form-control" 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" 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" id="tax">
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right "><b>Grand Total Amount</b></td>
|
||||
<td class="text-right">
|
||||
<input type="text" class="form-control" id="grandtotal">
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Sales Details Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<textarea class="form-control" rows="3" name="narration" id="narration" placeholder="Narration:"></textarea>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">
|
||||
<label for="remarks">Remarks:</label>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"></textarea>
|
||||
</div> -->
|
||||
<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>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).on("click", ".remove-sales-detail", function() {
|
||||
if ($("#salesDetails tr").length > 1) {
|
||||
$(this).closest("tr").remove();
|
||||
calculateTotals();
|
||||
}
|
||||
|
||||
});
|
||||
$(document).on('input', '.sales-detail-duplicator input[name^="qty"], .sales-detail-duplicator input[name^="rate"]', function() {
|
||||
calculateLineTotal($(this).closest('tr'));
|
||||
calculateTotals();
|
||||
});
|
||||
|
||||
$(document).on("change", "input[name=discountpercentage]", function() {
|
||||
calculateLineTotal($(this).closest("tr"));
|
||||
calculateTotals();
|
||||
});
|
||||
|
||||
function calculateLineTotal(row) {
|
||||
var quantity = parseFloat(row.find('input[name^="qty"]').val());
|
||||
var rate = parseFloat(row.find('input[name^="rate"]').val());
|
||||
if (!isNaN(quantity) && !isNaN(rate)) {
|
||||
var lineTotal = quantity * rate;
|
||||
row.find("input[name^='ltotal[]']").val(lineTotal.toFixed(2));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$(document).ready(function() {
|
||||
var currentRow = $(".sales-detail-duplicator").clone().show();
|
||||
$(document).on("click", ".add-row", function() {
|
||||
var newRow = currentRow.clone();
|
||||
$("#salesDetails").append(newRow);
|
||||
// newRow.find('.select2').select2();
|
||||
// calculateTotals();
|
||||
});
|
||||
// $(document).on("click", ".remove-sales-detail", function() {
|
||||
// $(this).closest(".sales-detail").remove();
|
||||
// calculateTotals();
|
||||
// });
|
||||
// $(document).on('input', 'input[name="qty[]"], input[name="rate[]"]', function() {
|
||||
// calculateTotals();
|
||||
// });
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function calculateTotals() {
|
||||
var subtotal = 0;
|
||||
$(".sales-detail-duplicator").each(function() {
|
||||
var lineTotal = parseFloat($(this).find("input[name^='ltotal']").val());
|
||||
if ((!isNaN(lineTotal))) {
|
||||
subtotal += lineTotal;
|
||||
}
|
||||
});
|
||||
|
||||
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));
|
||||
$('#grandtotal').val(grandTotal.toFixed(2));
|
||||
}
|
||||
</script>
|
71
account/application/views/inventory/sales/list.php
Normal file
71
account/application/views/inventory/sales/list.php
Normal file
@ -0,0 +1,71 @@
|
||||
<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($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php $TableData = $this->db->query("select * from tbl_sales where status=1")->result(); ?>
|
||||
<table class="table table-bordered table-striped dataTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-col col-1"><?php myLang('Sales Voucher #'); ?></th>
|
||||
<th width="10%"><?php myLang('Date'); ?></th>
|
||||
<th><?php myLang('Transaction'); ?></th>
|
||||
<th class="table-col col-1"><?php myLang('Amount'); ?></th>
|
||||
<th class="table-col col-1"><?php myLang('Action'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($SalesRecords as $TableRow) : ?>
|
||||
<tr>
|
||||
<td><?php echo $TableRow->sales_id; ?></td>
|
||||
<td><?php echo $TableRow->sales_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"> </span>
|
||||
<span class="col item_qty"> </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->totalsales); ?></td>
|
||||
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?>
|
||||
<?php showDeleteButton($TableRow->sales_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>
|
52
account/application/views/inventory/sales/register.php
Normal file
52
account/application/views/inventory/sales/register.php
Normal 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; ?> <a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php $TableData = $this->db->query("select * from tbl_sales where status=1")->result(); ?>
|
||||
<table class="table table-bordered table-striped dataTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-col col-1"><?php myLang('Sales Voucher #'); ?></th>
|
||||
<th width="10%"><?php myLang('Date'); ?></th>
|
||||
<th><?php myLang('Transaction'); ?></th>
|
||||
<th class="table-col col-1"><?php myLang('Amount'); ?></th>
|
||||
<th class="table-col col-1"><?php myLang('Action'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($SalesRecords as $TableRow) : ?>
|
||||
<tr>
|
||||
<td><?php echo $TableRow->sales_id; ?></td>
|
||||
<td><?php echo $TableRow->sales_date; ?></td>
|
||||
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?>
|
||||
|
||||
|
||||
</td>
|
||||
<td><?php echo myCurrency($TableRow->totalsales); ?></td>
|
||||
<td><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?>
|
||||
<?php showDeleteButton($TableRow->sales_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>
|
84
account/application/views/inventory/sales/view.php
Normal file
84
account/application/views/inventory/sales/view.php
Normal 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; ?> <a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row bill-header">
|
||||
<div class="col text-center">
|
||||
<h2>Sales Details</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bill-details">
|
||||
<div class="col">
|
||||
<p><strong>Bill Number:</strong> <?php echo $Sales->sales_id; ?></p>
|
||||
<p><strong>Date:</strong> <?php echo myDate($Sales->sales_date); ?></p>
|
||||
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Sales->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($SalesDetails as $SalesDetail): if($SalesDetail->items_id!=""):?>
|
||||
<div class="item-row">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p><?php echo getFieldfromValue("tbl_items","title","item_id",$SalesDetail->items_id); ?></p>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p><?php $qty=$SalesDetail->qty; echo $qty; ?></p>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p><?php $rate=$SalesDetail->rate; echo myCurrency($rate); ?></p>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p><?php $ltotal=$rate*$qty; $total+=$ltotal; echo myCurrency($ltotal); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; 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>
|
Reference in New Issue
Block a user