Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into ui_ux_changes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
class Origami::AddordersController < BaseOrigamiController
|
||||
# before_action :set_dining, only: [:detail]
|
||||
|
||||
def index
|
||||
@@ -161,10 +161,15 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
|
||||
# Order.send_customer_view(@booking)
|
||||
|
||||
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
||||
if @status && @booking && @order.source == 'quick_service'
|
||||
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||
# for second display
|
||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale"
|
||||
result = {:status=> @status, :data => @sale }
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
@@ -93,9 +93,6 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@account_arr = Array.new
|
||||
if @customer.tax_profiles
|
||||
accounts = @customer.tax_profiles
|
||||
puts accounts.to_json
|
||||
puts "sssssssssss"
|
||||
puts @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
|
||||
@@ -228,6 +228,23 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@individual_total.push({'total_customer' => saleObj.equal_persons.to_i, 'per_person_amount' => per_person_amount.to_f })
|
||||
end
|
||||
|
||||
# rounding adjustment
|
||||
# if @shop.is_rounding_adj
|
||||
# a = saleObj.grand_total % 25 # Modulus
|
||||
# b = saleObj.grand_total / 25 # Division
|
||||
# #not calculate rounding if modulus is 0 and division is even
|
||||
# #calculate rounding if modulus is zero or not zero and division are not even
|
||||
# if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
# @rounding_adj = new_total-saleObj.grand_total
|
||||
# else
|
||||
# @rounding_adj = @sale_data.rounding_adjustment
|
||||
# end
|
||||
# else
|
||||
# @rounding_adj = @sale_data.rounding_adjustment
|
||||
# end
|
||||
#end rounding adjustment
|
||||
|
||||
# rounding adjustment
|
||||
if @shop.is_rounding_adj
|
||||
a = saleObj.grand_total % 25 # Modulus
|
||||
@@ -237,6 +254,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
@rounding_adj = new_total-saleObj.grand_total
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
|
||||
else
|
||||
@rounding_adj = @sale_data.rounding_adjustment
|
||||
end
|
||||
|
||||
23
app/controllers/origami/second_display_controller.rb
Normal file
23
app/controllers/origami/second_display_controller.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
class Origami::SecondDisplayController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
def customer_view
|
||||
if params[:status]!= "billed"
|
||||
tax_profiles = TaxProfile.all.order("order_by asc")
|
||||
else
|
||||
tax_profiles = nil
|
||||
end
|
||||
|
||||
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status]
|
||||
end
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -46,6 +46,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
new_total = Sale.get_rounding_adjustment(sale.grand_total)
|
||||
sale.rounding_adjustment = new_total-sale.grand_total
|
||||
sale.update_attributes(grand_total: new_total,old_grand_total: sale.grand_total,rounding_adjustment:sale.rounding_adjustment)
|
||||
end
|
||||
end
|
||||
#end rounding adjustment
|
||||
|
||||
Reference in New Issue
Block a user