shop code

This commit is contained in:
Myat Zin Wai Maw
2019-11-22 18:24:02 +06:30
parent 5a3f328789
commit d1ab2c194d
106 changed files with 834 additions and 895 deletions

View File

@@ -25,7 +25,7 @@ class Api::AuthenticateController < Api::ApiController
@employee = Employee.login(emp_id, password)
if @employee && @employee.role == "cashier"
if @employee.is_active
shift = ShiftSale.current_open_shift(@employee.id)
shift = ShiftSale.current_open_shift(@employee)
if !shift.nil?
@status = true
@shift_id = shift.id

View File

@@ -6,7 +6,7 @@ class Api::BillController < Api::ApiController
@status = false
@error_message = "Order ID or Booking ID is require to request for a bill."
# if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
if !ShiftSale.current_shift.nil?
if !ShiftSale.current_shift(@shop.shop_code).nil?
#create Bill by Booking ID
table = 0
if (params[:booking_id])
@@ -161,7 +161,7 @@ class Api::BillController < Api::ApiController
@status, @booking = @order.generate
if @status && @booking
shift = ShiftSale.current_open_shift(current_login_employee.id)
shift = ShiftSale.current_open_shift(current_login_employee)
if !shift.nil?
cashier = Employee.find(shift.employee_id)
if (@booking.booking_id)

View File

@@ -18,17 +18,17 @@ class Api::CallWaitersController < ActionController::API
# CallWaiterJob.perform_later(@table,@time)
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
else
else
from = ""
end
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from, shift_ids: shift_ids
end
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from, shift_ids: shift_ids
# get printer info
@shop = Shop.first
unique_code = "CallWaiterPdf"
# @shop = Shop.first
unique_code = "CallWaiterPdf"
print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::ReceiptPrinter.new(print_settings)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_call_waiter(print_settings,@table,@time,@shop)
end
end

View File

@@ -46,7 +46,7 @@ class Api::OrdersController < Api::ApiController
@tax_profile = TaxProfile.where("lower(group_type)='cashier'")
# end
@shop = Shop.first
# @shop = Shop.first
puts "Hello world"
puts @shop.to_json
return @shop.to_json

View File

@@ -14,11 +14,11 @@ class Api::Payment::MobilepaymentController < Api::ApiController
saleObj = Sale.find(sale_id)
sale_items = SaleItem.get_all_sale_items(sale_id)
shop_detail = Shop.first
# shop_detail = Shop.first
# rounding adjustment
if !path.include? ("credit_payment")
if shop_detail.is_rounding_adj
if @shop.is_rounding_adj
a = saleObj.grand_total % 25 # Modulus
b = saleObj.grand_total / 25 # Division
#not calculate rounding if modulus is 0 and division is even

View File

@@ -19,14 +19,15 @@ class Api::SurveyController < Api::ApiController
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
# puts params.to_json
# set cashier
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
current_shift = ShiftSale.current_shift
open_cashier = Employee.where("shop_code='#{@shop.shop_code}' and role = 'cashier' AND token_session <> ''")
current_shift = ShiftSale.current_shift(@shop.shop_code)
current_shift_user =Employee.find_by_id(current_shift.employee_id)
if open_cashier.count>0
shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0].id)
shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0])
else
shift_by_terminal = ShiftSale.current_open_shift(current_shift.employee_id)
shift_by_terminal = ShiftSale.current_open_shift(current_shift_user)
end
if params[:survey][:id]>0
survey = Survey.find(params[:survey][:id])
else
@@ -50,8 +51,8 @@ class Api::SurveyController < Api::ApiController
# private
# def survey_params
# params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner,
# params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner,
# :dining_name,:created_by,:total_customer,:total_amount)
# end
end
end