changes for bbnepal data
This commit is contained in:
parent
967642f2be
commit
318998d272
@ -12,7 +12,7 @@
|
||||
<div class="col-2">
|
||||
<fieldset>
|
||||
<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>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
@ -31,7 +31,7 @@
|
||||
<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"); ?>
|
||||
<?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>
|
||||
@ -98,10 +98,13 @@
|
||||
<td></td>
|
||||
</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">
|
||||
<input type="text" class="form-control" id="tax">
|
||||
<td></td>
|
||||
<input type="hidden" name="vat_checkbox_value" id="vat_checkbox_value" value="0">
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-right "><b>Grand Total Amount</b></td>
|
||||
@ -161,9 +164,12 @@
|
||||
calculateLineTotal($(this).closest("tr"));
|
||||
calculateTotals('amount');
|
||||
});
|
||||
|
||||
function updateSerialNumbers(){
|
||||
$('.purchase-detail').each(function(index){
|
||||
$(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;
|
||||
@ -183,7 +189,7 @@
|
||||
var counter = $('.sales-detail-duplicator').length;
|
||||
var currentRow = $(".sales-detail-duplicator").clone().show();
|
||||
$(document).on("click", ".add-row", function() {
|
||||
counter+=1;
|
||||
counter += 1;
|
||||
var newRow = currentRow.clone();
|
||||
newRow.find('.bbsn').text(counter);
|
||||
$("#salesDetails").append(newRow);
|
||||
@ -191,7 +197,7 @@
|
||||
// calculateTotals();
|
||||
});
|
||||
|
||||
$(document).on('change', '.select_item', function(){
|
||||
$(document).on('change', '.select_item', function() {
|
||||
|
||||
var selectedOption = $(this).find(':selected');
|
||||
var selectedValue = selectedOption.val();
|
||||
@ -200,7 +206,7 @@
|
||||
$.ajax({
|
||||
url: "<?php echo site_url("inventory/Sales/getunitbyitem/"); ?>" + selectedValue,
|
||||
async: true,
|
||||
dataType:"json",
|
||||
dataType: "json",
|
||||
method: 'POST',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
@ -229,7 +235,7 @@
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function calculateTotals(type='') {
|
||||
function calculateTotals(type = '') {
|
||||
var subtotal = 0;
|
||||
$(".sales-detail-duplicator").each(function() {
|
||||
var lineTotal = parseFloat($(this).find("input[name^='ltotal']").val());
|
||||
@ -239,18 +245,30 @@
|
||||
});
|
||||
var discountamount = 0;
|
||||
var discountpercent = 0;
|
||||
if(type=='amount'){
|
||||
var tax_percentage =0;
|
||||
if (type == 'amount') {
|
||||
discountamount = parseFloat($("input[name='discount']").val());
|
||||
discountpercent = (discountamount * 100) / subtotal;
|
||||
$("#discountpercentage").val(discountpercent.toFixed(2));
|
||||
} 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());
|
||||
discountamount = subtotal * (discountpercent/100);
|
||||
discountamount = subtotal * (discountpercent / 100);
|
||||
$("#discount").val(discountamount.toFixed(2));
|
||||
}
|
||||
|
||||
var taxable = subtotal - discountamount;
|
||||
var tax = taxable * 0.13;
|
||||
var tax = taxable * tax_percentage;
|
||||
var grandTotal = taxable + tax;
|
||||
$('#subtotal').val(subtotal.toFixed(2));
|
||||
|
||||
@ -258,6 +276,7 @@
|
||||
$('#tax').val(tax.toFixed(2));
|
||||
$('#grandtotal').val(grandTotal.toFixed(2));
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php function footerFunctions()
|
||||
@ -269,6 +288,6 @@
|
||||
minDate: $('#salesDate').data('start'),
|
||||
maxDate: $('#salesDate').data('end'),
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
Loading…
Reference in New Issue
Block a user