shop code

This commit is contained in:
Myat Zin Wai Maw
2019-12-10 15:18:48 +06:30
parent c606ca73db
commit 79598c0126
115 changed files with 247 additions and 396 deletions

View File

@@ -7,7 +7,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(Shop.current_shop.shop_code).nil?
if !ShiftSale.current_shift(@shop.shop_code).nil?
#create Bill by Booking ID
table = 0
if (params[:booking_id])
@@ -107,7 +107,7 @@ class Api::BillController < Api::ApiController
# unique_code = "ReceiptBillPdf"
# #shop detail
# shop_details = Shop.current_shop
# shop_details = @shop
# customer= Customer.find(@sale_data.customer_id)
# # get member information

View File

@@ -23,9 +23,7 @@ class Api::CallWaitersController < ActionController::API
end
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from, shift_ids: shift_ids
# get printer info
@shop = Shop.current_shop
unique_code = "CallWaiterPdf"
unique_code = "CallWaiterPdf"
print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_call_waiter(print_settings,@table,@time,@shop)

View File

@@ -70,7 +70,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
if !order_reservation_id.nil? && flag
shop = Shop.current_shop
shop = @shop
if !shop.nil?
shop_code = shop.shop_code
order_audio = DisplayImage.find_by_shop_id_and_name(shop.id, "order_audio")

View File

@@ -46,7 +46,7 @@ class Api::OrdersController < Api::ApiController
@tax_profile = TaxProfile.where("lower(group_type)='cashier'")
# end
@shop = Shop.current_shop
#
return @shop.to_json
end
@@ -62,7 +62,7 @@ class Api::OrdersController < Api::ApiController
def create
Rails.logger.debug "Order Source - " + params[:order_source].to_s
Rails.logger.debug "Table ID - " + params[:table_id].to_s
# @shop = Shop.find_by_shop_code(params[:shop_code])
@shop = Shop.find_by_shop_code(params[:shop_code])
current_shift = ShiftSale.current_shift
if current_shift.nil?
@status = false
@@ -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.current_shop.shop_code
@order.shop_code = @shop.shop_code
@order.is_extra_time = is_extra_time
@order.extra_time = extra_time

View File

@@ -15,7 +15,7 @@ class Api::Payment::MobilepaymentController < Api::ApiController
saleObj = Sale.find(sale_id)
sale_items = SaleItem.get_all_sale_items(sale_id)
shop_detail = Shop.current_shop
shop_detail = @shop
# rounding adjustment
if !path.include? ("credit_payment")

View File

@@ -2,7 +2,7 @@ class Api::SoundEffectController < Api::ApiController
#sound effect / alarm api for doemal side calling
def sound_effect
shop = Shop.current_shop
shop = @shop
if !shop.nil?
shop_code = shop.shop_code
order_audio = DisplayImage.find_by_shop_id_and_name(shop.id, "order_audio")

View File

@@ -16,7 +16,7 @@ class Api::SurveyController < Api::ApiController
def create
dining_facility = DiningFacility.find(params[:id])
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
current_shift = ShiftSale.current_shift(Shop.current_shop.shop_code)
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])

View File

@@ -18,7 +18,7 @@ module LoginVerification
def current_shop
begin
return Shop.current_shop
return @shop
rescue
return nil
end

View File

@@ -11,10 +11,10 @@ module MultiTenancy
def find_shop_by_subdomain_or_frist
if request.subdomain.present?
shop_code = request.subdomain.partition('-').last
shop = Shop.find_by(shop_code: shop_code)
@shop = Shop.find_by(shop_code: shop_code)
else
shop = Shop.first
@shop = Shop.first
end
set_current_tenant(shop)
set_current_tenant(@shop)
end
end

View File

@@ -38,7 +38,7 @@ class Crm::CustomersController < BaseCrmController
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
@crm_customers.customer_type = "Dinein"
@crm_customers.tax_profiles = ["1", "2"]
@crm_customers.shop_code = Shop.current_shop.shop_code
@crm_customers.shop_code = @shop.shop_code
@crm_customers.save
@crm_customers = Customer.search(filter)
flash[:member_notice]='Customer was successfully created.'
@@ -130,7 +130,7 @@ class Crm::CustomersController < BaseCrmController
params[:type] = nil
params[:customer_id] = params[:id]
@credit_sales = SalePayment.get_credit_sales(params,Shop.current_shop.shop_code)
@credit_sales = SalePayment.get_credit_sales(params,@shop.shop_code)
#get customer amount
@customer = Customer.find(params[:id])
@@ -255,7 +255,7 @@ class Crm::CustomersController < BaseCrmController
if @checked_contact.nil?
respond_to do |format|
@crm_customers = Customer.new(customer_params)
@crm_customers.shop_code = Shop.current_shop.shop_code
@crm_customers.shop_code = @shop.shop_code
if @crm_customers.save
# update tax profile
customer = Customer.find(@crm_customers.customer_id)

View File

@@ -40,7 +40,7 @@ class Crm::DiningQueuesController < BaseCrmController
# POST /crm/dining_queues.json
def create
@dining_queue = DiningQueue.new(dining_queue_params)
@dining_queue.shop_code = Shop.current_shop.shop_code
@dining_queue.shop_code = @shop.shop_code
respond_to do |format|
if @dining_queue.save

View File

@@ -135,7 +135,7 @@ class Foodcourt::AddordersController < BaseFoodcourtController
@order.new_booking = true
@order.waiters = current_login_employee.name
@order.employee_name = current_login_employee.name
@order.shop_code = Shop.current_shop.shop_code
@order.shop_code = @shop.shop_code
@order.is_extra_time = is_extra_time
@order.extra_time = extra_time

View File

@@ -15,7 +15,7 @@ class Foodcourt::CashInsController < BaseFoodcourtController
p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user)
shift = ShiftSale.current_open_shift(current_user)
current_shift = ShiftSale.current_shift(Shop.current_shop.shop_code)
current_shift = ShiftSale.current_shift(@shop.shop_code)
# set cashier
if shift != nil
shift = shift

View File

@@ -10,7 +10,7 @@ class Foodcourt::CashOutsController < BaseFoodcourtController
p_jour.cash_out(reference, remark, amount, current_user)
shift = ShiftSale.current_open_shift(current_user)
current_shift = ShiftSale.current_shift(Shop.current_shop.shop_code)
current_shift = ShiftSale.current_shift(@shop.shop_code)
# set cashier
if shift != nil

View File

@@ -6,7 +6,6 @@ class Foodcourt::DashboardController < BaseFoodcourtController
@display_type = Lookup.find_by_lookup_type("display_type")
@sale_data = Array.new
@shop = Shop.current_shop
@total_payment_methods = Sale.total_payment_methods(@shop,today,current_user)
if !@total_payment_methods.nil?
@total_payment_methods.each do |payment|
@@ -109,7 +108,7 @@ def get_all_menu
end
def get_credit_sales
credit_sales = SalePayment.get_credit_sales(params,Shop.current_shop.shop_code)
credit_sales = SalePayment.get_credit_sales(params,@shop.shop_code)
if !credit_sales.nil?
result = {:status=> true, :data=> credit_sales }
else

View File

@@ -22,7 +22,7 @@ class Foodcourt::DiscountsController < BaseFoodcourtController
end
@member_discount = MembershipSetting.find_by_discount(1)
@accounts = Account.where("shop_code='#{Shop.current_shop.shop_code}'")
@accounts = Account.where("shop_code='#{@shop.shop_code}'")
end
#discount page show from origami index with selected order

View File

@@ -17,7 +17,6 @@ class Foodcourt::FoodCourtController < ApplicationController
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
shop = Shop.current_shop
@zone = Zone.all.where("is_active= true")
@customer = Customer.all
@tables = Table.all.active.order('status desc')
@@ -40,7 +39,7 @@ class Foodcourt::FoodCourtController < ApplicationController
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}' and DATE(bookings.created_at) = '#{Date.today}' and bookings.booking_status='assign'").uniq.length
.where("orders.source='app' and bookings.shop_code='#{@shop.shop_code}' and DATE(bookings.created_at) = '#{Date.today}' and bookings.booking_status='assign'").uniq.length
render "foodcourt/addorders/detail"
end
@@ -163,7 +162,7 @@ class Foodcourt::FoodCourtController < ApplicationController
end
def get_all_product()
@product = Product.where("shop_code='#{Shop.current_shop.shop_code}'")
@product = Product.where("shop_code='#{@shop.shop_code}'")
end
# render json for http status code

View File

@@ -4,7 +4,6 @@ class Foodcourt::HomeController < BaseFoodcourtController
def index
@webview = check_mobile
@shop = Shop.current_shop
@tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@complete = Sale.completed_sale("cashier",@shop.shop_code)
@@ -20,7 +19,6 @@ class Foodcourt::HomeController < BaseFoodcourtController
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@webview = check_mobile
@shop = Shop.current_shop
@tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@complete = Sale.completed_sale("cashier",@shop.shop_code)

View File

@@ -70,12 +70,12 @@ class Foodcourt::OrdersController < BaseFoodcourtController
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and bookings.shop_code=? and DATE(bookings.created_at)=?",Shop.current_shop.shop_code,Date.today).order("bookings.created_at desc").uniq
.where("orders.source='app' and bookings.shop_code=? and DATE(bookings.created_at)=?",@shop.shop_code,Date.today).order("bookings.created_at desc").uniq
end
def completed
customer =Customer.find_by_customer_id(params[:customer_id])
phone_number =customer.contact_no
if Order.send_message(phone_number,params[:order_id],Shop.current_shop.name)
if Order.send_message(phone_number,params[:order_id],@shop.name)
booking =Booking.find(params[:booking_id])
booking.booking_status ='completed'
booking.save!

View File

@@ -8,8 +8,6 @@ class Foodcourt::PaymalController < BaseFoodcourtController
sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no
@shop = Shop.current_shop
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else

View File

@@ -19,7 +19,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
#shop_detail = Shop.first
# rounding adjustment
if !path.include? ("credit_payment")
if Shop.current_shop.is_rounding_adj
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total - saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) if rounding_adj > 0
@@ -153,7 +153,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
other_amount = SaleItem.calculate_other_charges(sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,Shop.current_shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
#end
end
@@ -220,7 +220,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
@pdf_view = @lookup_pdf.value
end
amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,Shop.current_shop)
amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,@shop)
@kbz_pay_amount += amount.to_f
#for changable on/off
@@ -267,7 +267,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
#end rounding adjustment
# rounding adjustment
if Shop.current_shop.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
@@ -469,7 +469,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,Shop.current_shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
result = {
:status => true,
@@ -544,7 +544,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
#shop detail
#shop_detail = Shop.first
printer = PrintSetting.where("shop_code='#{Shop.current_shop.shop_code}'")
printer = PrintSetting.where("shop_code='#{@shop.shop_code}'")
unique_code="ReceiptBillPdf"
if !printer.empty?
@@ -559,7 +559,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code)
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
# Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
@@ -568,7 +568,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,Shop.current_shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil)
result = {
:status => true,
:filepath => filename,
@@ -603,7 +603,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
saleObj = Sale.find(params[:sale_id])
if Shop.current_shop.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
@@ -628,7 +628,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
else
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
unique_code = "ReceiptBillPdf"
print_settings = PrintSetting.where("shop_code='#{Shop.current_shop.shop_code}'")
print_settings = PrintSetting.where("shop_code='#{@shop.shop_code}'")
if !print_settings.nil?
print_settings.each do |setting|
if setting.unique_code == 'ReceiptBillPdf'
@@ -651,7 +651,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code)
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)

View File

@@ -8,8 +8,6 @@ class Foodcourt::PayparPaymentsController < BaseFoodcourtController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
@shop = Shop.current_shop
# rounding adjustment
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)

View File

@@ -6,7 +6,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
@cashier_type = params[:type]
@shift = ShiftSale.current_open_shift(current_user)
#for bank integration
bank_integration = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of('bank_integration')
bank_integration = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('bank_integration')
@bank_integration = 0
if !bank_integration[0].nil?
@bank_integration = bank_integration[0][1]
@@ -16,7 +16,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
def new
@float = Lookup.where('lookup_type=?','float_value')
@terminal = CashierTerminal.available.where("shop_code='#{Shop.current_shop.shop_code}'")
@terminal = CashierTerminal.available.where("shop_code='#{@shop.shop_code}'")
end
def create
@@ -56,7 +56,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
cashier_terminal.save
#add shift_sale_id to card_settle_trans
bank_integration = Lookup.find_by_lookup_type_and_shop_code('bank_integration',Shop.current_shop.shop_code)
bank_integration = Lookup.find_by_lookup_type_and_shop_code('bank_integration',@shop.shop_code)
if !bank_integration.nil?
card_settle_trans = CardSettleTran.select('id').where(['shift_sale_id IS NULL and status IS NOT NULL'])
@@ -74,7 +74,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
# if !close_cashier_print[0].nil?
# @close_cashier_print = close_cashier_print[0][1]
# end
close_cashier_pdf = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of("print_settings")
close_cashier_pdf = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("print_settings")
unique_code = "CloseCashierPdf"
if !close_cashier_pdf.empty?
@@ -92,13 +92,13 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
sale_items = ''
@lookup = Lookup.shift_sale_items_lookup_value(Shop.current_shop.shop_code)
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
if @lookup.to_i == 1
@sale_items = Sale.get_shift_sale_items(@shift.id)
other_charges = Sale.get_other_charges()
@total_other_charges_info = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",@shift)
end
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{Shop.current_shop.shop_code}'")
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
#other payment details for mpu or visa like card
@@ -143,7 +143,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
if @shift
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{Shop.current_shop.shop_code}'")
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
#other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)

View File

@@ -1,6 +1,5 @@
class Foodcourt::SurveysController < BaseFoodcourtController
def new
@shop = Shop.current_shop
@webview = false
if check_mobile
@webview = true
@@ -39,7 +38,6 @@ class Foodcourt::SurveysController < BaseFoodcourtController
end
def create
@shop = Shop.current_shop
@type = params[:cashier_type]
@sale_id = params[:sale_id]
if params[:table_id].to_i>0

View File

@@ -64,14 +64,14 @@ class Foodcourt::VoidController < BaseFoodcourtController
# FOr Sale Audit
action_by = current_user.name
if access_code != "null" && current_user.role == "cashier"
action_by = Employee.find_by_emp_id_and_shop_code(access_code,Shop.current_shop.shop_code).name
action_by = Employee.find_by_emp_id_and_shop_code(access_code,@shop.shop_code).name
end
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,"SALEVOID" )
#call paymal to void
if sale.sale_payments
if sale.sale_payments.nil?
membership_response =sale.paymal_payment_void
end
Rails.logger.debug "---------Paymal Payment Void response in VoidController"
@@ -110,7 +110,7 @@ class Foodcourt::VoidController < BaseFoodcourtController
current_balance = 0
end
printer = PrintSetting.where("shop_code='#{Shop.current_shop.shop_code}'")
printer = PrintSetting.where("shop_code='#{@shop.shop_code}'")
unique_code="ReceiptBillPdf"
if !printer.empty?
@@ -125,13 +125,13 @@ class Foodcourt::VoidController < BaseFoodcourtController
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code)
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
# Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
other_amount = SaleItem.calculate_other_charges(sale.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,Shop.current_shop, "VOID",current_balance,nil,other_amount,nil,nil,nil,nil)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "VOID",current_balance,nil,other_amount,nil,nil,nil,nil)
result = {
:filepath => filename,
:printer_model => print_settings.brand_name,

View File

@@ -1,6 +1,5 @@
class Foodcourt::WasteSpoileController < BaseFoodcourtController
def waste_and_spoilage
@shop = Shop.current_shop
sale_id = params[:sale_id]
remark = params[:remark]
order_source = params[:type]

View File

@@ -18,9 +18,8 @@ class HomeController < ApplicationController
def index
# @employees = Employee.all_emp_except_waiter.order("name asc")
shop = Shop.current_shop
@employees = Employee.all.where("shop_code='#{shop.shop_code}' and is_active = true").order("name asc")
@roles = Employee.where("shop_code='#{shop.shop_code}'").distinct.pluck(:role)
@employees = Employee.all.where("shop_code='#{@shop.shop_code}' and is_active = true").order("name asc")
@roles = Employee.where("shop_code='#{@shop.shop_code}'").distinct.pluck(:role)
# byebug
# @roles = Lookup.collection_of("employee_roles")
@@ -97,8 +96,6 @@ class HomeController < ApplicationController
def dashboard
@from, @to = get_date_range_from_params
@shop = Shop.current_shop
@orders = Sale.receipt_date_between(@from, @to).where("payment_status = 'new' and sale_status = 'bill'")
@sales = Sale.receipt_date_between(@from, @to).completed

View File

@@ -19,11 +19,4 @@ class Inventory::InventoryController < BaseInventoryController
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -104,12 +104,6 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
private
# Use callbacks to share common setup or constraints between actions.
def set_inventory_definition

View File

@@ -60,12 +60,6 @@ class Inventory::StockCheckItemsController < BaseInventoryController
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
private
# Use callbacks to share common setup or constraints between actions.
def set_stock_check_item

View File

@@ -34,7 +34,7 @@ class Inventory::StockChecksController < BaseInventoryController
check = params[:data]
stockCheck = StockCheck.find_by_id(check)
stockCheck.stock_check_items.each do |item|
StockJournal.from_stock_check(item,Shop.current_shop)
StockJournal.from_stock_check(item,@shop)
end
end
@@ -46,7 +46,6 @@ class Inventory::StockChecksController < BaseInventoryController
unique_code = 'StockCheckPdf'
shop_details = Shop.current_shop
checker = Employee.find(stockcheck.check_by)
print_settings = PrintSetting.find_by_unique_code(unique_code)
if !print_settings.nil?
@@ -66,12 +65,6 @@ class Inventory::StockChecksController < BaseInventoryController
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
# before_action :set_stock_check, only: [:show, :edit, :update, :destroy]
# GET /stock_checks

View File

@@ -61,12 +61,6 @@ class StockJournalsController < ApplicationController
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
private
# Use callbacks to share common setup or constraints between actions.
def set_stock_journal

View File

@@ -81,10 +81,4 @@ class Oqs::EditController < BaseOqsController
render :json => {:status=> false, :message => "Not allowed over quantity!" }
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -1,7 +1,6 @@
class Oqs::HomeController < BaseOqsController
authorize_resource :class => false
def index
@shop = Shop.current_shop
# Query for OQS with delivery status false
# @queue_items_details = queue_items_query(false)

View File

@@ -6,7 +6,6 @@ class Origami::AddordersController < BaseOrigamiController
if check_mobile
@webview = true
end
@shop = Shop.current_shop
@tables = Table.all.active.where("shop_code='#{@shop.shop_code}'").order('zone_id asc').group("zone_id")
@rooms = Room.all.active.where("shop_code='#{@shop.shop_code}'").order('zone_id asc').group("zone_id")
@all_table = Table.all.where("shop_code='#{@shop.shop_code}'").active.order('status desc')
@@ -19,7 +18,6 @@ class Origami::AddordersController < BaseOrigamiController
if check_mobile
@webview = true
end
@shop = Shop.current_shop
display_type = Lookup.find_by_lookup_type_and_shop_code("display_type",@shop.shop_code)
if !display_type.nil? && display_type.value.to_i ==2
@display_type = display_type.value
@@ -132,7 +130,7 @@ class Origami::AddordersController < BaseOrigamiController
@order.new_booking = true
@order.waiters = current_login_employee.name
@order.employee_name = current_login_employee.name
@order.shop_code = Shop.current_shop.shop_code
@order.shop_code = @shop.shop_code
@order.is_extra_time = is_extra_time
@order.extra_time = extra_time
@@ -225,7 +223,6 @@ class Origami::AddordersController < BaseOrigamiController
def process_order_queue(order_id,table_id,order_source)
print_status = nil
cup_status = nil
@shop = Shop.current_shop
#Send to background job for processing
order = Order.find(order_id)
sidekiq = Lookup.find_by_lookup_type_and_shop_code("sidekiq",@shop.shop_code)

View File

@@ -12,7 +12,6 @@ class Origami::AlipayController < BaseOrigamiController
total = 0
@alipaycount = 0
@shop = Shop.current_shop
@rounding_adj = 0
@can_alipay = 0
@member_discount = 0
@@ -66,7 +65,6 @@ class Origami::AlipayController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
@@ -87,10 +85,4 @@ class Origami::AlipayController < BaseOrigamiController
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -3,7 +3,6 @@ class Origami::CashInsController < BaseOrigamiController
end
def create
@shop = Shop.current_shop
reference = params[:reference]
remark = params[:remark]
amount = params[:amount]

View File

@@ -3,7 +3,6 @@ class Origami::CashOutsController < BaseOrigamiController
end
def create
@shop = Shop.current_shop
reference = params[:reference]
remark = params[:remark]
amount = params[:amount]

View File

@@ -8,8 +8,6 @@ class Origami::CreditPaymentsController < BaseOrigamiController
total = sale_data.grand_total
@creditcount = 0
others = 0
@shop = Shop.current_shop
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
@@ -33,7 +31,6 @@ class Origami::CreditPaymentsController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@@ -49,7 +46,6 @@ class Origami::CreditPaymentsController < BaseOrigamiController
end
def create_credit_payment
@shop = Shop.current_shop
arr_sale = JSON.parse(params[:data])
if !ShiftSale.current_shift(@shop.shop_code).nil?
if !arr_sale.nil?

View File

@@ -46,7 +46,6 @@ class Origami::CustomersController < BaseOrigamiController
end
def add_customer
@shop = Shop.current_shop
@webview = false
if check_mobile
@webview = true
@@ -163,7 +162,6 @@ class Origami::CustomersController < BaseOrigamiController
end
def send_account
@shop = Shop.current_shop
amount = params[:amount]
account_no = params[:account_no]
receipt_no = params[:receipt_no]

View File

@@ -1,8 +1,6 @@
class Origami::DashboardController < BaseOrigamiController
def index
@shop = Shop.current_shop
@display_type = Lookup.find_by_lookup_type("display_type")
@sale_data = Array.new
@@ -114,7 +112,7 @@ def get_all_menu
end
def get_credit_sales
credit_sales = SalePayment.get_credit_sales(params,Shop.current_shop.shop_code)
credit_sales = SalePayment.get_credit_sales(params,@shop.shop_code)
if !credit_sales.nil?
result = {:status=> true, :data=> credit_sales }
else

View File

@@ -6,8 +6,6 @@ class Origami::DingaController < BaseOrigamiController
@membership_rebate_balance=0
@sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = @sale_data.receipt_no
@shop = Shop.current_shop
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(@sale_data.grand_total)
else
@@ -79,7 +77,6 @@ def create
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)

View File

@@ -3,7 +3,6 @@ class Origami::DiscountsController < BaseOrigamiController
#discount page show from origami index with selected order
def index
@shop = Shop.current_shop
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@webview = false

View File

@@ -17,15 +17,14 @@ class Origami::FoodCourtController < ApplicationController
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
shop = Shop.current_shop
@zone = Zone.all.where("shop_code='#{shop.shop_code}' and is_active= true")
@zone = Zone.all.where("shop_code='#{@shop.shop_code}' and is_active= true")
@customer = Customer.all
@tables = Table.all.active.where("shop_code='#{shop.shop_code}'").order('status desc')
@rooms = Room.all.active.where("shop_code='#{shop.shop_code}'").order('status desc')
@tables = Table.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@rooms = Room.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@cashier_type = "food_court"
#checked quick_service only
@quick_service_only = true
lookup_dine_in = Lookup.where("shop_code='#{shop.shop_code}'").collection_of('dinein_cashier')
lookup_dine_in = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('dinein_cashier')
if !lookup_dine_in.empty?
lookup_dine_in.each do |dine_in|
if dine_in[0].downcase == "dineincashier"
@@ -154,7 +153,6 @@ class Origami::FoodCourtController < ApplicationController
end
def get_all_product()
@shop = Shop.current_shop
@product = Product..where("shop_code='#{@shop.shop_code}'")
end

View File

@@ -6,8 +6,6 @@ class Origami::GiftVoucherController < BaseOrigamiController
sale_data = Sale.find_by_sale_id(@sale_id)
total = 0
@gift_vouchercount = 0
@shop = Shop.current_shop
@rounding_adj = 0
@can_gift_voucher = 0
@member_discount = 0
@@ -49,8 +47,6 @@ class Origami::GiftVoucherController < BaseOrigamiController
ref_no = params[:reference_no]
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@@ -63,11 +59,4 @@ class Origami::GiftVoucherController < BaseOrigamiController
@status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "GiftVoucher",ref_no)
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -3,7 +3,6 @@ class Origami::HomeController < BaseOrigamiController
before_action :set_dining, only: [:show]
def index
@shop = Shop.current_shop
@webview = check_mobile
@@ -20,7 +19,6 @@ class Origami::HomeController < BaseOrigamiController
# origami table detail
def show
@shop = Shop.current_shop
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@webview = check_mobile

View File

@@ -13,7 +13,6 @@ class Origami::JcbController < BaseOrigamiController
total = 0
@jcbcount = 0
@shop = Shop.current_shop
@rounding_adj = 0
@can_jcb = 0
@member_discount= 0
@@ -67,7 +66,6 @@ class Origami::JcbController < BaseOrigamiController
ref_no = params[:ref_no]
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@@ -86,10 +84,4 @@ class Origami::JcbController < BaseOrigamiController
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -11,7 +11,6 @@ class Origami::JunctionPayController < BaseOrigamiController
@cashier_id = current_user.emp_id
@payment_method_setting_nav = PaymentMethodSetting.all
@shop = Shop.current_shop
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
@@ -53,7 +52,6 @@ class Origami::JunctionPayController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)

View File

@@ -12,8 +12,6 @@ class Origami::MasterController < BaseOrigamiController
end
total = 0
@mastercount = 0
@shop = Shop.current_shop
@rounding_adj = 0
@can_master = 0
@member_discount = 0
@@ -65,7 +63,6 @@ class Origami::MasterController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@@ -84,11 +81,4 @@ class Origami::MasterController < BaseOrigamiController
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -105,7 +105,7 @@ class Origami::MovetableController < BaseOrigamiController
# @type = (DiningFacility.find(change_to)).type
# @moved_by = @current_user.name
# @date = DateTime.now
# @shop = Shop.current_shop
# @shop = @shop
# unique_code = "MoveTablePdf"
# pdf_no = PrintSetting.where(:unique_code => unique_code).count
# #print_settings = PrintSetting.find_by_unique_code(unique_code)

View File

@@ -11,8 +11,6 @@ class Origami::MpuController < BaseOrigamiController
end
total = 0
@mpucount = 0
@shop = Shop.current_shop
@rounding_adj = 0
@can_mpu = 0
@member_discount = 0
@@ -66,7 +64,6 @@ class Origami::MpuController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@@ -84,11 +81,4 @@ class Origami::MpuController < BaseOrigamiController
@status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "mpu",ref_no,payment_for)
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -4,13 +4,10 @@ class Origami::OrderReservationController < BaseOrigamiController
@order = OrderReservation.latest_order #.active
@count_on_order = OrderReservation.get_count_on_order
@count_on_completed = OrderReservation.get_count_on_completed
@shop = Shop.current_shop
@receipt_bill = check_receipt_bill
end
def update
@shop = Shop.current_shop
@id = params[:order_id]
@status = params[:status]
min_type = params[:min_type]
@@ -87,7 +84,6 @@ class Origami::OrderReservationController < BaseOrigamiController
end
def send_status
@shop = Shop.current_shop
order_reservation = OrderReservation.find_by_transaction_ref(params[:ref_no])
if !order_reservation.nil?
if !ShiftSale.current_shift(@shop.shop_code).nil? || params[:status] == 'accepted' || (order_reservation.status == 'new' && params[:status] == 'rejected')
@@ -107,7 +103,6 @@ class Origami::OrderReservationController < BaseOrigamiController
end
def check_receipt_bill
@shop = Shop.current_shop
receipt_bill = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("order_reservation")
status = 0

View File

@@ -6,8 +6,6 @@ class Origami::PaymalController < BaseOrigamiController
@membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no
@shop = Shop.current_shop
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
@@ -76,8 +74,6 @@ def create
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)

View File

@@ -32,7 +32,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
receipt_bill_a5_pdf = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
receipt_bill_a5_pdf = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
# Print for First Bill to Customer
unique_code = "ReceiptBillPdf"
print_settings = PrintSetting.all
@@ -59,11 +59,11 @@ class Origami::PaymentsController < BaseOrigamiController
end
#shop detail
## shop_detail = Shop.current_shop
## shop_detail = @shop
# customer= Customer.where('customer_id=' +.customer_id)
customer = Customer.find(sale_data.customer_id)
# rounding adjustment
if Shop.current_shop.is_rounding_adj
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
rounding_adj = new_total - sale_data.grand_total
sale_data.update_attributes(grand_total: new_total,old_grand_total: sale_data.grand_total,rounding_adjustment:rounding_adj) if rounding_adj > 0
@@ -76,14 +76,14 @@ class Origami::PaymentsController < BaseOrigamiController
remark = "#{action_by} print out first bill for Receipt No #{sale_data.receipt_no}"
sale_audit = SaleAudit.record_audit_sale(sale_id,remark,action_by,type )
# get member information
rebate = MembershipSetting.find_by_rebate_and_shop_code(1,Shop.current_shop.shop_code)
rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code)
if customer.membership_id != nil && rebate
# member_info = Customer.get_member_account(customer)
# current_balance = SaleAudit.paymal_search(sale_id)
current_balance = 0
end
# get printer info
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code)
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
# find order id by sale id
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
@@ -99,7 +99,7 @@ class Origami::PaymentsController < BaseOrigamiController
#TODO :: KBZPAY ( QR )
# On/Off setting ( show or not qr )
# qrCode = "00020101021202021110500346KBZ005ab0ed5c1ed09d1c4585ff1313170389160831435294600062000040732kp1e78f7efddca190042638341afb88d50200006KBZPay0106KBZPay5303MMK5802MM62170813PAY_BY_QRCODE64060002my6304FBBD"
kbz_pay_method = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY,:shop_code => Shop.current_shop.shop_code).last
kbz_pay_method = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY,:shop_code => @shop.shop_code).last
status = false
qr = nil
@@ -113,7 +113,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
end
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, status, qr, cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, Shop.current_shop, "Frt",current_balance,nil,other_amount,nil,nil,nil,nil)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, status, qr, cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, @shop, "Frt",current_balance,nil,other_amount,nil,nil,nil,nil)
result = {
:filepath => filename,
@@ -141,10 +141,10 @@ class Origami::PaymentsController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
sale_items = SaleItem.get_all_sale_items(sale_id)
#shop_detail = Shop.current_shop
#shop_detail = @shop
# rounding adjustment
if !path.include? ("credit_payment")
if Shop.current_shop.is_rounding_adj
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total - saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) if rounding_adj > 0
@@ -198,7 +198,7 @@ class Origami::PaymentsController < BaseOrigamiController
# For Print
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
receipt_bill_a5_pdf = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
receipt_bill_a5_pdf = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
unique_code = "ReceiptBillPdf"
print_settings = PrintSetting.all
if !print_settings.nil?
@@ -226,7 +226,7 @@ class Origami::PaymentsController < BaseOrigamiController
customer= Customer.find(saleObj.customer_id)
# get member information
rebate = MembershipSetting.find_by_rebate_and_shop_code(1,Shop.current_shop.shop_code)
rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code)
credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote')
if customer.membership_id != nil && rebate && credit_data.nil?
@@ -281,14 +281,14 @@ class Origami::PaymentsController < BaseOrigamiController
card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id)
# get printer info
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code)
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
# Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
other_amount = SaleItem.calculate_other_charges(sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,Shop.current_shop, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
#end
end
@@ -313,7 +313,7 @@ class Origami::PaymentsController < BaseOrigamiController
# end
def show
display_type = Lookup.find_by_lookup_type_and_shop_code("display_type",Shop.current_shop.shop_code)
display_type = Lookup.find_by_lookup_type_and_shop_code("display_type",@shop.shop_code)
if !display_type.nil? && display_type.value.to_i ==2
@display_type = display_type.value
else
@@ -333,7 +333,7 @@ class Origami::PaymentsController < BaseOrigamiController
@sale_payment = SalePayment.get_credit_amount_due_left(sale_id)
end
@member_discount = MembershipSetting.find_by_discount_and_shop_code(1,Shop.current_shop.shop_code)
@member_discount = MembershipSetting.find_by_discount_and_shop_code(1,@shop.shop_code)
@membership_rebate_balance=0
if Sale.exists?(sale_id)
@@ -358,17 +358,17 @@ class Origami::PaymentsController < BaseOrigamiController
@dining = ''
@other_payment = 0.0
@pdf_view = nil
@lookup_pdf = Lookup.find_by_lookup_type_and_shop_code("ReceiptPdfView",Shop.current_shop.shop_code)
@lookup_pdf = Lookup.find_by_lookup_type_and_shop_code("ReceiptPdfView",@shop.shop_code)
if !@lookup_pdf.nil?
@pdf_view = @lookup_pdf.value
end
amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,Shop.current_shop)
amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,@shop)
@kbz_pay_amount += amount.to_f
#for changable on/off
@changable_tax = true
lookup_changable_tax = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of('changable_tax')
lookup_changable_tax = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('changable_tax')
if !lookup_changable_tax.empty?
lookup_changable_tax.each do |changable_tax|
if changable_tax[0].downcase == "change"
@@ -410,7 +410,7 @@ class Origami::PaymentsController < BaseOrigamiController
#end rounding adjustment
# rounding adjustment
if Shop.current_shop.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
@@ -436,7 +436,7 @@ class Origami::PaymentsController < BaseOrigamiController
#get customer amount
@customer = Customer.find(@sale_data.customer_id)
# accounts = @customer.tax_profiles
accounts = TaxProfile.where("group_type = ? and shop_code='#{Shop.current_shop.shop_code}'",@cashier_type).order("order_by ASC")
accounts = TaxProfile.where("group_type = ? and shop_code='#{@shop.shop_code}'",@cashier_type).order("order_by ASC")
@account_arr =[]
@tax_arr =[]
accounts.each do |acc|
@@ -450,7 +450,7 @@ class Origami::PaymentsController < BaseOrigamiController
@account_arr.push(sale_tax)
end
end
rebate = MembershipSetting.find_by_rebate_and_shop_code(1,Shop.current_shop.shop_code)
rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code)
# get member information
if @customer.membership_id != nil && rebate
response = Customer.get_member_account(@customer)
@@ -577,7 +577,7 @@ class Origami::PaymentsController < BaseOrigamiController
customer= Customer.find(saleObj.customer_id)
#shop detail
#shop_detail = Shop.current_shop
#shop_detail = @shop
# get member information
rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate
@@ -612,7 +612,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,Shop.current_shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref)
result = {
:status => true,
@@ -687,7 +687,7 @@ class Origami::PaymentsController < BaseOrigamiController
#shop detail
#shop_detail = Shop.current_shop
#shop_detail = @shop
printer = PrintSetting.all
unique_code="ReceiptBillPdf"
@@ -703,7 +703,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code)
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
# Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
@@ -712,7 +712,7 @@ class Origami::PaymentsController < BaseOrigamiController
printer = Printer::ReceiptPrinter.new(print_settings)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,Shop.current_shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil)
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil)
result = {
:status => true,
:filepath => filename,
@@ -747,7 +747,7 @@ class Origami::PaymentsController < BaseOrigamiController
saleObj = Sale.find(params[:sale_id])
if Shop.current_shop.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
@@ -770,9 +770,9 @@ class Origami::PaymentsController < BaseOrigamiController
if cashier_type.strip.downcase == "doemal_order"
unique_code = "ReceiptBillOrderPdf"
else
receipt_bill_a5_pdf = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
receipt_bill_a5_pdf = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
unique_code = "ReceiptBillPdf"
print_settings = PrintSetting.where("shop_code='#{Shop.current_shop.shop_code}'")
print_settings = PrintSetting.where("shop_code='#{@shop.shop_code}'")
if !print_settings.nil?
print_settings.each do |setting|
if setting.unique_code == 'ReceiptBillPdf'
@@ -795,7 +795,7 @@ class Origami::PaymentsController < BaseOrigamiController
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code)
print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name)

View File

@@ -7,8 +7,6 @@ class Origami::PayparPaymentsController < BaseOrigamiController
payment_method = "paypar"
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)

View File

@@ -1,6 +1,5 @@
class Origami::PendingOrderController < BaseOrigamiController
def index
@shop = Shop.current_shop
# @dining= DiningFacility.where("status = 'occupied'")
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
@cashier_type = params[:type]
@@ -14,7 +13,6 @@ class Origami::PendingOrderController < BaseOrigamiController
end
def show
@shop = Shop.current_shop
id = params[:sale_id]
if id.start_with?("SAL")
@sale = Sale.find(id)
@@ -45,7 +43,6 @@ class Origami::PendingOrderController < BaseOrigamiController
end
def completed_sale
@shop = Shop.current_shop
@cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type)
@@ -81,7 +78,6 @@ class Origami::PendingOrderController < BaseOrigamiController
end
def credit_sale
@shop = Shop.current_shop
@cashier_type = params[:type]
@sales = Sale.pending_sale(@cashier_type)
@orders = Sale.pending_order(@cashier_type)

View File

@@ -27,7 +27,7 @@ class Origami::QuickServiceController < ApplicationController
#checked quick_service only
@quick_service_only = false
lookup_dine_in = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of('quickservice_add_order')
lookup_dine_in = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('quickservice_add_order')
if !lookup_dine_in.empty?
lookup_dine_in.each do |dine_in|
if dine_in[0].downcase == "quickserviceaddorder"

View File

@@ -5,8 +5,6 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
@cashier_type = params[:type]
@membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id)
@shop = Shop.current_shop
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else

View File

@@ -8,7 +8,6 @@ class Origami::RequestBillsController < ApplicationController
end
# Print Request Bill and add to sale tables
def print
@shop = Shop.current_shop
if !ShiftSale.current_shift.nil?
order_id = params[:id] # order_id
order = Order.find(order_id)
@@ -91,7 +90,7 @@ class Origami::RequestBillsController < ApplicationController
# Not Use for these printed bill cannot give customer
# unique_code = "ReceiptBillPdf"
# #shop detail
# shop_details = Shop.current_shop
# shop_details = @shop
# # customer= Customer.where('customer_id=' +.customer_id)
# customer= Customer.find(@sale_data.customer_id)
# # get member information

View File

@@ -13,7 +13,6 @@ class Origami::RoomsController < BaseOrigamiController
end
def show
@shop = Shop.current_shop
@webview = false
if check_mobile
@webview = true
@@ -33,9 +32,6 @@ class Origami::RoomsController < BaseOrigamiController
@sale_array = Array.new
@membership = MembershipSetting.find_by_shop_code(@shop.shop_code)
@payment_methods = PaymentMethodSetting.find_by_shop_code(@shop.shop_code)
@shop = Shop.current_shop
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
@dining_room = @room.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ")

View File

@@ -27,7 +27,7 @@ class Origami::SecondDisplayController < BaseOrigamiController
#Shop Name in Navbor
# helper_method :shop_detail
# def shop_detail
# @shop = Shop.current_shop
#
# end

View File

@@ -42,7 +42,6 @@ class Origami::ShiftsController < BaseOrigamiController
def update_shift
@shop = Shop.current_shop
closing_balance = params[:closing_balance]
shift_id = params[:shift_id]
@shift = ShiftSale.find_by_id(shift_id)
@@ -89,7 +88,6 @@ class Origami::ShiftsController < BaseOrigamiController
end
end
end
shop_details = shop_detail
#get tax
shift_obj = ShiftSale.where('id =?',@shift.id)
sale_items = ''
@@ -126,7 +124,9 @@ class Origami::ShiftsController < BaseOrigamiController
end
find_close_cashier_print = Lookup.collection_of('close_cashier_print')
if find_close_cashier_print[0][1].to_i > 0
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, @shop,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
end
end
end

View File

@@ -84,7 +84,6 @@ class Origami::SplitBillController < BaseOrigamiController
end
def create
@shop = Shop.current_shop
cashier_type = params[:cashier_type]
order_ids = params[:order_ids]
arr_order_ids = nil
@@ -397,10 +396,4 @@ class Origami::SplitBillController < BaseOrigamiController
render :json => { status: true }
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -1,6 +1,5 @@
class Origami::SurveysController < BaseOrigamiController
def new
@shop = Shop.current_shop
@webview = false
if check_mobile
@webview = true
@@ -39,7 +38,6 @@ class Origami::SurveysController < BaseOrigamiController
end
def create
@shop = Shop.current_shop
@type = params[:cashier_type]
@sale_id = params[:sale_id]
if params[:table_id].to_i>0

View File

@@ -1,8 +1,6 @@
class Origami::TableInvoicesController < BaseOrigamiController
def index
@table = DiningFacility.find(params[:table_id])
@shop = Shop.current_shop
@sale_array = Array.new
@table.bookings.each do |booking|
@@ -33,7 +31,6 @@ class Origami::TableInvoicesController < BaseOrigamiController
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
@shop = Shop.current_shop
@sale_array = Array.new
@table.bookings.each do |booking|
if booking.sale_id.nil?

View File

@@ -11,8 +11,6 @@ class Origami::UnionpayController < BaseOrigamiController
end
total = 0
@unionpaycount = 0
@shop = Shop.current_shop
@rounding_adj = 0
@can_unionpay = 0
@member_discount = 0
@@ -62,8 +60,6 @@ class Origami::UnionpayController < BaseOrigamiController
ref_no = params[:ref_no]
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@@ -82,11 +78,4 @@ class Origami::UnionpayController < BaseOrigamiController
@status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "unionpay",ref_no,payment_for)
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -11,8 +11,6 @@ class Origami::VisaController < BaseOrigamiController
end
total = 0
@visacount = 0
@shop = Shop.current_shop
@rounding_adj = 0
@can_visa = 0
@member_discount = 0
@@ -62,8 +60,6 @@ class Origami::VisaController < BaseOrigamiController
ref_no = params[:ref_no]
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.current_shop
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@@ -82,11 +78,4 @@ class Origami::VisaController < BaseOrigamiController
@status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "visa",ref_no,payment_for)
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -1,7 +1,6 @@
class Origami::VoidController < BaseOrigamiController
authorize_resource :class => false
def overall_void
@shop = Shop.current_shop
sale_id = params[:sale_id]
remark = params[:remark]
order_source = params[:type] #tax profile source
@@ -114,9 +113,6 @@ class Origami::VoidController < BaseOrigamiController
# end
customer= Customer.find(sale.customer_id)
#shop detail
shop_details = Shop.current_shop
# get member information
rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code)
if customer.membership_id != nil && rebate

View File

@@ -7,9 +7,6 @@ class Origami::VoucherController < BaseOrigamiController
total = sale_data.grand_total
@vouchercount = 0
others = 0
@shop = Shop.current_shop
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else

View File

@@ -1,6 +1,5 @@
class Origami::WasteSpoileController < BaseOrigamiController
def waste_and_spoilage
@shop = Shop.current_shop
sale_id = params[:sale_id]
remark = params[:remark]
order_source = params[:type]
@@ -87,9 +86,6 @@ class Origami::WasteSpoileController < BaseOrigamiController
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# unique_code = "ReceiptBillPdf"
customer= Customer.find(sale.customer_id)
#shop detail
shop_details = Shop.current_shop
# get member information
rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code)
if customer.membership_id != nil && rebate

View File

@@ -11,7 +11,7 @@ class PrintSettingsController < ApplicationController
# GET /print_settings/1
# GET /print_settings/1.json
def show
@lookup = Lookup.shift_sale_items_lookup_value(Shop.current_shop.shop_code)
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
end
# GET /print_settings/new
@@ -22,7 +22,7 @@ class PrintSettingsController < ApplicationController
# GET /print_settings/1/edit
def edit
@lookup = Lookup.shift_sale_items_lookup_value(Shop.current_shop.shop_code)
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
@server_mode = ENV["SERVER_MODE"]
end
@@ -30,7 +30,7 @@ class PrintSettingsController < ApplicationController
# POST /print_settings.json
def create
@print_setting = PrintSetting.new(print_setting_params)
@print_setting.shop_code = Shop.current_shop.shop_code
@print_setting.shop_code = @shop.shop_code
respond_to do |format|
if @print_setting.save
format.html { redirect_to @print_setting, notice: 'Print setting was successfully created.' }
@@ -48,7 +48,7 @@ class PrintSettingsController < ApplicationController
respond_to do |format|
if @print_setting.update(print_setting_params)
if @print_setting.unique_code == 'CloseCashierPdf'
Lookup.save_shift_sale_items_settings(params[:shift_sale_items],Shop.current_shop.shop_code)
Lookup.save_shift_sale_items_settings(params[:shift_sale_items],@shop.shop_code)
end
format.html { redirect_to @print_setting, notice: 'Print setting was successfully updated.' }

View File

@@ -2,7 +2,6 @@ class Reports::CommissionController < BaseReportController
# authorize_resource :class => false
def index
@shop = Shop.current_shop
from_date, to_date = get_date_range_from_params
commissioner = params[:commissioner].to_i
@@ -22,7 +21,6 @@ class Reports::CommissionController < BaseReportController
end
def show
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,7 +1,6 @@
class Reports::CreditPaymentController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
@filter_for_credit = [['All',''],['Paid','paid'],['Unpaid','unpaid']]
@sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]]
from, to = get_date_range_from_params
@@ -43,7 +42,6 @@ authorize_resource :class => false
end
def show
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)

View File

@@ -2,7 +2,6 @@ class Reports::DailysaleController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_data = Sale.daily_sales_list(from,to,@shop.shop_code)
@tax = SaleTax.get_tax(from,to,@shop.shop_code)

View File

@@ -1,7 +1,6 @@
class Reports::HourlySaleitemController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
@account = Account.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params
@@ -65,7 +64,6 @@ class Reports::HourlySaleitemController < BaseReportController
end
def show
@shop = Shop.current_shop
from, to, report_type = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
sale_data = @sale_data

View File

@@ -1,7 +1,6 @@
class Reports::IndutyController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
@commissioners = Commissioner.where("shop_code='#{@shop.shop_code}'") #.where("is_active='1'")
from, to = get_date_range_from_params
@@ -42,7 +41,6 @@ class Reports::IndutyController < BaseReportController
end
def show
@shop = Shop.current_shop
from, to = get_date_range_from_params
@induty_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,7 +1,6 @@
class Reports::OrderReservationController < BaseReportController
# authorize_resource :class => false
def index
@shop = Shop.current_shop
@providers = [["All",''], ["Direct Delivery","direct_delivery"],["Pick-Up","pick_up"],["TURBO","turbo"],["food2u","food2u"], ["ygndoor2door","ygndoor2door"]]
@payment_types = [["All",''], ["COD","cash_on_delivery"],["DINGA","dinga"]]
@@ -48,7 +47,6 @@ class Reports::OrderReservationController < BaseReportController
end
def show
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,7 +1,6 @@
class Reports::PaymentMethodController < BaseReportController
# authorize_resource :class => false
def index
@shop = Shop.current_shop
@payments = [["All Payment",''],["Cash Payment","cash"], ["KBZ Payment", KbzPay::KBZ_PAY], ["Credit Payment","creditnote"],
["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"],
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
@@ -42,7 +41,6 @@ class Reports::PaymentMethodController < BaseReportController
end
def show
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -7,21 +7,15 @@ class Reports::ProductSaleController < BaseReportController
@order_by = params[:order_by]
end
@sale_data = Sale.get_menu_item_query(@order_by)
@sale_data = Sale.get_menu_item_query(@order_by)
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
respond_to do |format|
format.html
format.json
format.json
format.xls
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.current_shop
end
end

View File

@@ -1,7 +1,6 @@
class Reports::ReceiptNoController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
@payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params
@@ -54,7 +53,6 @@ authorize_resource :class => false
end
def show
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@@ -78,7 +76,7 @@ authorize_resource :class => false
end
def sync_data
@orders, @order_items, @sales, @sale_items, @sale_taxes, @sale_payments, @sale_orders, @sale_audits, @bookings, @assigned_order_items, @shift_sales = Booking.get_sync_data(params[:sale_id])
# Here comes to call the sync api
@@ -182,7 +180,7 @@ authorize_resource :class => false
customer= Customer.find(saleObj.customer_id)
#shop detail
#shop_detail = Shop.current_shop
#shop_detail = @shop
# get member information
rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate

View File

@@ -1,7 +1,6 @@
class Reports::ReceiptNoDetailController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
@payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params
@@ -49,7 +48,6 @@ authorize_resource :class => false
end
def show
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,7 +1,6 @@
class Reports::SaleitemController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
@account = Account.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params
@@ -60,7 +59,6 @@ class Reports::SaleitemController < BaseReportController
end
def show
@shop = Shop.current_shop
from, to, report_type = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@@ -86,7 +84,6 @@ class Reports::SaleitemController < BaseReportController
end
def print_sale_items
@shop = Shop.current_shop
from, to = get_date_range_from_params
shift_sale_range = ''

View File

@@ -2,7 +2,7 @@ class Reports::ShiftsaleController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
from, to = get_date_range_from_params
@shift = ''
if params[:shift_name].to_i != 0
@@ -26,7 +26,7 @@ class Reports::ShiftsaleController < BaseReportController
end
def show
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
@@ -50,7 +50,7 @@ class Reports::ShiftsaleController < BaseReportController
end
def print_close_receipt
@shop = Shop.current_shop
shift_id = params[:id]
@shift = ShiftSale.find_by_id(shift_id)
shift_obj = ShiftSale.where('id =?',shift_id)

View File

@@ -1,7 +1,7 @@
class Reports::StaffMealController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
@account = Account.where("shop_code='#{@shop.shop_code}'")
from, to = get_date_range_from_params

View File

@@ -2,7 +2,7 @@ class Reports::StockCheckController < BaseReportController
# authorize_resource :class => false
def index
@shop = Shop.current_shop
# from_date = DateTime.now.beginning_of_day.utc.getlocal
# to_date = DateTime.now.end_of_day.utc.getlocal
# unless params[:daterange].blank?
@@ -26,7 +26,7 @@ class Reports::StockCheckController < BaseReportController
end
def show
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")

View File

@@ -1,7 +1,7 @@
class Reports::VoidSaleController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
from, to = get_date_range_from_params
# @shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)

View File

@@ -1,7 +1,7 @@
class Reports::WasteAndSpoilageController < BaseReportController
authorize_resource :class => false
def index
@shop = Shop.current_shop
from, to = get_date_range_from_params
@sale_type = params[:sale_type]
@sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type).where("sales.shop_code='#{@shop.shop_code}'")

View File

@@ -5,7 +5,7 @@ class Settings::AccountsController < ApplicationController
# GET /settings/accounts
# GET /settings/accounts.json
def index
@shop = Shop.current_shop
@settings_accounts = Account.all.where("shop_code='#{@shop.shop_code}'")
end
@@ -26,7 +26,7 @@ class Settings::AccountsController < ApplicationController
# POST /settings/accounts
# POST /settings/accounts.json
def create
@shop = Shop.current_shop
@settings_account = Account.new(account_params)
@settings_account.shop_code = @shop.shop_code
respond_to do |format|

View File

@@ -5,7 +5,7 @@ class Settings::CashierTerminalsController < ApplicationController
# GET /settings/cashier_terminals
# GET /settings/cashier_terminals.json
def index
@settings_cashier_terminals = CashierTerminal.where("shop_code=?",Shop.current_shop.shop_code)
@settings_cashier_terminals = CashierTerminal.where("shop_code=?",@shop.shop_code)
end
# GET /settings/cashier_terminals/1
@@ -27,7 +27,7 @@ class Settings::CashierTerminalsController < ApplicationController
# POST /settings/cashier_terminals
# POST /settings/cashier_terminals.json
def create
@shop = Shop.current_shop
@settings_cashier_terminal = CashierTerminal.new(settings_cashier_terminal_params)
@settings_cashier_terminal.shop_code = @shop.shop_code
respond_to do |format|

View File

@@ -28,7 +28,7 @@ class Settings::CommissionersController < ApplicationController
# POST /commissioners
# POST /commissioners.json
def create
@shop = Shop.current_shop
@commissioner = Commissioner.new(commissioner_params)
@commissioner.created_by = current_user.id
@commissioner.shop_code = @shop.shop_code

View File

@@ -28,7 +28,7 @@ class Settings::CommissionsController < ApplicationController
# POST /commissions
# POST /commissions.json
def create
@shop = Shop.current_shop
@commission = Commission.new(commission_params)
@commission.product_type = 'menu_item'
@commission.product_code = "[]"

View File

@@ -25,7 +25,7 @@ class Settings::MembershipActionsController < ApplicationController
# POST /settings/membership_actions
# POST /settings/membership_actions.json
def create
@shop = Shop.current_shop
@settings_membership_action = MembershipAction.new(settings_membership_action_params)
@settings_membership_action.shop_code = @shop.shop_code
respond_to do |format|

View File

@@ -25,7 +25,7 @@ class Settings::MembershipSettingsController < ApplicationController
# POST /settings/membership_settings
# POST /settings/membership_settings.json
def create
@shop = Shop.current_shop
@settings_membership_setting = MembershipSetting.new(settings_membership_setting_params)
@settings_membership_setting.shop_code = @shop.shop_code
respond_to do |format|

View File

@@ -5,7 +5,7 @@ class Settings::MenusController < ApplicationController
# GET /settings/menus
# GET /settings/menus.json
def index
@shop = Shop.current_shop
@settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10)
respond_to do |format|
format.html
@@ -31,7 +31,7 @@ class Settings::MenusController < ApplicationController
# POST /settings/menus
# POST /settings/menus.json
def create
@shop = Shop.current_shop
@settings_menu = Menu.new(settings_menu_params)
@settings_menu.created_by = current_login_employee.name
@settings_menu.shop_code = @shop.shop_code
@@ -76,7 +76,7 @@ class Settings::MenusController < ApplicationController
end
def export
@shop = Shop.current_shop
@settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10)
menu = Menu.find(params[:id])

View File

@@ -29,7 +29,7 @@ class Settings::OrderQueueStationsController < ApplicationController
# POST /settings/order_queue_stations
# POST /settings/order_queue_stations.json
def create
@shop = Shop.current_shop
@settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params)
@settings_order_queue_station.created_by = current_login_employee.name
@settings_order_queue_station.processing_items = "[]"

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.current_shop.shop_code
@settings_payment_method_setting.shop_code = @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

@@ -26,7 +26,7 @@ load_and_authorize_resource except: [:create]
# POST /settings/products
# POST /settings/products.json
def create
@shop = Shop.current_shop
@settings_product = Product.new(settings_product_params)
@settings_product.created_by = current_user.name
@settings_product.shop_code = @shop.shop_code

View File

@@ -28,7 +28,7 @@ class Settings::PromotionsController < ApplicationController
# POST /promotions
# POST /promotions.json
def create
@shop = Shop.current_shop
@promotion = Promotion.new(promotion_params)
@promotion.created_by = current_login_employee.id
@promotion.shop_code = @shop.shop_code

View File

@@ -25,7 +25,7 @@ class Settings::RoomsController < ApplicationController
# POST /settings/rooms
# POST /settings/rooms.json
def create
@shop = Shop.current_shop
@settings_room = Room.new(settings_room_params)
@settings_room.type = DiningFacility::ROOM_TYPE
@settings_room.zone_id = params[:zone_id]

View File

@@ -60,11 +60,11 @@ class Settings::ShopsController < ApplicationController
File.delete(delete_path)
end
end
save_path = Rails.root.join("public/#{Shop.current_shop.shop_code}_#{a.original_filename}")
save_path = Rails.root.join("public/#{@shop.shop_code}_#{a.original_filename}")
File.open(save_path, 'wb') do |f|
f.write a.read
end
audio_name = "#{Shop.current_shop.shop_code}_#{a.original_filename}"
audio_name = "#{@shop.shop_code}_#{a.original_filename}"
@settings_shop.display_images.where(:name => "order_audio").destroy_all
@display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :name => "order_audio", :image => audio_name)
else

Some files were not shown because too many files have changed in this diff Show More