changes for bbnepal data
This commit is contained in:
parent
967642f2be
commit
318998d272
@ -12,11 +12,11 @@
|
|||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Transaction Date <span class="text-danger">*</span></legend>
|
<legend>Transaction Date <span class="text-danger">*</span></legend>
|
||||||
<input type="text" class="form-control2" id="salesDate" value="<?php echo NepaliDate(); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" name="salesDate" required>
|
<input type="text" class="form-control2" id="salesDate" value="<?php echo NepaliDate(); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" name="salesDate" required>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<h1 class="text-center"><?php echo $pageTitle; ?> Voucher</h1>
|
<h1 class="text-center"><?php echo $pageTitle; ?> Voucher</h1>
|
||||||
<!-- <fieldset>
|
<!-- <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>
|
<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> -->
|
</fieldset> -->
|
||||||
@ -31,7 +31,7 @@
|
|||||||
<legend> Enter Transaction </legend>
|
<legend> Enter Transaction </legend>
|
||||||
<div class="form-row mb-2">
|
<div class="form-row mb-2">
|
||||||
<div class="form-group col">
|
<div class="form-group col">
|
||||||
<?php $this->myaccounts->showAccountsCombo("accounts_id", " Account <span class='text-danger'>*</span>", "accounts_id", "accategory_id=4","required"); ?>
|
<?php $this->myaccounts->showAccountsCombo("accounts_id", " Account <span class='text-danger'>*</span>", "accounts_id", "accategory_id=4", "required"); ?>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="form-group col">
|
<!-- <div class="form-group col">
|
||||||
<label for="salesDate">Sales Date:</label>
|
<label for="salesDate">Sales Date:</label>
|
||||||
@ -98,10 +98,13 @@
|
|||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-right "><b>13% VAT</b></td>
|
<td class="text-right"><b><input type="checkbox" name="vat_checkbox" id="vat_checkbox"
|
||||||
|
>13% VAT</b></td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<input type="text" class="form-control" id="tax">
|
<input type="text" class="form-control" id="tax">
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<input type="hidden" name="vat_checkbox_value" id="vat_checkbox_value" value="0">
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-right "><b>Grand Total Amount</b></td>
|
<td class="text-right "><b>Grand Total Amount</b></td>
|
||||||
@ -142,7 +145,7 @@
|
|||||||
$(document).on("click", ".remove-sales-detail", function() {
|
$(document).on("click", ".remove-sales-detail", function() {
|
||||||
if ($("#salesDetails tr").length > 1) {
|
if ($("#salesDetails tr").length > 1) {
|
||||||
$(this).closest("tr").remove();
|
$(this).closest("tr").remove();
|
||||||
updateSerialNumbers();
|
updateSerialNumbers();
|
||||||
calculateTotals();
|
calculateTotals();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,22 +156,25 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("change", "input[name=discountpercentage]", function() {
|
$(document).on("change", "input[name=discountpercentage]", function() {
|
||||||
calculateLineTotal($(this).closest("tr"));
|
calculateLineTotal($(this).closest("tr"));
|
||||||
calculateTotals();
|
calculateTotals();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("change", "input[name=discount]", function() {
|
$(document).on("change", "input[name=discount]", function() {
|
||||||
calculateLineTotal($(this).closest("tr"));
|
calculateLineTotal($(this).closest("tr"));
|
||||||
calculateTotals('amount');
|
calculateTotals('amount');
|
||||||
});
|
});
|
||||||
|
$(document).on("change", "input[name=vat_checkbox]", function() {
|
||||||
|
calculateLineTotal($(this).closest("tr"));
|
||||||
|
calculateTotals('vat');
|
||||||
|
});
|
||||||
|
function updateSerialNumbers() {
|
||||||
|
$('.purchase-detail').each(function(index) {
|
||||||
|
$(this).find('.bbsn').text(index + 1);
|
||||||
|
})
|
||||||
|
counter = $('.purchase-detail').length;
|
||||||
|
}
|
||||||
|
|
||||||
function updateSerialNumbers(){
|
|
||||||
$('.purchase-detail').each(function(index){
|
|
||||||
$(this).find('.bbsn').text(index + 1);
|
|
||||||
})
|
|
||||||
counter = $('.purchase-detail').length;
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculateLineTotal(row) {
|
function calculateLineTotal(row) {
|
||||||
var quantity = parseFloat(row.find('input[name^="qty"]').val());
|
var quantity = parseFloat(row.find('input[name^="qty"]').val());
|
||||||
var rate = parseFloat(row.find('input[name^="rate"]').val());
|
var rate = parseFloat(row.find('input[name^="rate"]').val());
|
||||||
@ -183,7 +189,7 @@
|
|||||||
var counter = $('.sales-detail-duplicator').length;
|
var counter = $('.sales-detail-duplicator').length;
|
||||||
var currentRow = $(".sales-detail-duplicator").clone().show();
|
var currentRow = $(".sales-detail-duplicator").clone().show();
|
||||||
$(document).on("click", ".add-row", function() {
|
$(document).on("click", ".add-row", function() {
|
||||||
counter+=1;
|
counter += 1;
|
||||||
var newRow = currentRow.clone();
|
var newRow = currentRow.clone();
|
||||||
newRow.find('.bbsn').text(counter);
|
newRow.find('.bbsn').text(counter);
|
||||||
$("#salesDetails").append(newRow);
|
$("#salesDetails").append(newRow);
|
||||||
@ -191,8 +197,8 @@
|
|||||||
// calculateTotals();
|
// calculateTotals();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('change', '.select_item', function(){
|
$(document).on('change', '.select_item', function() {
|
||||||
|
|
||||||
var selectedOption = $(this).find(':selected');
|
var selectedOption = $(this).find(':selected');
|
||||||
var selectedValue = selectedOption.val();
|
var selectedValue = selectedOption.val();
|
||||||
var unitInput = $(this).closest('.sales-detail-duplicator').find('.item_unit');
|
var unitInput = $(this).closest('.sales-detail-duplicator').find('.item_unit');
|
||||||
@ -200,7 +206,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: "<?php echo site_url("inventory/Sales/getunitbyitem/"); ?>" + selectedValue,
|
url: "<?php echo site_url("inventory/Sales/getunitbyitem/"); ?>" + selectedValue,
|
||||||
async: true,
|
async: true,
|
||||||
dataType:"json",
|
dataType: "json",
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
@ -218,7 +224,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// $(document).on("click", ".remove-sales-detail", function() {
|
// $(document).on("click", ".remove-sales-detail", function() {
|
||||||
// $(this).closest(".sales-detail").remove();
|
// $(this).closest(".sales-detail").remove();
|
||||||
// calculateTotals();
|
// calculateTotals();
|
||||||
@ -229,7 +235,7 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function calculateTotals(type='') {
|
function calculateTotals(type = '') {
|
||||||
var subtotal = 0;
|
var subtotal = 0;
|
||||||
$(".sales-detail-duplicator").each(function() {
|
$(".sales-detail-duplicator").each(function() {
|
||||||
var lineTotal = parseFloat($(this).find("input[name^='ltotal']").val());
|
var lineTotal = parseFloat($(this).find("input[name^='ltotal']").val());
|
||||||
@ -239,36 +245,49 @@
|
|||||||
});
|
});
|
||||||
var discountamount = 0;
|
var discountamount = 0;
|
||||||
var discountpercent = 0;
|
var discountpercent = 0;
|
||||||
if(type=='amount'){
|
var tax_percentage =0;
|
||||||
|
if (type == 'amount') {
|
||||||
discountamount = parseFloat($("input[name='discount']").val());
|
discountamount = parseFloat($("input[name='discount']").val());
|
||||||
discountpercent = (discountamount * 100) / subtotal;
|
discountpercent = (discountamount * 100) / subtotal;
|
||||||
$("#discountpercentage").val(discountpercent.toFixed(2));
|
$("#discountpercentage").val(discountpercent.toFixed(2));
|
||||||
}else{
|
} else if(type == 'vat'){
|
||||||
|
checkBox = $("input[name='vat_checkbox_value']").val();
|
||||||
|
if(checkBox == "0"){
|
||||||
|
// if(checkBox){
|
||||||
|
tax_percentage= 0.13;
|
||||||
|
$("input[name='vat_checkbox_value']").val('13');
|
||||||
|
}else{
|
||||||
|
tax_percentage =0;
|
||||||
|
$("input[name='vat_checkbox_value']").val('0');
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else {
|
||||||
discountpercent = parseFloat($("input[name='discountpercentage']").val());
|
discountpercent = parseFloat($("input[name='discountpercentage']").val());
|
||||||
discountamount = subtotal * (discountpercent/100);
|
discountamount = subtotal * (discountpercent / 100);
|
||||||
$("#discount").val(discountamount.toFixed(2));
|
$("#discount").val(discountamount.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
var taxable = subtotal - discountamount;
|
var taxable = subtotal - discountamount;
|
||||||
var tax = taxable * 0.13;
|
var tax = taxable * tax_percentage;
|
||||||
var grandTotal = taxable + tax;
|
var grandTotal = taxable + tax;
|
||||||
$('#subtotal').val(subtotal.toFixed(2));
|
$('#subtotal').val(subtotal.toFixed(2));
|
||||||
|
|
||||||
$("#taxable").val(taxable.toFixed(2));
|
$("#taxable").val(taxable.toFixed(2));
|
||||||
$('#tax').val(tax.toFixed(2));
|
$('#tax').val(tax.toFixed(2));
|
||||||
$('#grandtotal').val(grandTotal.toFixed(2));
|
$('#grandtotal').val(grandTotal.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php function footerFunctions()
|
<?php function footerFunctions()
|
||||||
{ ?>
|
{ ?>
|
||||||
<script>
|
<script>
|
||||||
$("#salesDate").nepaliDatePicker({
|
$("#salesDate").nepaliDatePicker({
|
||||||
dateFormat: "%y-%m-%d",
|
dateFormat: "%y-%m-%d",
|
||||||
closeOnDateSelect: true,
|
closeOnDateSelect: true,
|
||||||
minDate: $('#salesDate').data('start'),
|
minDate: $('#salesDate').data('start'),
|
||||||
maxDate: $('#salesDate').data('end'),
|
maxDate: $('#salesDate').data('end'),
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php } ?>
|
<?php } ?>
|
Loading…
x
Reference in New Issue
Block a user