Pull from master
This commit is contained in:
@@ -47,9 +47,9 @@ class Api::BillController < Api::ApiController
|
||||
Promotion.promo_activate(@sale)
|
||||
|
||||
#BillBroadcastJob.perform_later(table)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
end
|
||||
#end
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift"
|
||||
|
||||
@@ -6,9 +6,9 @@ class Api::CallWaitersController < ActionController::API
|
||||
@time = params[:time]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
# CallWaiterJob.perform_later(@table,@time)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time
|
||||
end
|
||||
#end
|
||||
# get printer info
|
||||
@shop = Shop.first
|
||||
unique_code = "CallWaiterPdf"
|
||||
|
||||
@@ -59,10 +59,12 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
order_reservation = params
|
||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
|
||||
|
||||
order_reservation = OrderReservation.find(order_reservation_id)
|
||||
# if ENV["SERVER_MODE"] != 'cloud'
|
||||
# ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||
# end
|
||||
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
|
||||
|
||||
if flag #&& ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||
end
|
||||
|
||||
if flag
|
||||
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
||||
else
|
||||
|
||||
@@ -24,8 +24,7 @@ module TokenVerification
|
||||
end
|
||||
end
|
||||
|
||||
@user = Employee.
|
||||
(token)
|
||||
@user = Employee.authenticate_by_token(token)
|
||||
if @user
|
||||
return true
|
||||
#Maybe log - login?
|
||||
|
||||
@@ -184,11 +184,9 @@ puts items_arr.to_json
|
||||
|
||||
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
|
||||
# for second display
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
|
||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale"
|
||||
|
||||
end
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale"
|
||||
#end
|
||||
result = {:status=> @status, :data => @sale }
|
||||
render :json => result.to_json
|
||||
end
|
||||
|
||||
@@ -56,6 +56,22 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
@current_user = current_user
|
||||
#quick service
|
||||
quick_service = Lookup.collection_of('quick_service')
|
||||
@quick_service = 0
|
||||
if !quick_service[0].nil?
|
||||
@quick_service = quick_service[0][1]
|
||||
end
|
||||
#order reservation
|
||||
order_reservation = Lookup.collection_of('order_reservation')
|
||||
@order_reservation = 0
|
||||
if !order_reservation.empty?
|
||||
order_reservation.each do |order_reserve|
|
||||
if order_reserve[0] == 'OrderReservation'
|
||||
@order_reservation = order_reserve[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -86,11 +86,12 @@ def create
|
||||
|
||||
# saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
|
||||
if status == true
|
||||
status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
|
||||
|
||||
if status == true && @membership_data["status"] == true
|
||||
@out = true, "Success!"
|
||||
else
|
||||
@out =false, "Please try again payment!"
|
||||
@out =false, @membership_data["message"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
class Origami::OrderReservationController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@order = OrderReservation.all
|
||||
@order = OrderReservation.latest_order
|
||||
@count_on_order = OrderReservation.get_count_on_order
|
||||
end
|
||||
|
||||
def update
|
||||
@id = params[:order_id]
|
||||
@status = params[:status]
|
||||
@status = params[:status]
|
||||
expected_waiting_time = params[:expected_time]
|
||||
@order_reservation = OrderReservation.find(@id)
|
||||
|
||||
status = true
|
||||
@@ -25,7 +27,7 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
OrderReservation.update_order_reservation(@id, nil, "cancelled")
|
||||
result = {:status=> true, :message => "rejected" }
|
||||
else
|
||||
OrderReservation.update_order_reservation(@id, nil, "accepted")
|
||||
OrderReservation.update_order_reservation(@id, nil, "accepted", expected_waiting_time)
|
||||
result = {:status=> true, :message => "accepted" }
|
||||
end
|
||||
end
|
||||
@@ -50,7 +52,7 @@ class Origami::OrderReservationController < BaseOrigamiController
|
||||
status = params[:status]
|
||||
end
|
||||
|
||||
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status)
|
||||
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status,params[:waiting_time])
|
||||
|
||||
render :json => response
|
||||
end
|
||||
|
||||
@@ -88,11 +88,11 @@ def create
|
||||
|
||||
# saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
|
||||
if status == true
|
||||
status, @sale,@membership_data = sale_payment.process_payment(saleObj, @user, cash, "paymal",account_no)
|
||||
if status == true && @membership_data["status"] == true
|
||||
@out = true, "Success!"
|
||||
else
|
||||
@out =false, "Please try again payment!"
|
||||
@out =false, @membership_data["message"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
def first_bill
|
||||
sale_id = params[:sale_id] # sale_id
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
sale_items = SaleItem.where("sale_id=?",sale_id)
|
||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
||||
member_info = nil
|
||||
|
||||
# For Cashier by Zone
|
||||
@@ -99,6 +99,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_items = SaleItem.unscoped.select("sale_id,product_code,item_instance_code,product_name,product_alt_name,account_id,status,remark,SUM(qty) as qty,SUM(unit_price) as unit_price,SUM(taxable_price) as taxable_price,SUM(price) as price,is_taxable").where("sale_id=?",sale_id).group("item_instance_code,unit_price")
|
||||
shop_details = Shop.first
|
||||
# rounding adjustment
|
||||
if shop_details.is_rounding_adj
|
||||
@@ -204,7 +205,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
||||
|
||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||
|
||||
|
||||
@@ -39,9 +39,9 @@ class Origami::RequestBillsController < ApplicationController
|
||||
# Promotion Activation
|
||||
Promotion.promo_activate(@sale)
|
||||
#bill channel
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
end
|
||||
#end
|
||||
if order.source == "quick_service"
|
||||
result = {:status=> @status, :data => @sale.sale_id }
|
||||
render :json => result.to_json
|
||||
|
||||
@@ -13,9 +13,9 @@ class Origami::SecondDisplayController < BaseOrigamiController
|
||||
else
|
||||
tax_profiles = nil
|
||||
end
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status]
|
||||
end
|
||||
# end
|
||||
end
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
|
||||
@@ -335,9 +335,9 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
|
||||
Promotion.promo_activate(sale)
|
||||
if ENV["SERVER_MODE"] != 'cloud'
|
||||
#if ENV["SERVER_MODE"] != 'cloud'
|
||||
ActionCable.server.broadcast "bill_channel",table: table
|
||||
end
|
||||
#end
|
||||
render :json => { status: status }
|
||||
else
|
||||
render :json => { status: false, error_message: 'No Current Open Shift!'}
|
||||
|
||||
63
app/controllers/reports/order_reservation_controller.rb
Normal file
63
app/controllers/reports/order_reservation_controller.rb
Normal file
@@ -0,0 +1,63 @@
|
||||
class Reports::OrderReservationController < BaseReportController
|
||||
# authorize_resource :class => false
|
||||
def index
|
||||
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]]
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
shift_sale = ShiftSale.find(params[:shift_name])
|
||||
if to.blank?
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
|
||||
else
|
||||
|
||||
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
||||
end
|
||||
end
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_sales_by_order_reservation(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
if @shift.present?
|
||||
@shift.each do |sh|
|
||||
@shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
@shift_data = sh
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p")
|
||||
opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc
|
||||
closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc
|
||||
shift_id = sale.id.nil? ? '-' : sale.id
|
||||
str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date}
|
||||
date_arr.push(str)
|
||||
end
|
||||
|
||||
out = {:status => 'ok', :message => date_arr}
|
||||
|
||||
respond_to do |format|
|
||||
format.json { render json: out }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -20,7 +20,7 @@ authorize_resource :class => false
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@tax_profiles = TaxProfile.order('order_by asc')
|
||||
@tax_profiles = TaxProfile.order('order_by asc').limit(2)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
|
||||
Reference in New Issue
Block a user