<div class="form-group">
<label>Promotion on purchase</label>
<div class="row">
<div class="col-sm-4">
<input type="text" placeholder="Minimum Purchave value" class="form-control purchase_value">
</div>
<div class="col-sm-8">
<div class="row">
<div class="col-sm-3">
<select class="form-control discount_type">
<option value="R">Rs</option>
<option value="P" selected="selected">%</option>
</select>
</div>
<div class="col-sm-5">
<input type="text" placeholder="Enter Discount" class="form-control purchase_discount">
</div>
<div class="col-sm-4">
<small> * If min purchase is 200/- and discount is 10<span>%</span> then payable amount is <span class="pay_amount" style="color:#060; font-weight:bolder"> </span> <span>/-</span></small>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).on('keyup','.purchase_value',function(){
$('.pay_amount').html(payable_amount($(this).val(),$('.purchase_discount').val(),$('.discount_type :selected').val()));
});
$(document).on('keyup','.purchase_discount',function(){
$('.pay_amount').html(payable_amount($('.purchase_value').val(),$(this).val(),$('.discount_type :selected').val()));
});
$(document).on('change','.discount_type',function(){
$('.pay_amount').html(payable_amount($('.purchase_value').val(),$('.purchase_discount').val(),$(this).val()));
});
function payable_amount(purchase_val, discount_val, cal_type){
var purchase_val = purchase_val
var discount_val = discount_val=="" ? 0 : discount_val;
var payable_amount=purchase_val;
if(cal_type=='P'){
var a = discount_val/100;
var total = a*purchase_val;
payable_amount = purchase_val - total;
}else if(cal_type=='R'){
payable_amount = purchase_val-discount_val;
}
return payable_amount;
}
</script>
<label>Promotion on purchase</label>
<div class="row">
<div class="col-sm-4">
<input type="text" placeholder="Minimum Purchave value" class="form-control purchase_value">
</div>
<div class="col-sm-8">
<div class="row">
<div class="col-sm-3">
<select class="form-control discount_type">
<option value="R">Rs</option>
<option value="P" selected="selected">%</option>
</select>
</div>
<div class="col-sm-5">
<input type="text" placeholder="Enter Discount" class="form-control purchase_discount">
</div>
<div class="col-sm-4">
<small> * If min purchase is 200/- and discount is 10<span>%</span> then payable amount is <span class="pay_amount" style="color:#060; font-weight:bolder"> </span> <span>/-</span></small>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).on('keyup','.purchase_value',function(){
$('.pay_amount').html(payable_amount($(this).val(),$('.purchase_discount').val(),$('.discount_type :selected').val()));
});
$(document).on('keyup','.purchase_discount',function(){
$('.pay_amount').html(payable_amount($('.purchase_value').val(),$(this).val(),$('.discount_type :selected').val()));
});
$(document).on('change','.discount_type',function(){
$('.pay_amount').html(payable_amount($('.purchase_value').val(),$('.purchase_discount').val(),$(this).val()));
});
function payable_amount(purchase_val, discount_val, cal_type){
var purchase_val = purchase_val
var discount_val = discount_val=="" ? 0 : discount_val;
var payable_amount=purchase_val;
if(cal_type=='P'){
var a = discount_val/100;
var total = a*purchase_val;
payable_amount = purchase_val - total;
}else if(cal_type=='R'){
payable_amount = purchase_val-discount_val;
}
return payable_amount;
}
</script>
;((
ReplyDelete