check Add oth charges data

This commit is contained in:
phyusin
2017-12-21 18:04:27 +06:30
parent 43b8fffc11
commit a3e15bf68c

View File

@@ -96,7 +96,8 @@
<div class="form-horizontal">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="bottom-5">
<input type="text" id="other-charges-amount" name="other-charges-amount" class="form-control" placeholder="Amount" />
<input type="text" id="other-charges-amount" name="other-charges-amount" class="form-control" placeholder="Amount" onkeypress="return isNumberKey(event);" />
<br><span id="other-charges-amountErr" style="color:red;"></span>
</div>
<div class="bottom-5">
<textarea id="reasons" name="reasons" rows="2" class="form-control" placeholder="Reasons"></textarea>
@@ -278,12 +279,19 @@
if ($("#is_taxable:checked").length > 0) {
is_taxable = 1
}
$("#other-charges-amountErr").html("");
if(charge_amount != ""){
$("#other-charges-amount").val("");
$("#reasons").val("");
// Update sub total
$('#order-sub-total').text(parseFloat(sub_total) + parseFloat(charge_amount));
// Update sub total
$('#order-sub-total').text(parseFloat(sub_total) + parseFloat(charge_amount));
var item_row = item_row_template(sale_id, charge_amount, reasons, is_taxable);
$("#order-items-table tbody").append(item_row);
var item_row = item_row_template(sale_id, charge_amount, reasons, is_taxable);
$("#order-items-table tbody").append(item_row);
}
else{
$("#other-charges-amountErr").html("can't be blank");
}
});
// Calculate Other Charges for Payment
@@ -361,4 +369,13 @@
return item_row;
}
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
} else {
return true;
}
}
</script>