shop code

This commit is contained in:
Nweni
2019-12-04 13:57:26 +06:30
parent 7afddcdf2b
commit 8b5d28524e
18 changed files with 85 additions and 126 deletions

View File

@@ -109,7 +109,7 @@ class Api::OrdersController < Api::ApiController
@order.new_booking = true
@order.waiters = current_login_employee.name
@order.employee_name = current_login_employee.name
@order.shop_code =@shop.shop_code
@order.shop_code = Shop.current_shop.shop_code
@order.is_extra_time = is_extra_time
@order.extra_time = extra_time

View File

@@ -27,7 +27,7 @@ class Api::PaymentsController < Api::ApiController
if !sale.nil?
if sale.sale_status == "new"
if !params[:card_no].empty?
current_shift = ShiftSale.current_shift(sale.shop_code)
current_shift = ShiftSale.current_shift
current_login_employee =Employee.find(current_shift.employee_id)
@status, @message = send_account_paymal(sale.grand_total, params[:card_no], sale.receipt_no,current_login_employee)
if @status

View File

@@ -1,5 +1,5 @@
class Api::VerificationsController < Api::ApiController
skip_before_action :authenticate
def new
phone_number = params[:phone_number]

View File

@@ -59,7 +59,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and bookings.shop_code='#{@shop.shop_code}' and bookings.booking_id='#{params[:booking_id]}'").first
.where("orders.source='app' and bookings.booking_id='#{params[:booking_id]}'").first
@customer_id =@booking.customer_id
@booking_id =@booking.booking_id
end

View File

@@ -1,4 +1,5 @@
class Foodcourt::PaymalController < BaseFoodcourtController
def index
@sale_id = params[:sale_id]
payment_method = params[:payment_method]
@@ -6,7 +7,9 @@ class Foodcourt::PaymalController < BaseFoodcourtController
@membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no
# @shop = Shop.first
@shop = Shop.current_shop
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else

View File

@@ -7,7 +7,8 @@ class Foodcourt::PayparPaymentsController < BaseFoodcourtController
payment_method = "paypar"
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
# shop_details = Shop.first
@shop = Shop.current_shop
# rounding adjustment
if @shop.is_rounding_adj

View File

@@ -8,7 +8,7 @@ class Foodcourt::RequestBillsController < ApplicationController
end
# Print Request Bill and add to sale tables
def print
if !ShiftSale.current_shift(@shop.shop_code).nil?
if !ShiftSale.current_shift.nil?
order_id = params[:id] # order_id
order = Order.find(order_id)
booking = order.booking
@@ -45,7 +45,7 @@ class Foodcourt::RequestBillsController < ApplicationController
sale_audit = SaleAudit.record_audit_sale(sale_data.sale_id,remark,action_by,type )
# Promotion Activation
Promotion.promo_activate(sale_data,@shop.shop_code)
Promotion.promo_activate(sale_data)
#bill channel
if ENV["SERVER_MODE"] == 'cloud'
@@ -62,14 +62,14 @@ class Foodcourt::RequestBillsController < ApplicationController
render :json => result.to_json
else
#check checkInOut pdf print
checkout_time = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('checkout_time')
checkout_time = Lookup.collection_of('checkout_time')
if !booking.dining_facility_id.nil?
terminal = DiningFacility.find_by_id(booking.dining_facility_id)
cashier_terminal = CashierTerminal.find_by_id(terminal.zone_id)
if (!checkout_time.empty?) && (ENV["SERVER_MODE"] != "cloud") #no print in cloud server
unique_code = "CheckInOutPdf"
printer = PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
printer = PrintSetting.find_by_unique_code(unique_code)
# print when complete click
order_queue_printer = Printer::OrderQueuePrinter.new(printer)

View File

@@ -7,7 +7,7 @@ class Foodcourt::SalesController < BaseFoodcourtController
@tables = Table.unscoped.all.active.order('status desc')
@rooms = Room.unscoped.all.active.order('status desc')
@complete = Sale.completed_sale("cashier",@shop.shop_code)
@complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@customers = Customer.pluck("customer_id, name")
@sale = Sale.find(params[:sale_id])

View File

@@ -26,7 +26,7 @@ class Settings::PaymentMethodSettingsController < ApplicationController
# POST /settings/payment_method_settings.json
def create
@settings_payment_method_setting = PaymentMethodSetting.new(settings_payment_method_setting_params)
@settings_payment_method_setting.shop_code = @shop.shop_code
@settings_payment_method_setting.shop_code = Shop.current_shop.shop_code
respond_to do |format|
if @settings_payment_method_setting.save
format.html { redirect_to settings_payment_method_settings_path, notice: 'Payment method setting was successfully created.' }

View File

@@ -9,10 +9,10 @@ class Transactions::BookingsController < ApplicationController
to = params[:to]
if filter.nil? && from.nil? && to.nil?
@bookings = Booking.where("shop_code='#{@shop.shop_code}'").order("sale_id desc")
@bookings = Booking.order("sale_id desc")
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(20)
else
booking = Booking.search(filter,from,to).where("bookings.shop_code='#{@shop.shop_code}'")
booking = Booking.search(filter,from,to)
if booking.count > 0
@bookings = booking
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(20)

View File

@@ -18,13 +18,13 @@ class Transactions::SalesController < ApplicationController
if receipt_no.nil? && from.nil? && to.nil?
if @shift.blank?
@sales = Sale.where("NOT sale_status='new' and shop_code='#{@shop.shop_code}'").order("sale_id desc")
@sales = Sale.where("NOT sale_status='new'").order("sale_id desc")
else
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}' and shop_code='#{@shop.shop_code}'").order("sale_id desc")
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").order("sale_id desc")
end
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
else
sale = Sale.search(receipt_no,from,to,@shift).where("sales.shop_code='#{@shop.shop_code}'")
sale = Sale.search(receipt_no,from,to,@shift)
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
@@ -89,8 +89,8 @@ class Transactions::SalesController < ApplicationController
# GET /transactions/sales/1
# GET /transactions/sales/1.json
def show
@membership = MembershipSetting.find_by_shop_code(@shop.shop_code)
@payment_methods = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}' and is_active='1'")
@membership = MembershipSetting.find_by_shop_code(Shop.current_shop.shop_code)
@payment_methods = PaymentMethodSetting.where("is_active='1'")
@sale = Sale.find(params[:id])
@order_items = []