merge with master
This commit is contained in:
@@ -67,7 +67,8 @@ class Api::OrdersController < Api::ApiController
|
||||
end
|
||||
}
|
||||
#end extra time
|
||||
|
||||
puts params[:order_items]
|
||||
puts "ITEM aaaaaaaaaaaaaaaaaaa"
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
|
||||
17
app/controllers/oqs/edit_controller.rb
Executable file → Normal file
17
app/controllers/oqs/edit_controller.rb
Executable file → Normal file
@@ -6,6 +6,11 @@ class Oqs::EditController < BaseOqsController
|
||||
if params[:type] == 'oqs'
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'")
|
||||
elsif
|
||||
assigned_item = OrderItem.find(assigned_item_id)
|
||||
@booking = Booking.joins(" JOIN booking_orders as bko on bko.booking_id = bookings.booking_id")
|
||||
.where("bko.order_id = '#{assigned_item.order_id}'").first()
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.item_instance_code }'")
|
||||
else
|
||||
assigned_item = OrderItem.find(assigned_item_id)
|
||||
dining = DiningFacility.find_by_id(params[:type])
|
||||
@@ -25,13 +30,6 @@ class Oqs::EditController < BaseOqsController
|
||||
order_item.item_order_by = current_user.name
|
||||
order_item.qty = qty_weight
|
||||
order_item.remark = remarks
|
||||
if !order_item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(order_item.set_menu_items)
|
||||
instance_item_sets.each_with_index do |instance_item, instance_index|
|
||||
instance_item_sets[instance_index]["quantity"] = qty_weight
|
||||
end
|
||||
order_item.set_menu_items = instance_item_sets.to_json
|
||||
end
|
||||
order_item.save
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
@@ -67,4 +65,9 @@ class Oqs::EditController < BaseOqsController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,10 +94,10 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
if i["parent_order_item_id"]
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": i["options"]}
|
||||
if i["parent_order_item_id"];
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": JSON.parse(i["options"])}
|
||||
else
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": JSON.parse(i["options"])}
|
||||
end
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
@@ -74,16 +74,6 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@date = order.created_at
|
||||
@booking= booking
|
||||
order.order_items.each do |item|
|
||||
if !item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(item.set_menu_items)
|
||||
arr_instance_item_sets = Array.new
|
||||
instance_item_sets.each do |instance_item|
|
||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
||||
arr_instance_item_sets.push(item_instance_name)
|
||||
item.price = item.price.to_f + instance_item["price"].to_f
|
||||
end
|
||||
item.set_menu_items = arr_instance_item_sets
|
||||
end
|
||||
@order_items.push(item)
|
||||
# assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
||||
# if !assigned_order_items.nil?
|
||||
|
||||
@@ -113,7 +113,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
#end rounding adjustment
|
||||
|
||||
puts "sale"
|
||||
puts saleObj.to_json
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, current_user.name, cash, "cash")
|
||||
|
||||
@@ -161,12 +163,24 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
member_info = Customer.get_member_account(customer)
|
||||
if member_info["status"] == true
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
|
||||
#orders print out
|
||||
if params[:type] == "quick_service"
|
||||
booking = Booking.find_by_sale_id(sale_id)
|
||||
if booking.dining_facility_id.to_i>0
|
||||
table_id = booking.dining_facility_id
|
||||
else
|
||||
table_id = 0
|
||||
end
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
Order.pay_process_order_queue(order.order_id,table_id)
|
||||
end
|
||||
end
|
||||
|
||||
#for card sale data
|
||||
card_data = Array.new
|
||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
|
||||
@@ -68,16 +68,6 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@date = order.created_at
|
||||
@booking = booking
|
||||
order.order_items.each do |item|
|
||||
if !item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(item.set_menu_items)
|
||||
arr_instance_item_sets = Array.new
|
||||
instance_item_sets.each do |instance_item|
|
||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
||||
arr_instance_item_sets.push(item_instance_name)
|
||||
item.price = item.price.to_f + instance_item["price"].to_f
|
||||
end
|
||||
item.set_menu_items = arr_instance_item_sets
|
||||
end
|
||||
@order_items.push(item)
|
||||
# assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
||||
# if !assigned_order_items.nil?
|
||||
|
||||
@@ -3,6 +3,7 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def show
|
||||
@type = params[:type]
|
||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||
#for bank integration
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
|
||||
@@ -6,6 +6,13 @@ class Settings::MenusController < ApplicationController
|
||||
# GET /settings/menus.json
|
||||
def index
|
||||
@settings_menus = Menu.all.page(params[:page]).per(10)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
# format.csv { send_data MenuCsvExport.generate }
|
||||
|
||||
format.csv { send_data Menu.to_csv }
|
||||
# format.csv { send_data MenuCategory.to_csv }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /settings/menus/1
|
||||
@@ -67,6 +74,11 @@ class Settings::MenusController < ApplicationController
|
||||
# end
|
||||
end
|
||||
|
||||
def import
|
||||
Menu.import(params[:file])
|
||||
redirect_to settings_menu_path, notice: "imported"
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_menu
|
||||
|
||||
@@ -6,6 +6,18 @@ class Settings::TaxProfilesController < ApplicationController
|
||||
# GET /settings/tax_profiles.json
|
||||
def index
|
||||
@settings_tax_profiles = TaxProfile.all
|
||||
tax_profiles = Lookup.collection_of("tax_profiles")
|
||||
if !@settings_tax_profiles.nil?
|
||||
@settings_tax_profiles.each_with_index do |setting_tax_profile, tax_index|
|
||||
if !tax_profiles.nil?
|
||||
tax_profiles.each do |group|
|
||||
if setting_tax_profile.group_type == group[1]
|
||||
@settings_tax_profiles[tax_index].group_type = group[0]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /settings/tax_profiles/1
|
||||
@@ -15,11 +27,19 @@ class Settings::TaxProfilesController < ApplicationController
|
||||
|
||||
# GET /settings/tax_profiles/new
|
||||
def new
|
||||
@name = nil
|
||||
@settings_tax_profile = TaxProfile.new
|
||||
@tax_profiles = TaxProfile.all
|
||||
end
|
||||
|
||||
# GET /settings/tax_profiles/1/edit
|
||||
def edit
|
||||
@settings_tax_profile = TaxProfile.find(params[:id])
|
||||
@name = nil
|
||||
if !@settings_tax_profile.nil?
|
||||
@name = @settings_tax_profile.name
|
||||
end
|
||||
@tax_profiles = TaxProfile.all
|
||||
end
|
||||
|
||||
# POST /settings/tax_profiles
|
||||
@@ -69,10 +89,20 @@ class Settings::TaxProfilesController < ApplicationController
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_tax_profile
|
||||
@settings_tax_profile = TaxProfile.find(params[:id])
|
||||
tax_profiles = Lookup.collection_of("tax_profiles")
|
||||
if !@settings_tax_profile.nil?
|
||||
if !tax_profiles.nil?
|
||||
tax_profiles.each do |group|
|
||||
if @settings_tax_profile.group_type == group[1]
|
||||
@settings_tax_profile.group_type = group[0]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_tax_profile_params
|
||||
params.require(:tax_profile).permit(:name, :rate, :inclusive, :order_by, :created_by)
|
||||
params.require(:tax_profile).permit(:name, :group_type, :rate, :inclusive, :order_by, :created_by)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,11 +21,12 @@ class Transactions::OrdersController < ApplicationController
|
||||
@receipt_no = filter
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @orders }
|
||||
end
|
||||
format.html
|
||||
format.json { render json: @orders }
|
||||
# format.csv { send_data OrdersCsvExport.generate }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
Reference in New Issue
Block a user