add override sale tax for member discount

This commit is contained in:
phyusin
2018-05-30 10:20:36 +06:30
parent fee2a0431f
commit a9070ebe0d
4 changed files with 8 additions and 7 deletions

View File

@@ -231,6 +231,7 @@ class Origami::DiscountsController < BaseOrigamiController
sale_id = params[:sale_id]
is_card = params[:is_card]
sub_total = params[:sub_total]
tax_type = params[:tax_type]
sale = Sale.find(sale_id)
if is_card == 'true'
is_card = true
@@ -306,7 +307,7 @@ class Origami::DiscountsController < BaseOrigamiController
if response["discount_bonus_earned"]
discount_amount = discount_amount + response["discount_bonus_earned"]
end
sale.compute_by_sale_items(sale_id, sale.sale_items, discount_amount, 'member_discount', order_source)
sale.compute_by_sale_items(sale_id, sale.sale_items, discount_amount, 'member_discount', order_source, tax_type)
result = {:status=> "Success",:title=>"Member Discount", :table_id => table_id,:table_type => table_type }
elsif response["status"] == "500"
result = {:status=> response["error"],:title=>"Alert", :table_id => table_id,:table_type => table_type }

View File

@@ -270,7 +270,7 @@ class SalePayment < ApplicationRecord
def self.get_sale_payments_by_card(sale_payments)
# Check for Card Payment
sale_payments.each do |sp|
if sp.payment_method == "jcb" || sp.payment_method == "mpu" || sp.payment_method == "visa" || sp.payment_method == "master"
if sp.payment_method == "jcb" || sp.payment_method == "mpu" || sp.payment_method == "visa" || sp.payment_method == "master" || sp.payment_method == "unionpay" || sp.payment_method == "alipay"
return true;
end
end

View File

@@ -39,7 +39,7 @@
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
// if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
if(payment_type) {
$(".others-payment").hide();
@@ -47,7 +47,7 @@
$("."+payment_type[i]).show();
});
}
}
// }
/* end check first bill or not*/
$('.others-payment').on('click',function(){

View File

@@ -762,7 +762,7 @@ var customer_name = "<%= @customer.name %>";
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : '';
if (credit <= 0) {
calculate_member_discount(sale_id);
calculate_member_discount(sale_id,tax_type);
}
$("#pdfModal").on('shown.bs.modal', function () {
@@ -1049,7 +1049,7 @@ var customer_name = "<%= @customer.name %>";
});
}
function calculate_member_discount(sale_id) {
function calculate_member_discount(sale_id,tax_type) {
var sub_total = $('#sub-total').text();
var member_id = $('#membership_id').text();
var member_discount = $('#member_discount').text();
@@ -1064,7 +1064,7 @@ var customer_name = "<%= @customer.name %>";
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':cashier_type },
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':cashier_type, 'tax_type':tax_type },
async: false,
success:function(result){
}