- no tax after edit, discount, other charges
- redirect after discount, edit and other changes
This commit is contained in:
DevTeam
2025-07-04 16:34:00 +06:30
parent f003900fee
commit 04e03896b9
5 changed files with 45 additions and 79 deletions

View File

@@ -40,7 +40,7 @@
<tbody>
<% sub_total = 0 %>
<% @sale_data.sale_items.includes(:discount_item).each do |sale_item| %>
<% sub_total += sale_item.qty * sale_item.unit_price %>
<% sub_total += sale_item.status == "Discount"? sale_item.price : sale_item.qty * sale_item.unit_price %>
<% if sale_item.price > 0 && sale_item.status.blank? %>
<tr class="item-row item" id="<%= sale_item.sale_item_id %>"
data-account-type="<%=sale_item.account_id%>"
@@ -271,6 +271,8 @@
var precision = <%= precision %>;
var originalAmount = totalAmount;
var originalDiscount = totalDiscount;
var queryParams = new URLSearchParams(window.location.search)
$(document).ready(function(){
setHeaderBreadCrumb(_DISCOUNTS_);
/* check webview loaded*/
@@ -281,17 +283,10 @@
var id = $("#table_id").text();
var type = $("#table_type").text();
var sale_id = $('#sale-id').text();
if (cashier_type=="quick_service" || cashier_type=="food_court") {
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
} else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
} else if (cashier_type == 'food_court_qr') {
window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
}
else{
if (type=="Table") {
window.location.href = '/foodcourt/table/'+id
}else{
window.location.href = '/foodcourt/room/'+id
}
}
})
@@ -488,12 +483,7 @@
var sub_total = totalAmount;
var ajax_url = "/foodcourt/" + sale_id + "/discount";
if (cashier_type == "food_court_qr") {
var c_type = "food_court";
var params = { 'cashier_type' : c_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
}else{
var params = { 'cashier_type' : cashier_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
}
var params = { 'cashier_type' : cashier_type, 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount };
$.ajax({
type: "POST",
@@ -505,18 +495,11 @@
title: "Information!",
text: result.status,
}, function () {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else if(cashier_type == "food_court_qr") {
window.location.href = '/foodcourt/'+sale_id+'/qrpay/precreate';
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
}
else{
if(result.table_type == "Table"){
window.location.href = "/foodcourt/table/" + result.table_id
}
else {
window.location.href = "/foodcourt/room/" + result.table_id
}
else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
});
}
@@ -554,15 +537,11 @@
text: result.status,
type: "success",
}, function () {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
}
else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
window.location.href = "/foodcourt/table/" + result.table_id
}
else {
window.location.href = "/foodcourt/room/" + result.table_id
}
}
});
}
@@ -581,15 +560,11 @@
text: result.status,
type: "success",
}, function () {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
if (cashier_type=="food_court" && queryParams.get('payment_type') == 'qr') {
window.location.href = '/foodcourt/'+sale_id+'/'+'qrpay/precreate';
}
else if(cashier_type == "food_court") {
window.location.href = '/foodcourt/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
window.location.href = "/foodcourt/table/" + result.table_id
}
else {
window.location.href = "/foodcourt/room/" + result.table_id
}
}
});
}