diff --git a/app/controllers/api/restaurant/menu_controller.rb b/app/controllers/api/restaurant/menu_controller.rb index f6a43514..47a3703c 100755 --- a/app/controllers/api/restaurant/menu_controller.rb +++ b/app/controllers/api/restaurant/menu_controller.rb @@ -9,7 +9,7 @@ class Api::Restaurant::MenuController < Api::ApiController all_menu = Menu.all @request_url = '' if ENV["SERVER_MODE"] == "cloud" - @request_url = request.subdomain + "." + request.domain #local_url => 'http://0.0.0.0:3000' + @request_url = request.base_url end # to hash menu_array = [] diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index 2e43da0b..19d5720a 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -27,7 +27,8 @@ authorize_resource :class => false payment_type = params[:payment_type] @sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type) @sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type) - @tax_profiles = TaxProfile.where('group_type = "cashier"').order('order_by asc').limit(2) + @tax_profiles = TaxProfile.group('name').order('order_by asc') #.limit(2) + @from = from @to = to # get printer info diff --git a/app/models/sale.rb b/app/models/sale.rb index 7ceecebd..24d3f81c 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -51,7 +51,7 @@ class Sale < ApplicationRecord if !charges.nil? block_count, diningprice = DiningCharge.amount_calculate(charges, booking.checkin_at, booking.checkout_at) dining_time = booking.checkin_at.strftime('%H:%M %p').to_s + " - " + booking.checkout_at.strftime('%H:%M %p').to_s - create_saleitem_diningcharges(charges, block_count, diningprice, booking.dining_facility.name, dining_time) + create_saleitem_diningcharges(charges, block_count, diningprice, booking.dining_facility.name, dining_time, order_source) end return status, sale_id @@ -131,6 +131,7 @@ class Sale < ApplicationRecord if order_source.nil? order_source = order.source end + puts "compute source" compute(order_source) #Update the order items that is billed @@ -275,7 +276,7 @@ class Sale < ApplicationRecord end end - def create_saleitem_diningcharges(chargeObj, block_count, diningprice, dining_name, dining_time) + def create_saleitem_diningcharges(chargeObj, block_count, diningprice, dining_name, dining_time, order_source = nil) sale_item = SaleItem.new sale_item.product_code = chargeObj.item_code sale_item.product_name = dining_name.to_s + " ( " + dining_time.to_s + " )" @@ -291,7 +292,7 @@ class Sale < ApplicationRecord # Re-calc sale = Sale.find(self.id) - self.compute_by_sale_items(self.id, sale.sale_items, self.total_discount) + self.compute_by_sale_items(self.id, sale.sale_items, self.total_discount, nil, order_source) end def update_item (item) @@ -506,6 +507,7 @@ class Sale < ApplicationRecord if order_source.to_s == "emenu" order_source = "cashier" end + #Create new tax records tax_profiles.each do |tax| # customer.tax_profiles.each do |cus_tax| diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb index bd06be3f..30a610d0 100755 --- a/app/views/reports/receipt_no/index.html.erb +++ b/app/views/reports/receipt_no/index.html.erb @@ -47,7 +47,7 @@