print format update
This commit is contained in:
@@ -247,8 +247,6 @@ class Order < ApplicationRecord
|
||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||
.where("sales.sale_status='completed'")
|
||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status")
|
||||
|
||||
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view booking order Table
|
||||
@@ -259,7 +257,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("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
|
||||
.where("sales.sale_status<>'completed' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
|
||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status")
|
||||
|
||||
end
|
||||
@@ -273,7 +271,7 @@ class Order < ApplicationRecord
|
||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||
.where("sales.sale_status<>'complete' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
||||
.where("sales.sale_status<>'completed' and sales.sale_status<>'complete' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
||||
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id")
|
||||
|
||||
end
|
||||
@@ -303,7 +301,7 @@ class Order < ApplicationRecord
|
||||
left join order_items on order_items.order_id = orders.order_id
|
||||
left join sale_orders on sale_orders.order_id = orders.order_id
|
||||
left join sales on sales.sale_id = sale_orders.sale_id")
|
||||
.where("sales.sale_status<>'complete' and dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
.where("sales.sale_status<>'completed' and dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
.group("orders.order_id,order_items.order_items_id,dining_facilities.name,sales.receipt_no,bookings.booking_id,sales.sale_id,orders.customer_id")
|
||||
|
||||
end
|
||||
|
||||
@@ -35,26 +35,27 @@ class SaleItem < ApplicationRecord
|
||||
beverage_prices=0
|
||||
|
||||
sale_items.each do |si|
|
||||
food_price = self.get_food_price(si.sale_item_id)
|
||||
beverage_price = self.get_beverage_price(si.sale_item_id)
|
||||
food_price, beverage_price = self.get_price(si.sale_item_id)
|
||||
food_prices = food_prices + food_price
|
||||
beverage_prices = beverage_prices + beverage_price
|
||||
end
|
||||
return food_prices, beverage_prices
|
||||
end
|
||||
|
||||
def self.get_food_price(sale_item_id)
|
||||
food=SaleItem.select("sale_items.price")
|
||||
.joins("left join menu_items on menu_items.item_code = sale_items.product_code")
|
||||
.where("sale_items.sale_item_id=? and menu_items.account_id=1", sale_item_id.to_s)
|
||||
food_price = food[0].price rescue 0
|
||||
end
|
||||
def self.get_price(sale_item_id)
|
||||
food_price=0
|
||||
beverage_price=0
|
||||
|
||||
def self.get_beverage_price(sale_item_id)
|
||||
beverage=SaleItem.select("sale_items.price")
|
||||
item=SaleItem.select("sale_items.price , menu_items.account_id")
|
||||
.joins("left join menu_items on menu_items.item_code = sale_items.product_code")
|
||||
.where("sale_items.sale_item_id=? and menu_items.account_id=2", sale_item_id.to_s)
|
||||
beverage_price = beverage[0].price rescue 0
|
||||
.where("sale_items.sale_item_id=?", sale_item_id.to_s)
|
||||
if item[0].account_id == 1
|
||||
food_price = item[0].price
|
||||
else
|
||||
beverage_price = item[0].price
|
||||
end
|
||||
|
||||
return food_price, beverage_price
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user