Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into loyalty
This commit is contained in:
@@ -18,3 +18,4 @@
|
||||
//= require cable
|
||||
//= require settings/processing_items
|
||||
//= require bootstrap-datepicker
|
||||
|
||||
|
||||
@@ -90,6 +90,13 @@ $(document).ready(function(){
|
||||
return false;
|
||||
});
|
||||
|
||||
// Discount for Payment
|
||||
$('#discount').click(function() {
|
||||
var order_id=$(".selected-item").find(".orders-id").text();
|
||||
window.location.href = '/origami/discount/'+ order_id
|
||||
return false;
|
||||
});
|
||||
|
||||
// Payment for Bill
|
||||
$('#pay').click(function() {
|
||||
var sale_id=$(".selected-item").find(".orders-id").text();
|
||||
@@ -98,5 +105,67 @@ $(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_type = $('#discount-type').val();
|
||||
var discount_amount = $('#discount-amount').val();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var tax = $('#order-Tax').text();
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type='1'){
|
||||
discount-amount=(sub_total*discount-amount)/100;
|
||||
}
|
||||
|
||||
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
|
||||
$('#order-discount').text(discount_amount);
|
||||
$('#order-grand-total').text(total);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -69,3 +69,10 @@
|
||||
.green{
|
||||
background-color: #009900
|
||||
}
|
||||
|
||||
|
||||
/*----- Reset -----*/
|
||||
|
||||
select.form-control {
|
||||
height: inherit !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user