Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -10,7 +10,7 @@ class Api::BillController < Api::ApiController
|
||||
if (params[:booking_id])
|
||||
@sale = Sale.new
|
||||
@status = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
|
||||
|
||||
|
||||
elsif (params[:order_id])
|
||||
@sale = Sale.new
|
||||
@status = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
|
||||
|
||||
@@ -36,7 +36,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
# Query for OQS with status
|
||||
def queue_items_query(status)
|
||||
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
|
||||
.joins("join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
|
||||
.joins(" left join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
|
||||
left join dining_facilities as df on df.zone_id = oqpz.zone_id
|
||||
left join order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id
|
||||
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
|
||||
@@ -4,21 +4,23 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@booking_rooms = Order.get_booking_order_rooms()
|
||||
@orders = Order.get_orders()
|
||||
end
|
||||
|
||||
def show
|
||||
str = []
|
||||
|
||||
|
||||
|
||||
if !params[:sale_id].nil?
|
||||
@order_details = SaleItem.get_order_items_details(params[:sale_id])
|
||||
@order_details.each do |ord_detail|
|
||||
@order_details = SaleItem.get_order_items_details(params[:sale_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
render :json => str.to_json
|
||||
render :json => str.to_json
|
||||
else
|
||||
@order_details = OrderItem.get_order_items_details(params[:order_id])
|
||||
@order_details.each do |ord_detail|
|
||||
@order_details = OrderItem.get_order_items_details(params[:order_id])
|
||||
@order_details.each do |ord_detail|
|
||||
str.push(ord_detail)
|
||||
end
|
||||
render :json => str.to_json
|
||||
render :json => str.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,27 +1,37 @@
|
||||
class Origami::RequestBillsController < BaseOrigamiController
|
||||
def show
|
||||
|
||||
def create
|
||||
@sale = Sale.new
|
||||
|
||||
|
||||
booking_id = params[:id]
|
||||
check_booking = Booking.find_by_booking_id(booking_id)
|
||||
if check_booking.sale_id.nil?
|
||||
#check if it doesn't exist
|
||||
@status = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
||||
#check if it doesn't exist
|
||||
@status = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||
else
|
||||
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
unique_code="ReceiptBillPdf"
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_receipt_bill(print_settings,@sale_items,@sale,@sale_data)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def show
|
||||
sale_id = params[:sale_id]
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find_by_id(sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -63,7 +63,14 @@ class Settings::MenuCategoriesController < ApplicationController
|
||||
# DELETE /settings/menu_categories/1
|
||||
# DELETE /settings/menu_categories/1.json
|
||||
def destroy
|
||||
# instances = MenuItemInstance.where("menu_item_id=?",@settings_menu_item.id)
|
||||
# instances.each do |instance|
|
||||
# instance.destroy
|
||||
# end
|
||||
# @settings_menu_item.destroy
|
||||
|
||||
# @settings_menu_category.destroy
|
||||
abc = MenuCategory.destroyCategory(@settings_menu_category)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_menu_categories_path, notice: 'Menu category was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
|
||||
@@ -11,18 +11,21 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
# GET /settings/menu_item_instances/1
|
||||
# GET /settings/menu_item_instances/1.json
|
||||
def show
|
||||
@category = MenuCategory.find(@item.menu_category_id)
|
||||
id = MenuItemInstance.findParentCategory(@item)
|
||||
@category = MenuCategory.find(id)
|
||||
end
|
||||
|
||||
# GET /settings/menu_item_instances/new
|
||||
def new
|
||||
@category = MenuCategory.find(@item.menu_category_id)
|
||||
id = MenuItemInstance.findParentCategory(@item)
|
||||
@category = MenuCategory.find(id)
|
||||
@settings_menu_item_instances = MenuItemInstance.new
|
||||
end
|
||||
|
||||
# GET /settings/menu_item_instances/1/edit
|
||||
def edit
|
||||
@category = MenuCategory.find(@item.menu_category_id)
|
||||
id = MenuItemInstance.findParentCategory(@item)
|
||||
@category = MenuCategory.find(id)
|
||||
end
|
||||
|
||||
# POST /settings/menu_item_instances
|
||||
@@ -30,6 +33,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
def create
|
||||
@settings_menu_item_instances = MenuItemInstance.new(settings_menu_item_instance_params)
|
||||
|
||||
#check if the menu item type is simple or not( not only the diff of status .. here is different routes)
|
||||
if params[:simple_menu_item_id]
|
||||
@settings_menu_item_instances.menu_item_id = params[:simple_menu_item_id]
|
||||
catID = MenuItem.find(params[:simple_menu_item_id])
|
||||
@@ -38,7 +42,8 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
catID = MenuItem.find(params[:set_menu_item_id])
|
||||
end
|
||||
|
||||
category = MenuCategory.find(catID.menu_category_id)
|
||||
id = MenuItemInstance.findParentCategory(catID)
|
||||
category = MenuCategory.find(id)
|
||||
respond_to do |format|
|
||||
if @settings_menu_item_instances.save
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@@ -55,14 +60,15 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
# PATCH/PUT /settings/menu_item_instances/1
|
||||
# PATCH/PUT /settings/menu_item_instances/1.json
|
||||
def update
|
||||
puts "params[:menu_item_instance][:item_attributes]"
|
||||
puts params[:menu_item_instance][:item_attributes]
|
||||
#check if the menu item type is simple or not( not only the diff of status .. here is different routes)
|
||||
if params[:simple_menu_item_id]
|
||||
catID = MenuItem.find(params[:simple_menu_item_id])
|
||||
else
|
||||
catID = MenuItem.find(params[:set_menu_item_id])
|
||||
end
|
||||
category = MenuCategory.find(catID.menu_category_id)
|
||||
|
||||
id = MenuItemInstance.findParentCategory(catID)
|
||||
category = MenuCategory.find(id)
|
||||
respond_to do |format|
|
||||
|
||||
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
||||
@@ -86,7 +92,13 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
else
|
||||
catID = MenuItem.find(params[:set_menu_item_id])
|
||||
end
|
||||
category = MenuCategory.find(catID.menu_category_id)
|
||||
# check if the menu item is sub of another menu item
|
||||
if catID.menu_category_id
|
||||
category = MenuCategory.find(catID.menu_category_id)
|
||||
else
|
||||
item = MenuItem.find(catID.menu_item_id)
|
||||
category = MenuCategory.find(item.menu_category_id)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
|
||||
@@ -55,7 +55,8 @@ class Settings::MenusController < ApplicationController
|
||||
# DELETE /settings/menus/1
|
||||
# DELETE /settings/menus/1.json
|
||||
def destroy
|
||||
@settings_menu.destroy
|
||||
# @settings_menu.destroy
|
||||
abc = Menu.destroyMenu(@settings_menu)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_menus_path, notice: 'Menu was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
|
||||
@@ -62,7 +62,7 @@ class Settings::SetMenuItemsController < ApplicationController
|
||||
# DELETE /settings/menu_items/1
|
||||
# DELETE /settings/menu_items/1.json
|
||||
def destroy
|
||||
# @settings_menu_item.destroy
|
||||
abc = MenuItem.deleteRecursive(@settings_menu_item)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_menu_category_set_menu_items_path, notice: 'Menu item was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
|
||||
@@ -59,7 +59,7 @@ class Settings::SimpleMenuItemsController < ApplicationController
|
||||
# DELETE /settings/menu_items/1
|
||||
# DELETE /settings/menu_items/1.json
|
||||
def destroy
|
||||
# @settings_menu_item.destroy
|
||||
abc = MenuItem.deleteRecursive(@settings_menu_item)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
|
||||
Reference in New Issue
Block a user