request bill error on promotion. fix for compute sale's totals on promotion.

This commit is contained in:
Thein Lin Kyaw
2019-11-08 20:35:26 +06:30
parent 1e2ff8b1be
commit 8046b7210b
13 changed files with 117 additions and 127 deletions

View File

@@ -48,44 +48,44 @@ class Origami::CustomersController < BaseOrigamiController
def add_customer
@webview = false
if check_mobile
@webview = true
@webview = true
end
@sale_id = params[:sale_id]
@cashier_type = params[:type]
@page = params[:dir_page]
if(@sale_id[0,3] == "SAL")
@booking = Booking.find_by_sale_id(@sale_id)
if @booking.dining_facility_id.to_i > 0
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
else
@dining_facility = nil
@dining_facility = nil
end
else
@booking_order = BookingOrder.find_by_order_id(@sale_id)
@booking = Booking.find(@booking_order.booking_id)
if @booking.dining_facility_id.to_i > 0
@dining_facility = DiningFacility.find(@booking.dining_facility_id)
else
@dining_facility = nil
@dining_facility = nil
end
end
end
filter = params[:filter]
if filter.nil?
@crm_customers = Customer.order("customer_id") #.page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5)
else
@crm_customers = Customer.search(filter)
@crm_customers = Customer.search(filter)
end
#@crm_customers = Customer.all
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(20)
@crm_customer = Customer.new
@count_customer = Customer.count_customer
# @taxes = TaxProfile.where(:group_type => 'cashier')
@taxes = TaxProfile.unscoped.select("id, (CONCAT(name,'(',(SELECT name FROM lookups WHERE lookup_type='tax_profiles' AND value=group_type),')')) as name")
.order("group_type ASC,order_by ASC")
@@ -100,7 +100,7 @@ class Origami::CustomersController < BaseOrigamiController
lookup_customer = Lookup.collection_of('customer_settings')
if !lookup_customer.empty?
lookup_customer.each do |create_setting|
if create_setting[0].downcase == "create"
if create_setting[0].downcase == "create"
if create_setting[1] == '0' && current_login_employee.role == 'cashier'
@create_flag = false
end
@@ -154,13 +154,13 @@ class Origami::CustomersController < BaseOrigamiController
if status == true
render json: JSON.generate({:status => true})
if(id == "SAL")
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount, nil, order_source)
end
sale.compute_by_sale_items(sale.total_discount, nil, order_source)
end
else
render json: JSON.generate({:status => false, :error_message => "Record not found"})
end
end
def send_account
amount = params[:amount]
account_no = params[:account_no]