licensing
This commit is contained in:
@@ -39,7 +39,16 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def cache_license()
|
||||
@license = License.new(url, subdomain)
|
||||
##creating md5 hash
|
||||
md5_hostname = Digest::MD5.new
|
||||
md5key = md5_hostname.update(request.host)
|
||||
|
||||
if (@license.detail_with_local_cache(subdomain, md5key.to_s) == true)
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url, key)
|
||||
@@ -50,8 +59,6 @@ class ApplicationController < ActionController::Base
|
||||
key, iv = AESEncDec.export_key(passphrase)
|
||||
|
||||
if (@license.detail_with_local_file(key, key, iv) == true)
|
||||
#if (@license.detail == true)
|
||||
|
||||
return @license
|
||||
else
|
||||
return nil
|
||||
@@ -100,7 +107,9 @@ class ApplicationController < ActionController::Base
|
||||
private
|
||||
def check_license
|
||||
if License.check_license_file
|
||||
|
||||
# if !License.check_license_valid
|
||||
# redirect_to install_path
|
||||
# end
|
||||
else
|
||||
redirect_to install_path
|
||||
end
|
||||
|
||||
@@ -67,7 +67,7 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.employee_name = current_login_employee.name
|
||||
@order.waiters = current_login_employee.name
|
||||
#Create Table Booking or Room Booking
|
||||
if !params["booking_id"].nil?
|
||||
# check booking id is already completed.
|
||||
|
||||
@@ -6,7 +6,9 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale_id = params[:id]
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
|
||||
end
|
||||
|
||||
@member_discount = MembershipSetting.find_by_discount(1)
|
||||
@accounts = Account.all
|
||||
end
|
||||
|
||||
@@ -24,6 +24,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
|
||||
@dining.bookings.active.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
|
||||
@order_items = Array.new
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
@@ -31,26 +32,42 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@obj_order = order
|
||||
@customer = order.customer
|
||||
@date = order.created_at
|
||||
@booking= booking
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
@account_arr.push(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@booking= booking
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
@customer = sale.customer
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
@account_arr.push(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -5,6 +5,7 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
sale_id = params[:sale_id]
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -116,6 +116,13 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale_data.customer_id)
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
@account_arr.push(account)
|
||||
end
|
||||
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
# get member information
|
||||
if @customer.membership_id != nil && rebate
|
||||
@@ -136,6 +143,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@sale_data.bookings.each do |sbk|
|
||||
df = DiningFacility.find(sbk.dining_facility_id)
|
||||
@table_no = df.type + ' ' + df.name
|
||||
@checkin_time = sbk.checkin_at
|
||||
break
|
||||
end
|
||||
|
||||
|
||||
@@ -24,10 +24,12 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@order_items = Array.new
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
@customer = order.customer
|
||||
if (order.status == "new")
|
||||
@obj_order = order
|
||||
@customer = order.customer
|
||||
|
||||
@date = order.created_at
|
||||
@booking = booking
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
@@ -42,6 +44,7 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@booking = booking
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
|
||||
59
app/controllers/transactions/bookings_controller.rb
Normal file
59
app/controllers/transactions/bookings_controller.rb
Normal file
@@ -0,0 +1,59 @@
|
||||
class Transactions::BookingsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_transactions_booking, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
@bookings = Booking.all.order("sale_id desc")
|
||||
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2)
|
||||
else
|
||||
sale = Sale.search(filter,from,to)
|
||||
if sale.count > 0
|
||||
@bookings = sale
|
||||
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2)
|
||||
else
|
||||
@bookings = 0
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @bookings }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# GET /transactions/bookings/1
|
||||
# GET /transactions/bookings/1.json
|
||||
def show
|
||||
|
||||
@booking = Booking.find(params[:id])
|
||||
|
||||
@order_items = []
|
||||
@booking.booking_orders.each do |booking_order|
|
||||
@order = Order.find(booking_order.order_id)
|
||||
#if (order.status == "new")
|
||||
@order_items = @order_items + @order.order_items
|
||||
#end
|
||||
end
|
||||
if @booking.sale_id.present?
|
||||
@sale = Sale.find(@booking.sale_id)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @booking }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_transactions_booking
|
||||
@transactions_booking = Booking.find(params[:id])
|
||||
end
|
||||
end
|
||||
@@ -15,12 +15,11 @@ class Transactions::CreditNotesController < ApplicationController
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && customer.nil?
|
||||
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
puts "cccccccccccc"
|
||||
else
|
||||
sale = Sale.search_credit_sales(customer,filter,from,to)
|
||||
if sale.count > 0
|
||||
@sales = sale
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
|
||||
else
|
||||
@sales = 0
|
||||
end
|
||||
|
||||
@@ -9,19 +9,18 @@ class Transactions::OrdersController < ApplicationController
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && count.nil?
|
||||
orders = Order.order("order_id desc")
|
||||
puts "ssssss"
|
||||
|
||||
else
|
||||
orders = Order.search(filter,from,to,count)
|
||||
puts "aaaaa"
|
||||
|
||||
end
|
||||
|
||||
if !orders.nil?
|
||||
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
|
||||
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(20)
|
||||
else
|
||||
@orders = []
|
||||
end
|
||||
puts @orders.to_json
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @orders }
|
||||
|
||||
@@ -11,13 +11,13 @@ class Transactions::SalesController < ApplicationController
|
||||
to = params[:to]
|
||||
|
||||
if receipt_no.nil? && from.nil? && to.nil?
|
||||
@sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc").limit(500)
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
|
||||
@sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc")
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
|
||||
else
|
||||
sale = Sale.search(receipt_no,from,to)
|
||||
if sale.count > 0
|
||||
@sales = sale
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
|
||||
else
|
||||
@sales = 0
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user