add zone with oqs and tax calculte method update
This commit is contained in:
@@ -6,19 +6,24 @@ class Oqs::HomeController < BaseOqsController
|
||||
@queue_items_details = queue_items_query(false)
|
||||
|
||||
# Query for OQS with delivery status true
|
||||
@queue_completed_item = queue_items_query(true)
|
||||
@queue_completed_item = completed_order
|
||||
|
||||
@queue_stations_items=Array.new
|
||||
|
||||
# Calculate Count for each station tab
|
||||
queue_stations.each do |que|
|
||||
i=0
|
||||
i = 0
|
||||
zone_id = 0
|
||||
@queue_items_details.each do |qid|
|
||||
if qid.station_name == que.station_name
|
||||
i=i+1
|
||||
end
|
||||
dining = DiningFacility.find_by_name(qid.zone)
|
||||
que.order_queue_process_by_zones.each do |qz|
|
||||
if qid.station_id == qz.order_queue_station_id && qid.zone_id == dining.zone_id
|
||||
zone_id = qid.zone_id
|
||||
i=i+1
|
||||
end
|
||||
end
|
||||
end
|
||||
@queue_stations_items.push({:station_name => que.station_name, :is_active => que.is_active ,:item_count => i })
|
||||
@queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
|
||||
end
|
||||
|
||||
@queue_stations_items
|
||||
@@ -83,34 +88,9 @@ class Oqs::HomeController < BaseOqsController
|
||||
|
||||
# Query for OQS with delivery status
|
||||
def queue_items_query(status)
|
||||
# queue_items = []
|
||||
# AssignedOrderItem.all.each do |aoi|
|
||||
# oqs = OrderQueueStation.find(aoi.order_queue_station_id)
|
||||
# order = Order.find(aoi.order_id)
|
||||
# order_items = OrderItem.find_by_order_id(aoi.order_id)
|
||||
# booking_orders = BookingOrder.find_by_order_id(aoi.order_id)
|
||||
# booking = Booking.find(booking_orders.booking_id)
|
||||
# dining = DiningFacility.find(booking.dining_facility_id)
|
||||
# customer = Customer.find_by_customer_id(order.customer_id)
|
||||
# queue_item = {
|
||||
# :assigned_order_item_id => aoi.assigned_order_item_id,
|
||||
# :station_name => oqs.station_name,
|
||||
# :is_active => oqs.is_active,
|
||||
# :zone => dining.name,
|
||||
# :item_code => aoi.item_code,
|
||||
# :item_name => order_items.item_name,
|
||||
# :price => order_items.price,
|
||||
# :qty => order_items.qty,
|
||||
# :item_order_by => order_items.item_order_by,
|
||||
# :options => order_items.options,
|
||||
# :customer_name => customer.name,
|
||||
# :created_at => order_items.created_at
|
||||
# }
|
||||
# queue_items.push(queue_item)
|
||||
# end
|
||||
# return queue_items
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
|
||||
left join customers as cus ON cus.customer_id = od.customer_id
|
||||
@@ -120,4 +100,23 @@ class Oqs::HomeController < BaseOqsController
|
||||
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
end
|
||||
|
||||
# Completed Order
|
||||
def completed_order
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id
|
||||
left join customers as cus ON cus.customer_id = od.customer_id
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = true AND odt.price <> 0")
|
||||
.group("assigned_order_items.order_id")
|
||||
|
||||
|
||||
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -74,8 +74,10 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
|
||||
sale.save
|
||||
# sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
|
||||
# sale.save
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
|
||||
end
|
||||
|
||||
dining = {:table_id => table_id, :table_type => table_type }
|
||||
@@ -100,8 +102,12 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
|
||||
sale.save
|
||||
# sale.total_discount = 0
|
||||
# sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
|
||||
# sale.save
|
||||
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
|
||||
end
|
||||
|
||||
dining = {:table_id => table_id, :table_type => table_type }
|
||||
|
||||
Reference in New Issue
Block a user