diff --git a/app/models/order.rb b/app/models/order.rb index 6474fe7c..29267965 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -300,7 +300,7 @@ class Order < ApplicationRecord .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") - .where("(orders.status = 'new' or orders.status = 'billed')") + .where("(orders.status = 'new' or orders.status = 'billed') AND orders.date between #{ from } and #{ to }") # orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status, # orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb index ee6885ae..2d6b795e 100644 --- a/app/models/shift_sale.rb +++ b/app/models/shift_sale.rb @@ -21,7 +21,7 @@ class ShiftSale < ApplicationRecord #find open shift where is open today and is not closed and login by current cashier today_date = DateTime.now.strftime("%Y-%m-%d") puts today_date - shift = ShiftSale.where("TO_CHAR(shift_started_at, 'YYYY-MM-DD')=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).take + shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take return shift #end diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 2842c433..dde68c48 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -228,6 +228,10 @@ Tax: <%= @obj_sale.total_tax rescue 0%> + + Rounding Adj: + <%= @obj_sale.rounding_adjustment rescue 0%> + Grand Total: <%= @obj_sale.grand_total rescue 0%> @@ -411,10 +415,11 @@ $(document).ready(function(){ $("#first_bill").on('click', function(){ var sale_id = $('#sale_id').val(); var ajax_url = "/origami/sale/"+ sale_id + "/first_bill"; + $.ajax({ type: "GET", url: ajax_url, - success:function(result){ + success:function(result){ location.reload(); } });