editing discout

This commit is contained in:
Yan
2017-06-08 15:21:53 +06:30
parent c7aac7c2b8
commit 9866acf198
4 changed files with 151 additions and 69 deletions

View File

@@ -105,5 +105,61 @@ $(document).ready(function(){
});
});
/* For Receipt - discount or tax */
$(document).on('click', '.cashier_number', function(event){
if(event.handled !== true) {
var original_value=0;
original_value = $('#discount-amount').val();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('#discount-amount').val(input_value);
update_balance();
}
else{
$('#discount-amount').val(original_value + '' + input_value);
update_balance();
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#discount-amount').val(amount);
update_balance();
break;
case 'del' :
var discount_text=$('#discount-amount').val();
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
update_balance();
break;
case 'clr':
$('#discount-amount').val("0.0");
update_balance();
break;
}
event.handled = true;
} else {
return false;
}
});
function update_balance(){
var discount_amount = $('#discount-amount').val();
var sub_total = $('#order-sub-total').text();
var tax = $('#order-Tax').text();
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
$('#order-discount').text(discount_amount);
$('#order-grand-total').text(total);
}

View File

@@ -69,3 +69,10 @@
.green{
background-color: #009900
}
/*----- Reset -----*/
select.form-control {
height: inherit !important;
}